vite-plugin-taro 0.7.11 → 0.7.12-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +5 -5
- package/dist/node/plugins/mini/dev/inject-dev-page-component.d.ts +1 -1
- package/dist/node/plugins/mini/dev/modes/devtools/devtools-hmr-mode.d.ts +2 -4
- package/dist/node/plugins/mini/mini-contract.d.ts +1 -1
- package/dist/node/plugins/mini/module/module.d.ts +6 -6
- package/dist/node/plugins/mini/output/create-transport-output.d.ts +1 -1
- package/dist/node/plugins/mini/render/native.d.ts +2 -2
- package/dist/node/tests/create-test-project.d.ts +2 -0
- package/dist/node/tests/project-temp-dir.d.ts +2 -0
- package/dist/options.d.ts +5 -0
- package/dist/runtime/mini/amphibious/bootstrap.d.ts +1 -0
- package/dist/runtime/mini/amphibious/bootstrap.js +2 -0
- package/dist/runtime/mini/amphibious/get-page-query.d.ts +2 -0
- package/dist/runtime/mini/amphibious/get-page-query.js +16 -0
- package/dist/runtime/mini/capsule/create-vpt-page-config.d.ts +23 -0
- package/dist/runtime/mini/capsule/create-vpt-page-config.js +28 -0
- package/dist/runtime/mini/capsule/page.d.ts +3 -1
- package/dist/runtime/mini/capsule/page.js +2 -13
- package/dist/runtime/mini/capsule/prerender-to-data.d.ts +3 -0
- package/dist/runtime/mini/capsule/prerender-to-data.js +39 -0
- package/dist/runtime/mini/capsule/taro-runtime.d.ts +2 -1
- package/dist/runtime/mini/capsule/taro-runtime.js +2 -1
- package/dist/runtime/mini/dev/mini-hmr-runtime.d.ts +8 -1
- package/dist/runtime/mini/dev/mini-hmr-runtime.js +29 -2
- package/dist/runtime/mini/dev/modes/devtools/devtools-runtime.d.ts +1 -1
- package/dist/runtime/mini/dev/modes/devtools/devtools-runtime.js +1 -1
- package/dist/runtime/mini/dev/modes/devtools/{page-hmr.d.ts → inject-page-hmr.d.ts} +2 -1
- package/dist/runtime/mini/dev/modes/devtools/{page-hmr.js → inject-page-hmr.js} +15 -14
- package/dist/runtime/mini/native/app.js +1 -0
- package/dist/runtime/mini/native/component.js +1 -0
- package/dist/runtime/mini/native/custom-wrapper.js +1 -0
- package/dist/runtime/mini/native/page.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{createRequire as e,findPackageJSON as t}from"node:module";import n from"@vitejs/plugin-react";import r from"node:path";import{fileURLToPath as i,pathToFileURL as a}from"node:url";import{isCSSRequest as o,normalizePath as s,rolldownVersion as c,transformWithOxc as l,version as u}from"vite";import d from"@tailwindcss/vite";import{RUNTIME_MODULE_ID as f,RolldownMagicString as p,build as m}from"rolldown";import{parseSync as h}from"rolldown/utils";import{existsSync as g,mkdirSync as _,promises as v,readdirSync as y,unlinkSync as b,writeFileSync as x}from"node:fs";import S,{readFile as C,readdir as w,stat as ee}from"node:fs/promises";import{dev as T,viteReporterPlugin as te,viteTransformPlugin as E}from"rolldown/experimental";import{createHash as ne,randomUUID as re}from"node:crypto";import{parseAst as ie}from"rolldown/parseAst";import{Scanner as ae}from"@tailwindcss/oxide";import oe,{emitWarning as se}from"node:process";import{performance as ce}from"node:perf_hooks";import{channel as le,tracingChannel as ue}from"node:diagnostics_channel";import{RecursiveTemplate as D,UnRecursiveTemplate as de,capitalize as fe,toCamelCase as pe}from"@tarojs/shared/dist/template.js";import{components as O}from"vite-plugin-taro-runtime/plugin-platform-tt/runtime-utils";import{components as k}from"vite-plugin-taro-runtime/plugin-platform-weapp/runtime-utils";import{components as me}from"vite-plugin-taro-runtime/plugin-platform-alipay/runtime-utils";var he=Object.create,ge=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,ve=Object.getOwnPropertyNames,ye=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty,A=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),j=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ve(t),a=0,o=i.length,s;a<o;a++)s=i[a],!be.call(e,s)&&s!==n&&ge(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=_e(t,s))||r.enumerable});return e},M=(e,t,n)=>(n=e==null?{}:he(ye(e)),j(t||!e||!e.__esModule||!be.call(e,`default`)?ge(n,`default`,{value:e,enumerable:!0}):n,e)),xe=/* @__PURE__ */ e(import.meta.url);const Se=e(import.meta.url);function Ce(e){return Se.resolve(`vite-plugin-taro-runtime/${e}`)}const we=r.dirname(Se.resolve(`vite-plugin-taro/package.json`)),Te={".ts":{root:`src/runtime`,extension:`.ts`},".js":{root:`dist/runtime`,extension:`.js`}}[r.extname(i(import.meta.url))];function Ee(e){return s(r.join(we,Te.root,`${e}${Te.extension}`))}const De=`virtual:taro/native`;function Oe(e){let t=Ee(e===`h5`?`h5/taro-api`:`client/taro/api`),n=/* @__PURE__ */ new Map([[`virtual:taro/api`,t],[`@tarojs/taro`,t],[`virtual:taro/components`,Ee(`client/taro/component`)],[De,Ee(`client/taro/native`)]]);return{name:`vpt:client-taro`,enforce:`pre`,resolveId:e=>n.get(e)}}function ke({appPath:e,projectRoot:t}){return s(r.resolve(t,e))}function Ae({pagePath:e,projectRoot:t}){return s(r.resolve(t,`src`,`${e}.tsx`))}function je(e){return Pe(Ae(e))}function Me(e){let t=s(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`^${t}(?:\\?.*)?$`)}function Ne(e){return s(e.replace(/\?.*$/,``))}function Pe(e){return`/@fs/${s(r.resolve(e))}`}function Fe(e){return{name:`vpt:conditional-directives`,enforce:`pre`,transform:{filter:{id:{include:/^[^?]*\.(?:[cm]?[jt]sx?|css|s[ac]ss|less|styl)(?:\?.*)?$/,exclude:/^[^?]*\/node_modules\//},code:`#if`},handler(t,n){if(Ie(n)&&t.includes(`#if`))return{code:Le(t,e),map:null}}}}}function Ie(e){let t=Ne(e);return!t.includes(`/node_modules/`)&&/\.(?:[cm]?[jt]sx?|css|s[ac]ss|less|styl)$/.test(t)}function Le(e,t){let n=Array.from(e.matchAll(/[^\n]*(?:\n|$)/g),e=>e[0]),r=[],i=``;for(let e of n){if(!e)continue;let n=Re(e),a=e.match(/\r?\n$/)?.[0]??``;if(!n){i+=r.every(e=>e.active)?e:a;continue}if(n.name===`ifdef`||n.name===`ifndef`){let e=r.every(e=>e.active),i=n.target.toLowerCase()===t,a=n.name===`ifdef`?i:!i;r.push({parentActive:e,matched:a,active:e&&a})}else if(n.name===`else`){let e=r.at(-1);e&&(e.active=e.parentActive&&!e.matched)}else r.pop();i+=a}return i}function Re(e){let t=e.match(/^\s*(?:(?:\/\/)|(?:\/\*))\s*#(ifdef|ifndef|if|elif|else|endif)\b([^*\r\n]*)/);if(!t)return;let n=t[1];if(n===`if`||n===`elif`)throw Error(`vpt no longer supports #${n}; use #ifdef, #ifndef, or #else`);return{name:n,target:t[2].replace(/\*\/$/,``).trim()}}const ze=[`vite`,`rolldown`,`vite-plugin-taro-runtime`],Be=Se(`vite-plugin-taro/package.json`),Ve=Se(t(`vite-plugin-taro-runtime`,import.meta.url)),He={vite:Be.peerDependencies.vite,rolldown:Be.dependencies.rolldown,"vite-plugin-taro-runtime":Be.version};function Ue(){return{name:`vpt:deps`,configResolved({logger:e}){We({vite:u,rolldown:c,"vite-plugin-taro-runtime":Ve.version},e)}}}function We(e,t){for(let n of ze){let r=He[n],i=e[n];i!==r&&t.warn(`[vpt] Requires ${n}@${r}, but found ${n}@${i}. Compatibility is not guaranteed.`)}}const Ge=`es2018`,Ke=r.dirname(Se.resolve(`tailwindcss/package.json`)),qe=Ee(`h5/app`);function Je(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}var Ye=class{scopeTracker;enter;leave;contextEnter={skip:()=>{this._skip=!0},remove:()=>{this._remove=!0},replace:e=>{this._replacement=e}};contextLeave={remove:this.contextEnter.remove,replace:this.contextEnter.replace};_skip=!1;_remove=!1;_replacement=null;constructor(e,t){this.enter=e.enter,this.leave=e.leave,this.scopeTracker=t?.scopeTracker}replace(e,t,n,r){e&&t!==null&&(n===null?e[t]=r:e[t][n]=r)}insert(e,t,n,r){e&&t!==null&&(n===null?e[t]=r:e[t].splice(n,0,r))}remove(e,t,n){e&&t!==null&&(n===null?delete e[t]:e[t].splice(n,1))}},Xe=class extends Ye{constructor(e,t){super(e,t)}traverse(e,t,n,r){let i={key:null,index:n??null,ast:e},a=this.scopeTracker,o=this.enter,s=this.leave,c=this.contextEnter,l=this.contextLeave,u=(e,t,n,r,d)=>{a&&a.processNodeEnter(e);let f=e,p=!1,m=!1,h=d;if(o&&!d){let s=this._skip,l=this._remove,u=this._replacement;this._skip=!1,this._remove=!1,this._replacement=null,i.key=n,i.index=r,o.call(c,e,t,i),this._replacement&&!this._remove&&(f=this._replacement,m=!0,this.replace(t,n,r,this._replacement),a&&a.processNodeEnter(f)),this._remove&&(p=!0,f=null,this.remove(t,n,r)),this._skip&&(h=!0),this._skip=s,this._remove=l,this._replacement=u}if((!h||a)&&f)for(let e in f){if(e===`type`||e===`start`||e===`end`)continue;let t=f[e];if(t&&typeof t==`object`){if(Array.isArray(t))for(let n=0;n<t.length;n++){let r=t[n];Je(r)&&u(r,f,e,n,h)===null&&n--}else typeof t.type==`string`&&u(t,f,e,null,h)}}if(a&&(m&&a.processNodeLeave(f),a.processNodeLeave(e)),s&&!d){let a=this._replacement,o=this._remove;this._replacement=null,this._remove=!1,i.key=n,i.index=r,s.call(l,e,t,i),this._replacement&&!this._remove&&(f=this._replacement,p?this.insert(t,n,r,this._replacement):this.replace(t,n,r,this._replacement)),this._remove&&(f=null,this.remove(t,n,r)),this._replacement=a,this._remove=o}return f};if(!Je(e))return null;if(a&&a.onWalkStart(e),a&&!o&&!s){let t=e=>{a.processNodeEnter(e);for(let n in e){if(n===`type`||n===`start`||n===`end`)continue;let r=e[n];if(r&&typeof r==`object`){if(Array.isArray(r))for(let e=0;e<r.length;e++){let n=r[e];Je(n)&&t(n)}else typeof r.type==`string`&&t(r)}}a.processNodeLeave(e)};return t(e),e}return u(e,r??null,t??null,n??null,!1)}};function Ze(e,t){return new Xe({enter:t.enter,leave:t.leave},{scopeTracker:t.scopeTracker}).traverse(e)}const Qe=/* @__PURE__ */ new Set(/* @__PURE__ */ `Program.BlockStatement.StaticBlock.TSModuleBlock.FunctionDeclaration.FunctionExpression.ArrowFunctionExpression.VariableDeclaration.ClassDeclaration.ClassExpression.ImportDeclaration.TSEnumDeclaration.TSModuleDeclaration.TSImportEqualsDeclaration.TSDeclareFunction.TSInterfaceDeclaration.TSTypeAliasDeclaration.TSTypeParameter.TSMappedType.TSEnumBody.TSMethodSignature.TSCallSignatureDeclaration.TSConstructSignatureDeclaration.TSFunctionType.TSConstructorType.TSConditionalType.CatchClause.ForStatement.ForOfStatement.ForInStatement.SwitchStatement`.split(`.`));var $e=class{scopeIndexStack=[];scopeKeyStack=[];scopeOwnerStack=[];scopeIndexKey=``;scopes=/* @__PURE__ */ new Map;typeScopes=/* @__PURE__ */ new Map;implicitArguments=/* @__PURE__ */ new WeakMap;options;isFrozen=!1;constructor(e={}){this.options=e}onWalkStart=e=>{this.scopeIndexStack.length===0&&e.type!==`Program`&&this.scopeIndexStack.push(0)};pushScope(e){let t=this.scopeIndexStack[this.scopeIndexStack.length-1];this.scopeKeyStack.push(this.scopeIndexKey),this.scopeOwnerStack.push(e),this.scopeIndexStack.push(0),t!==void 0&&(this.scopeIndexKey=this.scopeIndexKey?`${this.scopeIndexKey}-${t}`:`${t}`)}popScope(){this.scopeOwnerStack.pop(),this.scopeIndexStack.pop(),this.scopeIndexStack[this.scopeIndexStack.length-1]!==void 0&&this.scopeIndexStack[this.scopeIndexStack.length-1]++,this.options.preserveExitedScopes||(this.scopes.delete(this.scopeIndexKey),this.typeScopes.delete(this.scopeIndexKey)),this.scopeIndexKey=this.scopeKeyStack.pop()??``}getScopeKeyAt(e){return e===this.scopeKeyStack.length-1?this.scopeIndexKey:this.scopeKeyStack[e+1]}getVarScopeKey(){let e=this.scopeOwnerStack;for(let t=e.length-1;t>=0;t--)switch(e[t].type){case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`Program`:case`StaticBlock`:case`TSModuleBlock`:return this.getScopeKeyAt(t)}return``}declareInNamespace(e,t,n){let r=e.get(n.scope);r||(r=/* @__PURE__ */ new Map,e.set(n.scope,r)),r.set(t,n)}declareIdentifier(e,t,n={value:!0}){this.isFrozen||(n.value&&this.declareInNamespace(this.scopes,e,t),n.type&&this.declareInNamespace(this.typeScopes,e,t))}declareFunctionParameter(e,t){if(this.isFrozen)return;let n=et(e);for(let e of n)this.declareIdentifier(e.name,new st(e,this.scopeIndexKey,t))}declarePattern(e,t){if(this.isFrozen)return;let n=t.type===`VariableDeclaration`&&t.kind===`var`?this.getVarScopeKey():this.scopeIndexKey,r=et(e);for(let e of r)this.declareIdentifier(e.name,t.type===`VariableDeclaration`?new ut(e,n,t):t.type===`CatchClause`?new ft(e,n,t):new st(e,n,t))}processNodeEnter=e=>{if(Qe.has(e.type))switch(e.type){case`Program`:case`BlockStatement`:case`StaticBlock`:case`SwitchStatement`:case`TSModuleBlock`:case`TSMethodSignature`:case`TSCallSignatureDeclaration`:case`TSConstructSignatureDeclaration`:case`TSFunctionType`:case`TSConstructorType`:case`TSConditionalType`:this.pushScope(e);break;case`FunctionDeclaration`:e.id?.name&&this.declareIdentifier(e.id.name,new ct(e,this.scopeIndexKey)),this.pushScope(e);for(let t of e.params)this.declareFunctionParameter(t,e);break;case`FunctionExpression`:this.pushScope(e),e.id?.name&&this.declareIdentifier(e.id.name,new ct(e,this.scopeIndexKey)),this.pushScope(e);for(let t of e.params)this.declareFunctionParameter(t,e);break;case`ArrowFunctionExpression`:this.pushScope(e);for(let t of e.params)this.declareFunctionParameter(t,e);break;case`VariableDeclaration`:for(let t of e.declarations)this.declarePattern(t.id,e);break;case`ClassDeclaration`:e.id?.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey),{value:!0,type:!0}),e.typeParameters&&this.pushScope(e);break;case`ClassExpression`:this.pushScope(e),e.id?.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey),{value:!0,type:!0});break;case`ImportDeclaration`:for(let t of e.specifiers){let n=e.importKind===`type`||t.type===`ImportSpecifier`&&t.importKind===`type`;this.declareIdentifier(t.local.name,new dt(t,this.scopeIndexKey,e),{value:!n,type:!0})}break;case`TSEnumDeclaration`:case`TSModuleDeclaration`:case`TSImportEqualsDeclaration`:if(e.type===`TSModuleDeclaration`&&e.kind===`global`)break;e.id?.type===`Identifier`&&e.id.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey),{value:!0,type:!0});break;case`TSDeclareFunction`:e.id?.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey)),this.pushScope(e);break;case`TSInterfaceDeclaration`:case`TSTypeAliasDeclaration`:e.id?.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey),{type:!0}),this.pushScope(e);break;case`TSTypeParameter`:e.name?.name&&this.declareIdentifier(e.name.name,new ot(e.name,this.scopeIndexKey),{type:!0});break;case`TSMappedType`:this.pushScope(e),this.declareIdentifier(e.key.name,new ot(e.key,this.scopeIndexKey),{type:!0});break;case`TSEnumBody`:this.pushScope(e);for(let t of e.members)t.id.type===`Identifier`&&this.declareIdentifier(t.id.name,new ot(t.id,this.scopeIndexKey));break;case`CatchClause`:this.pushScope(e),e.param&&this.declarePattern(e.param,e);break;case`ForStatement`:case`ForOfStatement`:case`ForInStatement`:if(this.pushScope(e),e.type===`ForStatement`&&e.init?.type===`VariableDeclaration`)for(let t of e.init.declarations)this.declarePattern(t.id,e.init);else if((e.type===`ForOfStatement`||e.type===`ForInStatement`)&&e.left.type===`VariableDeclaration`)for(let t of e.left.declarations)this.declarePattern(t.id,e.left)}};processNodeLeave=e=>{let t=this.scopeOwnerStack;for(;t.length>0&&t[t.length-1]===e;)this.popScope()};getDeclarationIn(e,t){let n=this.scopeIndexKey;for(;;){let r=e.get(n)?.get(t);if(r)return r;if(!n)return null;let i=n.lastIndexOf(`-`);n=i===-1?``:n.slice(0,i)}}isDeclared(e,t){return this.getDeclaration(e,t)!==null}getDeclaration(e,t){let n=t?.mode??`value`,r=(n===`type`?null:this.getDeclarationIn(this.scopes,e))??(n===`value`?null:this.getDeclarationIn(this.typeScopes,e));if(e===`arguments`&&n!==`type`){let e=this.scopeOwnerStack;for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`FunctionDeclaration`||n.type===`FunctionExpression`){let e=this.getScopeKeyAt(t);if(!r||it(e,r.scope)){let t=this.implicitArguments.get(n);return t||(t=new lt(n,e),this.implicitArguments.set(n,t)),t}break}}}return r}getCurrentScope(){return this.scopeIndexKey}isCurrentScopeUnder(e){return it(this.scopeIndexKey,e)}freeze(){this.isFrozen=!0,this.scopeIndexStack=[],this.scopeKeyStack=[],this.scopeOwnerStack=[],this.scopeIndexKey=``}};function et(e){let t=[];function n(e){switch(e.type){case`Identifier`:t.push(e);break;case`AssignmentPattern`:n(e.left);break;case`RestElement`:n(e.argument);break;case`TSParameterProperty`:n(e.parameter);break;case`ArrayPattern`:for(let t of e.elements)t&&n(t.type===`RestElement`?t.argument:t);break;case`ObjectPattern`:for(let t of e.properties)n(t.type===`RestElement`?t.argument:t.value)}}return n(e),t}function tt(e,t){switch(e.type){case`Identifier`:return e===t;case`AssignmentPattern`:return tt(e.left,t);case`RestElement`:return tt(e.argument,t);case`TSParameterProperty`:return tt(e.parameter,t);case`ArrayPattern`:for(let n of e.elements)if(n&&tt(n.type===`RestElement`?n.argument:n,t))return!0;return!1;case`ObjectPattern`:for(let n of e.properties)if(tt(n.type===`RestElement`?n.argument:n.value,t))return!0;return!1}return!1}function nt(e,t){if(!t||e.type!==`Identifier`)return!1;switch(t.type){case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`TSEmptyBodyFunctionExpression`:if(t.type!==`ArrowFunctionExpression`&&t.id===e)return!0;for(let n of t.params)if(tt(n,e))return!0;return!1;case`ClassDeclaration`:case`ClassExpression`:return t.id===e;case`VariableDeclarator`:return tt(t.id,e);case`CatchClause`:return t.param?tt(t.param,e):!1;case`ImportSpecifier`:return t.local===e;case`ImportDefaultSpecifier`:case`ImportNamespaceSpecifier`:return!0;case`TSEnumDeclaration`:case`TSModuleDeclaration`:return t.id===e;case`TSImportEqualsDeclaration`:return t.id===e;case`TSParameterProperty`:return tt(t.parameter,e)}return!1}function rt(e,t,n){if(!t)return!1;let r=n?.mode??`value`;if(e.type===`JSXIdentifier`){if(r===`type`)return!1;switch(t.type){case`JSXOpeningElement`:case`JSXClosingElement`:return t.name===e&&!/^[a-z]/.test(e.name);case`JSXMemberExpression`:return t.object===e;case`JSXAttribute`:case`JSXNamespacedName`:return!1}return!1}if(e.type!==`Identifier`||nt(e,t))return!1;switch(t.type){case`MemberExpression`:return r!==`type`&&(t.object===e||t.computed);case`Property`:return r!==`type`&&(t.value===e||t.computed);case`MethodDefinition`:case`PropertyDefinition`:case`AccessorProperty`:case`TSAbstractMethodDefinition`:case`TSAbstractPropertyDefinition`:case`TSAbstractAccessorProperty`:return r!==`type`&&(t.value===e||t.computed);case`ExportSpecifier`:return r!==`type`&&t.local===e;case`ExportAllDeclaration`:return!1;case`ImportSpecifier`:return!1;case`LabeledStatement`:case`BreakStatement`:case`ContinueStatement`:return!1;case`MetaProperty`:return!1;case`ImportAttribute`:return!1;case`TSEnumMember`:return r!==`type`&&t.id!==e;case`TSMappedType`:return!1;case`TSTypeReference`:return r!==`value`;case`TSQualifiedName`:return r!==`value`&&t.left===e;case`TSClassImplements`:case`TSInterfaceHeritage`:return r!==`value`&&t.expression===e;case`TSTypeParameter`:case`TSInterfaceDeclaration`:case`TSTypeAliasDeclaration`:case`TSPropertySignature`:case`TSMethodSignature`:case`TSIndexSignature`:return!1;case`TSFunctionType`:case`TSConstructorType`:case`TSCallSignatureDeclaration`:case`TSConstructSignatureDeclaration`:return!1}return r!==`type`}function it(e,t){return e.length>t.length&&e.startsWith(t)&&(t===``||e[t.length]===`-`)}var at=class{scope;node;constructor(e,t){this.node=e,this.scope=t}isUnderScope(e){return it(this.scope,e)}},ot=class extends at{type=`Identifier`;get start(){return this.node.start}get end(){return this.node.end}},st=class extends at{type=`FunctionParam`;fnNode;constructor(e,t,n){super(e,t),this.fnNode=n}get start(){return this.fnNode.start}get end(){return this.fnNode.end}},ct=class extends at{type=`Function`;get start(){return this.node.start}get end(){return this.node.end}},lt=class extends at{type=`FunctionArguments`;get start(){return this.node.start}get end(){return this.node.end}},ut=class extends at{type=`Variable`;variableNode;constructor(e,t,n){super(e,t),this.variableNode=n}get start(){return this.variableNode.start}get end(){return this.variableNode.end}},dt=class extends at{type=`Import`;importNode;constructor(e,t,n){super(e,t),this.importNode=n}get start(){return this.importNode.start}get end(){return this.importNode.end}},ft=class extends at{type=`CatchParam`;catchNode;constructor(e,t,n){super(e,t),this.catchNode=n}get start(){return this.catchNode.start}get end(){return this.catchNode.end}};function pt({code:e,filename:t,sourcemap:n,createVisitor:r}){let i=new p(e,{filename:t}),a=h(t,e);if(a.errors.length>0){let e=a.errors.map(e=>e.message).join(`; `);throw Error(`Failed to parse ${t} with Oxc: ${e}`)}Ze(a.program,{enter:r(i)});let o=n?i.generateMap({file:t,hires:`boundary`,includeContent:!0,source:t}):null;return{code:i.toString(),map:o?{version:o.version,file:o.file,sources:o.sources,sourcesContent:o.sourcesContent,names:o.names,mappings:o.mappings}:null}}const mt=e(Ce(`components`)).resolve(`@stencil/core/internal/client`),ht=s(mt);function gt(){return{name:`vpt:h5-stencil-client`,transform:{filter:{id:Me(mt)},handler:_t}}}function _t(e,t){if(Ne(t)===ht)return pt({code:e,filename:t,sourcemap:!0,createVisitor:vt})}function vt(e){return function(t){if(t.type!==`CallExpression`||t.callee.type!==`MemberExpression`||t.callee.computed||t.callee.object.type!==`Identifier`||t.callee.object.name!==`styleContainerNode`||t.callee.property.type!==`Identifier`||t.callee.property.name!==`insertBefore`)return;let[n,r]=t.arguments;if(t.arguments.length!==2||n?.type!==`Identifier`||n.name!==`styleElm`||r?.type!==`CallExpression`||r.callee.type!==`MemberExpression`||r.callee.computed||r.callee.object.type!==`Identifier`||r.callee.object.name!==`styleContainerNode`||r.callee.property.type!==`Identifier`||r.callee.property.name!==`querySelector`)return;let[i]=r.arguments;i?.type===`Literal`&&i.value===`link`&&e.overwrite(r.start,r.end,`scopeId.startsWith("sc-taro-") ? styleContainerNode.querySelector("style,link[rel=\\"stylesheet\\"]") : styleContainerNode.querySelector("link")`)}}function yt(e){return e.config??{}}function bt(e){let{subPackages:t,subpackages:n,...r}=e.appJson;return{...r,pages:e.pages.map(e=>e.path)}}function xt(e,t){let n=e.split(t).length-1;if(n!==1)throw Error(`Expected one placeholder ${t}, found ${n}`)}function St(e,t,n,r){let i=new p(e,{filename:t});for(let[t,r]of Object.entries(n)){xt(e,t);let n=e.indexOf(t);i.overwrite(n,n+t.length,r)}return{code:i.toString(),map:r?Ct(i,t):null}}function Ct(e,t){let n=e.generateMap({file:t,source:t,includeContent:!0,hires:`boundary`});return{version:n.version,file:n.file,sources:n.sources,sourcesContent:n.sourcesContent,names:n.names,mappings:n.mappings}}function wt({code:e,id:t,options:n,projectRoot:r,sourcemap:i}){return St(e,t,{__VPT_H5_APP_CONFIG__:JSON.stringify({router:{},...bt(n)}),__VPT_H5_ROUTES__:`[${n.pages.map(e=>Tt(e,r)).join(`,`)}]`},i??!0)}function Tt(e,t){let n=JSON.stringify(je({pagePath:e.path,projectRoot:t}));return`{path:${JSON.stringify(e.path)},load:async function(context,params){const page=await import(${n});return [page,context,params]},...${JSON.stringify(yt(e))}}`}function Et(e){return{resolveId({id:t,projectRoot:n}){if(t===`\0vpt:app-component`)return ke({appPath:e.app,projectRoot:n})},transform({code:t,id:n,projectRoot:r,sourcemap:i=!0}){if(Ne(n)===s(qe))return wt({code:t,id:n,options:e,projectRoot:r,sourcemap:i})}}}function Dt(e){return[...d({optimize:!1}),gt(),Ot(e)]}function Ot(e){let t=Et(e);return{name:`vpt:h5`,config(){return{define:Mt(),resolve:{mainFields:[`main:h5`,`browser`,`module`,`jsnext:main`,`jsnext`],alias:[{find:/^tailwindcss(?=\/|$)/,replacement:Ke},{find:/^(?:@tarojs\/plugin-platform-h5\/dist|vite-plugin-taro-runtime\/plugin-platform-h5)\/runtime\/apis$/,replacement:Ce(`plugin-platform-h5/runtime/apis`)},{find:/^(?:@tarojs\/plugin-platform-h5\/dist|vite-plugin-taro-runtime\/plugin-platform-h5)\/definition\.json$/,replacement:Ce(`plugin-platform-h5/definition.json`)},{find:/^(?:@tarojs\/plugin-framework-react\/dist|vite-plugin-taro-runtime\/plugin-framework-react)\/runtime$/,replacement:Ce(`plugin-framework-react/runtime`)},{find:/^(?:@tarojs\/runtime|vite-plugin-taro-runtime\/runtime\/h5)$/,replacement:Ce(`runtime/h5`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/api$/,replacement:Ce(`api`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/taro-h5\/dist\/api\/taro$/,replacement:Ce(`taro-h5/dist/api/taro`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/taro-h5\/dist\/api\/index$/,replacement:Ce(`taro-h5/dist/api/index`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components\/global\.css$/,replacement:Ce(`components/global.css`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components\/dist\/taro-components\/taro-components\.css$/,replacement:Ce(`components/dist/taro-components/taro-components.css`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/router$/,replacement:Ce(`router`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components$/,replacement:Ce(`components`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components\/dist\/components$/,replacement:Ce(`components/dist/components`)}]},optimizeDeps:{include:[`vite-plugin-taro-runtime/plugin-platform-h5/runtime/apis`,`vite-plugin-taro-runtime/plugin-framework-react/runtime`,`vite-plugin-taro-runtime/router`,`vite-plugin-taro-runtime/runtime/h5`,`react-dom/client`],rolldownOptions:{plugins:[At(),gt()]}},build:{target:Ge}}},resolveId:{order:`pre`,handler(e){return t.resolveId({id:e,projectRoot:this.environment.config.root})}},transform:{order:`pre`,filter:{id:Me(qe)},handler(e,n){return t.transform({code:e,id:n,projectRoot:this.environment.config.root,sourcemap:!!this.environment.config.build.sourcemap})}},transformIndexHtml:{order:`pre`,handler(){return kt()}}}}function kt(){return[{tag:`script`,attrs:{type:`module`},children:`import '${Pe(qe)}'`,injectTo:`body`}]}function At(){return{name:`vpt:h5-optimizer-taro`,resolveId:jt}}function jt(e){if(e===`@tarojs/taro`)return Ce(`plugin-platform-h5/runtime/apis`)}function Mt(){return{"process.env.FRAMEWORK":JSON.stringify(`react`),"process.env.SUPPORT_TARO_POLYFILL":JSON.stringify(`disabled`),"process.env.TARO_ENV":JSON.stringify(`h5`),"process.env.TARO_PLATFORM":JSON.stringify(`web`),"process.env.SUPPORT_DINGTALK_NAVIGATE":JSON.stringify(`disabled`),DEPRECATED_ADAPTER_COMPONENT:`false`}}function Nt(e,t){_(e,{recursive:!0});let n=new Set(t.map(t=>r.resolve(e,t)));for(let t of y(e,{recursive:!0,withFileTypes:!0})){let e=r.resolve(t.parentPath,t.name);!t.isDirectory()&&!n.has(e)&&b(e)}}function Pt(e,t={}){let{cache:n=/* @__PURE__ */ new Map,getCacheKey:r}=t,i=function(t){let i=r?r(t):t;if(n.has(i))return n.get(i);let a=e.call(this,t);return n.set(i,a),a};return i.cache=n,i}const Ft=Ee(`mini/amphibious/bootstrap`),It=Ee(`mini/native/app`),Lt=Ee(`mini/capsule/app`),Rt=Ee(`mini/native/component`),zt=Ee(`mini/capsule/component`),Bt=Ee(`mini/native/custom-wrapper`),Vt=Ee(`mini/native/page`),Ht=Ee(`mini/capsule/page`),Ut=Ce(`runtime/mini`),Wt=f,Gt=`\0vpt:global-binding`,Kt=`\0vpt:mini-polyfills`,qt=`common/vpt/transport.js`,Jt=`\0vpt:page-component`,Yt=[r.resolve(r.dirname(Ut),`../..`),...[`react`,`react-dom`].map(e=>r.dirname(Se.resolve(`${e}/package.json`)))].map(e=>`${s(e)}/`),Xt=`${s(r.dirname(Se.resolve(`core-js/package.json`)))}/`,Zt=RegExp(`^${Xt.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}`);function Qt(e){let t=s(e);return t===`\0vpt:mini-polyfills`||t===`\0vpt:global-binding`||t.startsWith(Xt)}function $t(e){let t=s(e);return Yt.some(e=>t.startsWith(e))}const en=/* @__PURE__ */ new Map([[It,`native`],[Rt,`native`],[Bt,`native`],[Vt,`native`],[Lt,`entry-capsule`],[zt,`entry-capsule`],[Ht,`entry-capsule`],[Ft,`amphibious`],[Gt,`amphibious`],[Kt,`amphibious`],[Wt,`amphibious`]]);function tn(e){for(let t of e.moduleIds){let e=en.get(Ne(t));if(e!==void 0)return e}return`normal-capsule`}var nn=/* @__PURE__ */ A(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c}));function rn(e){return typeof e==`function`}function an(e){let t=e(e=>{Error.call(e),e.stack=(/* @__PURE__ */ Error()).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}const on=an(e=>function(t){e(this),this.message=t?`${t.length} errors occurred during unsubscription:
|
|
1
|
+
import{createRequire as e,findPackageJSON as t}from"node:module";import n from"@vitejs/plugin-react";import r from"node:path";import{fileURLToPath as i,pathToFileURL as a}from"node:url";import{isCSSRequest as o,normalizePath as s,rolldownVersion as c,transformWithOxc as l,version as u}from"vite";import d from"@tailwindcss/vite";import{RUNTIME_MODULE_ID as f,RolldownMagicString as p,build as m}from"rolldown";import{parseSync as h}from"rolldown/utils";import{existsSync as g,mkdirSync as _,promises as v,readdirSync as y,unlinkSync as b,writeFileSync as x}from"node:fs";import S,{readFile as C,readdir as w,stat as ee}from"node:fs/promises";import{dev as T,viteReporterPlugin as te,viteTransformPlugin as E}from"rolldown/experimental";import{createHash as ne,randomUUID as re}from"node:crypto";import{parseAst as ie}from"rolldown/parseAst";import{Scanner as ae}from"@tailwindcss/oxide";import oe,{emitWarning as se}from"node:process";import{performance as ce}from"node:perf_hooks";import{channel as le,tracingChannel as ue}from"node:diagnostics_channel";import{RecursiveTemplate as D,UnRecursiveTemplate as de,capitalize as fe,toCamelCase as pe}from"@tarojs/shared/dist/template.js";import{components as O}from"vite-plugin-taro-runtime/plugin-platform-tt/runtime-utils";import{components as k}from"vite-plugin-taro-runtime/plugin-platform-weapp/runtime-utils";import{components as me}from"vite-plugin-taro-runtime/plugin-platform-alipay/runtime-utils";var he=Object.create,ge=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,ve=Object.getOwnPropertyNames,ye=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty,A=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),j=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ve(t),a=0,o=i.length,s;a<o;a++)s=i[a],!be.call(e,s)&&s!==n&&ge(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=_e(t,s))||r.enumerable});return e},M=(e,t,n)=>(n=e==null?{}:he(ye(e)),j(t||!e||!e.__esModule||!be.call(e,`default`)?ge(n,`default`,{value:e,enumerable:!0}):n,e)),xe=/* @__PURE__ */ e(import.meta.url);const Se=e(import.meta.url);function Ce(e){return Se.resolve(`vite-plugin-taro-runtime/${e}`)}const we=r.dirname(Se.resolve(`vite-plugin-taro/package.json`)),Te={".ts":{root:`src/runtime`,extension:`.ts`},".js":{root:`dist/runtime`,extension:`.js`}}[r.extname(i(import.meta.url))];function Ee(e){return s(r.join(we,Te.root,`${e}${Te.extension}`))}const De=`virtual:taro/native`;function Oe(e){let t=Ee(e===`h5`?`h5/taro-api`:`client/taro/api`),n=/* @__PURE__ */ new Map([[`virtual:taro/api`,t],[`@tarojs/taro`,t],[`virtual:taro/components`,Ee(`client/taro/component`)],[De,Ee(`client/taro/native`)]]);return{name:`vpt:client-taro`,enforce:`pre`,resolveId:e=>n.get(e)}}function ke({appPath:e,projectRoot:t}){return s(r.resolve(t,e))}function Ae({pagePath:e,projectRoot:t}){return s(r.resolve(t,`src`,`${e}.tsx`))}function je(e){return Pe(Ae(e))}function Me(e){let t=s(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`^${t}(?:\\?.*)?$`)}function Ne(e){return s(e.replace(/\?.*$/,``))}function Pe(e){return`/@fs/${s(r.resolve(e))}`}function Fe(e){return{name:`vpt:conditional-directives`,enforce:`pre`,transform:{filter:{id:{include:/^[^?]*\.(?:[cm]?[jt]sx?|css|s[ac]ss|less|styl)(?:\?.*)?$/,exclude:/^[^?]*\/node_modules\//},code:`#if`},handler(t,n){if(Ie(n)&&t.includes(`#if`))return{code:Le(t,e),map:null}}}}}function Ie(e){let t=Ne(e);return!t.includes(`/node_modules/`)&&/\.(?:[cm]?[jt]sx?|css|s[ac]ss|less|styl)$/.test(t)}function Le(e,t){let n=Array.from(e.matchAll(/[^\n]*(?:\n|$)/g),e=>e[0]),r=[],i=``;for(let e of n){if(!e)continue;let n=Re(e),a=e.match(/\r?\n$/)?.[0]??``;if(!n){i+=r.every(e=>e.active)?e:a;continue}if(n.name===`ifdef`||n.name===`ifndef`){let e=r.every(e=>e.active),i=n.target.toLowerCase()===t,a=n.name===`ifdef`?i:!i;r.push({parentActive:e,matched:a,active:e&&a})}else if(n.name===`else`){let e=r.at(-1);e&&(e.active=e.parentActive&&!e.matched)}else r.pop();i+=a}return i}function Re(e){let t=e.match(/^\s*(?:(?:\/\/)|(?:\/\*))\s*#(ifdef|ifndef|if|elif|else|endif)\b([^*\r\n]*)/);if(!t)return;let n=t[1];if(n===`if`||n===`elif`)throw Error(`vpt no longer supports #${n}; use #ifdef, #ifndef, or #else`);return{name:n,target:t[2].replace(/\*\/$/,``).trim()}}const ze=[`vite`,`rolldown`,`vite-plugin-taro-runtime`],Be=Se(`vite-plugin-taro/package.json`),Ve=Se(t(`vite-plugin-taro-runtime`,import.meta.url)),He={vite:Be.peerDependencies.vite,rolldown:Be.dependencies.rolldown,"vite-plugin-taro-runtime":Be.version};function Ue(){return{name:`vpt:deps`,configResolved({logger:e}){We({vite:u,rolldown:c,"vite-plugin-taro-runtime":Ve.version},e)}}}function We(e,t){for(let n of ze){let r=He[n],i=e[n];i!==r&&t.warn(`[vpt] Requires ${n}@${r}, but found ${n}@${i}. Compatibility is not guaranteed.`)}}const Ge=`es2018`,Ke=r.dirname(Se.resolve(`tailwindcss/package.json`)),qe=Ee(`h5/app`);function Je(e){return typeof e==`object`&&!!e&&typeof e.type==`string`}var Ye=class{scopeTracker;enter;leave;contextEnter={skip:()=>{this._skip=!0},remove:()=>{this._remove=!0},replace:e=>{this._replacement=e}};contextLeave={remove:this.contextEnter.remove,replace:this.contextEnter.replace};_skip=!1;_remove=!1;_replacement=null;constructor(e,t){this.enter=e.enter,this.leave=e.leave,this.scopeTracker=t?.scopeTracker}replace(e,t,n,r){e&&t!==null&&(n===null?e[t]=r:e[t][n]=r)}insert(e,t,n,r){e&&t!==null&&(n===null?e[t]=r:e[t].splice(n,0,r))}remove(e,t,n){e&&t!==null&&(n===null?delete e[t]:e[t].splice(n,1))}},Xe=class extends Ye{constructor(e,t){super(e,t)}traverse(e,t,n,r){let i={key:null,index:n??null,ast:e},a=this.scopeTracker,o=this.enter,s=this.leave,c=this.contextEnter,l=this.contextLeave,u=(e,t,n,r,d)=>{a&&a.processNodeEnter(e);let f=e,p=!1,m=!1,h=d;if(o&&!d){let s=this._skip,l=this._remove,u=this._replacement;this._skip=!1,this._remove=!1,this._replacement=null,i.key=n,i.index=r,o.call(c,e,t,i),this._replacement&&!this._remove&&(f=this._replacement,m=!0,this.replace(t,n,r,this._replacement),a&&a.processNodeEnter(f)),this._remove&&(p=!0,f=null,this.remove(t,n,r)),this._skip&&(h=!0),this._skip=s,this._remove=l,this._replacement=u}if((!h||a)&&f)for(let e in f){if(e===`type`||e===`start`||e===`end`)continue;let t=f[e];if(t&&typeof t==`object`){if(Array.isArray(t))for(let n=0;n<t.length;n++){let r=t[n];Je(r)&&u(r,f,e,n,h)===null&&n--}else typeof t.type==`string`&&u(t,f,e,null,h)}}if(a&&(m&&a.processNodeLeave(f),a.processNodeLeave(e)),s&&!d){let a=this._replacement,o=this._remove;this._replacement=null,this._remove=!1,i.key=n,i.index=r,s.call(l,e,t,i),this._replacement&&!this._remove&&(f=this._replacement,p?this.insert(t,n,r,this._replacement):this.replace(t,n,r,this._replacement)),this._remove&&(f=null,this.remove(t,n,r)),this._replacement=a,this._remove=o}return f};if(!Je(e))return null;if(a&&a.onWalkStart(e),a&&!o&&!s){let t=e=>{a.processNodeEnter(e);for(let n in e){if(n===`type`||n===`start`||n===`end`)continue;let r=e[n];if(r&&typeof r==`object`){if(Array.isArray(r))for(let e=0;e<r.length;e++){let n=r[e];Je(n)&&t(n)}else typeof r.type==`string`&&t(r)}}a.processNodeLeave(e)};return t(e),e}return u(e,r??null,t??null,n??null,!1)}};function Ze(e,t){return new Xe({enter:t.enter,leave:t.leave},{scopeTracker:t.scopeTracker}).traverse(e)}const Qe=/* @__PURE__ */ new Set(/* @__PURE__ */ `Program.BlockStatement.StaticBlock.TSModuleBlock.FunctionDeclaration.FunctionExpression.ArrowFunctionExpression.VariableDeclaration.ClassDeclaration.ClassExpression.ImportDeclaration.TSEnumDeclaration.TSModuleDeclaration.TSImportEqualsDeclaration.TSDeclareFunction.TSInterfaceDeclaration.TSTypeAliasDeclaration.TSTypeParameter.TSMappedType.TSEnumBody.TSMethodSignature.TSCallSignatureDeclaration.TSConstructSignatureDeclaration.TSFunctionType.TSConstructorType.TSConditionalType.CatchClause.ForStatement.ForOfStatement.ForInStatement.SwitchStatement`.split(`.`));var $e=class{scopeIndexStack=[];scopeKeyStack=[];scopeOwnerStack=[];scopeIndexKey=``;scopes=/* @__PURE__ */ new Map;typeScopes=/* @__PURE__ */ new Map;implicitArguments=/* @__PURE__ */ new WeakMap;options;isFrozen=!1;constructor(e={}){this.options=e}onWalkStart=e=>{this.scopeIndexStack.length===0&&e.type!==`Program`&&this.scopeIndexStack.push(0)};pushScope(e){let t=this.scopeIndexStack[this.scopeIndexStack.length-1];this.scopeKeyStack.push(this.scopeIndexKey),this.scopeOwnerStack.push(e),this.scopeIndexStack.push(0),t!==void 0&&(this.scopeIndexKey=this.scopeIndexKey?`${this.scopeIndexKey}-${t}`:`${t}`)}popScope(){this.scopeOwnerStack.pop(),this.scopeIndexStack.pop(),this.scopeIndexStack[this.scopeIndexStack.length-1]!==void 0&&this.scopeIndexStack[this.scopeIndexStack.length-1]++,this.options.preserveExitedScopes||(this.scopes.delete(this.scopeIndexKey),this.typeScopes.delete(this.scopeIndexKey)),this.scopeIndexKey=this.scopeKeyStack.pop()??``}getScopeKeyAt(e){return e===this.scopeKeyStack.length-1?this.scopeIndexKey:this.scopeKeyStack[e+1]}getVarScopeKey(){let e=this.scopeOwnerStack;for(let t=e.length-1;t>=0;t--)switch(e[t].type){case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`Program`:case`StaticBlock`:case`TSModuleBlock`:return this.getScopeKeyAt(t)}return``}declareInNamespace(e,t,n){let r=e.get(n.scope);r||(r=/* @__PURE__ */ new Map,e.set(n.scope,r)),r.set(t,n)}declareIdentifier(e,t,n={value:!0}){this.isFrozen||(n.value&&this.declareInNamespace(this.scopes,e,t),n.type&&this.declareInNamespace(this.typeScopes,e,t))}declareFunctionParameter(e,t){if(this.isFrozen)return;let n=et(e);for(let e of n)this.declareIdentifier(e.name,new st(e,this.scopeIndexKey,t))}declarePattern(e,t){if(this.isFrozen)return;let n=t.type===`VariableDeclaration`&&t.kind===`var`?this.getVarScopeKey():this.scopeIndexKey,r=et(e);for(let e of r)this.declareIdentifier(e.name,t.type===`VariableDeclaration`?new ut(e,n,t):t.type===`CatchClause`?new ft(e,n,t):new st(e,n,t))}processNodeEnter=e=>{if(Qe.has(e.type))switch(e.type){case`Program`:case`BlockStatement`:case`StaticBlock`:case`SwitchStatement`:case`TSModuleBlock`:case`TSMethodSignature`:case`TSCallSignatureDeclaration`:case`TSConstructSignatureDeclaration`:case`TSFunctionType`:case`TSConstructorType`:case`TSConditionalType`:this.pushScope(e);break;case`FunctionDeclaration`:e.id?.name&&this.declareIdentifier(e.id.name,new ct(e,this.scopeIndexKey)),this.pushScope(e);for(let t of e.params)this.declareFunctionParameter(t,e);break;case`FunctionExpression`:this.pushScope(e),e.id?.name&&this.declareIdentifier(e.id.name,new ct(e,this.scopeIndexKey)),this.pushScope(e);for(let t of e.params)this.declareFunctionParameter(t,e);break;case`ArrowFunctionExpression`:this.pushScope(e);for(let t of e.params)this.declareFunctionParameter(t,e);break;case`VariableDeclaration`:for(let t of e.declarations)this.declarePattern(t.id,e);break;case`ClassDeclaration`:e.id?.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey),{value:!0,type:!0}),e.typeParameters&&this.pushScope(e);break;case`ClassExpression`:this.pushScope(e),e.id?.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey),{value:!0,type:!0});break;case`ImportDeclaration`:for(let t of e.specifiers){let n=e.importKind===`type`||t.type===`ImportSpecifier`&&t.importKind===`type`;this.declareIdentifier(t.local.name,new dt(t,this.scopeIndexKey,e),{value:!n,type:!0})}break;case`TSEnumDeclaration`:case`TSModuleDeclaration`:case`TSImportEqualsDeclaration`:if(e.type===`TSModuleDeclaration`&&e.kind===`global`)break;e.id?.type===`Identifier`&&e.id.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey),{value:!0,type:!0});break;case`TSDeclareFunction`:e.id?.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey)),this.pushScope(e);break;case`TSInterfaceDeclaration`:case`TSTypeAliasDeclaration`:e.id?.name&&this.declareIdentifier(e.id.name,new ot(e.id,this.scopeIndexKey),{type:!0}),this.pushScope(e);break;case`TSTypeParameter`:e.name?.name&&this.declareIdentifier(e.name.name,new ot(e.name,this.scopeIndexKey),{type:!0});break;case`TSMappedType`:this.pushScope(e),this.declareIdentifier(e.key.name,new ot(e.key,this.scopeIndexKey),{type:!0});break;case`TSEnumBody`:this.pushScope(e);for(let t of e.members)t.id.type===`Identifier`&&this.declareIdentifier(t.id.name,new ot(t.id,this.scopeIndexKey));break;case`CatchClause`:this.pushScope(e),e.param&&this.declarePattern(e.param,e);break;case`ForStatement`:case`ForOfStatement`:case`ForInStatement`:if(this.pushScope(e),e.type===`ForStatement`&&e.init?.type===`VariableDeclaration`)for(let t of e.init.declarations)this.declarePattern(t.id,e.init);else if((e.type===`ForOfStatement`||e.type===`ForInStatement`)&&e.left.type===`VariableDeclaration`)for(let t of e.left.declarations)this.declarePattern(t.id,e.left)}};processNodeLeave=e=>{let t=this.scopeOwnerStack;for(;t.length>0&&t[t.length-1]===e;)this.popScope()};getDeclarationIn(e,t){let n=this.scopeIndexKey;for(;;){let r=e.get(n)?.get(t);if(r)return r;if(!n)return null;let i=n.lastIndexOf(`-`);n=i===-1?``:n.slice(0,i)}}isDeclared(e,t){return this.getDeclaration(e,t)!==null}getDeclaration(e,t){let n=t?.mode??`value`,r=(n===`type`?null:this.getDeclarationIn(this.scopes,e))??(n===`value`?null:this.getDeclarationIn(this.typeScopes,e));if(e===`arguments`&&n!==`type`){let e=this.scopeOwnerStack;for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`FunctionDeclaration`||n.type===`FunctionExpression`){let e=this.getScopeKeyAt(t);if(!r||it(e,r.scope)){let t=this.implicitArguments.get(n);return t||(t=new lt(n,e),this.implicitArguments.set(n,t)),t}break}}}return r}getCurrentScope(){return this.scopeIndexKey}isCurrentScopeUnder(e){return it(this.scopeIndexKey,e)}freeze(){this.isFrozen=!0,this.scopeIndexStack=[],this.scopeKeyStack=[],this.scopeOwnerStack=[],this.scopeIndexKey=``}};function et(e){let t=[];function n(e){switch(e.type){case`Identifier`:t.push(e);break;case`AssignmentPattern`:n(e.left);break;case`RestElement`:n(e.argument);break;case`TSParameterProperty`:n(e.parameter);break;case`ArrayPattern`:for(let t of e.elements)t&&n(t.type===`RestElement`?t.argument:t);break;case`ObjectPattern`:for(let t of e.properties)n(t.type===`RestElement`?t.argument:t.value)}}return n(e),t}function tt(e,t){switch(e.type){case`Identifier`:return e===t;case`AssignmentPattern`:return tt(e.left,t);case`RestElement`:return tt(e.argument,t);case`TSParameterProperty`:return tt(e.parameter,t);case`ArrayPattern`:for(let n of e.elements)if(n&&tt(n.type===`RestElement`?n.argument:n,t))return!0;return!1;case`ObjectPattern`:for(let n of e.properties)if(tt(n.type===`RestElement`?n.argument:n.value,t))return!0;return!1}return!1}function nt(e,t){if(!t||e.type!==`Identifier`)return!1;switch(t.type){case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:case`TSDeclareFunction`:case`TSEmptyBodyFunctionExpression`:if(t.type!==`ArrowFunctionExpression`&&t.id===e)return!0;for(let n of t.params)if(tt(n,e))return!0;return!1;case`ClassDeclaration`:case`ClassExpression`:return t.id===e;case`VariableDeclarator`:return tt(t.id,e);case`CatchClause`:return t.param?tt(t.param,e):!1;case`ImportSpecifier`:return t.local===e;case`ImportDefaultSpecifier`:case`ImportNamespaceSpecifier`:return!0;case`TSEnumDeclaration`:case`TSModuleDeclaration`:return t.id===e;case`TSImportEqualsDeclaration`:return t.id===e;case`TSParameterProperty`:return tt(t.parameter,e)}return!1}function rt(e,t,n){if(!t)return!1;let r=n?.mode??`value`;if(e.type===`JSXIdentifier`){if(r===`type`)return!1;switch(t.type){case`JSXOpeningElement`:case`JSXClosingElement`:return t.name===e&&!/^[a-z]/.test(e.name);case`JSXMemberExpression`:return t.object===e;case`JSXAttribute`:case`JSXNamespacedName`:return!1}return!1}if(e.type!==`Identifier`||nt(e,t))return!1;switch(t.type){case`MemberExpression`:return r!==`type`&&(t.object===e||t.computed);case`Property`:return r!==`type`&&(t.value===e||t.computed);case`MethodDefinition`:case`PropertyDefinition`:case`AccessorProperty`:case`TSAbstractMethodDefinition`:case`TSAbstractPropertyDefinition`:case`TSAbstractAccessorProperty`:return r!==`type`&&(t.value===e||t.computed);case`ExportSpecifier`:return r!==`type`&&t.local===e;case`ExportAllDeclaration`:return!1;case`ImportSpecifier`:return!1;case`LabeledStatement`:case`BreakStatement`:case`ContinueStatement`:return!1;case`MetaProperty`:return!1;case`ImportAttribute`:return!1;case`TSEnumMember`:return r!==`type`&&t.id!==e;case`TSMappedType`:return!1;case`TSTypeReference`:return r!==`value`;case`TSQualifiedName`:return r!==`value`&&t.left===e;case`TSClassImplements`:case`TSInterfaceHeritage`:return r!==`value`&&t.expression===e;case`TSTypeParameter`:case`TSInterfaceDeclaration`:case`TSTypeAliasDeclaration`:case`TSPropertySignature`:case`TSMethodSignature`:case`TSIndexSignature`:return!1;case`TSFunctionType`:case`TSConstructorType`:case`TSCallSignatureDeclaration`:case`TSConstructSignatureDeclaration`:return!1}return r!==`type`}function it(e,t){return e.length>t.length&&e.startsWith(t)&&(t===``||e[t.length]===`-`)}var at=class{scope;node;constructor(e,t){this.node=e,this.scope=t}isUnderScope(e){return it(this.scope,e)}},ot=class extends at{type=`Identifier`;get start(){return this.node.start}get end(){return this.node.end}},st=class extends at{type=`FunctionParam`;fnNode;constructor(e,t,n){super(e,t),this.fnNode=n}get start(){return this.fnNode.start}get end(){return this.fnNode.end}},ct=class extends at{type=`Function`;get start(){return this.node.start}get end(){return this.node.end}},lt=class extends at{type=`FunctionArguments`;get start(){return this.node.start}get end(){return this.node.end}},ut=class extends at{type=`Variable`;variableNode;constructor(e,t,n){super(e,t),this.variableNode=n}get start(){return this.variableNode.start}get end(){return this.variableNode.end}},dt=class extends at{type=`Import`;importNode;constructor(e,t,n){super(e,t),this.importNode=n}get start(){return this.importNode.start}get end(){return this.importNode.end}},ft=class extends at{type=`CatchParam`;catchNode;constructor(e,t,n){super(e,t),this.catchNode=n}get start(){return this.catchNode.start}get end(){return this.catchNode.end}};function pt({code:e,filename:t,sourcemap:n,createVisitor:r}){let i=new p(e,{filename:t}),a=h(Ne(t),e);if(a.errors.length>0){let e=a.errors.map(e=>e.message).join(`; `);throw Error(`Failed to parse ${t} with Oxc: ${e}`)}Ze(a.program,{enter:r(i)});let o=n?i.generateMap({file:t,hires:`boundary`,includeContent:!0,source:t}):null;return{code:i.toString(),map:o?{version:o.version,file:o.file,sources:o.sources,sourcesContent:o.sourcesContent,names:o.names,mappings:o.mappings}:null}}const mt=e(Ce(`components`)).resolve(`@stencil/core/internal/client`),ht=s(mt);function gt(){return{name:`vpt:h5-stencil-client`,transform:{filter:{id:Me(mt)},handler:_t}}}function _t(e,t){if(Ne(t)===ht)return pt({code:e,filename:t,sourcemap:!0,createVisitor:vt})}function vt(e){return function(t){if(t.type!==`CallExpression`||t.callee.type!==`MemberExpression`||t.callee.computed||t.callee.object.type!==`Identifier`||t.callee.object.name!==`styleContainerNode`||t.callee.property.type!==`Identifier`||t.callee.property.name!==`insertBefore`)return;let[n,r]=t.arguments;if(t.arguments.length!==2||n?.type!==`Identifier`||n.name!==`styleElm`||r?.type!==`CallExpression`||r.callee.type!==`MemberExpression`||r.callee.computed||r.callee.object.type!==`Identifier`||r.callee.object.name!==`styleContainerNode`||r.callee.property.type!==`Identifier`||r.callee.property.name!==`querySelector`)return;let[i]=r.arguments;i?.type===`Literal`&&i.value===`link`&&e.overwrite(r.start,r.end,`scopeId.startsWith("sc-taro-") ? styleContainerNode.querySelector("style,link[rel=\\"stylesheet\\"]") : styleContainerNode.querySelector("link")`)}}function yt(e){return e.config??{}}function bt(e){let{subPackages:t,subpackages:n,...r}=e.appJson;return{...r,pages:e.pages.map(e=>e.path)}}function xt(e,t){let n=e.split(t).length-1;if(n!==1)throw Error(`Expected one placeholder ${t}, found ${n}`)}function St(e,t,n,r){let i=new p(e,{filename:t});for(let[t,r]of Object.entries(n)){xt(e,t);let n=e.indexOf(t);i.overwrite(n,n+t.length,r)}return{code:i.toString(),map:r?Ct(i,t):null}}function Ct(e,t){let n=e.generateMap({file:t,source:t,includeContent:!0,hires:`boundary`});return{version:n.version,file:n.file,sources:n.sources,sourcesContent:n.sourcesContent,names:n.names,mappings:n.mappings}}function wt({code:e,id:t,options:n,projectRoot:r,sourcemap:i}){return St(e,t,{__VPT_H5_APP_CONFIG__:JSON.stringify({router:{},...bt(n)}),__VPT_H5_ROUTES__:`[${n.pages.map(e=>Tt(e,r)).join(`,`)}]`},i??!0)}function Tt(e,t){let n=JSON.stringify(je({pagePath:e.path,projectRoot:t}));return`{path:${JSON.stringify(e.path)},load:async function(context,params){const page=await import(${n});return [page,context,params]},...${JSON.stringify(yt(e))}}`}function Et(e){return{resolveId({id:t,projectRoot:n}){if(t===`\0vpt:app-component`)return ke({appPath:e.app,projectRoot:n})},transform({code:t,id:n,projectRoot:r,sourcemap:i=!0}){if(Ne(n)===s(qe))return wt({code:t,id:n,options:e,projectRoot:r,sourcemap:i})}}}function Dt(e){return[...d({optimize:!1}),gt(),Ot(e)]}function Ot(e){let t=Et(e);return{name:`vpt:h5`,config(){return{define:Mt(),resolve:{mainFields:[`main:h5`,`browser`,`module`,`jsnext:main`,`jsnext`],alias:[{find:/^tailwindcss(?=\/|$)/,replacement:Ke},{find:/^(?:@tarojs\/plugin-platform-h5\/dist|vite-plugin-taro-runtime\/plugin-platform-h5)\/runtime\/apis$/,replacement:Ce(`plugin-platform-h5/runtime/apis`)},{find:/^(?:@tarojs\/plugin-platform-h5\/dist|vite-plugin-taro-runtime\/plugin-platform-h5)\/definition\.json$/,replacement:Ce(`plugin-platform-h5/definition.json`)},{find:/^(?:@tarojs\/plugin-framework-react\/dist|vite-plugin-taro-runtime\/plugin-framework-react)\/runtime$/,replacement:Ce(`plugin-framework-react/runtime`)},{find:/^(?:@tarojs\/runtime|vite-plugin-taro-runtime\/runtime\/h5)$/,replacement:Ce(`runtime/h5`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/api$/,replacement:Ce(`api`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/taro-h5\/dist\/api\/taro$/,replacement:Ce(`taro-h5/dist/api/taro`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/taro-h5\/dist\/api\/index$/,replacement:Ce(`taro-h5/dist/api/index`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components\/global\.css$/,replacement:Ce(`components/global.css`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components\/dist\/taro-components\/taro-components\.css$/,replacement:Ce(`components/dist/taro-components/taro-components.css`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/router$/,replacement:Ce(`router`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components$/,replacement:Ce(`components`)},{find:/^(?:@tarojs|vite-plugin-taro-runtime)\/components\/dist\/components$/,replacement:Ce(`components/dist/components`)}]},optimizeDeps:{include:[`vite-plugin-taro-runtime/plugin-platform-h5/runtime/apis`,`vite-plugin-taro-runtime/plugin-framework-react/runtime`,`vite-plugin-taro-runtime/router`,`vite-plugin-taro-runtime/runtime/h5`,`react-dom/client`],rolldownOptions:{plugins:[At(),gt()]}},build:{target:Ge}}},resolveId:{order:`pre`,handler(e){return t.resolveId({id:e,projectRoot:this.environment.config.root})}},transform:{order:`pre`,filter:{id:Me(qe)},handler(e,n){return t.transform({code:e,id:n,projectRoot:this.environment.config.root,sourcemap:!!this.environment.config.build.sourcemap})}},transformIndexHtml:{order:`pre`,handler(){return kt()}}}}function kt(){return[{tag:`script`,attrs:{type:`module`},children:`import '${Pe(qe)}'`,injectTo:`body`}]}function At(){return{name:`vpt:h5-optimizer-taro`,resolveId:jt}}function jt(e){if(e===`@tarojs/taro`)return Ce(`plugin-platform-h5/runtime/apis`)}function Mt(){return{"process.env.FRAMEWORK":JSON.stringify(`react`),"process.env.SUPPORT_TARO_POLYFILL":JSON.stringify(`disabled`),"process.env.TARO_ENV":JSON.stringify(`h5`),"process.env.TARO_PLATFORM":JSON.stringify(`web`),"process.env.SUPPORT_DINGTALK_NAVIGATE":JSON.stringify(`disabled`),DEPRECATED_ADAPTER_COMPONENT:`false`}}function Nt(e,t){_(e,{recursive:!0});let n=new Set(t.map(t=>r.resolve(e,t)));for(let t of y(e,{recursive:!0,withFileTypes:!0})){let e=r.resolve(t.parentPath,t.name);!t.isDirectory()&&!n.has(e)&&b(e)}}function Pt(e,t={}){let{cache:n=/* @__PURE__ */ new Map,getCacheKey:r}=t,i=function(t){let i=r?r(t):t;if(n.has(i))return n.get(i);let a=e.call(this,t);return n.set(i,a),a};return i.cache=n,i}const Ft=Ee(`mini/amphibious/bootstrap`),It=Ee(`mini/native/app`),Lt=Ee(`mini/capsule/app`),Rt=Ee(`mini/native/component`),zt=Ee(`mini/capsule/component`),Bt=Ee(`mini/native/custom-wrapper`),Vt=Ee(`mini/native/page`),Ht=Ee(`mini/capsule/page`),Ut=Ce(`runtime/mini`),Wt=f,Gt=`\0vpt:global-binding`,Kt=`\0vpt:mini-polyfills`,qt=`common/vpt-transport.js`,Jt=`\0vpt:page-component`,Yt=[r.resolve(r.dirname(Ut),`../..`),...[`react`,`react-dom`].map(e=>r.dirname(Se.resolve(`${e}/package.json`)))].map(e=>`${s(e)}/`),Xt=`${s(r.dirname(Se.resolve(`core-js/package.json`)))}/`,Zt=RegExp(`^${Xt.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}`);function Qt(e){let t=s(e);return t===`\0vpt:mini-polyfills`||t===`\0vpt:global-binding`||t.startsWith(Xt)}function $t(e){let t=s(e);return Yt.some(e=>t.startsWith(e))}const en=/* @__PURE__ */ new Map([[It,`native`],[Rt,`native`],[Bt,`native`],[Vt,`native`],[Lt,`entry-capsule`],[zt,`entry-capsule`],[Ht,`entry-capsule`],[Ft,`amphibious`],[Gt,`amphibious`],[Kt,`amphibious`],[Wt,`amphibious`]]);function tn(e){let t=e.facadeModuleId&&en.get(Ne(e.facadeModuleId));if(t)return t;for(let t of e.moduleIds){let e=en.get(Ne(t));if(e!==void 0)return e}return`normal-capsule`}var nn=/* @__PURE__ */ A(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c}));function rn(e){return typeof e==`function`}function an(e){let t=e(e=>{Error.call(e),e.stack=(/* @__PURE__ */ Error()).stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}const on=an(e=>function(t){e(this),this.message=t?`${t.length} errors occurred during unsubscription:
|
|
2
2
|
${t.map((e,t)=>`${t+1}) ${e.toString()}`).join(`
|
|
3
3
|
`)}`:``,this.name=`UnsubscriptionError`,this.errors=t});function sn(e,t){if(e){let n=e.indexOf(t);0<=n&&e.splice(n,1)}}var cn=class e{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:t}=this;if(t){if(this._parentage=null,Array.isArray(t))for(let e of t)e.remove(this);else t.remove(this)}let{initialTeardown:n}=this;if(rn(n))try{n()}catch(t){e=t instanceof on?t.errors:[t]}let{_finalizers:r}=this;if(r){this._finalizers=null;for(let t of r)try{dn(t)}catch(t){e??=[],t instanceof on?e=[...e,...t.errors]:e.push(t)}}if(e)throw new on(e)}}add(t){if(t&&t!==this){if(this.closed)dn(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=this._finalizers??[]).push(t)}}}_hasParent(e){let{_parentage:t}=this;return t===e||Array.isArray(t)&&t.includes(e)}_addParent(e){let{_parentage:t}=this;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e}_removeParent(e){let{_parentage:t}=this;t===e?this._parentage=null:Array.isArray(t)&&sn(t,e)}remove(t){let{_finalizers:n}=this;n&&sn(n,t),t instanceof e&&t._removeParent(this)}};cn.EMPTY=(()=>{let e=new cn;return e.closed=!0,e})();const ln=cn.EMPTY;function un(e){return e instanceof cn||e&&`closed`in e&&rn(e.remove)&&rn(e.add)&&rn(e.unsubscribe)}function dn(e){rn(e)?e():e.unsubscribe()}const fn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},pn={setTimeout(e,t,...n){let{delegate:r}=pn;return r?.setTimeout?r.setTimeout(e,t,...n):setTimeout(e,t,...n)},clearTimeout(e){let{delegate:t}=pn;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function mn(e){pn.setTimeout(()=>{let{onUnhandledError:t}=fn;if(t)t(e);else throw e})}function hn(){}const gn=yn(`C`,void 0,void 0);function _n(e){return yn(`E`,void 0,e)}function vn(e){return yn(`N`,e,void 0)}function yn(e,t,n){return{kind:e,value:t,error:n}}let bn=null;function xn(e){if(fn.useDeprecatedSynchronousErrorHandling){let t=!bn;if(t&&(bn={errorThrown:!1,error:null}),e(),t){let{errorThrown:e,error:t}=bn;if(bn=null,e)throw t}}else e()}function Sn(e){fn.useDeprecatedSynchronousErrorHandling&&bn&&(bn.errorThrown=!0,bn.error=e)}var Cn=class extends cn{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,un(e)&&e.add(this)):this.destination=jn}static create(e,t,n){return new Dn(e,t,n)}next(e){this.isStopped?An(vn(e),this):this._next(e)}error(e){this.isStopped?An(_n(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?An(gn,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}};const wn=Function.prototype.bind;function Tn(e,t){return wn.call(e,t)}var En=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:t}=this;if(t.next)try{t.next(e)}catch(e){On(e)}}error(e){let{partialObserver:t}=this;if(t.error)try{t.error(e)}catch(e){On(e)}else On(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(e){On(e)}}},Dn=class extends Cn{constructor(e,t,n){super();let r;if(rn(e)||!e)r={next:e??void 0,error:t??void 0,complete:n??void 0};else{let t;this&&fn.useDeprecatedNextContext?(t=Object.create(e),t.unsubscribe=()=>this.unsubscribe(),r={next:e.next&&Tn(e.next,t),error:e.error&&Tn(e.error,t),complete:e.complete&&Tn(e.complete,t)}):r=e}this.destination=new En(r)}};function On(e){fn.useDeprecatedSynchronousErrorHandling?Sn(e):mn(e)}function kn(e){throw e}function An(e,t){let{onStoppedNotification:n}=fn;n&&pn.setTimeout(()=>n(e,t))}const jn={closed:!0,next:hn,error:kn,complete:hn},Mn=typeof Symbol==`function`&&Symbol.observable||`@@observable`;function Nn(e){return e}function Pn(e){return e.length===0?Nn:e.length===1?e[0]:function(t){return e.reduce((e,t)=>t(e),t)}}var Fn=class e{constructor(e){e&&(this._subscribe=e)}lift(t){let n=new e;return n.source=this,n.operator=t,n}subscribe(e,t,n){let r=Rn(e)?e:new Dn(e,t,n);return xn(()=>{let{operator:e,source:t}=this;r.add(e?e.call(r,t):t?this._subscribe(r):this._trySubscribe(r))}),r}_trySubscribe(e){try{return this._subscribe(e)}catch(t){e.error(t)}}forEach(e,t){return t=In(t),new t((t,n)=>{let r=new Dn({next:t=>{try{e(t)}catch(e){n(e),r.unsubscribe()}},error:n,complete:t});this.subscribe(r)})}_subscribe(e){return this.source?.subscribe(e)}[Mn](){return this}pipe(...e){return Pn(e)(this)}toPromise(e){return e=In(e),new e((e,t)=>{let n;this.subscribe(e=>n=e,e=>t(e),()=>e(n))})}};Fn.create=e=>new Fn(e);function In(e){return e??fn.Promise??Promise}function Ln(e){return e&&rn(e.next)&&rn(e.error)&&rn(e.complete)}function Rn(e){return e&&e instanceof Cn||Ln(e)&&un(e)}function zn(e){return rn(e?.lift)}function Bn(e){return t=>{if(zn(t))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError(`Unable to lift unknown Observable type`)}}function Vn(e,t,n,r,i){return new Hn(e,t,n,r,i)}var Hn=class extends Cn{constructor(e,t,n,r,i,a){super(e),this.onFinalize=i,this.shouldUnsubscribe=a,this._next=t?function(n){try{t(n)}catch(t){e.error(t)}}:super._next,this._error=r?function(t){try{r(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:t}=this;super.unsubscribe(),!t&&((e=this.onFinalize)==null||e.call(this))}}};const Un=an(e=>function(){e(this),this.name=`ObjectUnsubscribedError`,this.message=`object unsubscribed`});var Wn=class extends Fn{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(e){let t=new Gn(this,this);return t.operator=e,t}_throwIfClosed(){if(this.closed)throw new Un}next(e){xn(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||=Array.from(this.observers);for(let t of this.currentObservers)t.next(e)}})}error(e){xn(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=e;let{observers:t}=this;for(;t.length;)t.shift().error(e)}})}complete(){xn(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:e}=this;for(;e.length;)e.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){return this.observers?.length>0}_trySubscribe(e){return this._throwIfClosed(),super._trySubscribe(e)}_subscribe(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)}_innerSubscribe(e){let{hasError:t,isStopped:n,observers:r}=this;return t||n?ln:(this.currentObservers=null,r.push(e),new cn(()=>{this.currentObservers=null,sn(r,e)}))}_checkFinalizedStatuses(e){let{hasError:t,thrownError:n,isStopped:r}=this;t?e.error(n):r&&e.complete()}asObservable(){let e=new Fn;return e.source=this,e}};Wn.create=(e,t)=>new Gn(e,t);var Gn=class extends Wn{constructor(e,t){super(),this.destination=e,this.source=t}next(e){var t,n;(n=(t=this.destination)?.next)==null||n.call(t,e)}error(e){var t,n;(n=(t=this.destination)?.error)==null||n.call(t,e)}complete(){var e,t;(t=(e=this.destination)?.complete)==null||t.call(e)}_subscribe(e){return this.source?.subscribe(e)??ln}};const Kn={now(){return(Kn.delegate||Date).now()},delegate:void 0};var qn=class extends cn{constructor(e,t){super()}schedule(e,t=0){return this}};const Jn={setInterval(e,t,...n){let{delegate:r}=Jn;return r?.setInterval?r.setInterval(e,t,...n):setInterval(e,t,...n)},clearInterval(e){let{delegate:t}=Jn;return(t?.clearInterval||clearInterval)(e)},delegate:void 0};var Yn=class extends qn{constructor(e,t){super(e,t),this.scheduler=e,this.work=t,this.pending=!1}schedule(e,t=0){if(this.closed)return this;this.state=e;let n=this.id,r=this.scheduler;return n!=null&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id??this.requestAsyncId(r,this.id,t),this}requestAsyncId(e,t,n=0){return Jn.setInterval(e.flush.bind(e,this),n)}recycleAsyncId(e,t,n=0){if(n!=null&&this.delay===n&&this.pending===!1)return t;t!=null&&Jn.clearInterval(t)}execute(e,t){if(this.closed)return/* @__PURE__ */ Error(`executing a cancelled action`);this.pending=!1;let n=this._execute(e,t);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(e,t){let n=!1,r;try{this.work(e)}catch(e){n=!0,r=e||/* @__PURE__ */ Error(`Scheduled action threw falsy error`)}if(n)return this.unsubscribe(),r}unsubscribe(){if(!this.closed){let{id:e,scheduler:t}=this,{actions:n}=t;this.work=this.state=this.scheduler=null,this.pending=!1,sn(n,this),e!=null&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null,super.unsubscribe()}}},Xn=class e{constructor(t,n=e.now){this.schedulerActionCtor=t,this.now=n}schedule(e,t=0,n){return new this.schedulerActionCtor(this,e).schedule(n,t)}};Xn.now=Kn.now;const Zn=new class extends Xn{constructor(e,t=Xn.now){super(e,t),this.actions=[],this._active=!1}flush(e){let{actions:t}=this;if(this._active){t.push(e);return}let n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}}(Yn),Qn=Zn,$n=new Fn(e=>e.complete());function er(e){return e&&rn(e.schedule)}function tr(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function nr(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function rr(e){return this instanceof rr?(this.v=e,this):new rr(e)}function ir(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof rr?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function ar(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof nr==`function`?nr(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}const or=(e=>e&&typeof e.length==`number`&&typeof e!=`function`);function sr(e){return rn(e?.then)}function cr(e){return rn(e[Mn])}function lr(e){return Symbol.asyncIterator&&rn(e?.[Symbol.asyncIterator])}function ur(e){return/* @__PURE__ */ TypeError(`You provided ${typeof e==`object`&&e?`an invalid object`:`'${e}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function dr(){return typeof Symbol!=`function`||!Symbol.iterator?`@@iterator`:Symbol.iterator}const fr=dr();function pr(e){return rn(e?.[fr])}function mr(e){return ir(this,arguments,function*(){let t=e.getReader();try{for(;;){let{value:e,done:n}=yield rr(t.read());if(n)return yield rr(void 0);yield yield rr(e)}}finally{t.releaseLock()}})}function hr(e){return rn(e?.getReader)}function gr(e){if(e instanceof Fn)return e;if(e!=null){if(cr(e))return _r(e);if(or(e))return vr(e);if(sr(e))return yr(e);if(lr(e))return xr(e);if(pr(e))return br(e);if(hr(e))return Sr(e)}throw ur(e)}function _r(e){return new Fn(t=>{let n=e[Mn]();if(rn(n.subscribe))return n.subscribe(t);throw TypeError(`Provided object does not correctly implement Symbol.observable`)})}function vr(e){return new Fn(t=>{for(let n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function yr(e){return new Fn(t=>{e.then(e=>{t.closed||(t.next(e),t.complete())},e=>t.error(e)).then(null,mn)})}function br(e){return new Fn(t=>{for(let n of e)if(t.next(n),t.closed)return;t.complete()})}function xr(e){return new Fn(t=>{Cr(e,t).catch(e=>t.error(e))})}function Sr(e){return xr(mr(e))}function Cr(e,t){var n,r,i,a;return tr(this,void 0,void 0,function*(){try{for(n=ar(e);r=yield n.next(),!r.done;){let e=r.value;if(t.next(e),t.closed)return}}catch(e){i={error:e}}finally{try{r&&!r.done&&(a=n.return)&&(yield a.call(n))}finally{if(i)throw i.error}}t.complete()})}function wr(e,t,n,r=0,i=!1){let a=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(a),!i)return a}const Tr=an(e=>function(){e(this),this.name=`EmptyError`,this.message=`no elements in sequence`});function Er(e,t){let n=typeof t==`object`;return new Promise((r,i)=>{let a=!1,o;e.subscribe({next:e=>{o=e,a=!0},error:i,complete:()=>{a?r(o):n?r(t.defaultValue):i(new Tr)}})})}function Dr(e,t){let n=typeof t==`object`;return new Promise((r,i)=>{let a=new Dn({next:e=>{r(e),a.unsubscribe()},error:i,complete:()=>{n?r(t.defaultValue):i(new Tr)}});e.subscribe(a)})}function Or(e){return e instanceof Date&&!isNaN(e)}function kr(e,t){return Bn((n,r)=>{let i=0;n.subscribe(Vn(r,n=>{r.next(e.call(t,n,i++))}))})}function Ar(e,t,n,r,i,a,o,s){let c=[],l=0,u=0,d=!1,f=()=>{d&&!c.length&&!l&&t.complete()},p=e=>l<r?m(e):c.push(e),m=e=>{a&&t.next(e),l++;let s=!1;gr(n(e,u++)).subscribe(Vn(t,e=>{i?.(e),a?p(e):t.next(e)},()=>{s=!0},void 0,()=>{if(s)try{for(l--;c.length&&l<r;){let e=c.shift();o?wr(t,o,()=>m(e)):m(e)}f()}catch(e){t.error(e)}}))};return e.subscribe(Vn(t,p,()=>{d=!0,f()})),()=>{s?.()}}function jr(e,t,n=1/0){return rn(t)?jr((n,r)=>kr((e,i)=>t(n,e,r,i))(gr(e(n,r))),n):(typeof t==`number`&&(n=t),Bn((t,r)=>Ar(t,r,e,n)))}function Mr(e){return new Fn(t=>{gr(e()).subscribe(t)})}function Nr(e=0,t,n=Qn){let r=-1;return t!=null&&(er(t)?n=t:r=t),new Fn(t=>{let i=Or(e)?+e-n.now():e;i<0&&(i=0);let a=0;return n.schedule(function(){t.closed||(t.next(a++),0<=r?this.schedule(void 0,r):t.complete())},i)})}function Pr(e,t){return Bn((n,r)=>{let i=0;n.subscribe(Vn(r,n=>e.call(t,n,i++)&&r.next(n)))})}function Fr(e){return Bn((t,n)=>{let r=!1,i=null,a=null,o=!1,s=()=>{if(a?.unsubscribe(),a=null,r){r=!1;let e=i;i=null,n.next(e)}o&&n.complete()},c=()=>{a=null,o&&n.complete()};t.subscribe(Vn(n,t=>{r=!0,i=t,a||gr(e(t)).subscribe(a=Vn(n,s,c))},()=>{o=!0,(!r||!a||a.closed)&&n.complete()}))})}function Ir(e,t=Zn){return Fr(()=>Nr(e,t))}function Lr(e){return Bn((t,n)=>{let r=[];return t.subscribe(Vn(n,e=>r.push(e),()=>{n.next(r),n.complete()})),gr(e).subscribe(Vn(n,()=>{let e=r;r=[],n.next(e)},hn)),()=>{r=null}})}function Rr(e){return Bn((t,n)=>{let r=null,i=!1,a;r=t.subscribe(Vn(n,void 0,void 0,o=>{a=gr(e(o,Rr(e)(t))),r?(r.unsubscribe(),r=null,a.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,a.subscribe(n))})}function zr(e,t){return rn(t)?jr(e,t,1):jr(e,1)}var Br=/* @__PURE__ */ M(nn(),1);const Vr=`vpt:mini-hmr:control`;function Hr(e,t,n,r){let i=new Wn,a=i.pipe(Pr(e=>e instanceof Error||e.updates.some(({update:e})=>e.type!==`Noop`)));return a.pipe(Lr(a.pipe(Ir(e,t))),Pr(e=>e.length>0)).subscribe(e=>{let t=e.findLast(e=>e instanceof Error);t&&r(t);let i=e.filter(e=>!(e instanceof Error));i.length>0&&n({updates:i.flatMap(e=>e.updates),changedFiles:i.flatMap(e=>e.changedFiles)})}),i}const Ur=`hmr/info.js`;function Wr(e){return`module.exports = Object.freeze(${JSON.stringify(e)});\n`}function Gr(e,t){return`@import "./${e}";\n/* vpt-build:${t} */\n`}async function Kr(e,t,n){let i=r.join(e,t),a=r.dirname(i);await S.mkdir(a,{recursive:!0});let o=r.join(a,`.${r.basename(i)}.${re()}.txt`);try{await S.writeFile(o,n),await S.rename(o,i)}finally{await S.rm(o,{force:!0})}}const qr=`/__vpt_hmr__`;function Jr(e,t){let n=new Wn,r=Er(n.pipe(zr(n=>n.kind===`barrier`?Mr(()=>(n.resolve(),$n)):Mr(()=>Promise.resolve(e(n.action))).pipe(Rr(e=>(t(n.action,e),$n))))),{defaultValue:void 0});return{complete:async()=>{n.complete(),await r},next(e){n.next({kind:`action`,action:e})},waitForAction(e){return Dr(n.pipe(Pr(e=>e.kind===`action`),kr(e=>e.action),Pr(e)))},waitForIdle(){let e=Promise.withResolvers();return n.next({kind:`barrier`,resolve:e.resolve}),e.promise}}}async function Yr(e,t){if(t.oxc===!1)return e;let n=await e;if(Array.isArray(n))return Promise.all(n.map(e=>Yr(e,t)));if(!n||!(`name`in n)||n.name!==`builtin:vite-transform`)return n;let{jsxInject:r,include:i,exclude:a,jsxRefreshInclude:o,jsxRefreshExclude:s,...c}=t.oxc;return E({root:t.root,tsconfig:t.tsconfig,include:i??/\.(m?ts|[jt]sx)$/,exclude:a??/\.js$/,jsxRefreshInclude:o,jsxRefreshExclude:s,isServerConsumer:t.consumer===`server`,jsxInject:r,transformOptions:{...c,sourcemap:!1}})}function Xr({server:e,contract:t,hmrMode:n}){return{name:`vpt:mini-dev-options`,async options(r){let i=Qr(r),a=e.config.build.rolldownOptions.output;if(Array.isArray(a))throw Error(`Mini Program development supports one configured Rolldown output.`);let o=a??{},s=new Set(t.options.pages.map(e=>`${e.path}.js`));Object.assign(i,o,{banner:n.createEntryBanner(s),format:`es`,minify:!0,keepNames:!0,sourcemap:!1}),r.experimental??={};let c=r.experimental.devMode;return r.experimental.devMode={...typeof c==`object`?c:{},implement:await ei(n.runtimeFile),lazy:!1,skipCommonRuntimeInjection:!0},r.plugins=[await Yr(r.plugins,e.environments.client.config),$r(e)],r}}}function Zr(e){if(!e.output||Array.isArray(e.output))throw Error(`Mini Program development requires exactly one Rolldown output.`);return e.output}function Qr(e){if(Array.isArray(e.output))throw Error(`Mini Program development requires one configured Rolldown output.`);return e.output??={},e.output}function $r(e){let{build:t,logger:n,logLevel:i,root:a}=e.config;return te({assetsDir:r.join(t.assetsDir,`/`),chunkLimit:2e3,isLib:!!t.lib,isTty:!(!process.stdout.isTTY||process.env.CI),logInfo:(i??`info`)===`info`?e=>n.info(e):void 0,reportCompressedSize:!1,root:a,warnLargeChunks:!1})}const ei=Pt(async function(e){return`__rolldown_runtime__ = (function (globalThis) {\n${(await m({input:e,output:{format:`iife`,minify:!1,sourcemap:!1},write:!1})).output[0].code}\nreturn globalThis.__rolldown_runtime__;\n})(__VPT_GLOBAL__);`});var ti=class{publishPatches;buildId;pendingPatches=[];hasPublishedPatches=!1;constructor(e){this.publishPatches=e}isCurrentBuild(e){return e===this.buildId}startBuild(){let e=this.buildId,t=re();return this.buildId=t,this.pendingPatches.length=0,this.hasPublishedPatches=!1,{buildId:t,previousBuildId:e}}async produce(e){this.buildId!==void 0&&e.length!==0&&(this.pendingPatches.push(...e),await this.publishPatches({buildId:this.buildId,patches:this.pendingPatches}),this.hasPublishedPatches=!0)}isBaselineCurrent(){return!this.hasPublishedPatches}acknowledge(e){let t=0;for(;t<this.pendingPatches.length&&this.pendingPatches[t].seq<=e;)t++;this.pendingPatches.splice(0,t)}};async function ni({server:e,contract:t,styles:n,hmrMode:r}){let i=li(e),a=Jr(p,(n,r)=>si(e.config.logger,`${t.options.target} HMR ${n.kind} failed`,r)),o=(t,n)=>Kr(e.config.build.outDir,t,n),s=new ti(e=>d(r.publish?.(e)));e.ws.on(`vpt:mini-hmr:report`,e=>{a.next({kind:`report`,report:e})});let c=await g(),l=Hr(16,Zn,e=>{a.next({kind:`publish`,result:e})},e=>{a.next({kind:`error`,error:e})});return i._devEngine=c,i.triggerBundleRegenerationIfStale=async()=>!1,i.listen=async()=>{let e=a.waitForAction(e=>e.kind===`output`);await c.run();let{result:t}=await e;if(t instanceof Error)throw t;await c.ensureCurrentBuildFinish(),await a.waitForIdle()},r.rebuildStrategy===`on-failure`&&e.httpServer?.once(`listening`,()=>{a.next({kind:`listening`})}),ai(e),{close:async()=>{l.complete(),await a.waitForIdle(),await c.ensureCurrentBuildFinish(),await a.complete(),e.ws.send(Vr,{kind:`close`,reason:`host closed`})}};async function u(){if(r.rebuildStrategy===`always`){let{buildId:e}=s.startBuild();await o(t.styles.appFileName,Gr(t.styles.globalFileName,e));return}let n=ri(e);if(n===void 0)return;e.ws.send(Vr,{kind:`close`,reason:`build replaced`});let{buildId:i,previousBuildId:a}=s.startBuild();a&&await c.removeClient(a),await c.registerClient(i),await f(i,n)}async function d(t){if(t)switch(t.kind){case`write`:await o(t.fileName,t.source);return;case`event`:e.ws.send(t.event,t.data);return}}async function f(n,i){let a={buildId:n,endpoint:ii(e,i)};await d(r.reset?.()),await o(Ur,Wr(a)),await o(t.styles.appFileName,Gr(t.styles.globalFileName,n))}function p(n){switch(n.kind){case`publish`:return v(n.result);case`error`:si(e.config.logger,`${t.options.target} HMR update failed`,n.error);return;case`report`:return h(n.report);case`output`:if(n.result instanceof Error){si(e.config.logger,`${t.options.target} dev build failed`,n.result);return}return m();case`listening`:return u()}}async function m(){await n.finalizeUpdate([],o),await u()}function h(e){if(s.isCurrentBuild(e.buildId))switch(e.kind){case`startup`:s.isBaselineCurrent()||_(`App started after published patches; replacing baseline`);return;case`rebuild`:_(e.reason);return;case`applied`:s.acknowledge(e.seq);return}}async function g(){let n=await i.getRolldownOptions(),o=Zr(n);return T({...n,plugins:[n.plugins,Xr({server:e,contract:t,hmrMode:r})]},o,{onHmrUpdates:r.rebuildStrategy===`on-failure`?e=>{l.next(e)}:void 0,onOutput:e=>{a.next({kind:`output`,result:e})},rebuildStrategy:r.rebuildStrategy===`always`?`always`:`never`,watch:{skipWrite:!1,useDebounce:!0}})}function _(n){e.config.logger.info(`[vpt] ${t.options.target} full rebuild required: ${n}`),c.triggerFullBuild()}async function v(e){let t=[];for(let{clientId:n,update:r}of e.updates)if(s.isCurrentBuild(n)&&r.type!==`Noop`){if(r.type===`Patch`){t.push(r);continue}_(r.reason||`Rolldown ${r.type} update`);return}await y(t)}async function y(e){if(e.length===0)return;let t=await n.finalizeUpdate(e,o);await s.produce(t),await b(t)}async function b(e){for(let t of e)await c.notifyPayloadDelivered(t.filename)}}function ri(e){let t=e.httpServer;if(!t)return;let n=t.address();if(n&&typeof n!=`string`)return n.port}function ii(e,t){let n=typeof e.config.server.ws==`object`?e.config.server.ws:void 0;if(e.config.server.ws===!1||e.config.base!==`/`||n?.path!==`/__vpt_hmr__`||n?.protocol!==void 0||n?.host!==void 0||n?.port!==void 0||n?.clientPort!==void 0||n?.server!==void 0)throw Error(`Mini Program HMR requires Vite WebSocket on the development HTTP server.`);let r=e.config.server.https?`wss`:`ws`,i=new URL(`${r}://${ci(e)}:${t}${qr}`);return i.searchParams.set(`token`,e.config.webSocketToken),i.href}function ai(e){e.printUrls=()=>{e.config.logger.info(` ${Br.default.green(`➜`)} ${Br.default.bold(`Mini Program project`)}: ${Br.default.cyan(oi(e.config.build.outDir,e.config.configFile,e.config.root))}`)}}function oi(e,t,n){let i=t?r.dirname(t):n,a=r.relative(i,e).replaceAll(`\\`,`/`);return a?a.startsWith(`.`)?a:`./${a}`:`.`}function si(e,t,n){Error.isError(n)?e.error(`[vpt] ${t}`,{error:n}):e.error(`[vpt] ${t} with unknown error: ${n}`)}function ci(e){let t=e.httpServer?.address();return!t||typeof t==`string`||t.address===`0.0.0.0`||t.address===`::`?`127.0.0.1`:t.address.includes(`:`)?`[${t.address}]`:t.address}function li(e){let t=e.environments.client.bundledDev;if(!t)throw Error(`Vite did not create the Mini Program bundled-development environment.`);return t}const ui=`hmr/patches.js`;function di(e){return{rebuildStrategy:`on-failure`,runtimeFile:e,plugins:[hi()],createEntryBanner:mi,reset:()=>({kind:`write`,fileName:ui,source:fi()}),publish:e=>({kind:`write`,fileName:ui,source:pi(e.buildId,e.patches)})}}function fi(){return`module.exports = undefined;
|
|
4
|
-
`}function pi(e,t){if(t.length===0)throw Error(`Cannot render an empty Mini Program patch range.`);let n=t.map(e=>`{seq: ${e.seq}, changedIds: ${JSON.stringify(e.changedIds)}, factory: (__rolldown_runtime__) => {\n${e.code}\n}}`);return`module.exports = {buildId: ${JSON.stringify(e)}, patches: [${n.join(`,`)}]};\n`}function mi(e){return t=>t.name===`app.js`?`__rolldown_runtime__.initialize(require('./${Ur}'));\n`:e.has(t.name)?`__rolldown_runtime__.applyPatches(require('${r.posix.relative(r.posix.dirname(t.fileName),ui)}'));\n`:``}function hi(){return{name:`vpt:mini-page-shell-hmr`,apply:`serve`,transform:{order:`post`,filter:{id:Me(Vt)},handler
|
|
4
|
+
`}function pi(e,t){if(t.length===0)throw Error(`Cannot render an empty Mini Program patch range.`);let n=t.map(e=>`{seq: ${e.seq}, changedIds: ${JSON.stringify(e.changedIds)}, factory: (__rolldown_runtime__) => {\n${e.code}\n}}`);return`module.exports = {buildId: ${JSON.stringify(e)}, patches: [${n.join(`,`)}]};\n`}function mi(e){return t=>t.name===`app.js`?`__rolldown_runtime__.initialize(require('./${Ur}'));\n`:e.has(t.name)?`__rolldown_runtime__.applyPatches(require('${r.posix.relative(r.posix.dirname(t.fileName),ui)}'));\n`:``}function hi(){return{name:`vpt:mini-page-shell-hmr`,apply:`serve`,transform:{order:`post`,filter:{id:Me(Vt)},handler:gi}}}function gi(e){let t=`Page(pageConfig)`;if(!e.includes(t))throw Error(`Mini Program Page shell must register pageConfig`);return{code:e.replace(t,`Page(__rolldown_runtime__.injectPageHmr(pageConfig))`),map:null}}function _i(e){return{rebuildStrategy:`on-failure`,runtimeFile:e,plugins:[],createEntryBanner:vi,publish:e=>({kind:`event`,event:`vpt:hmr-interpreter:source`,data:{kind:`patches`,buildId:e.buildId,patches:e.patches}})}}function vi(e){return e=>e.name===`app.js`?`__rolldown_runtime__.initialize(require('./${Ur}'));\n`:``}function yi(e){return{rebuildStrategy:`always`,runtimeFile:e,plugins:[],createEntryBanner:bi}}function bi(e){return e=>``}function xi(e,t){switch(e?.mode??`devtools`){case`devtools`:return di(t.devtoolsHmrRuntime);case`interpreter`:return _i(t.interpreterHmrRuntime);case`rebuild`:return yi(t.devtoolsHmrRuntime)}}function Si({capsuleCode:e,componentId:t,capsuleId:n}){let r=0,i=pt({code:e,filename:n,sourcemap:!1,createVisitor(n){return n.appendRight(e.length,`
|
|
5
5
|
import.meta.hot.accept()
|
|
6
|
-
`),e=>{if(e.type!==`CallExpression`||e.callee.type!==`Identifier`)return;let i=e.arguments[0];e.callee.name===`
|
|
6
|
+
`),e=>{if(e.type!==`CallExpression`||e.callee.type!==`Identifier`)return;let i=e.arguments[0];e.callee.name===`createVptPageConfig`&&i?.type===`Identifier`&&i.name===`PageComponent`&&(r++,n.overwrite(i.start,i.end,`__rolldown_runtime__.resolvePageComponent(${JSON.stringify(t)}, PageComponent)`))}}});if(r!==1)throw Error(`Expected one Page config component argument, found ${r}`);return i}const Ci=`/@react-refresh`,wi=s(r.join(r.dirname(Se.resolve(`react-reconciler/package.json`)),`cjs/react-reconciler.development.js`));function Ti(){return[{name:`vpt:mini-react-refresh-runtime`,apply:`serve`,config(){return{define:{queueMicrotask:`globalThis.queueMicrotask`,"window.$RefreshReg$":`globalThis.$RefreshReg$`,"window.$RefreshSig$":`globalThis.$RefreshSig$`,"window.__registerBeforePerformReactRefresh":`globalThis.__registerBeforePerformReactRefresh`,"window.__getReactRefreshIgnoredExports":`globalThis.__getReactRefreshIgnoredExports`}}},transform:{order:`post`,filter:{id:Me(Ci)},handler(e){return Ei(e)}}},{name:`vpt:mini-react-refresh-renderer-dependency`,apply:`serve`,transform:{order:`post`,filter:{id:Me(wi)},handler(e){return Di(e)}}}]}function Ei(e){return{code:`${e}
|
|
7
7
|
injectIntoGlobalHook(globalThis);
|
|
8
8
|
globalThis.$RefreshReg$ = () => {};
|
|
9
|
-
globalThis.$RefreshSig$ = () => (type) => type;`,map:null}}function Di(e){if(!/\bhook\.inject\(internals\)/.test(e))throw Error(`React Reconciler must inject its renderer into the DevTools hook`);return{code:`import '${Ci}'\n${e}`,map:null}}function Oi(e){return e.name===`client`}function ki(e,t){let n=xi(e.options.hmr,e.runtime),i=n.reset?.(),a=[e.output.projectConfigFilename,e.output.projectPrivateConfigFilename,e.styles.appFileName,e.styles.globalFileName,...e.options.pages.map(t=>`${t.path}${r.extname(e.styles.appFileName)}`),...n.rebuildStrategy===`on-failure`?[Ur]:[],...i?.kind===`write`?[i.fileName]:[]],o=null,c=!0;return[{name:`vpt:mini-dev`,apply:`serve`,applyToEnvironment:Oi,config(){return{define:{"performance.now":`Date.now`},build:{emptyOutDir:!1,sourcemap:!1},experimental:{bundledDev:!0},server:{ws:{path:qr}}}},configureServer:{order:`post`,async handler(r){o=await ni({server:r,contract:e,styles:t,hmrMode:n})}},generateBundle:{order:`post`,async handler(t,n){Ai(n,e.styles.appFileName),await ji(this)}},writeBundle:{order:`post`,handler(e,t){if(!c)return;let{root:n,build:i}=this.environment.config;Nt(r.resolve(n,i.outDir),[...Object.keys(t),...a]),c=!1}},closeBundle(){return o?.close()}},{name:`vpt:mini-page-capsule-hmr`,apply:`serve`,transform:{order:`pre`,filter:{id:Me(Ht)},async handler(e,t){let n=await this.resolve(Jt,t);if(!n)throw Error(`Failed to resolve Page component imported by ${t}`);return Si({capsuleCode:e,componentId:s(r.relative(this.environment.config.root,n.id)),capsuleId:t})}}},{name:`vpt:mini-runtime-lowering`,apply:`serve`,transform:{order:`post`,filter:{id:Me(Wt)},handler(e){return Mi(e)}}},...n.plugins,...Ti()]}function Ai(e,t){delete e[t]}async function ji(e){let{publicDir:t,build:n}=e.environment.config;if(n.copyPublicDir&&t&&g(t))for(let n of await w(t,{recursive:!0,withFileTypes:!0})){if(!n.isFile())continue;let i=r.join(n.parentPath,n.name);e.emitFile({type:`asset`,fileName:s(r.relative(t,i)),source:await C(i)})}}const Mi=Pt(e=>l(e,Wt,{lang:`js`,target:Ge,sourcemap:!1,assumptions:{setPublicClassFields:!0}})),Ni=Ee(`global/vpt-global`),Pi=`common/vpt
|
|
9
|
+
globalThis.$RefreshSig$ = () => (type) => type;`,map:null}}function Di(e){if(!/\bhook\.inject\(internals\)/.test(e))throw Error(`React Reconciler must inject its renderer into the DevTools hook`);return{code:`import '${Ci}'\n${e}`,map:null}}function Oi(e){return e.name===`client`}function ki(e,t){let n=xi(e.options.hmr,e.runtime),i=n.reset?.(),a=[e.output.projectConfigFilename,e.output.projectPrivateConfigFilename,e.styles.appFileName,e.styles.globalFileName,...e.options.pages.map(t=>`${t.path}${r.extname(e.styles.appFileName)}`),...n.rebuildStrategy===`on-failure`?[Ur]:[],...i?.kind===`write`?[i.fileName]:[]],o=null,c=!0;return[{name:`vpt:mini-dev`,apply:`serve`,applyToEnvironment:Oi,config(){return{define:{"performance.now":`Date.now`},build:{emptyOutDir:!1,sourcemap:!1},experimental:{bundledDev:!0},server:{ws:{path:qr}}}},configureServer:{order:`post`,async handler(r){o=await ni({server:r,contract:e,styles:t,hmrMode:n})}},generateBundle:{order:`post`,async handler(t,n){Ai(n,e.styles.appFileName),await ji(this)}},writeBundle:{order:`post`,handler(e,t){if(!c)return;let{root:n,build:i}=this.environment.config;Nt(r.resolve(n,i.outDir),[...Object.keys(t),...a]),c=!1}},closeBundle(){return o?.close()}},{name:`vpt:mini-page-capsule-hmr`,apply:`serve`,transform:{order:`pre`,filter:{id:Me(Ht)},async handler(e,t){let n=await this.resolve(Jt,t);if(!n)throw Error(`Failed to resolve Page component imported by ${t}`);return Si({capsuleCode:e,componentId:s(r.relative(this.environment.config.root,n.id)),capsuleId:t})}}},{name:`vpt:mini-runtime-lowering`,apply:`serve`,transform:{order:`post`,filter:{id:Me(Wt)},handler(e){return Mi(e)}}},...n.plugins,...Ti()]}function Ai(e,t){delete e[t]}async function ji(e){let{publicDir:t,build:n}=e.environment.config;if(n.copyPublicDir&&t&&g(t))for(let n of await w(t,{recursive:!0,withFileTypes:!0})){if(!n.isFile())continue;let i=r.join(n.parentPath,n.name);e.emitFile({type:`asset`,fileName:s(r.relative(t,i)),source:await C(i)})}}const Mi=Pt(e=>l(e,Wt,{lang:`js`,target:Ge,sourcemap:!1,assumptions:{setPublicClassFields:!0}})),Ni=Ee(`global/vpt-global`),Pi=`common/vpt-global.js`;function Fi(e){function t(t){let n=r.posix.relative(r.posix.dirname(e.getPhysicalChunkId(t)),Pi),i=n.startsWith(`.`)?n:`./${n}`;return`require(${JSON.stringify(i)}).vptGlobal`}return[{name:`vpt:mini-global`,resolveId:{filter:{id:Me(Gt)},handler(){return Gt}},load:{filter:{id:Me(Gt)},handler(){return`export const vptGlobal = __VPT_GLOBAL__;`}},config(){return{build:{rolldownOptions:{transform:{inject:{globalThis:[Gt,`vptGlobal`]}}}}}},renderChunk:{order:`pre`,filter:{code:/__VPT_GLOBAL__/},handler(e,n,r){if(n.moduleIds.includes(`\0vpt:global-binding`)||n.moduleIds.includes(Wt))return l(e,n.fileName,{define:{__VPT_GLOBAL__:t(n)},sourcemap:!!r.sourcemap})}},generateBundle:{order:`post`,async handler(e){let t=await Ii({dir:e.dir,minify:e.minify!==!1,sourcemap:e.sourcemap});for(let e of t.output)e.type===`asset`?this.emitFile({type:`asset`,fileName:e.fileName,source:e.source}):this.emitFile({type:`prebuilt-chunk`,fileName:e.fileName,code:e.code,exports:e.exports,facadeModuleId:Ni,isEntry:!0})}}},{name:`vpt:mini-global-dev`,apply:`serve`,renderChunk:{order:`pre`,filter:{code:/__rolldown_runtime__/},handler(e,n){return{code:(n.moduleIds.includes(Wt)?`let __rolldown_runtime__;
|
|
10
10
|
`:`const __rolldown_runtime__ = ${t(n)}.__rolldown_runtime__;\n`)+e,map:null}}}}]}const Ii=Pt(e=>m({input:Ni,transform:{target:Ge},output:{...e,format:`cjs`,strict:!1,generatedCode:{symbols:!1},entryFileNames:Pi},write:!1}),{getCacheKey:e=>JSON.stringify(e)});function Li(e){return e?.[`vpt:native-components`]?.assetBytes??0}function Ri(e){return e?.[`vpt:native-components`]?.sources??[]}async function zi(e,t){await Bi(e.folder),await Vi(e);let n=[];return await Hi(e.folder,[],n,s(t)),{...e,assets:n}}async function Bi(e){try{if((await ee(e)).isDirectory())return}catch(t){throw Error.isError(t)&&`code`in t&&t.code===`ENOENT`?Error(`Native component folder does not exist: ${e}`,{cause:t}):t}throw Error(`Native component source is not a directory: ${e}`)}async function Vi(e){let t=r.join(e.folder,`${e.entry}.js`);try{if((await ee(t)).isFile())return}catch(e){throw Error.isError(e)&&`code`in e&&e.code===`ENOENT`?Error(`Native component entry file does not exist: ${t}`,{cause:e}):e}throw Error(`Native component entry is not a file: ${t}`)}async function Hi(e,t,n,i){let a=r.join(e,...t),o=await w(a,{withFileTypes:!0});o.sort((e,t)=>e.name.localeCompare(t.name));for(let a of o){let o=[...t,a.name];if(a.isDirectory()){await Hi(e,o,n,i);continue}if(!a.isFile())continue;let c=r.join(e,...o);s(c)!==i&&n.push({relativePath:o.join(`/`),byteLength:(await ee(c)).size})}}function Ui(e,t,n){let i=Ne(t),a=ie(e,{astType:`ts`,lang:`tsx`,preserveParens:!1,sourceType:`module`},i),o=Yi(a),s=Gi(a),c=Ki(a,new Set(s.flatMap(e=>e.names))).map(t=>({call:t,definition:Ji(t,i,o,n=>ta(n,i,e,t.start))})),l=new p(e,{filename:i});return c.forEach(({call:e,definition:t})=>{l.overwrite(e.start,e.end,JSON.stringify(r.posix.basename(t.folder)))}),s.forEach(({declaration:e})=>{l.remove(e.start,e.end)}),{code:l.toString(),map:n?Wi(l,i):null,definitions:c.map(({definition:e})=>e)}}function Wi(e,t){let n=e.generateMap({hires:`boundary`,includeContent:!0,source:t});return{file:n.file,mappings:n.mappings,names:n.names,sources:n.sources,sourcesContent:n.sourcesContent,version:n.version}}function Gi(e){return e.body.flatMap(e=>{if(e.type!==`ImportDeclaration`||e.source.value!==`virtual:taro/native`)return[];let t=e.specifiers.flatMap(e=>e.type!==`ImportSpecifier`||Qi(e.imported)!==`defineNativeComponent`?[]:[e.local.name]);return t.length===0?[]:[{declaration:e,names:t}]})}function Ki(e,t){return e.body.flatMap(e=>{if(e.type===`ExpressionStatement`)return qi(e.expression,t)?[e.expression]:[];if(e.type===`ExportDefaultDeclaration`)return qi(e.declaration,t)?[e.declaration]:[];let n=e.type===`ExportNamedDeclaration`?e.declaration:e;return n?.type===`VariableDeclaration`?n.declarations.flatMap(({init:e})=>qi(e,t)?[e]:[]):[]})}function qi(e,t){return e?.type===`CallExpression`&&e.callee.type===`Identifier`&&t.has(e.callee.name)}function Ji(e,t,n,i){if(e.arguments.length!==1)throw i(`defineNativeComponent() requires exactly one entry loader`);let a=$i(e.arguments[0]);if(!a)throw i(`Native component entry must use () => import(...) with a static relative .js path`);let o=s(r.resolve(r.dirname(t),a));return{folder:r.posix.dirname(o),entry:r.posix.basename(o,`.js`),fields:Zi(e.typeArguments,n,i)}}function Yi(e){let t=/* @__PURE__ */ new Map;for(let n of e.body){let e=n.type===`ExportNamedDeclaration`?n.declaration:n;if(e?.type===`TSTypeAliasDeclaration`&&!e.typeParameters&&e.typeAnnotation.type===`TSTypeLiteral`){t.set(e.id.name,e.typeAnnotation.members);continue}e?.type===`TSInterfaceDeclaration`&&!e.typeParameters&&e.extends.length===0&&t.set(e.id.name,e.body.body)}return t}function Xi(e,t){if(e.type===`TSTypeLiteral`)return e.members;if(e.type===`TSTypeReference`&&e.typeName.type===`Identifier`&&!e.typeArguments)return t.get(e.typeName.name)}function Zi(e,t,n){if(!e)return[];if(e.params.length!==1)throw n(`Native component interface must be one TypeScript object type`);let r=e.params[0],i=Xi(r,t);if(!i)throw n(`Native component interface must be inline or declared in the same module`);let a=/* @__PURE__ */ new Set;for(let e of i){if(e.type!==`TSPropertySignature`&&e.type!==`TSMethodSignature`)throw n(`Native component interface must contain only static fields`);if(e.computed)throw n(`Native component interface contains a computed field`);let t=Qi(e.key);if(!t)throw n(`Native component interface contains a computed field`);if(a.has(t))throw n(`Duplicate native component interface field: ${t}`);a.add(t)}return[...a].filter(e=>e!==`children`)}function Qi(e){if(e.type===`Identifier`)return e.name;if(e.type===`Literal`&&typeof e.value==`string`)return e.value}function $i(e){if(e?.type!==`ArrowFunctionExpression`||e.params.length!==0||e.body.type!==`ImportExpression`)return;let t=e.body;if(t.source.type===`Literal`&&typeof t.source.value==`string`&&t.options===null&&ea(t.source.value))return t.source.value}function ea(e){return(e.startsWith(`./`)||e.startsWith(`../`))&&r.posix.extname(e)===`.js`}function ta(e,t,n,r){let i=n.slice(0,r),a=i.split(`
|
|
11
11
|
`).length,o=r-i.lastIndexOf(`
|
|
12
12
|
`);return/* @__PURE__ */ Error(`${e}\n${t}:${a}:${o}`)}async function na({code:e,id:t,sourcemap:n,addWatchFile:i}){let a=Ui(e,t,n),o=Ne(t),c=await Promise.all(a.definitions.map(e=>zi(e,o)));c.forEach(e=>{i(e.folder),e.assets.forEach(t=>{i(s(r.join(e.folder,t.relativePath)))})});let l=c.reduce((e,t)=>e+t.assets.reduce((e,t)=>e+t.byteLength,0),0);return{code:a.code,map:a.map,meta:{"vpt:native-components":{sources:c,assetBytes:l}}}}function ra(){return{name:`vpt:mini-native-component`,transform:{order:`pre`,filter:{code:De},handler(e,t){return na({code:e,id:t,sourcemap:!!this.environment.config.build.sourcemap,addWatchFile:e=>this.addWatchFile(e)})}}}}function ia(e){return r.posix.normalize(e)}function aa(e,t){if(!t.startsWith(`./`)&&!t.startsWith(`../`))throw Error(`Expected a relative chunk reference in ${e}: ${t}`);return r.posix.join(r.posix.dirname(e),t)}function oa(e,t){return ia(aa(e,t))}function sa({bundle:e,getPackageLocation:t}){let n=[],i=r.posix.dirname(qt);for(let a of Object.keys(e).sort()){let o=e[a];if(o.type!==`chunk`)continue;let s=tn(o);if(s===`native`)continue;let c=t(o),l=c.kind===`subpackage`;if(s===`amphibious`&&l)throw Error(`Amphibious module must be in the main package: ${o.fileName}`);let u=ia(l?o.fileName.slice(c.root.length+1):o.fileName),d=r.posix.relative(i,o.fileName),f=JSON.stringify(d.startsWith(`.`)?d:`./${d}`),p=`${l?`require.async`:`require`}(${f})`,m=s===`amphibious`?`amphibious(function(){return ${p}})`:p;n.push(`case ${JSON.stringify(u)}:return ${m};`)}return{type:`asset`,fileName:qt,source:`"use strict";function amphibious(r){return[[],function(e){return{execute:function(){e(r())}}}]}exports.transport=function(m){switch(m){${n.join(``)}default:throw new Error('Unknown module: '+m)}};`}}async function ca({bundle:e,getModuleInfo:t,getPackageLocation:n}){let i=[],a=[];for(let o of Object.values(e)){if(o.type!==`chunk`)continue;let e=n(o),s=e.kind===`subpackage`?e.root:void 0;for(let e of o.moduleIds){let n=Ri(t(e)?.meta);for(let e of n){let t=r.posix.basename(e.folder),n=r.posix.join(`components`,t),o=s?r.posix.join(s,n):n;a.push({name:t,componentPath:`/${r.posix.join(o,e.entry)}`,fields:e.fields});for(let t of e.assets)i.push({type:`asset`,fileName:r.posix.join(o,t.relativePath),source:await C(r.join(e.folder,t.relativePath))})}}}return{files:i,registrations:a}}async function la({bundle:e,contract:t,subpackages:n,isProduction:r,getModuleInfo:i,getPackageLocation:a}){let o=await ca({bundle:e,getModuleInfo:i,getPackageLocation:a});return[{type:`asset`,fileName:t.styles.appFileName,source:`@import "./${t.styles.globalFileName}";\n`},...t.output.generateProjectSkeleton({bundle:e,subpackages:n,nativeComponents:o.registrations,isProduction:r},t),...o.files]}const ua=`sub/p_`,da={kind:`main`};function fa({chunks:e,planningBudgetBytes:t,getAdditionalModuleBytes:n}){let r=new Map(Object.entries(e).sort(([e],[t])=>e.localeCompare(t))),i=new Map([...r.values()].flatMap(e=>e.facadeModuleId===null?[]:[[e.facadeModuleId,e]])),a=pa(r),o=ma({chunks:r,mainChunkIds:a}),s=ga({chunks:[...r].filter(([e])=>!a.has(e)).map(([e,t])=>({chunkId:e,estimatedBytes:Sa(t)+t.moduleIds.reduce((e,t)=>e+n(t),0),transitions:o.get(e)??/* @__PURE__ */ new Set})),planningBudgetBytes:t}).map(Ca),c=/* @__PURE__ */ new Map;for(let e of a)c.set(e,da);for(let e of s)for(let t of e.chunkIds)c.set(t,e);function l(e){let t=c.get(e);if(!t)throw Error(`Mini Program placement is missing final chunk: ${e}`);return t}function u(e){return l(`preliminaryFileName`in e?e.preliminaryFileName:e.fileName)}return{getPackageLocation:u,getPhysicalChunkId(e){let t=typeof e==`string`?i.get(e):e;if(!t)throw Error(`Mini Program placement is missing entry module: ${e}`);let n=u(t);return n.kind===`main`?t.fileName:`${n.root}/${t.fileName}`},finalize(e){let t=Object.values(e).filter(e=>e.type===`chunk`),n=/* @__PURE__ */ new Set;for(let e of t){let t=l(e.preliminaryFileName);t.kind===`subpackage`&&(e.fileName=`${t.root}/${e.fileName}`,n.add(t.root))}return[...n].sort().map(e=>({root:e}))}}}function pa(e){let t=/* @__PURE__ */ new Set,n=[...e].filter(([,e])=>e.isEntry).map(([e])=>e);for(;n.length>0;){let r=n.pop();if(!r||t.has(r))continue;let i=e.get(r);i&&(t.add(r),n.push(...i.imports))}return t}function ma({chunks:e,mainChunkIds:t}){let n=/* @__PURE__ */ new Map,r=0;for(let i of e.values())for(let a of[...i.dynamicImports].sort())if(e.has(a)&&!t.has(a)){for(let i of ha({rootId:a,chunks:e,mainChunkIds:t})){let e=n.get(i)??/* @__PURE__ */ new Set;e.add(r),n.set(i,e)}r++}return n}function ha({rootId:e,chunks:t,mainChunkIds:n}){let r=/* @__PURE__ */ new Set,i=[e];for(;i.length>0;){let e=i.pop();if(!e||r.has(e)||n.has(e))continue;let a=t.get(e);a&&(r.add(e),i.push(...a.imports))}return[...r].sort()}function ga({chunks:e,planningBudgetBytes:t}){let n=[],r=[...e].sort(_a);for(let e of r)xa(e.estimatedBytes<=t?va({bins:n,chunk:e,planningBudgetBytes:t})??ba(n):ba(n),e);return n}function _a(e,t){return t.transitions.size-e.transitions.size||t.estimatedBytes-e.estimatedBytes||e.chunkId.localeCompare(t.chunkId)}function va({bins:e,chunk:t,planningBudgetBytes:n}){let r;for(let i of e){if(i.estimatedBytes+t.estimatedBytes>n)continue;let e={bin:i,overlap:ya(i.transitions,t.transitions),remainingBytes:n-i.estimatedBytes-t.estimatedBytes};(!r||e.overlap>r.overlap||e.overlap===r.overlap&&e.remainingBytes<r.remainingBytes)&&(r=e)}return r?.bin}function ya(e,t){let[n,r]=e.size<=t.size?[e,t]:[t,e],i=0;for(let e of n)r.has(e)&&i++;return i}function ba(e){let t={chunkIds:[],estimatedBytes:0,transitions:/* @__PURE__ */ new Set};return e.push(t),t}function xa(e,t){e.chunkIds.push(t.chunkId),e.estimatedBytes+=t.estimatedBytes;for(let n of t.transitions)e.transitions.add(n)}function Sa(e){let t=Object.values(e.modules).reduce((e,t)=>e+(t.code?Buffer.byteLength(t.code,`utf8`):0),0),n=e.moduleIds.length*64,r=(e.imports.length+e.dynamicImports.length)*32;return t+n+r+64}function Ca(e){let t=[...e.chunkIds].sort(),n=ne(`sha256`).update(t.join(`\0`)).digest(`hex`).slice(0,8);return{kind:`subpackage`,root:`${ua}${n}`,chunkIds:t}}function wa(e){return e.startsWith(ua)}function Ta(){return{output:{codeSplitting:{groups:[{name:`polyfills`,test:Qt,priority:200,includeDependenciesRecursively:!1},{name:`vendor`,test:$t,priority:100,includeDependenciesRecursively:!0}]},entryFileNames(e){switch(tn(e)){case`native`:return`[name]`;case`entry-capsule`:return`[name].js`;default:return`common/[name].js`}},chunkFileNames:`common/[name].js`},preserveEntrySignatures:`allow-extension`}}function Ea(){let e={phase:`idle`};function t(){if(e.phase===`idle`||e.phase===`awaiting-chunks`)throw Error(`Mini Program placement is unavailable before Rolldown exposes the final chunk graph`);return e.placement}return{name:`vpt:mini-placer`,config(){return{build:{rolldownOptions:Ta()}}},renderStart(){e={phase:`awaiting-chunks`}},renderChunk:{order:`pre`,handler(t,n,r,i){if(e.phase!==`planned`){if(e.phase!==`awaiting-chunks`)throw Error(`Mini Program placement received final chunks during the ${e.phase} phase`);e={phase:`planned`,placement:fa({chunks:i.chunks,planningBudgetBytes:19e5,getAdditionalModuleBytes:e=>Li(this.getModuleInfo(e)?.meta)})}}}},generateBundle:{order:`pre`,handler(n,r){let i=t();e={phase:`finalized`,placement:i,subpackages:i.finalize(r)}}},getPackageLocation(e){return t().getPackageLocation(e)},getPhysicalChunkId(e){return t().getPhysicalChunkId(e)},getSubpackages(){if(e.phase!==`finalized`)throw Error(`Mini Program subpackages are unavailable before output finalization`);return e.subpackages}}}const Da={document:[Ut,`document`],navigator:[Ut,`navigator`],requestAnimationFrame:[Ut,`requestAnimationFrame`],cancelAnimationFrame:[Ut,`cancelAnimationFrame`],Element:[Ut,`TaroElement`],SVGElement:[Ut,`SVGElement`],MutationObserver:[Ut,`MutationObserver`],history:[Ut,`history`],location:[Ut,`location`]},Oa=Object.fromEntries(Object.keys(Da).map(e=>[e,`globalThis.${e}`]));function ka(e){let t=[...new Set(e.options.polyfills??[])];return{name:`vpt:mini-polyfills`,config(){return{build:{rolldownOptions:{transform:{inject:Da}}}}},transform:{filter:{id:Zt,code:RegExp(`\\\\|\\b(?:${Object.keys(Da).join(`|`)})\\b`)},handler(e,t){return l(e,t,{define:Oa,sourcemap:!!this.environment.config.build.sourcemap})}},resolveId:{filter:{id:Me(Kt)},handler(){return Kt}},load:{filter:{id:Me(Kt)},handler(){return t.map(e=>`import ${JSON.stringify(Aa(e))};`).join(`
|
|
13
|
-
`)}}}}function Aa(e){if(!/^[a-z][a-z\d]*(?:[.-][a-z\d]+)*$/.test(e))throw Error(`Invalid core-js polyfill module: ${JSON.stringify(e)}. Use a module name such as "web.url".`);try{return Se.resolve(`core-js/modules/${e}.js`)}catch(t){throw Error(`Unknown core-js polyfill module: ${JSON.stringify(e)}.`,{cause:t})}}var ja=class{original;#e=/* @__PURE__ */ new Map;#t=[];constructor(e){this.original=e}overwrite(e,t,n){this.#t.push({content:n,end:t,start:e})}prependLeft(e,t){this.#n(e).prepend.push(t)}appendLeft(e,t){this.#n(e).append.push(t)}appendRight(e,t){this.#n(e).append.push(t)}compile(){let e={original:this.original,replacements:this.#t.toSorted((e,t)=>e.start-t.start||t.end-e.end),insertions:[...this.#e].sort(([e],[t])=>e-t).map(([e,t])=>({start:e,content:t.prepend.toReversed().join(``)+t.append.join(``)}))};return{render:(t,n)=>Na(e,t,n,!0,!0),renderOutside:t=>Ma(e,t)}}#n(e){let t=this.#e.get(e);if(t)return t;let n={append:[],prepend:[]};return this.#e.set(e,n),n}};function Ma(e,t){let n=[],r=0,i=!0;for(let a of t)n.push(Na(e,r,a.start,i,!1)),r=a.end,i=!1;return n.push(Na(e,r,e.original.length,i,!0)),n.join(``)}function Na(e,t,n,r,i){let a=t,o=Pa(e.insertions,t),s=[],c=(n,i)=>{for(;o<e.insertions.length;){let c=e.insertions[o];if(c.start>n||c.start===n&&!i)break;o++,!(c.start<a||c.start===t&&!r)&&(s.push(e.original.slice(a,c.start),c.content),a=c.start)}s.push(e.original.slice(a,n)),a=n};for(let r=Pa(e.replacements,t);r<e.replacements.length;r++){let t=e.replacements[r];if(t.start>=n)break;if(!(t.end>n||t.end<=a)){if(t.start<a)throw Error(`Partially overlapping source edits at ${t.start}:${t.end}`);c(t.start,!1),s.push(t.content),a=t.end}}return c(n,i),s.join(``)}function Pa(e,t){let n=0,r=e.length;for(;n<r;){let i=Math.floor((n+r)/2);e[i].start<t?n=i+1:r=i}return n}function Fa(e){let t=h(e.filename,e.code);if(t.errors.length>0){let n=t.errors.map(e=>e.message).join(`; `);throw Error(`Failed to parse ${e.filename} with Oxc: ${n}`)}let n=Ia(t.program,e.filename);if(!e.sourcemap){let t=new ja(e.code);return Ba(t,n),Ga(t,n,e),{code:Ya(t,n,e),map:null}}let r=new p(e.code,{filename:e.filename});return Ba(r,n),Ga(r,n,e),Xa(r,n,e),{code:r.toString(),map:Co(r,e.filename)}}function Ia(e,t){let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=[],o=[],s=[],c=/* @__PURE__ */ new Set,l=/* @__PURE__ */ new Set,u=new $e({preserveExitedScopes:!0}),d=0,f=!1,p=!1;Ze(e,{scopeTracker:u,enter(e,t){if(e.type===`Identifier`&&n.add(e.name),e.type===`CallExpression`&&e.callee.type===`Identifier`&&e.callee.name===`eval`&&(f=!0),_o(e)&&(d+=1),e.type===`AwaitExpression`&&d===0&&(p=!0),e.type===`VariableDeclaration`&&d===0&&(e.kind===`var`||t?.type===`Program`)&&(o.push(e),e.kind===`var`)){if(t?.type!==`Program`){let n=(t?.type===`ForInStatement`||t?.type===`ForOfStatement`)&&t.left===e;s.push({declaration:e,isForIterationBinding:n})}fo(e).forEach(e=>{l.add(e)})}},leave(e){_o(e)&&--d}});for(let n of e.body)switch(n.type){case`ImportDeclaration`:La(n,i,c,l,t);break;case`ExportNamedDeclaration`:Ra(n,r,t);break;case`ExportDefaultDeclaration`:case`ExportAllDeclaration`:throw So(t,`source-level ${n.type}`);case`VariableDeclaration`:bo(n,t),n.declarations.flatMap(e=>po(e.id)).forEach(e=>{l.add(e)});break;case`FunctionDeclaration`:{let e=n.id;a.push(n),l.add(e.name);break}case`ClassDeclaration`:{let e=n.id;l.add(e.name);break}}u.freeze(),yo(f,t);let m=co(n,i.size);return za(r,l,t),{dependencies:[...i.values()],exportNamesByLocal:r,functions:a,generatedNames:m,hasTopLevelAwait:p,importBindings:c,moduleVariables:o,nestedHoistedVariables:s,outerBindings:l,program:e,scopes:u}}function La(e,t,n,r,i){if(e.phase||e.attributes.length>0||e.importKind===`type`)throw So(i,`import phases, attributes, or type-only imports`);let a=e.source.value,o=t.get(a)??{source:a,imports:[]};t.has(a)||t.set(a,o);for(let t of e.specifiers)switch(n.add(t.local.name),r.add(t.local.name),t.type){case`ImportDefaultSpecifier`:o.imports.push({imported:`default`,local:t.local.name});break;case`ImportNamespaceSpecifier`:o.imports.push({imported:null,local:t.local.name});break;case`ImportSpecifier`:o.imports.push({imported:lo(t.imported),local:t.local.name})}}function Ra(e,t,n){if(e.declaration||e.source||e.attributes.length>0||e.exportKind===`type`)throw So(n,`declaration exports, re-exports, export attributes, or type-only exports`);for(let n of e.specifiers){let e=lo(n.local),r=lo(n.exported),i=t.get(e)??[];i.push(r),t.has(e)||t.set(e,i)}}function za(e,t,n){for(let r of e.keys())if(!t.has(r))throw So(n,`export of non-module binding ${JSON.stringify(r)}`)}function Ba(e,t){for(let n of t.program.body)switch(n.type){case`ImportDeclaration`:e.overwrite(n.start,n.end,``);break;case`ExportNamedDeclaration`:e.overwrite(n.start,n.end,$a(n.specifiers,t));break;case`VariableDeclaration`:Va(e,n,t.generatedNames.exportBinding,t.exportNamesByLocal);break;case`ClassDeclaration`:Wa(e,n,t.generatedNames.exportBinding,t.exportNamesByLocal)}for(let{declaration:n,isForIterationBinding:r}of t.nestedHoistedVariables)Ha(e,n,r,t.generatedNames.exportBinding,t.exportNamesByLocal)}function Va(e,t,n,r){let i=t.declarations[0];e.overwrite(t.start,i.start,`(`),e.appendLeft(xo(e.original,t.end),`)`),Ua(e,t,n,r)}function Ha(e,t,n,r,i){let a=t.declarations[0];e.overwrite(t.start,a.start,n?``:`(`),n||e.appendLeft(xo(e.original,t.end),`)`),Ua(e,t,r,i)}function Ua(e,t,n,r){for(let i of t.declarations){if(!i.init)continue;let t=po(i.id).flatMap(e=>(r.get(e)??[]).map(t=>({exported:t,local:e})));if(t.length!==0){if(i.id.type===`Identifier`){let t=r.get(i.id.name);e.prependLeft(i.start,no(n,t,``)),e.appendRight(i.end,ro(t));continue}e.prependLeft(i.start,`(`),e.appendRight(i.end,`,${t.map(({exported:e,local:t})=>oo(n,e,t)).join(`,`)})`)}}}function Wa(e,t,n,r){let i=t.id,a=r.get(i.name)??[];e.prependLeft(t.start,no(n,a,`${i.name}=`)),e.appendRight(t.end,ro(a))}function Ga(e,t,n){let r=t.scopes,i=0;Ze(t.program,{scopeTracker:r,enter(a){switch(vo(a)&&(i+=1),a.type){case`ImportExpression`:if(a.options||a.phase)throw So(n.filename,`dynamic import options or phases`);e.overwrite(a.start,a.source.start,`${t.generatedNames.context}.import(`),a.source.type===`Literal`&&typeof a.source.value==`string`&&e.overwrite(a.source.start,a.source.end,JSON.stringify(n.resolveReference(a.source.value,`dynamic`)));break;case`MetaProperty`:a.meta.name===`import`&&a.property.name===`meta`&&e.overwrite(a.start,a.end,`${t.generatedNames.context}.meta`);break;case`ThisExpression`:i===0&&e.overwrite(a.start,a.end,`void 0`);break;case`AssignmentExpression`:Ka(e,a.left,a.start,a.end,r,t,n.filename);break;case`UpdateExpression`:qa(e,a,r,t);break;case`ForInStatement`:case`ForOfStatement`:a.left.type!==`VariableDeclaration`&&Ja(a.left,r,t.exportNamesByLocal,n.filename)}},leave(e){vo(e)&&--i}})}function Ka(e,t,n,r,i,a,o){if(t.type===`Identifier`){let o=to(t.name,i,a.exportNamesByLocal);if(o.length===0)return;e.prependLeft(n,no(a.generatedNames.exportBinding,o,``)),e.appendRight(r,ro(o));return}Ja(t,i,a.exportNamesByLocal,o)}function qa(e,t,n,r){if(t.argument.type!==`Identifier`)return;let i=to(t.argument.name,n,r.exportNamesByLocal);if(i.length===0)return;if(t.prefix){e.prependLeft(t.start,no(r.generatedNames.exportBinding,i,``)),e.appendRight(t.end,ro(i));return}let a=`+${t.argument.name}${t.operator[0]}1`;e.prependLeft(t.start,`(${io(r.generatedNames.exportBinding,i,a)},`),e.appendRight(t.end,`)`)}function Ja(e,t,n,r){let i=mo(e).filter(e=>to(e,t,n).length>0);if(i.length>0)throw So(r,`destructuring write to exported binding ${JSON.stringify(i[0])}`)}function Ya(e,t,n){let r=Za(t,n),i=e.compile(),a=t.functions.map(e=>i.render(e.start,e.end)).join(``);return`${r.prefix}${i.renderOutside(t.functions)}}};${a}${r.suffix}`}function Xa(e,t,n){let r=Za(t,n);for(let n of t.functions)e.move(n.start,n.end,e.original.length);e.prepend(r.prefix),e.prependLeft(e.original.length,`}};`),e.append(r.suffix)}function Za(e,t){let n=e.dependencies.map(e=>t.resolveReference(e.source,`static`)),r=e.dependencies.map((t,n)=>eo(t,n,e.generatedNames)),i=Qa(e),a=e.outerBindings.size>0?`var ${[...e.outerBindings].join(`,`)};`:``,o=e.hasTopLevelAwait?`async function`:`function`,s=`function(${e.generatedNames.exportBinding},${e.generatedNames.context}){"use strict";${a}${i}return {setters:[${r.join(`,`)}],execute:${o}(){`;return t.format===`system-register`?{prefix:`System.register(${JSON.stringify(n)},${s}`,suffix:`})`}:{prefix:`module.exports=[${JSON.stringify(n)},${s}`,suffix:`}]`}}function Qa(e){let t=new Set(e.functions.map(e=>e.id.name)),n=[];for(let[r,i]of e.exportNamesByLocal)if(t.has(r))for(let e of i)n.push({exported:e,value:r});for(let t of e.moduleVariables)for(let r of t.declarations)if(!r.init)for(let t of po(r.id))for(let r of e.exportNamesByLocal.get(t)??[])n.push({exported:r,value:`void 0`});if(n.length===0)return``;if(n.length===1){let[t]=n;return so(e.generatedNames.exportBinding,t.exported,t.value)}let r=n.map(({exported:e,value:t})=>`[${JSON.stringify(e)}]:${t}`).join(`,`);return`${e.generatedNames.exportBinding}({${r}});`}function $a(e,t){return e.filter(e=>t.importBindings.has(lo(e.local))).map(e=>{let n=lo(e.local);return so(t.generatedNames.exportBinding,lo(e.exported),n)}).join(``)}function eo(e,t,n){let r=`${n.dependencyPrefix}${t}`;return`function(${r}){${e.imports.flatMap(e=>{let t=e.imported===null?r:uo(r,e.imported);return[`${e.local}=${t};`]}).join(``)}}`}function to(e,t,n){let r=n.get(e)??[];return r.length===0||t.getDeclaration(e)?.scope===``?r:[]}function no(e,t,n){return t.length===0?n:t.reduce((t,n)=>`${ao(e,n)}${t}`,n)}function ro(e){return`)`.repeat(e.length)}function io(e,t,n){return t.reduce((t,n)=>`${ao(e,n)}${t})`,n)}function ao(e,t){return`${e}(${JSON.stringify(t)},`}function oo(e,t,n){return`${e}(${JSON.stringify(t)},${n})`}function so(e,t,n){return`${e}(${JSON.stringify(t)},${n});`}function co(e,t){let n=t=>{let n=0,r=t;for(;e.has(r);)n+=1,r=`${t}${n}`;return r};return{context:n(`__systemContext`),exportBinding:n(`__systemExport`),dependencyPrefix:(n=>{let r=0,i=n;for(;;){let a=0;for(;a<t&&!e.has(`${i}${a}`);)a+=1;if(a===t)return i;r+=1,i=`${n}${r}`}})(`__systemDependency`)}}function lo(e){return e.type===`Literal`?String(e.value):e.name}function uo(e,t){return/^[$A-Z_a-z][$\w]*$/.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`}function fo(e){return e.declarations.flatMap(e=>po(e.id))}function po(e){return ho(e)}function mo(e){return ho(e)}function ho(e){switch(e.type){case`Identifier`:return[e.name];case`AssignmentPattern`:return ho(e.left);case`ArrayPattern`:return e.elements.flatMap(e=>e?ho(e):[]);case`ObjectPattern`:return e.properties.flatMap(e=>e.type===`Property`?ho(e.value):ho(e.argument));case`RestElement`:return ho(e.argument);default:return[]}}function go(e){return e.type===`FunctionDeclaration`||e.type===`FunctionExpression`||e.type===`ArrowFunctionExpression`||e.type===`TSEmptyBodyFunctionExpression`}function _o(e){return go(e)||e.type===`ClassDeclaration`||e.type===`ClassExpression`}function vo(e){return go(e)&&e.type!==`ArrowFunctionExpression`||e.type===`ClassDeclaration`||e.type===`ClassExpression`}function yo(e,t){if(e)throw So(t,`direct eval`)}function bo(e,t){if(e.kind===`using`||e.kind===`await using`||e.declare)throw So(t,`using or ambient variable declaration`)}function xo(e,t){return e[t-1]===`;`?t-1:t}function So(e,t){return/* @__PURE__ */ Error(`Unsupported final Rolldown chunk ${e}: ${t}`)}function Co(e,t){let n=e.generateMap({file:t,hires:`boundary`,includeContent:!0,source:t});return{version:n.version,file:n.file,sources:n.sources,sourcesContent:n.sourcesContent,names:n.names,mappings:n.mappings}}function wo(e,t,n){return Fa({code:e,filename:t.fileName,format:`commonjs-registration`,sourcemap:n,resolveReference(e,n){return To(t.fileName,e,n)}})}function To(e,t,n){return n===`dynamic`&&!t.startsWith(`./`)&&!t.startsWith(`../`)?t:oa(e,t)}function Eo({code:e,chunk:t,chunks:n,getPhysicalChunkId:r,sourcemap:i}){let a=h(t.fileName,e);if(a.errors.length>0){let e=a.errors.map(e=>e.message).join(`; `);throw Error(`Failed to parse ${t.fileName} with Oxc: ${e}`)}let o=Do(a.program,t,n,r),s=new p(e,{filename:t.fileName});ko(s,o,t.fileName);let c=Ao(s,o,t.fileName);Oo(s,o);let l=o.exportNamesByLocal.size>0,u=Jo(o),d=c?`var ${o.postfixTemp};`:``,f=Ko(o);return l?s.prepend(`"use strict";Object.defineProperty(exports,"__esModule",{value:true});${u}${d}${f}`):s.prepend(`"use strict";${u}${d}${f}`),{code:s.toString(),map:i?ns(s,t.fileName):null}}function Do(e,t,n,i){let a=/* @__PURE__ */ new Set,o=/* @__PURE__ */ new Map,s=[],c=/* @__PURE__ */ new Map,l=new $e({preserveExitedScopes:!0}),u=[],d=!1;if(Ze(e,{scopeTracker:l,enter(e){e.type===`Identifier`&&a.add(e.name),e.type===`CallExpression`&&e.callee.type===`Identifier`&&e.callee.name===`eval`&&(d=!0),e.type===`ImportExpression`&&u.push(e)}}),l.freeze(),d)throw ts(t.fileName,`direct eval`);let f=0;function p(e,t){let n=t;if(n===void 0){for(n=f===0?`__nativeImport`:`__nativeImport${f}`;a.has(n);)f+=1,n=`__nativeImport${f}`;a.add(n),f+=1}let r=n;return{bindings:e.specifiers.map(e=>{let t={imported:e.type===`ImportNamespaceSpecifier`?null:e.type===`ImportDefaultSpecifier`?`default`:Zo(e.imported),local:e.local.name,namespace:r};return c.set(t.local,t),t}),capsuleBinding:null,interop:qo(e),namespace:r,reference:e.source.value}}for(let r of e.body)switch(r.type){case`ImportDeclaration`:{Yo(r,t.fileName);let e=Go(t.fileName,r.source.value,n);if(e){let[n]=r.specifiers;if(r.specifiers.length!==1||!n||n.type===`ImportNamespaceSpecifier`)throw Error(`Expected one capsule value import from ${e.fileName} in ${t.fileName}`);s.push({bindings:[],capsuleBinding:{imported:n.type===`ImportDefaultSpecifier`?`default`:Zo(n.imported),local:n.local.name,logicalId:oa(t.fileName,r.source.value)},interop:`none`,namespace:``,reference:r.source.value});continue}s.push(p(r,void 0));break}case`ExportNamedDeclaration`:Fo(r,o,t.fileName);break;case`ExportDefaultDeclaration`:case`ExportAllDeclaration`:throw ts(t.fileName,`source-level ${r.type}`)}if(u.length>0||s.some(e=>e.capsuleBinding)){let e=r.posix.relative(r.posix.dirname(i(t)),i(Ft)),n=e.startsWith(`../`)?e:`./${e}`,o=Xo(`__nativeSystem`,a),c=h(t.fileName,`import { System as ${o} } from ${JSON.stringify(n)}`).program.body[0],l=s.findIndex(e=>e.reference===n),u=l<0?void 0:s.splice(l,1)[0],d=p(c,u?.namespace);s.unshift(u?{...u,bindings:[...d.bindings,...u.bindings]}:d)}return{defaultInterop:Xo(`__nativeDefault`,a),dynamicImports:u,exportNamesByLocal:o,imports:s,importBindingsByLocal:c,namespaceInterop:Xo(`__nativeNamespace`,a),postfixTemp:Xo(`__nativePostfix`,a),program:e,scopes:l}}function Oo(e,t){for(let n of t.program.body)switch(n.type){case`ImportDeclaration`:e.remove(n.start,n.end);break;case`ExportNamedDeclaration`:n.declaration?(e.remove(n.start,n.declaration.start),Io(e,n.declaration,t.exportNamesByLocal)):e.overwrite(n.start,n.end,Lo(n.specifiers,t));break;case`VariableDeclaration`:Ro(e,n,t.exportNamesByLocal);break;case`FunctionDeclaration`:n.id&&zo(e,n.end,n.id.name,t.exportNamesByLocal);break;case`ClassDeclaration`:n.id&&zo(e,n.end,n.id.name,t.exportNamesByLocal)}}function ko(e,t,n){for(let r of t.dynamicImports){if(r.options||r.phase)throw ts(n,`dynamic import options or phases`);let i=Uo(t.imports[0].bindings[0]);e.overwrite(r.start,r.source.start,`${i}.import(`),r.source.type===`Literal`&&typeof r.source.value==`string`&&(r.source.value.startsWith(`./`)||r.source.value.startsWith(`../`))&&e.overwrite(r.source.start,r.source.end,JSON.stringify(oa(n,r.source.value)))}}function Ao(e,t,n){let r=[],i=0,a=!1;return Ze(t.program,{scopeTracker:t.scopes,enter(o,s){if(es(o)&&(i+=1),o.type===`ThisExpression`&&i===0&&e.overwrite(o.start,o.end,`void 0`),o.type===`Identifier`&&s?.type!==`ImportDeclaration`&&rt(o,s)){let n=t.importBindingsByLocal.get(o.name),i=n?t.scopes.getDeclaration(o.name):null;if(n&&i?.type===`Import`){let t=Ho(o,s,r),i=Uo(n),a=t===`unbound`?`(0,${i})`:i;e.overwrite(o.start,o.end,s?.type===`Property`&&s.shorthand&&s.value===o?`${o.name}:${a}`:a)}}switch(o.type){case`AssignmentExpression`:jo(e,o.left,o.start,t,n);break;case`UpdateExpression`:Mo(e,o,t)&&(a=!0);break;case`ForInStatement`:case`ForOfStatement`:o.left.type!==`VariableDeclaration`&&No(o.left,t,n)}r.push(o)},leave(e){r.pop(),es(e)&&--i}}),a}function jo(e,t,n,r,i){if(t.type===`Identifier`){let i=Po(t.name,r);i.length>0&&e.prependLeft(n,Bo(i));return}No(t,r,i)}function Mo(e,t,n){if(t.argument.type!==`Identifier`)return!1;let r=Po(t.argument.name,n);return r.length===0?!1:t.prefix?(e.prependLeft(t.start,Bo(r)),!1):(e.prependLeft(t.start,`(${n.postfixTemp}=`),e.appendRight(t.end,`,${Vo(r,t.argument.name)},${n.postfixTemp})`),!0)}function No(e,t,n){let r=$o(e).filter(e=>Po(e,t).length>0);if(r.length>0)throw ts(n,`destructuring write to exported binding ${JSON.stringify(r[0])}`)}function Po(e,t){let n=t.exportNamesByLocal.get(e)??[];return n.length===0||t.scopes.getDeclaration(e)?.scope===``?n:[]}function Fo(e,t,n){if(e.source||e.attributes.length>0||e.exportKind===`type`)throw ts(n,`re-exports, export attributes, or type-only exports`);if(e.declaration){for(let r of Qo(e.declaration,n)){let e=t.get(r)??[];e.push(r),t.has(r)||t.set(r,e)}return}for(let n of e.specifiers){let e=Zo(n.local),r=t.get(e)??[];r.push(Zo(n.exported)),t.has(e)||t.set(e,r)}}function Io(e,t,n){switch(t.type){case`VariableDeclaration`:Ro(e,t,n);break;case`FunctionDeclaration`:case`ClassDeclaration`:t.id&&zo(e,t.end,t.id.name,n)}}function Lo(e,t){return e.map(e=>{let n=Zo(e.local),r=Zo(e.exported),i=t.importBindingsByLocal.get(n);return i?`Object.defineProperty(exports,${JSON.stringify(r)},{enumerable:true,get:function(){return ${Uo(i)}}});`:``}).join(``)}function Ro(e,t,n){for(let r of t.declarations){if(r.id.type!==`Identifier`){if($o(r.id).filter(e=>n.has(e)).length>0)throw ts(`native chunk`,`exported destructuring declaration`);continue}let t=n.get(r.id.name)??[];t.length!==0&&(r.init?e.prependLeft(r.init.start,Bo(t)):e.appendRight(r.end,`=${Vo(t,`void 0`)}`))}}function zo(e,t,n,r){let i=r.get(n)??[];i.length>0&&e.appendRight(t,`;${Vo(i,n)};`)}function Bo(e){return e.reduce((e,t)=>`exports[${JSON.stringify(t)}]=${e}`,``)}function Vo(e,t){return`${Bo(e)}${t}`}function Ho(e,t,n){let r=e,i=t,a=n.length-1;for(;i?.type===`ParenthesizedExpression`&&i.expression===r;)r=i,--a,i=n[a];return i?.type===`CallExpression`&&i.callee===r?`unbound`:i?.type===`NewExpression`&&i.callee===r?`plain`:i?.type===`TaggedTemplateExpression`&&i.tag===r?`unbound`:`plain`}function Uo(e){return e.imported===null?e.namespace:Wo(e.namespace,e.imported)}function Wo(e,t){return/^[$A-Z_a-z][$\w]*$/.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`}function Go(e,t,n){if(!t.startsWith(`./`)&&!t.startsWith(`../`))return;let r=n[aa(e,t)];return r&&tn(r)===`entry-capsule`?r:void 0}function Ko(e){return e.imports.map(t=>{if(t.capsuleBinding){let{imported:n,local:r,logicalId:i}=t.capsuleBinding;return`var ${r}=${Wo(`${Uo(e.imports[0].bindings[0])}.importSync(${JSON.stringify(i)})`,n)};`}let n=`require(${JSON.stringify(t.reference)})`;if(t.bindings.length===0)return`${n};`;let r=t.interop==="default"?`${e.defaultInterop}(${n})`:t.interop===`namespace`?`${e.namespaceInterop}(${n})`:n;return`var ${t.namespace}=${r};`}).join(``)}function qo(e){return e.specifiers.some(e=>e.type===`ImportNamespaceSpecifier`)?`namespace`:e.specifiers.some(e=>e.type===`ImportDefaultSpecifier`)?`default`:`none`}function Jo(e){let t=new Set(e.imports.map(({interop:e})=>e));return`${t.has(`default`)?`function ${e.defaultInterop}(value){return value&&value.__esModule?value:{default:value};}`:``}${t.has(`namespace`)?`function ${e.namespaceInterop}(value){if(value&&value.__esModule)return value;var namespace={default:value};if(value!==null&&(typeof value==="object"||typeof value==="function")){for(var key in value)if(key!=="default"&&Object.prototype.hasOwnProperty.call(value,key))Object.defineProperty(namespace,key,{enumerable:true,get:function(key){return function(){return value[key]}}(key)});}return namespace;}`:``}`}function Yo(e,t){if(e.phase||e.attributes.length>0||e.importKind===`type`)throw ts(t,`import phases, attributes, or type-only imports`)}function Xo(e,t){let n=0,r=e;for(;t.has(r);)n+=1,r=`${e}${n}`;return t.add(r),r}function Zo(e){return e.type===`Literal`?String(e.value):e.name}function Qo(e,t){return e.type===`VariableDeclaration`?e.declarations.flatMap(({id:e})=>$o(e)):[e.id.name]}function $o(e){switch(e.type){case`Identifier`:return[e.name];case`AssignmentPattern`:return $o(e.left);case`ArrayPattern`:return e.elements.flatMap(e=>e?$o(e):[]);case`ObjectPattern`:return e.properties.flatMap(e=>e.type===`Property`?$o(e.value):$o(e.argument));case`RestElement`:return $o(e.argument);default:return[]}}function es(e){return e.type===`FunctionDeclaration`||e.type===`FunctionExpression`||e.type===`ClassDeclaration`||e.type===`ClassExpression`}function ts(e,t){return/* @__PURE__ */ Error(`Unsupported final Rolldown native chunk ${e}: ${t}`)}function ns(e,t){let n=e.generateMap({file:t,hires:`boundary`,includeContent:!0,source:t});return{version:n.version,file:n.file,sources:n.sources,sourcesContent:n.sourcesContent,names:n.names,mappings:n.mappings}}function rs({code:e,id:t,appConfig:n,sourcemap:r}){return St(e,t,{__VPT_APP_CONFIG__:JSON.stringify(n)},r??!1)}function is({code:e,id:t,page:n,sourcemap:r}){return St(e,t,{__VPT_PAGE_PATH__:JSON.stringify(n.path),__VPT_PAGE_CONFIG__:JSON.stringify(yt(n))},r??!1)}function as(e){let t=s(Lt),n=s(Ht),i=os(e.options.pages),a=new Map(e.options.pages.map(e=>[e.path,e])),o=/* @__PURE__ */ new Map([[`\0vite/preload-helper.js`,()=>Ft],[`\0vpt:taro-target-runtime`,()=>e.taro.targetRuntimePath],[`\0vpt:app-component`,(t,n)=>ke({appPath:e.options.app,projectRoot:n})],[Jt,(e,t)=>Ae({pagePath:cs({moduleId:e,pageByPath:a}).path,projectRoot:t})],[`\0vpt:page-capsule`,e=>{let t=cs({moduleId:e,pageByPath:a});return ss({moduleId:Ht,pagePath:t.path})}]]);return{...i,resolveId(e,t,n){return e===`\0vpt:mini-transport`?{id:`./${r.posix.relative(`common`,qt)}`,external:!0}:o.get(e)?.(t,n)},specialize(r,i,o){let s=Ne(i);if(s===t)return rs({code:r,id:i,appConfig:bt(e.options),sourcemap:o});if(s===n)return is({code:r,id:i,page:cs({moduleId:i,pageByPath:a}),sourcemap:o})}}}function os(e){let t={capsuleId:Lt,capsuleName:`app-capsule`,shellId:It,shellName:`app.js`},n=e.map(e=>({capsuleId:ss({moduleId:Ht,pagePath:e.path}),capsuleName:`${e.path}-capsule`,shellId:ss({moduleId:Vt,pagePath:e.path}),shellName:`${e.path}.js`}));return{entries:{appEntries:t,pageEntries:n},input:Object.fromEntries([[`bootstrap`,Ft],[t.shellName,t.shellId],[t.capsuleName,t.capsuleId],[`comp.js`,Rt],[`component-capsule`,zt],[`custom-wrapper.js`,Bt],...n.flatMap(e=>[[e.shellName,e.shellId],[e.capsuleName,e.capsuleId]])])}}function ss({moduleId:e,pagePath:t}){return`${e}?route=${encodeURIComponent(t)}`}function cs({moduleId:e,pageByPath:t}){let n=e?.indexOf(`?`)??-1,r=n===-1?void 0:new URLSearchParams(e?.slice(n+1)).get(`route`),i=r?t.get(r):void 0;if(!i)throw Error(r?`Unknown Page capsule: ${r}`:`Page capsule import must originate from a route module`);return i}var ls;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(ls||={});var us;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(us||={});var ds;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(ds||={});var fs;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(fs||={});var ps;(function(e){e[e.Tab=9]=`Tab`,e[e.NewLine=10]=`NewLine`,e[e.FormFeed=12]=`FormFeed`,e[e.CarriageReturn=13]=`CarriageReturn`,e[e.Space=32]=`Space`,e[e.ExclamationMark=33]=`ExclamationMark`,e[e.Number=35]=`Number`,e[e.Amp=38]=`Amp`,e[e.SingleQuote=39]=`SingleQuote`,e[e.DoubleQuote=34]=`DoubleQuote`,e[e.Dash=45]=`Dash`,e[e.Slash=47]=`Slash`,e[e.Zero=48]=`Zero`,e[e.Nine=57]=`Nine`,e[e.Semi=59]=`Semi`,e[e.Lt=60]=`Lt`,e[e.Eq=61]=`Eq`,e[e.Gt=62]=`Gt`,e[e.Questionmark=63]=`Questionmark`,e[e.UpperA=65]=`UpperA`,e[e.LowerA=97]=`LowerA`,e[e.UpperF=70]=`UpperF`,e[e.LowerF=102]=`LowerF`,e[e.UpperZ=90]=`UpperZ`,e[e.LowerZ=122]=`LowerZ`,e[e.LowerX=120]=`LowerX`,e[e.OpeningSquareBracket=91]=`OpeningSquareBracket`})(ps||={});var ms;(function(e){e[e.Text=1]=`Text`,e[e.BeforeTagName=2]=`BeforeTagName`,e[e.InTagName=3]=`InTagName`,e[e.InSelfClosingTag=4]=`InSelfClosingTag`,e[e.BeforeClosingTagName=5]=`BeforeClosingTagName`,e[e.InClosingTagName=6]=`InClosingTagName`,e[e.AfterClosingTagName=7]=`AfterClosingTagName`,e[e.BeforeAttributeName=8]=`BeforeAttributeName`,e[e.InAttributeName=9]=`InAttributeName`,e[e.AfterAttributeName=10]=`AfterAttributeName`,e[e.BeforeAttributeValue=11]=`BeforeAttributeValue`,e[e.InAttributeValueDq=12]=`InAttributeValueDq`,e[e.InAttributeValueSq=13]=`InAttributeValueSq`,e[e.InAttributeValueNq=14]=`InAttributeValueNq`,e[e.BeforeDeclaration=15]=`BeforeDeclaration`,e[e.InDeclaration=16]=`InDeclaration`,e[e.InProcessingInstruction=17]=`InProcessingInstruction`,e[e.BeforeComment=18]=`BeforeComment`,e[e.CDATASequence=19]=`CDATASequence`,e[e.DeclarationSequence=20]=`DeclarationSequence`,e[e.InSpecialComment=21]=`InSpecialComment`,e[e.InCommentLike=22]=`InCommentLike`,e[e.SpecialStartSequence=23]=`SpecialStartSequence`,e[e.InSpecialTag=24]=`InSpecialTag`,e[e.InPlainText=25]=`InPlainText`,e[e.InEntity=26]=`InEntity`})(ms||={});var hs;(function(e){e[e.NoValue=0]=`NoValue`,e[e.Unquoted=1]=`Unquoted`,e[e.Single=2]=`Single`,e[e.Double=3]=`Double`})(hs||={});const gs={Empty:/* @__PURE__ */ new Uint8Array,Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,33,62]),Doctype:new Uint8Array([100,111,99,116,121,112,101]),IframeEnd:new Uint8Array([60,47,105,102,114,97,109,101]),NoembedEnd:new Uint8Array([60,47,110,111,101,109,98,101,100]),NoframesEnd:new Uint8Array([60,47,110,111,102,114,97,109,101,115]),Plaintext:new Uint8Array([60,47,112,108,97,105,110,116,101,120,116]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97]),XmpEnd:new Uint8Array([60,47,120,109,112])};gs.IframeEnd[2],gs.IframeEnd,gs.NoembedEnd[2],gs.NoembedEnd,gs.Plaintext[2],gs.Plaintext,gs.ScriptEnd[2],gs.ScriptEnd,gs.TitleEnd[2],gs.TitleEnd,gs.XmpEnd[2],gs.XmpEnd;const{fromCodePoint:_s}=String;var vs;(function(e){e[e.None=0]=`None`,e[e.Svg=1]=`Svg`,e[e.MathML=2]=`MathML`})(vs||={});let ys=()=>{var e=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},a=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of n(a))!r.call(i,c)&&c!==o&&e(i,c,{get:()=>a[c],enumerable:!(s=t(a,c))||s.enumerable});return i},o=t=>a(e({},`__esModule`,{value:!0}),t),s={};i(s,{default:()=>Re});var c=e=>Array.isArray(e),l=e=>typeof e==`function`,u=e=>e.length===0,d=e=>typeof e==`number`,f=e=>typeof e==`object`&&!!e,p=e=>e instanceof RegExp,m=e=>typeof e==`string`,h=e=>e===void 0,g=e=>{let t=/* @__PURE__ */ new Map;return n=>{let r=t.get(n);if(r)return r;let i=e(n);return t.set(n,i),i}},_=(e,t,n={})=>{let r={cache:{},input:e,index:0,indexMax:0,options:n,output:[]};if(ie(t)(r)&&r.index===e.length)return r.output;throw Error(`Failed to parse at index ${r.indexMax}`)},v=(e,t)=>c(e)?y(e,t):m(e)?x(e,t):b(e,t),y=(e,t)=>{let n={};for(let t of e){if(t.length!==1)throw Error(`Invalid character: "${t}"`);let e=t.charCodeAt(0);n[e]=!0}return e=>{let r=e.index,i=e.input;for(;e.index<i.length&&i.charCodeAt(e.index)in n;)e.index+=1;let a=e.index;if(a>r){if(!h(t)&&!e.options.silent){let n=e.input.slice(r,a),o=l(t)?t(n,i,String(r)):t;h(o)||e.output.push(o)}e.indexMax=Math.max(e.indexMax,e.index)}return!0}},b=(e,t)=>{let n=e.source,r=e.flags.replace(/y|$/,`y`),i=new RegExp(n,r);return ne(e=>{i.lastIndex=e.index;let n=i.exec(e.input);if(n){if(!h(t)&&!e.options.silent){let r=l(t)?t(...n,e.input,String(e.index)):t;h(r)||e.output.push(r)}return e.index+=n[0].length,e.indexMax=Math.max(e.indexMax,e.index),!0}return!1})},x=(e,t)=>n=>{if(n.input.startsWith(e,n.index)){if(!h(t)&&!n.options.silent){let r=l(t)?t(e,n.input,String(n.index)):t;h(r)||n.output.push(r)}return n.index+=e.length,n.indexMax=Math.max(n.indexMax,n.index),!0}return!1},S=(e,t,n,r)=>{let i=ie(e);return ne(E(te(e=>{let r=0;for(;r<n;){let t=e.index;if(!i(e)||(r+=1,e.index===t))break}return r>=t})))},C=(e,t)=>S(e,0,1),w=(e,t)=>S(e,0,1/0),ee=(e,t)=>{let n=e.map(ie);return ne(E(te(e=>{for(let t=0,r=n.length;t<r;t++)if(!n[t](e))return!1;return!0})))},T=(e,t)=>{let n=e.map(ie);return ne(E(e=>{for(let t=0,r=n.length;t<r;t++)if(n[t](e))return!0;return!1}))},te=(e,t=!1)=>{let n=ie(e);return e=>{let r=e.index,i=e.output.length,a=n(e);return(!a||t)&&(e.index=r,e.output.length!==i&&(e.output.length=i)),a}},E=(e,t)=>ie(e),ne=(()=>{let e=0;return t=>{let n=ie(t),r=e+=1;return e=>{var t;if(e.options.memoization===!1)return n(e);let i=e.index,a=(t=e.cache)[r]||(t[r]=/* @__PURE__ */ new Map),o=a.get(i);if(o===!1)return!1;if(d(o))return e.index=o,!0;if(o)return e.index=o.index,o.output?.length&&e.output.push(...o.output),!0;{let t=e.output.length;if(n(e)){let n=e.index,r=e.output.length;if(r>t){let o=e.output.slice(t,r);a.set(i,{index:n,output:o})}else a.set(i,n);return!0}return a.set(i,!1),!1}}}})(),re=e=>{let t;return n=>(t||=ie(e()),t(n))},ie=g(e=>{if(l(e))return u(e)?re(e):e;if(m(e)||p(e))return v(e);if(c(e))return ee(e);if(f(e))return T(Object.values(e));throw Error(`Invalid rule`)}),ae=`abcdefghijklmnopqrstuvwxyz`,oe=e=>{let t=``;for(;e>0;)t=ae[(e-1)%26]+t,e=Math.floor((e-1)/26);return t},se=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t=t*26+ae.indexOf(e[n])+1;return t},ce=(e,t)=>{if(t<e)return ce(t,e);let n=[];for(;e<=t;)n.push(e++);return n},le=(e,t,n)=>ce(e,t).map(e=>String(e).padStart(n,`0`)),ue=(e,t)=>ce(se(e),se(t)).map(oe),D=e=>e,de=e=>fe(t=>_(t,e,{memoization:!1}).join(``)),fe=e=>{let t={};return n=>t[n]??(t[n]=e(n))},pe=v(/^\*\*\/\*$/,`.*`),O=v(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/,(e,t,n)=>`.*${t?``:`(?:^|/)`}${n.replaceAll(`.`,`\\.`)}`),k=v(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/,(e,t,n,r)=>`.*${t?``:`(?:^|/)`}${n.replaceAll(`.`,`\\.`)}(?:${r.replaceAll(`,`,`|`).replaceAll(`.`,`\\.`)})`),me=v(/\\./,D),he=v(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),ge=v(/./,D),_e=T([v(/^(?:!!)*!(.*)$/,(e,t)=>`(?!^${Ne(t)}$).*?`),v(/^(!!)+/,``)]),ve=T([v(/\/(\*\*\/)+/,`(?:/.+/|/)`),v(/^(\*\*\/)+/,`(?:^|.*/)`),v(/\/(\*\*)$/,`(?:/.*|$)`),v(/\*\*/,`.*`)]),ye=T([v(/\*\/(?!\*\*\/)/,`[^/]*/`),v(/\*/,`[^/]*`)]),be=v(`?`,`[^/]`),A=v(`[`,D),j=v(`]`,D),M=v(/[!^]/,`^/`),xe=v(/[a-z]-[a-z]|[0-9]-[0-9]/i,D),Se=T([me,v(/[$.*+?^(){}[\|]/,e=>`\\${e}`),xe,v(/[^\]]/,D)]),Ce=ee([A,C(M),w(Se),j]),we=v(`{`,`(?:`),Te=v(`}`,`)`),Ee=ee([we,T([v(/(\d+)\.\.(\d+)/,(e,t,n)=>le(+t,+n,Math.min(t.length,n.length)).join(`|`)),v(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ue(t,n).join(`|`)),v(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ue(t.toLowerCase(),n.toLowerCase()).join(`|`).toUpperCase())]),Te]),De=v(`{`,`(?:`),Oe=v(`}`,`)`),ke=v(`,`,`|`),Ae=v(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),je=v(/[^}]/,D),Me=ee([De,w(T([ve,ye,be,Ce,Ee,re(()=>Me),me,Ae,ke,je])),Oe]),Ne=de(w(T([pe,O,k,_e,ve,ye,be,Ce,Ee,Me,me,he,ge]))),Pe=v(/\\./,D),Fe=v(/./,D),Ie=de(w(T([Pe,v(/\*\*\*+/,`*`),v(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),v(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Fe]))),Le=(e,t)=>{let n=Array.isArray(e)?e:[e];if(!n.length)return!1;let r=n.map(Le.compile),i=n.every(e=>/(\/(?:\*\*)?|\[\/\])$/.test(e)),a=t.replace(/[\\\/]+/g,`/`).replace(/\/$/,i?`/`:``);return r.some(e=>e.test(a))};Le.compile=e=>RegExp(`^${Ne(Ie(e))}$`,`s`);var Re=Le;return o(s)})();return e.default||e},bs;const xs=(e,t)=>(bs||(bs=ys(),ys=null),bs(e,t)),Ss=/^[A-Za-z]:\//;function Cs(e=``){return e&&e.replace(/\\/g,`/`).replace(Ss,e=>e.toUpperCase())}const ws=/^[/\\]{2}/,Ts=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Es=/^[A-Za-z]:$/,Ds=/^\/([A-Za-z]:)?$/,Os=/.(\.[^./]+|\.)$/,ks=/^[/\\]|^[a-zA-Z]:[/\\]/,As=function(e){if(e.length===0)return`.`;e=Cs(e);let t=e.match(ws),n=Fs(e),r=e[e.length-1]===`/`;return e=Ps(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),Es.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!Fs(e)?`/${e}`:e)},js=function(...e){let t=``;for(let n of e)if(n){if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;t+=e&&r?n.slice(1):e||r?n:`/${n}`}else t+=n}return As(t)};function Ms(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const Ns=function(...e){e=e.map(e=>Cs(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:Ms();i&&i.length!==0&&(t=`${i}/${t}`,n=Fs(i))}return t=Ps(t,!n),n&&!Fs(t)?`/${t}`:t.length>0?t:`.`};function Ps(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(i!==s-1&&a!==1){if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1}i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const Fs=function(e){return Ts.test(e)},Is=function(e){return Cs(e)},Ls=function(e){if(e===`..`)return``;let t=Os.exec(Cs(e));return t&&t[1]||``},Rs=function(e,t){let n=Ns(e).replace(Ds,`$1`).split(`/`),r=Ns(t).replace(Ds,`$1`).split(`/`);if(r[0][1]===`:`&&n[0][1]===`:`&&n[0]!==r[0])return r.join(`/`);let i=[...n];for(let e of i){if(r[0]!==e)break;n.shift(),r.shift()}return[...n.map(()=>`..`),...r].join(`/`)},zs=function(e){let t=Cs(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&Es.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(Fs(e)?`/`:`.`)},Bs=function(e){let t=e.ext?e.ext.startsWith(`.`)?e.ext:`.${e.ext}`:``,n=[e.root,e.dir,e.base??(e.name??``)+t].filter(Boolean);return Cs(e.root?Ns(...n):n.join(`/`))},Vs=function(e,t){let n=Cs(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r},Hs={__proto__:null,basename:Vs,dirname:zs,extname:Ls,format:Bs,isAbsolute:Fs,join:js,matchesGlob:(e,t)=>xs(t,As(e)),normalize:As,normalizeString:Ps,parse:function(e){let t=ks.exec(e)?.[0]?.replace(/\\/g,`/`)||``,n=Vs(e),r=Ls(n);return{root:t,dir:zs(e),base:n,ext:r,name:n.slice(0,n.length-r.length)}},relative:Rs,resolve:Ns,sep:`/`,toNamespacedPath:Is},Us=globalThis.process?.platform===`win32`?`;`:`:`,Ws={posix:void 0,win32:void 0},Gs=(e=Us)=>new Proxy(Hs,{get(t,n){return n===`delimiter`?e:n===`posix`?Ks:n===`win32`?qs:Ws[n]||Hs[n]}}),Ks=/* @__PURE__ */ Gs(`:`),qs=/* @__PURE__ */ Gs(`;`);var Js=/* @__PURE__ */ A(((e,t)=>{let n=/[\t\n\f\r "#'()/;[\\\]{}]/g,r=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,i=/.[\r\n"'(/\\]/,a=/[\da-f]/i;t.exports=function(e,t={}){let o=e.css.valueOf(),s=t.ignoreErrors,c,l,u,d,f,p,m,h,g,_,v=o.length,y=0,b=[],x=[],S=-1;function C(){return y}function w(t){throw e.error(`Unclosed `+t,y)}function ee(){return x.length===0&&y>=v}function T(e){if(x.length)return x.pop();if(y>=v)return;let t=e?e.ignoreUnclosed:!1;switch(c=o.charCodeAt(y),c){case 10:case 32:case 9:case 13:case 12:d=y;do d+=1,c=o.charCodeAt(d);while(c===32||c===10||c===9||c===13||c===12);p=[`space`,o.slice(y,d)],y=d-1;break;case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let e=String.fromCharCode(c);p=[e,e,y];break}case 40:if(_=b.length?b.pop()[1]:``,g=o.charCodeAt(y+1),_===`url`&&g!==39&&g!==34&&g!==32&&g!==10&&g!==9&&g!==12&&g!==13){d=y;do{if(m=!1,d=o.indexOf(`)`,d+1),d===-1){if(s||t){d=y;break}w(`bracket`)}for(h=d;o.charCodeAt(h-1)===92;)--h,m=!m}while(m);p=[`brackets`,o.slice(y,d+1),y,d],y=d}else y<=S?p=[`(`,`(`,y]:(d=o.indexOf(`)`,y+1),l=o.slice(y,d+1),d===-1||i.test(l)?(S=d===-1?v:d,p=[`(`,`(`,y]):(p=[`brackets`,l,y,d],y=d));break;case 39:case 34:f=c===39?`'`:`"`,d=y;do{if(m=!1,d=o.indexOf(f,d+1),d===-1){if(s||t){d=y+1;break}w(`string`)}for(h=d;o.charCodeAt(h-1)===92;)--h,m=!m}while(m);p=[`string`,o.slice(y,d+1),y,d],y=d;break;case 64:n.lastIndex=y+1,n.test(o),d=n.lastIndex===0?o.length-1:n.lastIndex-2,p=[`at-word`,o.slice(y,d+1),y,d],y=d;break;case 92:for(d=y,u=!0;o.charCodeAt(d+1)===92;)d+=1,u=!u;if(c=o.charCodeAt(d+1),u&&c!==47&&c!==32&&c!==10&&c!==9&&c!==13&&c!==12&&(d+=1,a.test(o.charAt(d)))){for(;a.test(o.charAt(d+1));)d+=1;o.charCodeAt(d+1)===32&&(d+=1)}p=[`word`,o.slice(y,d+1),y,d],y=d;break;default:c===47&&o.charCodeAt(y+1)===42?(d=o.indexOf(`*/`,y+2)+1,d===0&&(s||t?d=o.length:w(`comment`)),p=[`comment`,o.slice(y,d+1),y,d],y=d):(r.lastIndex=y+1,r.test(o),d=r.lastIndex===0?o.length-1:r.lastIndex-2,p=[`word`,o.slice(y,d+1),y,d],b.push(p),y=d)}return y++,p}function te(e){x.push(e)}return{back:te,endOfFile:ee,nextToken:T,position:C}}})),Ys=/* @__PURE__ */ A(((e,t)=>{let n=nn(),r=Js(),i;function a(e){i=e}let o={";":n.yellow,":":n.yellow,"(":n.cyan,")":n.cyan,"[":n.yellow,"]":n.yellow,"{":n.yellow,"}":n.yellow,"at-word":n.cyan,brackets:n.cyan,call:n.cyan,class:n.yellow,comment:n.gray,hash:n.magenta,string:n.green};function s([e,t],n){if(e===`word`){if(t[0]===`.`)return`class`;if(t[0]===`#`)return`hash`}if(!n.endOfFile()){let e=n.nextToken();if(n.back(e),e[0]===`brackets`||e[0]===`(`)return`call`}return e}function c(e){let t=r(new i(e),{ignoreErrors:!0}),n=``;for(;!t.endOfFile();){let e=t.nextToken(),r=o[s(e,t)];n+=r?e[1].split(/\r?\n/).map(e=>r(e)).join(`
|
|
13
|
+
`)}}}}function Aa(e){if(!/^[a-z][a-z\d]*(?:[.-][a-z\d]+)*$/.test(e))throw Error(`Invalid core-js polyfill module: ${JSON.stringify(e)}. Use a module name such as "web.url".`);try{return Se.resolve(`core-js/modules/${e}.js`)}catch(t){throw Error(`Unknown core-js polyfill module: ${JSON.stringify(e)}.`,{cause:t})}}var ja=class{original;#e=/* @__PURE__ */ new Map;#t=[];constructor(e){this.original=e}overwrite(e,t,n){this.#t.push({content:n,end:t,start:e})}prependLeft(e,t){this.#n(e).prepend.push(t)}appendLeft(e,t){this.#n(e).append.push(t)}appendRight(e,t){this.#n(e).append.push(t)}compile(){let e={original:this.original,replacements:this.#t.toSorted((e,t)=>e.start-t.start||t.end-e.end),insertions:[...this.#e].sort(([e],[t])=>e-t).map(([e,t])=>({start:e,content:t.prepend.toReversed().join(``)+t.append.join(``)}))};return{render:(t,n)=>Na(e,t,n,!0,!0),renderOutside:t=>Ma(e,t)}}#n(e){let t=this.#e.get(e);if(t)return t;let n={append:[],prepend:[]};return this.#e.set(e,n),n}};function Ma(e,t){let n=[],r=0,i=!0;for(let a of t)n.push(Na(e,r,a.start,i,!1)),r=a.end,i=!1;return n.push(Na(e,r,e.original.length,i,!0)),n.join(``)}function Na(e,t,n,r,i){let a=t,o=Pa(e.insertions,t),s=[],c=(n,i)=>{for(;o<e.insertions.length;){let c=e.insertions[o];if(c.start>n||c.start===n&&!i)break;o++,!(c.start<a||c.start===t&&!r)&&(s.push(e.original.slice(a,c.start),c.content),a=c.start)}s.push(e.original.slice(a,n)),a=n};for(let r=Pa(e.replacements,t);r<e.replacements.length;r++){let t=e.replacements[r];if(t.start>=n)break;if(!(t.end>n||t.end<=a)){if(t.start<a)throw Error(`Partially overlapping source edits at ${t.start}:${t.end}`);c(t.start,!1),s.push(t.content),a=t.end}}return c(n,i),s.join(``)}function Pa(e,t){let n=0,r=e.length;for(;n<r;){let i=Math.floor((n+r)/2);e[i].start<t?n=i+1:r=i}return n}function Fa(e){let t=h(e.filename,e.code);if(t.errors.length>0){let n=t.errors.map(e=>e.message).join(`; `);throw Error(`Failed to parse ${e.filename} with Oxc: ${n}`)}let n=Ia(t.program,e.filename);if(!e.sourcemap){let t=new ja(e.code);return Ba(t,n),Ga(t,n,e),{code:Ya(t,n,e),map:null}}let r=new p(e.code,{filename:e.filename});return Ba(r,n),Ga(r,n,e),Xa(r,n,e),{code:r.toString(),map:Co(r,e.filename)}}function Ia(e,t){let n=/* @__PURE__ */ new Set,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=[],o=[],s=[],c=/* @__PURE__ */ new Set,l=/* @__PURE__ */ new Set,u=new $e({preserveExitedScopes:!0}),d=0,f=!1,p=!1;Ze(e,{scopeTracker:u,enter(e,t){if(e.type===`Identifier`&&n.add(e.name),e.type===`CallExpression`&&e.callee.type===`Identifier`&&e.callee.name===`eval`&&(f=!0),_o(e)&&(d+=1),e.type===`AwaitExpression`&&d===0&&(p=!0),e.type===`VariableDeclaration`&&d===0&&(e.kind===`var`||t?.type===`Program`)&&(o.push(e),e.kind===`var`)){if(t?.type!==`Program`){let n=(t?.type===`ForInStatement`||t?.type===`ForOfStatement`)&&t.left===e;s.push({declaration:e,isForIterationBinding:n})}fo(e).forEach(e=>{l.add(e)})}},leave(e){_o(e)&&--d}});for(let n of e.body)switch(n.type){case`ImportDeclaration`:La(n,i,c,l,t);break;case`ExportNamedDeclaration`:Ra(n,r,t);break;case`ExportDefaultDeclaration`:case`ExportAllDeclaration`:throw So(t,`source-level ${n.type}`);case`VariableDeclaration`:bo(n,t),n.declarations.flatMap(e=>po(e.id)).forEach(e=>{l.add(e)});break;case`FunctionDeclaration`:{let e=n.id;a.push(n),l.add(e.name);break}case`ClassDeclaration`:{let e=n.id;l.add(e.name);break}}u.freeze(),yo(f,t);let m=co(n,i.size);return za(r,l,t),{dependencies:[...i.values()],exportNamesByLocal:r,functions:a,generatedNames:m,hasTopLevelAwait:p,importBindings:c,moduleVariables:o,nestedHoistedVariables:s,outerBindings:l,program:e,scopes:u}}function La(e,t,n,r,i){if(e.phase||e.attributes.length>0||e.importKind===`type`)throw So(i,`import phases, attributes, or type-only imports`);let a=e.source.value,o=t.get(a)??{source:a,imports:[]};t.has(a)||t.set(a,o);for(let t of e.specifiers)switch(n.add(t.local.name),r.add(t.local.name),t.type){case`ImportDefaultSpecifier`:o.imports.push({imported:`default`,local:t.local.name});break;case`ImportNamespaceSpecifier`:o.imports.push({imported:null,local:t.local.name});break;case`ImportSpecifier`:o.imports.push({imported:lo(t.imported),local:t.local.name})}}function Ra(e,t,n){if(e.declaration||e.source||e.attributes.length>0||e.exportKind===`type`)throw So(n,`declaration exports, re-exports, export attributes, or type-only exports`);for(let n of e.specifiers){let e=lo(n.local),r=lo(n.exported),i=t.get(e)??[];i.push(r),t.has(e)||t.set(e,i)}}function za(e,t,n){for(let r of e.keys())if(!t.has(r))throw So(n,`export of non-module binding ${JSON.stringify(r)}`)}function Ba(e,t){for(let n of t.program.body)switch(n.type){case`ImportDeclaration`:e.overwrite(n.start,n.end,``);break;case`ExportNamedDeclaration`:e.overwrite(n.start,n.end,$a(n.specifiers,t));break;case`VariableDeclaration`:Va(e,n,t.generatedNames.exportBinding,t.exportNamesByLocal);break;case`ClassDeclaration`:Wa(e,n,t.generatedNames.exportBinding,t.exportNamesByLocal)}for(let{declaration:n,isForIterationBinding:r}of t.nestedHoistedVariables)Ha(e,n,r,t.generatedNames.exportBinding,t.exportNamesByLocal)}function Va(e,t,n,r){let i=t.declarations[0];e.overwrite(t.start,i.start,`(`),e.appendLeft(xo(e.original,t.end),`)`),Ua(e,t,n,r)}function Ha(e,t,n,r,i){let a=t.declarations[0];e.overwrite(t.start,a.start,n?``:`(`),n||e.appendLeft(xo(e.original,t.end),`)`),Ua(e,t,r,i)}function Ua(e,t,n,r){for(let i of t.declarations){if(!i.init)continue;let t=po(i.id).flatMap(e=>(r.get(e)??[]).map(t=>({exported:t,local:e})));if(t.length!==0){if(i.id.type===`Identifier`){let t=r.get(i.id.name);e.prependLeft(i.start,no(n,t,``)),e.appendRight(i.end,ro(t));continue}e.prependLeft(i.start,`(`),e.appendRight(i.end,`,${t.map(({exported:e,local:t})=>oo(n,e,t)).join(`,`)})`)}}}function Wa(e,t,n,r){let i=t.id,a=r.get(i.name)??[];e.prependLeft(t.start,no(n,a,`${i.name}=`)),e.appendRight(t.end,ro(a))}function Ga(e,t,n){let r=t.scopes,i=0;Ze(t.program,{scopeTracker:r,enter(a){switch(vo(a)&&(i+=1),a.type){case`ImportExpression`:if(a.options||a.phase)throw So(n.filename,`dynamic import options or phases`);e.overwrite(a.start,a.source.start,`${t.generatedNames.context}.import(`),a.source.type===`Literal`&&typeof a.source.value==`string`&&e.overwrite(a.source.start,a.source.end,JSON.stringify(n.resolveReference(a.source.value,`dynamic`)));break;case`MetaProperty`:a.meta.name===`import`&&a.property.name===`meta`&&e.overwrite(a.start,a.end,`${t.generatedNames.context}.meta`);break;case`ThisExpression`:i===0&&e.overwrite(a.start,a.end,`void 0`);break;case`AssignmentExpression`:Ka(e,a.left,a.start,a.end,r,t,n.filename);break;case`UpdateExpression`:qa(e,a,r,t);break;case`ForInStatement`:case`ForOfStatement`:a.left.type!==`VariableDeclaration`&&Ja(a.left,r,t.exportNamesByLocal,n.filename)}},leave(e){vo(e)&&--i}})}function Ka(e,t,n,r,i,a,o){if(t.type===`Identifier`){let o=to(t.name,i,a.exportNamesByLocal);if(o.length===0)return;e.prependLeft(n,no(a.generatedNames.exportBinding,o,``)),e.appendRight(r,ro(o));return}Ja(t,i,a.exportNamesByLocal,o)}function qa(e,t,n,r){if(t.argument.type!==`Identifier`)return;let i=to(t.argument.name,n,r.exportNamesByLocal);if(i.length===0)return;if(t.prefix){e.prependLeft(t.start,no(r.generatedNames.exportBinding,i,``)),e.appendRight(t.end,ro(i));return}let a=`+${t.argument.name}${t.operator[0]}1`;e.prependLeft(t.start,`(${io(r.generatedNames.exportBinding,i,a)},`),e.appendRight(t.end,`)`)}function Ja(e,t,n,r){let i=mo(e).filter(e=>to(e,t,n).length>0);if(i.length>0)throw So(r,`destructuring write to exported binding ${JSON.stringify(i[0])}`)}function Ya(e,t,n){let r=Za(t,n),i=e.compile(),a=t.functions.map(e=>i.render(e.start,e.end)).join(``);return`${r.prefix}${i.renderOutside(t.functions)}}};${a}${r.suffix}`}function Xa(e,t,n){let r=Za(t,n);for(let n of t.functions)e.move(n.start,n.end,e.original.length);e.prepend(r.prefix),e.prependLeft(e.original.length,`}};`),e.append(r.suffix)}function Za(e,t){let n=e.dependencies.map(e=>t.resolveReference(e.source,`static`)),r=e.dependencies.map((t,n)=>eo(t,n,e.generatedNames)),i=Qa(e),a=e.outerBindings.size>0?`var ${[...e.outerBindings].join(`,`)};`:``,o=e.hasTopLevelAwait?`async function`:`function`,s=`function(${e.generatedNames.exportBinding},${e.generatedNames.context}){"use strict";${a}${i}return {setters:[${r.join(`,`)}],execute:${o}(){`;return t.format===`system-register`?{prefix:`System.register(${JSON.stringify(n)},${s}`,suffix:`})`}:{prefix:`module.exports=[${JSON.stringify(n)},${s}`,suffix:`}]`}}function Qa(e){let t=new Set(e.functions.map(e=>e.id.name)),n=[];for(let[r,i]of e.exportNamesByLocal)if(t.has(r))for(let e of i)n.push({exported:e,value:r});for(let t of e.moduleVariables)for(let r of t.declarations)if(!r.init)for(let t of po(r.id))for(let r of e.exportNamesByLocal.get(t)??[])n.push({exported:r,value:`void 0`});if(n.length===0)return``;if(n.length===1){let[t]=n;return so(e.generatedNames.exportBinding,t.exported,t.value)}let r=n.map(({exported:e,value:t})=>`[${JSON.stringify(e)}]:${t}`).join(`,`);return`${e.generatedNames.exportBinding}({${r}});`}function $a(e,t){return e.filter(e=>t.importBindings.has(lo(e.local))).map(e=>{let n=lo(e.local);return so(t.generatedNames.exportBinding,lo(e.exported),n)}).join(``)}function eo(e,t,n){let r=`${n.dependencyPrefix}${t}`;return`function(${r}){${e.imports.flatMap(e=>{let t=e.imported===null?r:uo(r,e.imported);return[`${e.local}=${t};`]}).join(``)}}`}function to(e,t,n){let r=n.get(e)??[];return r.length===0||t.getDeclaration(e)?.scope===``?r:[]}function no(e,t,n){return t.length===0?n:t.reduce((t,n)=>`${ao(e,n)}${t}`,n)}function ro(e){return`)`.repeat(e.length)}function io(e,t,n){return t.reduce((t,n)=>`${ao(e,n)}${t})`,n)}function ao(e,t){return`${e}(${JSON.stringify(t)},`}function oo(e,t,n){return`${e}(${JSON.stringify(t)},${n})`}function so(e,t,n){return`${e}(${JSON.stringify(t)},${n});`}function co(e,t){let n=t=>{let n=0,r=t;for(;e.has(r);)n+=1,r=`${t}${n}`;return r};return{context:n(`__systemContext`),exportBinding:n(`__systemExport`),dependencyPrefix:(n=>{let r=0,i=n;for(;;){let a=0;for(;a<t&&!e.has(`${i}${a}`);)a+=1;if(a===t)return i;r+=1,i=`${n}${r}`}})(`__systemDependency`)}}function lo(e){return e.type===`Literal`?String(e.value):e.name}function uo(e,t){return/^[$A-Z_a-z][$\w]*$/.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`}function fo(e){return e.declarations.flatMap(e=>po(e.id))}function po(e){return ho(e)}function mo(e){return ho(e)}function ho(e){switch(e.type){case`Identifier`:return[e.name];case`AssignmentPattern`:return ho(e.left);case`ArrayPattern`:return e.elements.flatMap(e=>e?ho(e):[]);case`ObjectPattern`:return e.properties.flatMap(e=>e.type===`Property`?ho(e.value):ho(e.argument));case`RestElement`:return ho(e.argument);default:return[]}}function go(e){return e.type===`FunctionDeclaration`||e.type===`FunctionExpression`||e.type===`ArrowFunctionExpression`||e.type===`TSEmptyBodyFunctionExpression`}function _o(e){return go(e)||e.type===`ClassDeclaration`||e.type===`ClassExpression`}function vo(e){return go(e)&&e.type!==`ArrowFunctionExpression`||e.type===`ClassDeclaration`||e.type===`ClassExpression`}function yo(e,t){if(e)throw So(t,`direct eval`)}function bo(e,t){if(e.kind===`using`||e.kind===`await using`||e.declare)throw So(t,`using or ambient variable declaration`)}function xo(e,t){return e[t-1]===`;`?t-1:t}function So(e,t){return/* @__PURE__ */ Error(`Unsupported final Rolldown chunk ${e}: ${t}`)}function Co(e,t){let n=e.generateMap({file:t,hires:`boundary`,includeContent:!0,source:t});return{version:n.version,file:n.file,sources:n.sources,sourcesContent:n.sourcesContent,names:n.names,mappings:n.mappings}}function wo(e,t,n){return Fa({code:e,filename:t.fileName,format:`commonjs-registration`,sourcemap:n,resolveReference(e,n){return To(t.fileName,e,n)}})}function To(e,t,n){return n===`dynamic`&&!t.startsWith(`./`)&&!t.startsWith(`../`)?t:oa(e,t)}function Eo({code:e,chunk:t,chunks:n,getPhysicalChunkId:r,sourcemap:i}){let a=h(t.fileName,e);if(a.errors.length>0){let e=a.errors.map(e=>e.message).join(`; `);throw Error(`Failed to parse ${t.fileName} with Oxc: ${e}`)}let o=Do(a.program,t,n,r),s=new p(e,{filename:t.fileName});ko(s,o,t.fileName);let c=Ao(s,o,t.fileName);Oo(s,o);let l=o.exportNamesByLocal.size>0,u=Jo(o),d=c?`var ${o.postfixTemp};`:``,f=Ko(o);return l?s.prepend(`"use strict";Object.defineProperty(exports,"__esModule",{value:true});${u}${d}${f}`):s.prepend(`"use strict";${u}${d}${f}`),{code:s.toString(),map:i?ns(s,t.fileName):null}}function Do(e,t,n,i){let a=/* @__PURE__ */ new Set,o=/* @__PURE__ */ new Map,s=[],c=/* @__PURE__ */ new Map,l=new $e({preserveExitedScopes:!0}),u=[],d=!1;if(Ze(e,{scopeTracker:l,enter(e){e.type===`Identifier`&&a.add(e.name),e.type===`CallExpression`&&e.callee.type===`Identifier`&&e.callee.name===`eval`&&(d=!0),e.type===`ImportExpression`&&u.push(e)}}),l.freeze(),d)throw ts(t.fileName,`direct eval`);let f=0;function p(e,t){let n=t;if(n===void 0){for(n=f===0?`__nativeImport`:`__nativeImport${f}`;a.has(n);)f+=1,n=`__nativeImport${f}`;a.add(n),f+=1}let r=n;return{bindings:e.specifiers.map(e=>{let t={imported:e.type===`ImportNamespaceSpecifier`?null:e.type===`ImportDefaultSpecifier`?`default`:Zo(e.imported),local:e.local.name,namespace:r};return c.set(t.local,t),t}),capsuleBinding:null,interop:qo(e),namespace:r,reference:e.source.value}}for(let r of e.body)switch(r.type){case`ImportDeclaration`:if(Yo(r,t.fileName),Go(t.fileName,r.source.value,n)){s.push({...p(r,void 0),capsuleBinding:{logicalId:oa(t.fileName,r.source.value)},interop:`none`});continue}s.push(p(r,void 0));break;case`ExportNamedDeclaration`:Fo(r,o,t.fileName);break;case`ExportDefaultDeclaration`:case`ExportAllDeclaration`:throw ts(t.fileName,`source-level ${r.type}`)}if(u.length>0||s.some(e=>e.capsuleBinding)){let e=r.posix.relative(r.posix.dirname(i(t)),i(Ft)),n=e.startsWith(`../`)?e:`./${e}`,o=Xo(`__nativeSystem`,a),c=h(t.fileName,`import { System as ${o} } from ${JSON.stringify(n)}`).program.body[0],l=s.findIndex(e=>e.reference===n),u=l<0?void 0:s.splice(l,1)[0],d=p(c,u?.namespace);s.unshift(u?{...u,bindings:[...d.bindings,...u.bindings]}:d)}return{defaultInterop:Xo(`__nativeDefault`,a),dynamicImports:u,exportNamesByLocal:o,imports:s,importBindingsByLocal:c,namespaceInterop:Xo(`__nativeNamespace`,a),postfixTemp:Xo(`__nativePostfix`,a),program:e,scopes:l}}function Oo(e,t){for(let n of t.program.body)switch(n.type){case`ImportDeclaration`:e.remove(n.start,n.end);break;case`ExportNamedDeclaration`:n.declaration?(e.remove(n.start,n.declaration.start),Io(e,n.declaration,t.exportNamesByLocal)):e.overwrite(n.start,n.end,Lo(n.specifiers,t));break;case`VariableDeclaration`:Ro(e,n,t.exportNamesByLocal);break;case`FunctionDeclaration`:n.id&&zo(e,n.end,n.id.name,t.exportNamesByLocal);break;case`ClassDeclaration`:n.id&&zo(e,n.end,n.id.name,t.exportNamesByLocal)}}function ko(e,t,n){for(let r of t.dynamicImports){if(r.options||r.phase)throw ts(n,`dynamic import options or phases`);let i=Uo(t.imports[0].bindings[0]);e.overwrite(r.start,r.source.start,`${i}.import(`),r.source.type===`Literal`&&typeof r.source.value==`string`&&(r.source.value.startsWith(`./`)||r.source.value.startsWith(`../`))&&e.overwrite(r.source.start,r.source.end,JSON.stringify(oa(n,r.source.value)))}}function Ao(e,t,n){let r=[],i=0,a=!1;return Ze(t.program,{scopeTracker:t.scopes,enter(o,s){if(es(o)&&(i+=1),o.type===`ThisExpression`&&i===0&&e.overwrite(o.start,o.end,`void 0`),o.type===`Identifier`&&s?.type!==`ImportDeclaration`&&rt(o,s)){let n=t.importBindingsByLocal.get(o.name),i=n?t.scopes.getDeclaration(o.name):null;if(n&&i?.type===`Import`){let t=Ho(o,s,r),i=Uo(n),a=t===`unbound`?`(0,${i})`:i;e.overwrite(o.start,o.end,s?.type===`Property`&&s.shorthand&&s.value===o?`${o.name}:${a}`:a)}}switch(o.type){case`AssignmentExpression`:jo(e,o.left,o.start,t,n);break;case`UpdateExpression`:Mo(e,o,t)&&(a=!0);break;case`ForInStatement`:case`ForOfStatement`:o.left.type!==`VariableDeclaration`&&No(o.left,t,n)}r.push(o)},leave(e){r.pop(),es(e)&&--i}}),a}function jo(e,t,n,r,i){if(t.type===`Identifier`){let i=Po(t.name,r);i.length>0&&e.prependLeft(n,Bo(i));return}No(t,r,i)}function Mo(e,t,n){if(t.argument.type!==`Identifier`)return!1;let r=Po(t.argument.name,n);return r.length===0?!1:t.prefix?(e.prependLeft(t.start,Bo(r)),!1):(e.prependLeft(t.start,`(${n.postfixTemp}=`),e.appendRight(t.end,`,${Vo(r,t.argument.name)},${n.postfixTemp})`),!0)}function No(e,t,n){let r=$o(e).filter(e=>Po(e,t).length>0);if(r.length>0)throw ts(n,`destructuring write to exported binding ${JSON.stringify(r[0])}`)}function Po(e,t){let n=t.exportNamesByLocal.get(e)??[];return n.length===0||t.scopes.getDeclaration(e)?.scope===``?n:[]}function Fo(e,t,n){if(e.source||e.attributes.length>0||e.exportKind===`type`)throw ts(n,`re-exports, export attributes, or type-only exports`);if(e.declaration){for(let r of Qo(e.declaration,n)){let e=t.get(r)??[];e.push(r),t.has(r)||t.set(r,e)}return}for(let n of e.specifiers){let e=Zo(n.local),r=t.get(e)??[];r.push(Zo(n.exported)),t.has(e)||t.set(e,r)}}function Io(e,t,n){switch(t.type){case`VariableDeclaration`:Ro(e,t,n);break;case`FunctionDeclaration`:case`ClassDeclaration`:t.id&&zo(e,t.end,t.id.name,n)}}function Lo(e,t){return e.map(e=>{let n=Zo(e.local),r=Zo(e.exported),i=t.importBindingsByLocal.get(n);return i?`Object.defineProperty(exports,${JSON.stringify(r)},{enumerable:true,get:function(){return ${Uo(i)}}});`:``}).join(``)}function Ro(e,t,n){for(let r of t.declarations){if(r.id.type!==`Identifier`){if($o(r.id).filter(e=>n.has(e)).length>0)throw ts(`native chunk`,`exported destructuring declaration`);continue}let t=n.get(r.id.name)??[];t.length!==0&&(r.init?e.prependLeft(r.init.start,Bo(t)):e.appendRight(r.end,`=${Vo(t,`void 0`)}`))}}function zo(e,t,n,r){let i=r.get(n)??[];i.length>0&&e.appendRight(t,`;${Vo(i,n)};`)}function Bo(e){return e.reduce((e,t)=>`exports[${JSON.stringify(t)}]=${e}`,``)}function Vo(e,t){return`${Bo(e)}${t}`}function Ho(e,t,n){let r=e,i=t,a=n.length-1;for(;i?.type===`ParenthesizedExpression`&&i.expression===r;)r=i,--a,i=n[a];return i?.type===`CallExpression`&&i.callee===r?`unbound`:i?.type===`NewExpression`&&i.callee===r?`plain`:i?.type===`TaggedTemplateExpression`&&i.tag===r?`unbound`:`plain`}function Uo(e){return e.imported===null?e.namespace:Wo(e.namespace,e.imported)}function Wo(e,t){return/^[$A-Z_a-z][$\w]*$/.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`}function Go(e,t,n){if(!t.startsWith(`./`)&&!t.startsWith(`../`))return;let r=n[aa(e,t)];if(!r)return;let i=tn(r);return i===`entry-capsule`||i===`normal-capsule`?r:void 0}function Ko(e){return e.imports.map(t=>{if(t.capsuleBinding){let n=`${Uo(e.imports[0].bindings[0])}.importSync(${JSON.stringify(t.capsuleBinding.logicalId)})`;return`var ${t.namespace}=${n};`}let n=`require(${JSON.stringify(t.reference)})`;if(t.bindings.length===0)return`${n};`;let r=t.interop==="default"?`${e.defaultInterop}(${n})`:t.interop===`namespace`?`${e.namespaceInterop}(${n})`:n;return`var ${t.namespace}=${r};`}).join(``)}function qo(e){return e.specifiers.some(e=>e.type===`ImportNamespaceSpecifier`)?`namespace`:e.specifiers.some(e=>e.type===`ImportDefaultSpecifier`)?`default`:`none`}function Jo(e){let t=new Set(e.imports.map(({interop:e})=>e));return`${t.has(`default`)?`function ${e.defaultInterop}(value){return value&&value.__esModule?value:{default:value};}`:``}${t.has(`namespace`)?`function ${e.namespaceInterop}(value){if(value&&value.__esModule)return value;var namespace={default:value};if(value!==null&&(typeof value==="object"||typeof value==="function")){for(var key in value)if(key!=="default"&&Object.prototype.hasOwnProperty.call(value,key))Object.defineProperty(namespace,key,{enumerable:true,get:function(key){return function(){return value[key]}}(key)});}return namespace;}`:``}`}function Yo(e,t){if(e.phase||e.attributes.length>0||e.importKind===`type`)throw ts(t,`import phases, attributes, or type-only imports`)}function Xo(e,t){let n=0,r=e;for(;t.has(r);)n+=1,r=`${e}${n}`;return t.add(r),r}function Zo(e){return e.type===`Literal`?String(e.value):e.name}function Qo(e,t){return e.type===`VariableDeclaration`?e.declarations.flatMap(({id:e})=>$o(e)):[e.id.name]}function $o(e){switch(e.type){case`Identifier`:return[e.name];case`AssignmentPattern`:return $o(e.left);case`ArrayPattern`:return e.elements.flatMap(e=>e?$o(e):[]);case`ObjectPattern`:return e.properties.flatMap(e=>e.type===`Property`?$o(e.value):$o(e.argument));case`RestElement`:return $o(e.argument);default:return[]}}function es(e){return e.type===`FunctionDeclaration`||e.type===`FunctionExpression`||e.type===`ClassDeclaration`||e.type===`ClassExpression`}function ts(e,t){return/* @__PURE__ */ Error(`Unsupported final Rolldown native chunk ${e}: ${t}`)}function ns(e,t){let n=e.generateMap({file:t,hires:`boundary`,includeContent:!0,source:t});return{version:n.version,file:n.file,sources:n.sources,sourcesContent:n.sourcesContent,names:n.names,mappings:n.mappings}}function rs({code:e,id:t,appConfig:n,sourcemap:r}){return St(e,t,{__VPT_APP_CONFIG__:JSON.stringify(n)},r??!1)}function is({code:e,id:t,page:n,sourcemap:r}){return St(e,t,{__VPT_PAGE_OPTIONS__:JSON.stringify({path:n.path,config:n.config,prerender:n.prerender===!0})},r??!1)}function as(e){let t=s(Lt),n=s(Ht),i=os(e.options.pages),a=new Map(e.options.pages.map(e=>[e.path,e])),o=/* @__PURE__ */ new Map([[`\0vite/preload-helper.js`,()=>Ft],[`\0vpt:taro-target-runtime`,()=>e.taro.targetRuntimePath],[`\0vpt:app-component`,(t,n)=>ke({appPath:e.options.app,projectRoot:n})],[Jt,(e,t)=>Ae({pagePath:cs({moduleId:e,pageByPath:a}).path,projectRoot:t})],[`\0vpt:page-capsule`,e=>{let t=cs({moduleId:e,pageByPath:a});return ss({moduleId:Ht,pagePath:t.path})}]]);return{...i,resolveId(e,t,n){return e===`\0vpt:mini-transport`?{id:`./${r.posix.relative(`common`,qt)}`,external:!0}:o.get(e)?.(t,n)},specialize(r,i,o){let s=Ne(i);if(s===t)return rs({code:r,id:i,appConfig:bt(e.options),sourcemap:o});if(s===n)return is({code:r,id:i,page:cs({moduleId:i,pageByPath:a}),sourcemap:o})}}}function os(e){let t={capsuleId:Lt,capsuleName:`app-capsule`,shellId:It,shellName:`app.js`},n=e.map(e=>({capsuleId:ss({moduleId:Ht,pagePath:e.path}),capsuleName:`${e.path}-capsule`,shellId:ss({moduleId:Vt,pagePath:e.path}),shellName:`${e.path}.js`}));return{entries:{appEntries:t,pageEntries:n},input:Object.fromEntries([[`bootstrap`,Ft],[t.shellName,t.shellId],[t.capsuleName,t.capsuleId],[`comp.js`,Rt],[`component-capsule`,zt],[`custom-wrapper.js`,Bt],...n.flatMap(e=>[[e.shellName,e.shellId],[e.capsuleName,e.capsuleId]])])}}function ss({moduleId:e,pagePath:t}){return`${e}?route=${encodeURIComponent(t)}`}function cs({moduleId:e,pageByPath:t}){let n=e?.indexOf(`?`)??-1,r=n===-1?void 0:new URLSearchParams(e?.slice(n+1)).get(`route`),i=r?t.get(r):void 0;if(!i)throw Error(r?`Unknown Page capsule: ${r}`:`Page capsule import must originate from a route module`);return i}var ls;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.FLAG13=8192]=`FLAG13`,e[e.BRANCH_LENGTH=8064]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(ls||={});var us;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(us||={});var ds;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(ds||={});var fs;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(fs||={});var ps;(function(e){e[e.Tab=9]=`Tab`,e[e.NewLine=10]=`NewLine`,e[e.FormFeed=12]=`FormFeed`,e[e.CarriageReturn=13]=`CarriageReturn`,e[e.Space=32]=`Space`,e[e.ExclamationMark=33]=`ExclamationMark`,e[e.Number=35]=`Number`,e[e.Amp=38]=`Amp`,e[e.SingleQuote=39]=`SingleQuote`,e[e.DoubleQuote=34]=`DoubleQuote`,e[e.Dash=45]=`Dash`,e[e.Slash=47]=`Slash`,e[e.Zero=48]=`Zero`,e[e.Nine=57]=`Nine`,e[e.Semi=59]=`Semi`,e[e.Lt=60]=`Lt`,e[e.Eq=61]=`Eq`,e[e.Gt=62]=`Gt`,e[e.Questionmark=63]=`Questionmark`,e[e.UpperA=65]=`UpperA`,e[e.LowerA=97]=`LowerA`,e[e.UpperF=70]=`UpperF`,e[e.LowerF=102]=`LowerF`,e[e.UpperZ=90]=`UpperZ`,e[e.LowerZ=122]=`LowerZ`,e[e.LowerX=120]=`LowerX`,e[e.OpeningSquareBracket=91]=`OpeningSquareBracket`})(ps||={});var ms;(function(e){e[e.Text=1]=`Text`,e[e.BeforeTagName=2]=`BeforeTagName`,e[e.InTagName=3]=`InTagName`,e[e.InSelfClosingTag=4]=`InSelfClosingTag`,e[e.BeforeClosingTagName=5]=`BeforeClosingTagName`,e[e.InClosingTagName=6]=`InClosingTagName`,e[e.AfterClosingTagName=7]=`AfterClosingTagName`,e[e.BeforeAttributeName=8]=`BeforeAttributeName`,e[e.InAttributeName=9]=`InAttributeName`,e[e.AfterAttributeName=10]=`AfterAttributeName`,e[e.BeforeAttributeValue=11]=`BeforeAttributeValue`,e[e.InAttributeValueDq=12]=`InAttributeValueDq`,e[e.InAttributeValueSq=13]=`InAttributeValueSq`,e[e.InAttributeValueNq=14]=`InAttributeValueNq`,e[e.BeforeDeclaration=15]=`BeforeDeclaration`,e[e.InDeclaration=16]=`InDeclaration`,e[e.InProcessingInstruction=17]=`InProcessingInstruction`,e[e.BeforeComment=18]=`BeforeComment`,e[e.CDATASequence=19]=`CDATASequence`,e[e.DeclarationSequence=20]=`DeclarationSequence`,e[e.InSpecialComment=21]=`InSpecialComment`,e[e.InCommentLike=22]=`InCommentLike`,e[e.SpecialStartSequence=23]=`SpecialStartSequence`,e[e.InSpecialTag=24]=`InSpecialTag`,e[e.InPlainText=25]=`InPlainText`,e[e.InEntity=26]=`InEntity`})(ms||={});var hs;(function(e){e[e.NoValue=0]=`NoValue`,e[e.Unquoted=1]=`Unquoted`,e[e.Single=2]=`Single`,e[e.Double=3]=`Double`})(hs||={});const gs={Empty:/* @__PURE__ */ new Uint8Array,Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,33,62]),Doctype:new Uint8Array([100,111,99,116,121,112,101]),IframeEnd:new Uint8Array([60,47,105,102,114,97,109,101]),NoembedEnd:new Uint8Array([60,47,110,111,101,109,98,101,100]),NoframesEnd:new Uint8Array([60,47,110,111,102,114,97,109,101,115]),Plaintext:new Uint8Array([60,47,112,108,97,105,110,116,101,120,116]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97]),XmpEnd:new Uint8Array([60,47,120,109,112])};gs.IframeEnd[2],gs.IframeEnd,gs.NoembedEnd[2],gs.NoembedEnd,gs.Plaintext[2],gs.Plaintext,gs.ScriptEnd[2],gs.ScriptEnd,gs.TitleEnd[2],gs.TitleEnd,gs.XmpEnd[2],gs.XmpEnd;const{fromCodePoint:_s}=String;var vs;(function(e){e[e.None=0]=`None`,e[e.Svg=1]=`Svg`,e[e.MathML=2]=`MathML`})(vs||={});let ys=()=>{var e=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(t,n)=>{for(var r in n)e(t,r,{get:n[r],enumerable:!0})},a=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of n(a))!r.call(i,c)&&c!==o&&e(i,c,{get:()=>a[c],enumerable:!(s=t(a,c))||s.enumerable});return i},o=t=>a(e({},`__esModule`,{value:!0}),t),s={};i(s,{default:()=>Re});var c=e=>Array.isArray(e),l=e=>typeof e==`function`,u=e=>e.length===0,d=e=>typeof e==`number`,f=e=>typeof e==`object`&&!!e,p=e=>e instanceof RegExp,m=e=>typeof e==`string`,h=e=>e===void 0,g=e=>{let t=/* @__PURE__ */ new Map;return n=>{let r=t.get(n);if(r)return r;let i=e(n);return t.set(n,i),i}},_=(e,t,n={})=>{let r={cache:{},input:e,index:0,indexMax:0,options:n,output:[]};if(ie(t)(r)&&r.index===e.length)return r.output;throw Error(`Failed to parse at index ${r.indexMax}`)},v=(e,t)=>c(e)?y(e,t):m(e)?x(e,t):b(e,t),y=(e,t)=>{let n={};for(let t of e){if(t.length!==1)throw Error(`Invalid character: "${t}"`);let e=t.charCodeAt(0);n[e]=!0}return e=>{let r=e.index,i=e.input;for(;e.index<i.length&&i.charCodeAt(e.index)in n;)e.index+=1;let a=e.index;if(a>r){if(!h(t)&&!e.options.silent){let n=e.input.slice(r,a),o=l(t)?t(n,i,String(r)):t;h(o)||e.output.push(o)}e.indexMax=Math.max(e.indexMax,e.index)}return!0}},b=(e,t)=>{let n=e.source,r=e.flags.replace(/y|$/,`y`),i=new RegExp(n,r);return ne(e=>{i.lastIndex=e.index;let n=i.exec(e.input);if(n){if(!h(t)&&!e.options.silent){let r=l(t)?t(...n,e.input,String(e.index)):t;h(r)||e.output.push(r)}return e.index+=n[0].length,e.indexMax=Math.max(e.indexMax,e.index),!0}return!1})},x=(e,t)=>n=>{if(n.input.startsWith(e,n.index)){if(!h(t)&&!n.options.silent){let r=l(t)?t(e,n.input,String(n.index)):t;h(r)||n.output.push(r)}return n.index+=e.length,n.indexMax=Math.max(n.indexMax,n.index),!0}return!1},S=(e,t,n,r)=>{let i=ie(e);return ne(E(te(e=>{let r=0;for(;r<n;){let t=e.index;if(!i(e)||(r+=1,e.index===t))break}return r>=t})))},C=(e,t)=>S(e,0,1),w=(e,t)=>S(e,0,1/0),ee=(e,t)=>{let n=e.map(ie);return ne(E(te(e=>{for(let t=0,r=n.length;t<r;t++)if(!n[t](e))return!1;return!0})))},T=(e,t)=>{let n=e.map(ie);return ne(E(e=>{for(let t=0,r=n.length;t<r;t++)if(n[t](e))return!0;return!1}))},te=(e,t=!1)=>{let n=ie(e);return e=>{let r=e.index,i=e.output.length,a=n(e);return(!a||t)&&(e.index=r,e.output.length!==i&&(e.output.length=i)),a}},E=(e,t)=>ie(e),ne=(()=>{let e=0;return t=>{let n=ie(t),r=e+=1;return e=>{var t;if(e.options.memoization===!1)return n(e);let i=e.index,a=(t=e.cache)[r]||(t[r]=/* @__PURE__ */ new Map),o=a.get(i);if(o===!1)return!1;if(d(o))return e.index=o,!0;if(o)return e.index=o.index,o.output?.length&&e.output.push(...o.output),!0;{let t=e.output.length;if(n(e)){let n=e.index,r=e.output.length;if(r>t){let o=e.output.slice(t,r);a.set(i,{index:n,output:o})}else a.set(i,n);return!0}return a.set(i,!1),!1}}}})(),re=e=>{let t;return n=>(t||=ie(e()),t(n))},ie=g(e=>{if(l(e))return u(e)?re(e):e;if(m(e)||p(e))return v(e);if(c(e))return ee(e);if(f(e))return T(Object.values(e));throw Error(`Invalid rule`)}),ae=`abcdefghijklmnopqrstuvwxyz`,oe=e=>{let t=``;for(;e>0;)t=ae[(e-1)%26]+t,e=Math.floor((e-1)/26);return t},se=e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t=t*26+ae.indexOf(e[n])+1;return t},ce=(e,t)=>{if(t<e)return ce(t,e);let n=[];for(;e<=t;)n.push(e++);return n},le=(e,t,n)=>ce(e,t).map(e=>String(e).padStart(n,`0`)),ue=(e,t)=>ce(se(e),se(t)).map(oe),D=e=>e,de=e=>fe(t=>_(t,e,{memoization:!1}).join(``)),fe=e=>{let t={};return n=>t[n]??(t[n]=e(n))},pe=v(/^\*\*\/\*$/,`.*`),O=v(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/,(e,t,n)=>`.*${t?``:`(?:^|/)`}${n.replaceAll(`.`,`\\.`)}`),k=v(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/,(e,t,n,r)=>`.*${t?``:`(?:^|/)`}${n.replaceAll(`.`,`\\.`)}(?:${r.replaceAll(`,`,`|`).replaceAll(`.`,`\\.`)})`),me=v(/\\./,D),he=v(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),ge=v(/./,D),_e=T([v(/^(?:!!)*!(.*)$/,(e,t)=>`(?!^${Ne(t)}$).*?`),v(/^(!!)+/,``)]),ve=T([v(/\/(\*\*\/)+/,`(?:/.+/|/)`),v(/^(\*\*\/)+/,`(?:^|.*/)`),v(/\/(\*\*)$/,`(?:/.*|$)`),v(/\*\*/,`.*`)]),ye=T([v(/\*\/(?!\*\*\/)/,`[^/]*/`),v(/\*/,`[^/]*`)]),be=v(`?`,`[^/]`),A=v(`[`,D),j=v(`]`,D),M=v(/[!^]/,`^/`),xe=v(/[a-z]-[a-z]|[0-9]-[0-9]/i,D),Se=T([me,v(/[$.*+?^(){}[\|]/,e=>`\\${e}`),xe,v(/[^\]]/,D)]),Ce=ee([A,C(M),w(Se),j]),we=v(`{`,`(?:`),Te=v(`}`,`)`),Ee=ee([we,T([v(/(\d+)\.\.(\d+)/,(e,t,n)=>le(+t,+n,Math.min(t.length,n.length)).join(`|`)),v(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>ue(t,n).join(`|`)),v(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>ue(t.toLowerCase(),n.toLowerCase()).join(`|`).toUpperCase())]),Te]),De=v(`{`,`(?:`),Oe=v(`}`,`)`),ke=v(`,`,`|`),Ae=v(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),je=v(/[^}]/,D),Me=ee([De,w(T([ve,ye,be,Ce,Ee,re(()=>Me),me,Ae,ke,je])),Oe]),Ne=de(w(T([pe,O,k,_e,ve,ye,be,Ce,Ee,Me,me,he,ge]))),Pe=v(/\\./,D),Fe=v(/./,D),Ie=de(w(T([Pe,v(/\*\*\*+/,`*`),v(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),v(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Fe]))),Le=(e,t)=>{let n=Array.isArray(e)?e:[e];if(!n.length)return!1;let r=n.map(Le.compile),i=n.every(e=>/(\/(?:\*\*)?|\[\/\])$/.test(e)),a=t.replace(/[\\\/]+/g,`/`).replace(/\/$/,i?`/`:``);return r.some(e=>e.test(a))};Le.compile=e=>RegExp(`^${Ne(Ie(e))}$`,`s`);var Re=Le;return o(s)})();return e.default||e},bs;const xs=(e,t)=>(bs||(bs=ys(),ys=null),bs(e,t)),Ss=/^[A-Za-z]:\//;function Cs(e=``){return e&&e.replace(/\\/g,`/`).replace(Ss,e=>e.toUpperCase())}const ws=/^[/\\]{2}/,Ts=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Es=/^[A-Za-z]:$/,Ds=/^\/([A-Za-z]:)?$/,Os=/.(\.[^./]+|\.)$/,ks=/^[/\\]|^[a-zA-Z]:[/\\]/,As=function(e){if(e.length===0)return`.`;e=Cs(e);let t=e.match(ws),n=Fs(e),r=e[e.length-1]===`/`;return e=Ps(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),Es.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!Fs(e)?`/${e}`:e)},js=function(...e){let t=``;for(let n of e)if(n){if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;t+=e&&r?n.slice(1):e||r?n:`/${n}`}else t+=n}return As(t)};function Ms(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const Ns=function(...e){e=e.map(e=>Cs(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:Ms();i&&i.length!==0&&(t=`${i}/${t}`,n=Fs(i))}return t=Ps(t,!n),n&&!Fs(t)?`/${t}`:t.length>0?t:`.`};function Ps(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(i!==s-1&&a!==1){if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1}i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}const Fs=function(e){return Ts.test(e)},Is=function(e){return Cs(e)},Ls=function(e){if(e===`..`)return``;let t=Os.exec(Cs(e));return t&&t[1]||``},Rs=function(e,t){let n=Ns(e).replace(Ds,`$1`).split(`/`),r=Ns(t).replace(Ds,`$1`).split(`/`);if(r[0][1]===`:`&&n[0][1]===`:`&&n[0]!==r[0])return r.join(`/`);let i=[...n];for(let e of i){if(r[0]!==e)break;n.shift(),r.shift()}return[...n.map(()=>`..`),...r].join(`/`)},zs=function(e){let t=Cs(e).replace(/\/$/,``).split(`/`).slice(0,-1);return t.length===1&&Es.test(t[0])&&(t[0]+=`/`),t.join(`/`)||(Fs(e)?`/`:`.`)},Bs=function(e){let t=e.ext?e.ext.startsWith(`.`)?e.ext:`.${e.ext}`:``,n=[e.root,e.dir,e.base??(e.name??``)+t].filter(Boolean);return Cs(e.root?Ns(...n):n.join(`/`))},Vs=function(e,t){let n=Cs(e).split(`/`),r=``;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t){r=t;break}}return t&&r.endsWith(t)?r.slice(0,-t.length):r},Hs={__proto__:null,basename:Vs,dirname:zs,extname:Ls,format:Bs,isAbsolute:Fs,join:js,matchesGlob:(e,t)=>xs(t,As(e)),normalize:As,normalizeString:Ps,parse:function(e){let t=ks.exec(e)?.[0]?.replace(/\\/g,`/`)||``,n=Vs(e),r=Ls(n);return{root:t,dir:zs(e),base:n,ext:r,name:n.slice(0,n.length-r.length)}},relative:Rs,resolve:Ns,sep:`/`,toNamespacedPath:Is},Us=globalThis.process?.platform===`win32`?`;`:`:`,Ws={posix:void 0,win32:void 0},Gs=(e=Us)=>new Proxy(Hs,{get(t,n){return n===`delimiter`?e:n===`posix`?Ks:n===`win32`?qs:Ws[n]||Hs[n]}}),Ks=/* @__PURE__ */ Gs(`:`),qs=/* @__PURE__ */ Gs(`;`);var Js=/* @__PURE__ */ A(((e,t)=>{let n=/[\t\n\f\r "#'()/;[\\\]{}]/g,r=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,i=/.[\r\n"'(/\\]/,a=/[\da-f]/i;t.exports=function(e,t={}){let o=e.css.valueOf(),s=t.ignoreErrors,c,l,u,d,f,p,m,h,g,_,v=o.length,y=0,b=[],x=[],S=-1;function C(){return y}function w(t){throw e.error(`Unclosed `+t,y)}function ee(){return x.length===0&&y>=v}function T(e){if(x.length)return x.pop();if(y>=v)return;let t=e?e.ignoreUnclosed:!1;switch(c=o.charCodeAt(y),c){case 10:case 32:case 9:case 13:case 12:d=y;do d+=1,c=o.charCodeAt(d);while(c===32||c===10||c===9||c===13||c===12);p=[`space`,o.slice(y,d)],y=d-1;break;case 91:case 93:case 123:case 125:case 58:case 59:case 41:{let e=String.fromCharCode(c);p=[e,e,y];break}case 40:if(_=b.length?b.pop()[1]:``,g=o.charCodeAt(y+1),_===`url`&&g!==39&&g!==34&&g!==32&&g!==10&&g!==9&&g!==12&&g!==13){d=y;do{if(m=!1,d=o.indexOf(`)`,d+1),d===-1){if(s||t){d=y;break}w(`bracket`)}for(h=d;o.charCodeAt(h-1)===92;)--h,m=!m}while(m);p=[`brackets`,o.slice(y,d+1),y,d],y=d}else y<=S?p=[`(`,`(`,y]:(d=o.indexOf(`)`,y+1),l=o.slice(y,d+1),d===-1||i.test(l)?(S=d===-1?v:d,p=[`(`,`(`,y]):(p=[`brackets`,l,y,d],y=d));break;case 39:case 34:f=c===39?`'`:`"`,d=y;do{if(m=!1,d=o.indexOf(f,d+1),d===-1){if(s||t){d=y+1;break}w(`string`)}for(h=d;o.charCodeAt(h-1)===92;)--h,m=!m}while(m);p=[`string`,o.slice(y,d+1),y,d],y=d;break;case 64:n.lastIndex=y+1,n.test(o),d=n.lastIndex===0?o.length-1:n.lastIndex-2,p=[`at-word`,o.slice(y,d+1),y,d],y=d;break;case 92:for(d=y,u=!0;o.charCodeAt(d+1)===92;)d+=1,u=!u;if(c=o.charCodeAt(d+1),u&&c!==47&&c!==32&&c!==10&&c!==9&&c!==13&&c!==12&&(d+=1,a.test(o.charAt(d)))){for(;a.test(o.charAt(d+1));)d+=1;o.charCodeAt(d+1)===32&&(d+=1)}p=[`word`,o.slice(y,d+1),y,d],y=d;break;default:c===47&&o.charCodeAt(y+1)===42?(d=o.indexOf(`*/`,y+2)+1,d===0&&(s||t?d=o.length:w(`comment`)),p=[`comment`,o.slice(y,d+1),y,d],y=d):(r.lastIndex=y+1,r.test(o),d=r.lastIndex===0?o.length-1:r.lastIndex-2,p=[`word`,o.slice(y,d+1),y,d],b.push(p),y=d)}return y++,p}function te(e){x.push(e)}return{back:te,endOfFile:ee,nextToken:T,position:C}}})),Ys=/* @__PURE__ */ A(((e,t)=>{let n=nn(),r=Js(),i;function a(e){i=e}let o={";":n.yellow,":":n.yellow,"(":n.cyan,")":n.cyan,"[":n.yellow,"]":n.yellow,"{":n.yellow,"}":n.yellow,"at-word":n.cyan,brackets:n.cyan,call:n.cyan,class:n.yellow,comment:n.gray,hash:n.magenta,string:n.green};function s([e,t],n){if(e===`word`){if(t[0]===`.`)return`class`;if(t[0]===`#`)return`hash`}if(!n.endOfFile()){let e=n.nextToken();if(n.back(e),e[0]===`brackets`||e[0]===`(`)return`call`}return e}function c(e){let t=r(new i(e),{ignoreErrors:!0}),n=``;for(;!t.endOfFile();){let e=t.nextToken(),r=o[s(e,t)];n+=r?e[1].split(/\r?\n/).map(e=>r(e)).join(`
|
|
14
14
|
`):e[1]}return n}c.registerInput=a,t.exports=c})),Xs=/* @__PURE__ */ A(((e,t)=>{let n=nn(),r=Ys();var i=class e extends Error{constructor(t,n,r,i,a,o){super(t),this.name=`CssSyntaxError`,this.reason=t,a&&(this.file=a),i&&(this.source=i),o&&(this.plugin=o),n!==void 0&&r!==void 0&&(typeof n==`number`?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+`: `:``,this.message+=this.file?this.file:`<css input>`,this.line!==void 0&&(this.message+=`:`+this.line+`:`+this.column),this.message+=`: `+this.reason}showSourceCode(e){if(!this.source)return``;let t=this.source;e??=n.isColorSupported;let i=e=>e,a=e=>e,o=e=>e;if(e){let{bold:e,gray:t,red:s}=n.createColors(!0);a=t=>e(s(t)),i=e=>t(e),r&&(o=e=>r(e))}let s=t.split(/\r?\n/),c=Math.max(this.line-3,0),l=Math.min(this.line+2,s.length),u=String(l).length;return s.slice(c,l).map((e,t)=>{let n=c+1+t,r=` `+(` `+n).slice(-u)+` | `;if(n===this.line){if(e.length>160){let t=Math.max(0,this.column-20),n=Math.max(this.column+20,this.endColumn+20),s=e.slice(t,n),c=i(r.replace(/\d/g,` `))+e.slice(0,Math.min(this.column-1,19)).replace(/[^\t]/g,` `);return a(`>`)+i(r)+o(s)+`
|
|
15
15
|
`+c+a(`^`)}let t=i(r.replace(/\d/g,` `))+e.slice(0,this.column-1).replace(/[^\t]/g,` `);return a(`>`)+i(r)+o(e)+`
|
|
16
16
|
`+t+a(`^`)}return` `+i(r)+o(e)}).join(`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AstTransformResult } from '../../../utils/transform.ts';
|
|
2
2
|
/**
|
|
3
3
|
* In serve, a native Page may load its original physical capsule after HMR has already installed a newer component factory.
|
|
4
|
-
*
|
|
4
|
+
* The VPT factory passes the component to Taro at createVptPageConfig() time; without this lookup, that Page first mounts with stale source even
|
|
5
5
|
* though the patch was acknowledged. Replace only the component argument, leaving the production capsule untouched.
|
|
6
6
|
*/
|
|
7
7
|
export declare function injectDevPageComponent({ capsuleCode, componentId, capsuleId }: {
|
|
@@ -21,10 +21,8 @@ export declare function renderInitialDevtoolsPatches(): string;
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function renderDevtoolsPatches(buildId: string, patches: readonly PatchUpdate[]): string;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* The native shell has one stable `Page(pageConfig)` contract. Failing when that contract changes is intentional: silently
|
|
27
|
-
* skipping this transform would let DevTools unload the live Taro Page and destroy React state while appearing to support HMR.
|
|
24
|
+
* Prepares the capsule's final config immediately before the native shell registers it.
|
|
25
|
+
* The shared shell owns this one registration call; no platform choice or import-source parsing belongs in HMR.
|
|
28
26
|
*/
|
|
29
27
|
export declare function injectPageShellHmr(code: string): {
|
|
30
28
|
code: string;
|
|
@@ -6,7 +6,7 @@ export type TaroContract = {
|
|
|
6
6
|
componentsReactPath: string;
|
|
7
7
|
targetRuntimePath: string;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
9
|
+
/** Development runtimes selected once by the target. */
|
|
10
10
|
export type RuntimeContract = {
|
|
11
11
|
devtoolsHmrRuntime: string;
|
|
12
12
|
interpreterHmrRuntime: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Rolldown } from 'vite';
|
|
2
|
-
/**
|
|
2
|
+
/** Initializes SystemJS, transport, polyfills and native query capture before application capsules. */
|
|
3
3
|
export declare const miniBootstrapId: string;
|
|
4
4
|
/** Registers the native App using its generated configuration capsule. */
|
|
5
5
|
export declare const miniAppShellId: string;
|
|
@@ -20,14 +20,14 @@ export declare const miniTaroRuntimeId: string;
|
|
|
20
20
|
export declare const rolldownRuntimeId = "\0rolldown/runtime.js";
|
|
21
21
|
/** Identifies the virtual binding shared by native files, SystemJS capsules and HMR factories. */
|
|
22
22
|
export declare const vptGlobalBindingId = "\0vpt:global-binding";
|
|
23
|
-
/** Generates the selected core-js imports loaded
|
|
23
|
+
/** Generates the selected core-js imports loaded before SystemJS from the native polyfill chunk. */
|
|
24
24
|
export declare const miniPolyfillsId = "\0vpt:mini-polyfills";
|
|
25
|
-
/** External
|
|
25
|
+
/** External loader dependency emitted only after the bundled graph is finalized. */
|
|
26
26
|
export declare const miniTransportId = "\0vpt:mini-transport";
|
|
27
|
-
export declare const miniTransportOutputPath = "common/vpt
|
|
27
|
+
export declare const miniTransportOutputPath = "common/vpt-transport.js";
|
|
28
28
|
/** Resolves the shared Taro facade's target initialization side effect. */
|
|
29
29
|
export declare const taroTargetRuntimeId = "\0vpt:taro-target-runtime";
|
|
30
|
-
/** Redirects Vite's injected browser preload helper to the
|
|
30
|
+
/** Redirects Vite's injected browser preload helper to the SystemJS entry's identity loader. */
|
|
31
31
|
export declare const vitePreloadId = "\0vite/preload-helper.js";
|
|
32
32
|
/** Forces the native App shell entry to emit at the required root path. */
|
|
33
33
|
export declare const appShellFileName = "app.js";
|
|
@@ -48,5 +48,5 @@ export declare const miniPolyfillSourceFilter: RegExp;
|
|
|
48
48
|
export declare function isMiniPolyfillModule(moduleId: string): boolean;
|
|
49
49
|
/** Groups framework modules by resolved package roots; Rolldown includes their dependencies. */
|
|
50
50
|
export declare function isMiniFrameworkVendorModule(moduleId: string): boolean;
|
|
51
|
-
/** Classifies
|
|
51
|
+
/** Classifies compiler-owned entry facades and modules; ordinary application chunks are normal capsules. O(M) time. */
|
|
52
52
|
export declare function classifyMiniModule(chunk: MiniChunk): MiniChunkKind;
|
|
@@ -5,7 +5,7 @@ import type { PackageLocation } from '../placer/placement.ts';
|
|
|
5
5
|
* identities: the package-neutral final filename is the SystemJS registration ID, while the package-qualified filename
|
|
6
6
|
* supplies the literal native require path. Preliminary hash placeholders must not escape into this late-generated file.
|
|
7
7
|
*
|
|
8
|
-
* Transport itself executes only as native CommonJS in common/vpt
|
|
8
|
+
* Transport itself executes only as native CommonJS in common/vpt-transport.js, outside the bundled graph. Together
|
|
9
9
|
* with bootstrap it publishes native namespaces to SystemJS without re-evaluating their module bodies.
|
|
10
10
|
*
|
|
11
11
|
* Do not generate this table in renderChunk: that hook runs before Rolldown's final minifier/code generator, which can rewrite
|
|
@@ -7,8 +7,8 @@ import type { AstTransformResult } from '../../../utils/transform.ts';
|
|
|
7
7
|
*
|
|
8
8
|
* 1. Static ESM imports are hoisted into source-order `require` calls. Named imports remain property reads from the required
|
|
9
9
|
* namespace so they observe current values. Default and namespace imports receive Babel-compatible CommonJS interop.
|
|
10
|
-
* 2. An import
|
|
11
|
-
*
|
|
10
|
+
* 2. An import targeting any capsule is not passed to native `require`. It becomes
|
|
11
|
+
* the loader's `System.importSync(logicalChunkId)`, synchronously linking the capsule before the native lifecycle call.
|
|
12
12
|
* 3. Local exports are published at declaration and mutation points. Imported re-exports use getters, while assignments and
|
|
13
13
|
* updates notify every alias without changing expression completion values or accidentally matching shadowed bindings.
|
|
14
14
|
* 4. ESM top-level `this` becomes `undefined`. Direct imported calls and tags are explicitly unbound so converting an import
|
package/dist/options.d.ts
CHANGED
|
@@ -35,6 +35,11 @@ export type VptPageOption = {
|
|
|
35
35
|
* It does not translate configuration names between platforms.
|
|
36
36
|
*/
|
|
37
37
|
config?: VptPageConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Registers a native Page data factory for synchronous prerendering; disabled unless true.
|
|
40
|
+
* Requires host data-factory support (WX glass-easel). Rendering and effects may run before native onLoad.
|
|
41
|
+
*/
|
|
42
|
+
prerender?: boolean;
|
|
38
43
|
};
|
|
39
44
|
/** Configures vpt for one build target. */
|
|
40
45
|
export interface VptOptions {
|
|
@@ -8,6 +8,8 @@ import '\0vpt:mini-polyfills';
|
|
|
8
8
|
import { transport } from '\0vpt:mini-transport';
|
|
9
9
|
// Install the minimal SystemJS loader and its synchronous-import extension before any native entry requests a capsule.
|
|
10
10
|
import { System as createdSystem } from '../systemjs/system-core.js';
|
|
11
|
+
// Install native query capture before App/Page capsules evaluate.
|
|
12
|
+
export { getPageQuery } from './get-page-query.js';
|
|
11
13
|
// install the System on globalThis
|
|
12
14
|
globalThis.System = createdSystem;
|
|
13
15
|
// Publish the installed loader as an explicit native dependency; callers need no ambient globalThis binding.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
// WX Page shells share one listener and the latest query supplied by native routing.
|
|
3
|
+
let pageQuery;
|
|
4
|
+
if (typeof wx !== 'undefined' && typeof wx.onBeforePageLoad === 'function') {
|
|
5
|
+
const capturePageQuery = ({ query }) => {
|
|
6
|
+
pageQuery = query;
|
|
7
|
+
};
|
|
8
|
+
wx.onBeforePageLoad(capturePageQuery);
|
|
9
|
+
if (import.meta.hot) {
|
|
10
|
+
import.meta.hot.dispose(() => wx.offBeforePageLoad(capturePageQuery));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Reads the complete native query for the Page instance currently being created. */
|
|
14
|
+
export function getPageQuery() {
|
|
15
|
+
return pageQuery;
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createPageConfig as createTaroPageConfig, type MiniElementData } from 'vite-plugin-taro-runtime/runtime/mini';
|
|
2
|
+
export type PageData = {
|
|
3
|
+
app: {
|
|
4
|
+
nn: string;
|
|
5
|
+
cn: MiniElementData['cn'];
|
|
6
|
+
};
|
|
7
|
+
page: {
|
|
8
|
+
cn: MiniElementData['cn'];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type VptPageOptions = {
|
|
12
|
+
path: string;
|
|
13
|
+
config: Record<string, unknown>;
|
|
14
|
+
prerender: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** Prepares the original Taro config for native registration, capturing the seed when prerendering. */
|
|
17
|
+
export declare function createVptPageConfig(component: Parameters<typeof createTaroPageConfig>[0], vptPageOptions: {
|
|
18
|
+
path: string;
|
|
19
|
+
config: Record<string, unknown>;
|
|
20
|
+
prerender: boolean;
|
|
21
|
+
}): import("vite-plugin-taro-runtime/runtime/mini").PageInstance & {
|
|
22
|
+
__vpt_meta: {};
|
|
23
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createPageConfig as createTaroPageConfig } from 'vite-plugin-taro-runtime/runtime/mini';
|
|
2
|
+
import { prerenderToData } from './prerender-to-data.js';
|
|
3
|
+
/** Prepares the original Taro config for native registration, capturing the seed when prerendering. */
|
|
4
|
+
export function createVptPageConfig(component, vptPageOptions) {
|
|
5
|
+
const { path: routePath, config: pageConfig, prerender } = vptPageOptions;
|
|
6
|
+
/*
|
|
7
|
+
* Generated Page templates invoke Taro's unchanged recursive component, whose input is one compact node selected by i.nn.
|
|
8
|
+
* App JSX does not have that cardinality: it may return one or many top-level hosts, and the private Page outlet may occur at
|
|
9
|
+
* any depth within them. vpt_fragment is therefore a native-template-only collection adapter. Its fixed nn selects a transparent
|
|
10
|
+
* template that iterates cn while one surrounding component owns the Page-content boundary. Runtime projection markers relay
|
|
11
|
+
* that content only through the App branch containing the outlet. Without the fragment, each App root would need a separate
|
|
12
|
+
* recursive component and potential Page-content copy, or the component would need an App-specific collection mode.
|
|
13
|
+
*
|
|
14
|
+
* This record is not a Taro host: it has no Fiber, event source, ref, lifecycle, native element, or keyed parent collection.
|
|
15
|
+
* It consequently needs no sid. Only cn is seeded and updated; nn remains the stable generic-template discriminator.
|
|
16
|
+
*/
|
|
17
|
+
const initialData = { app: { nn: 'vpt_fragment', cn: [] }, page: { cn: [] } };
|
|
18
|
+
const config = Object.assign(createTaroPageConfig(component, routePath, initialData, pageConfig), {
|
|
19
|
+
__vpt_meta: {}
|
|
20
|
+
});
|
|
21
|
+
// Keep the one-shot prerender identity out of native registration.
|
|
22
|
+
Object.defineProperty(config, '__vpt_meta', { enumerable: false });
|
|
23
|
+
if (prerender) {
|
|
24
|
+
// Keep render inputs in the closure; native onLoad only needs the prepared identity.
|
|
25
|
+
config.data = () => prerenderToData(config, component, routePath, initialData);
|
|
26
|
+
}
|
|
27
|
+
return config;
|
|
28
|
+
}
|
|
@@ -2,17 +2,6 @@
|
|
|
2
2
|
import './app.js';
|
|
3
3
|
// @ts-expect-error: The Mini Program build replaces this private import with the configured Page component.
|
|
4
4
|
import PageComponent from '\0vpt:page-component';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
* Generated Page templates invoke Taro's unchanged recursive component, whose input is one compact node selected by i.nn.
|
|
8
|
-
* App JSX does not have that cardinality: it may return one or many top-level hosts, and the private Page outlet may occur at
|
|
9
|
-
* any depth within them. vpt_fragment is therefore a native-template-only collection adapter. Its fixed nn selects a transparent
|
|
10
|
-
* template that iterates cn while one surrounding component owns the Page-content boundary. Runtime projection markers relay
|
|
11
|
-
* that content only through the App branch containing the outlet. Without the fragment, each App root would need a separate
|
|
12
|
-
* recursive component and potential Page-content copy, or the component would need an App-specific collection mode.
|
|
13
|
-
*
|
|
14
|
-
* This record is not a Taro host: it has no Fiber, event source, ref, lifecycle, native element, or keyed parent collection.
|
|
15
|
-
* It consequently needs no sid. Only cn is seeded and updated; nn remains the stable generic-template discriminator.
|
|
16
|
-
*/
|
|
17
|
-
const config = createPageConfig(PageComponent, __VPT_PAGE_PATH__, { app: { nn: 'vpt_fragment', cn: [] }, page: { cn: [] } }, __VPT_PAGE_CONFIG__);
|
|
5
|
+
import { createVptPageConfig } from './taro-runtime.js';
|
|
6
|
+
const config = createVptPageConfig(PageComponent, __VPT_PAGE_OPTIONS__);
|
|
18
7
|
export default config;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { createVptPageConfig, PageData } from './create-vpt-page-config.ts';
|
|
2
|
+
/** Commits one Page into the existing App root and returns its initial native data without dispatching lifecycles. */
|
|
3
|
+
export declare function prerenderToData(config: ReturnType<typeof createVptPageConfig>, component: Parameters<typeof createVptPageConfig>[0], route: string, initialData: PageData): PageData;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { flushSync } from 'vite-plugin-taro-runtime/react';
|
|
2
|
+
import { addLeadingSlash, Current, document, getOnHideEventKey, getOnReadyEventKey, getOnShowEventKey, getPath, hydrate, incrementId } from 'vite-plugin-taro-runtime/runtime/mini';
|
|
3
|
+
import { getPageQuery } from '../amphibious/bootstrap.js';
|
|
4
|
+
// One counter distinguishes native instances even when their route, query and creation timestamp match.
|
|
5
|
+
const pageId = incrementId();
|
|
6
|
+
/** Commits one Page into the existing App root and returns its initial native data without dispatching lifecycles. */
|
|
7
|
+
export function prerenderToData(config, component, route, initialData) {
|
|
8
|
+
if (!Current.app?.mount) {
|
|
9
|
+
return initialData;
|
|
10
|
+
}
|
|
11
|
+
const params = { ...getPageQuery(), $taroTimestamp: Date.now() };
|
|
12
|
+
const path = getPath(route, { ...params, $vptPage: pageId() });
|
|
13
|
+
// Retain this instance identity until native onLoad consumes it without remounting the Page.
|
|
14
|
+
config.__vpt_meta.prerenderIdentity = { path, params };
|
|
15
|
+
Current.router = {
|
|
16
|
+
params,
|
|
17
|
+
path: addLeadingSlash(route),
|
|
18
|
+
$taroPath: path,
|
|
19
|
+
onReady: getOnReadyEventKey(route),
|
|
20
|
+
onShow: getOnShowEventKey(route),
|
|
21
|
+
onHide: getOnHideEventKey(route)
|
|
22
|
+
};
|
|
23
|
+
flushSync(() => {
|
|
24
|
+
Current.app.mount(component, path, () => { });
|
|
25
|
+
});
|
|
26
|
+
const page = document.getElementById(path);
|
|
27
|
+
const app = page?.parentNode?._root;
|
|
28
|
+
// Cold App startup or Suspense without a committed fallback keeps the seed until a later React commit.
|
|
29
|
+
if (!page || !app) {
|
|
30
|
+
return initialData;
|
|
31
|
+
}
|
|
32
|
+
// Both hosts are elements; hydrate's shared return type also includes text nodes.
|
|
33
|
+
const appData = hydrate(app);
|
|
34
|
+
const pageData = hydrate(page);
|
|
35
|
+
return {
|
|
36
|
+
app: { ...initialData.app, cn: appData.cn },
|
|
37
|
+
page: { ...initialData.page, cn: pageData.cn }
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -4,4 +4,5 @@ import '\0vpt:taro-target-runtime';
|
|
|
4
4
|
import 'vite-plugin-taro-runtime/plugin-html/runtime';
|
|
5
5
|
export { createReactApp } from 'vite-plugin-taro-runtime/plugin-framework-react/runtime';
|
|
6
6
|
export { default as ReactDOM } from 'vite-plugin-taro-runtime/react';
|
|
7
|
-
export {
|
|
7
|
+
export { createRecursiveComponentConfig } from 'vite-plugin-taro-runtime/runtime/mini';
|
|
8
|
+
export { createVptPageConfig } from './create-vpt-page-config.ts';
|
|
@@ -8,8 +8,9 @@ import '\0vpt:taro-target-runtime';
|
|
|
8
8
|
import 'vite-plugin-taro-runtime/plugin-html/runtime';
|
|
9
9
|
export { createReactApp } from 'vite-plugin-taro-runtime/plugin-framework-react/runtime';
|
|
10
10
|
export { default as ReactDOM } from 'vite-plugin-taro-runtime/react';
|
|
11
|
-
export {
|
|
11
|
+
export { createRecursiveComponentConfig } from 'vite-plugin-taro-runtime/runtime/mini';
|
|
12
12
|
import { customWrapperCache } from 'vite-plugin-taro-runtime/runtime/mini';
|
|
13
|
+
export { createVptPageConfig } from './create-vpt-page-config.js';
|
|
13
14
|
// DevTools HMR runs in the bootstrap chunk, so publish the application graph's cache once on the language global.
|
|
14
15
|
if (process.env.NODE_ENV === 'development') {
|
|
15
16
|
Reflect.set(globalThis, Symbol.for('customWrapperCache'), customWrapperCache);
|
|
@@ -26,7 +26,10 @@ declare class MiniHotContext {
|
|
|
26
26
|
/** Stable module identity and shared sparse index used only when this context accepts. */
|
|
27
27
|
private readonly moduleId;
|
|
28
28
|
private readonly acceptingContexts;
|
|
29
|
-
|
|
29
|
+
private readonly disposeCallbacks;
|
|
30
|
+
constructor(moduleId: string, acceptingContexts: Map<string, MiniHotContext>, disposeCallbacks: Map<string, Array<() => void>>);
|
|
31
|
+
/** Cleanup registration is independent of accepting updates; passive dependencies ay own native listenemrs. */
|
|
32
|
+
dispose(callback: () => void): void;
|
|
30
33
|
accept(callback?: AcceptCallback): void;
|
|
31
34
|
/** Invokes this old context's callbacks; invalidation aborts the update synchronously. */
|
|
32
35
|
runAccept(moduleExports: unknown): void;
|
|
@@ -67,6 +70,7 @@ export declare class MiniHmrRuntime extends DevRuntime {
|
|
|
67
70
|
* the new one. Passive contexts are never retained, so space is O(number of boundaries).
|
|
68
71
|
*/
|
|
69
72
|
private readonly moduleHotContexts;
|
|
73
|
+
private readonly moduleDisposeCallbacks;
|
|
70
74
|
/** Immutable platform socket constructor retained until the running App initializes. */
|
|
71
75
|
private readonly connectSocket;
|
|
72
76
|
constructor(connectSocket: ConnectMiniSocket);
|
|
@@ -76,6 +80,9 @@ export declare class MiniHmrRuntime extends DevRuntime {
|
|
|
76
80
|
* calling accept registers the new context after the apply plan captured old callbacks.
|
|
77
81
|
*/
|
|
78
82
|
createModuleHotContext(moduleId: string): MiniHotContext;
|
|
83
|
+
/** Native listener cleanup runs before the old exports are evicted, including cold-capsule replacement. */
|
|
84
|
+
removeModuleCache(moduleId: string): void;
|
|
85
|
+
private disposeModule;
|
|
79
86
|
/** Resolves a cold Page against patches installed before its physical capsule first executed. */
|
|
80
87
|
resolvePageComponent(moduleId: string, baseline: ElementType): ElementType;
|
|
81
88
|
/** Computes accepting boundaries and every executed module that must be re-armed. */
|
|
@@ -29,9 +29,21 @@ class MiniHotContext {
|
|
|
29
29
|
/** Stable module identity and shared sparse index used only when this context accepts. */
|
|
30
30
|
moduleId;
|
|
31
31
|
acceptingContexts;
|
|
32
|
-
|
|
32
|
+
disposeCallbacks;
|
|
33
|
+
constructor(moduleId, acceptingContexts, disposeCallbacks) {
|
|
33
34
|
this.moduleId = moduleId;
|
|
34
35
|
this.acceptingContexts = acceptingContexts;
|
|
36
|
+
this.disposeCallbacks = disposeCallbacks;
|
|
37
|
+
}
|
|
38
|
+
/** Cleanup registration is independent of accepting updates; passive dependencies ay own native listenemrs. */
|
|
39
|
+
dispose(callback) {
|
|
40
|
+
const callbacks = this.disposeCallbacks.get(this.moduleId);
|
|
41
|
+
if (callbacks) {
|
|
42
|
+
callbacks.push(callback);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
this.disposeCallbacks.set(this.moduleId, [callback]);
|
|
46
|
+
}
|
|
35
47
|
}
|
|
36
48
|
accept(callback) {
|
|
37
49
|
if (!this.acceptCallbacks) {
|
|
@@ -76,6 +88,8 @@ export class MiniHmrRuntime extends DevRuntime {
|
|
|
76
88
|
* the new one. Passive contexts are never retained, so space is O(number of boundaries).
|
|
77
89
|
*/
|
|
78
90
|
moduleHotContexts = new Map();
|
|
91
|
+
// Retain only modules that registered cleanup; eviction consumes their callbacks before replacement factories execute.
|
|
92
|
+
moduleDisposeCallbacks = new Map();
|
|
79
93
|
/** Immutable platform socket constructor retained until the running App initializes. */
|
|
80
94
|
connectSocket;
|
|
81
95
|
constructor(connectSocket) {
|
|
@@ -94,8 +108,21 @@ export class MiniHmrRuntime extends DevRuntime {
|
|
|
94
108
|
*/
|
|
95
109
|
createModuleHotContext(moduleId) {
|
|
96
110
|
// A new execution supersedes the old boundary before it decides whether to accept.
|
|
111
|
+
this.disposeModule(moduleId);
|
|
97
112
|
this.moduleHotContexts.delete(moduleId);
|
|
98
|
-
return new MiniHotContext(moduleId, this.moduleHotContexts);
|
|
113
|
+
return new MiniHotContext(moduleId, this.moduleHotContexts, this.moduleDisposeCallbacks);
|
|
114
|
+
}
|
|
115
|
+
/** Native listener cleanup runs before the old exports are evicted, including cold-capsule replacement. */
|
|
116
|
+
removeModuleCache(moduleId) {
|
|
117
|
+
this.disposeModule(moduleId);
|
|
118
|
+
super.removeModuleCache(moduleId);
|
|
119
|
+
}
|
|
120
|
+
disposeModule(moduleId) {
|
|
121
|
+
const callbacks = this.moduleDisposeCallbacks.get(moduleId);
|
|
122
|
+
this.moduleDisposeCallbacks.delete(moduleId);
|
|
123
|
+
for (const callback of callbacks ?? []) {
|
|
124
|
+
callback();
|
|
125
|
+
}
|
|
99
126
|
}
|
|
100
127
|
/** Resolves a cold Page against patches installed before its physical capsule first executed. */
|
|
101
128
|
resolvePageComponent(moduleId, baseline) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ConnectMiniSocket, MiniHmrRuntime, type RuntimePatch } from '../../mini-hmr-runtime.ts';
|
|
2
|
-
import { injectPageHmr as injectDevtoolsPageHmr } from './page-hmr.ts';
|
|
2
|
+
import { injectPageHmr as injectDevtoolsPageHmr } from './inject-page-hmr.ts';
|
|
3
3
|
/**
|
|
4
4
|
* One physical DevTools patch. DevTools compiles `factory` as native project JavaScript; invoking it registers updated Rolldown
|
|
5
5
|
* factories but does not execute application modules, allowing the shared runtime to install a complete batch before one render.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* what allows module and React state to survive repeated native Page registration.
|
|
5
5
|
*/
|
|
6
6
|
import { MiniHmrRuntime } from '../../mini-hmr-runtime.js';
|
|
7
|
-
import { injectPageHmr as injectDevtoolsPageHmr } from './page-hmr.js';
|
|
7
|
+
import { injectPageHmr as injectDevtoolsPageHmr } from './inject-page-hmr.js';
|
|
8
8
|
/** Adapts physical DevTools patch modules and Page replacement onto the shared Mini Program HMR runtime. */
|
|
9
9
|
class DevtoolsHmrRuntime extends MiniHmrRuntime {
|
|
10
10
|
/** Applies one Page-delivered payload before the native shell imports its route capsule. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type NativePage = {
|
|
2
2
|
data: Record<string, unknown>;
|
|
3
|
+
groupUpdates?: unknown;
|
|
3
4
|
};
|
|
4
5
|
declare const pageHmrStateKey: unique symbol;
|
|
5
6
|
type PageHmrState = {
|
|
@@ -9,7 +10,7 @@ type PageHmrState = {
|
|
|
9
10
|
mountedPage: NativePage | undefined;
|
|
10
11
|
};
|
|
11
12
|
type HmrPageConfig = {
|
|
12
|
-
data: Record<string, unknown
|
|
13
|
+
data: Record<string, unknown> | (() => Record<string, unknown>);
|
|
13
14
|
onUnload?: unknown;
|
|
14
15
|
onLoad?: unknown;
|
|
15
16
|
onShow?: unknown;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
// A symbol cannot collide with native or Taro string-named Page options, and it lets a later injection recover the exact
|
|
2
2
|
// config-local state without a route map or runtime-global WeakMap.
|
|
3
3
|
const pageHmrStateKey = Symbol('vpt.pageHmrState');
|
|
4
|
+
/** Detects the active glass-easel framework through its native instance API, not compiler configuration. */
|
|
5
|
+
function isGlassEasel(page) {
|
|
6
|
+
return typeof page.groupUpdates === 'function';
|
|
7
|
+
}
|
|
4
8
|
/** Calls a native lifecycle with the same Page bound to `this` and the same arguments. */
|
|
5
9
|
function forward(handler, page, args) {
|
|
6
|
-
if (typeof handler === 'function')
|
|
10
|
+
if (typeof handler === 'function') {
|
|
7
11
|
handler.apply(page, args);
|
|
12
|
+
}
|
|
8
13
|
}
|
|
9
14
|
/** Tracks the mounted native Page and prepares its static config for DevTools re-registration. */
|
|
10
15
|
export function injectPageHmr(config) {
|
|
@@ -15,20 +20,15 @@ export function injectPageHmr(config) {
|
|
|
15
20
|
* The static config can outlive a native Page instance. Before its first ordinary onLoad, or after a real onUnload,
|
|
16
21
|
* there is no mounted Page or current view-model to carry into another registration. Leave the lifecycle gate unarmed
|
|
17
22
|
* and preserve the config's existing initial data so a future real onLoad still enters Taro normally.
|
|
23
|
+
* Glass-easel retains native instances without replaying lifecycles, so it needs neither suppression nor snapshot handoff.
|
|
18
24
|
*/
|
|
19
|
-
if (!mountedPage) {
|
|
25
|
+
if (!mountedPage || isGlassEasel(mountedPage)) {
|
|
20
26
|
return config;
|
|
21
27
|
}
|
|
22
|
-
|
|
23
|
-
* Arm the lifecycle wrappers on this exact static config before it is passed back to `Page(config)`. DevTools then
|
|
24
|
-
* triggers an unload/load/show sequence for that native re-registration: unload and load observe `true` and return before
|
|
25
|
-
* entering Taro, preserving the mounted React tree and its original Page connection; show consumes the one-shot gate by
|
|
26
|
-
* restoring `false`. Ordinary navigation never enters this branch, and every Page config owns an independent state, so
|
|
27
|
-
* no route map, global phase, or Page identity comparison participates in the decision.
|
|
28
|
-
*/
|
|
28
|
+
// Legacy hosts replay unload/load/show; onShow ends that native cycle.
|
|
29
29
|
existingState.isReregistering = true;
|
|
30
30
|
/*
|
|
31
|
-
*
|
|
31
|
+
* Native registration reads `config.data` as the initial view-model for this registration. The Page owns current app
|
|
32
32
|
* and ordinary Page fields, while each mounted CustomWrapper owns the current snapshot below its native boundary. Join
|
|
33
33
|
* those already-serialized snapshots before registration so the native host never publishes the stale initial placeholder tree.
|
|
34
34
|
* This lifecycle handoff performs no setData call and runs before React Refresh can publish another logical tree.
|
|
@@ -43,14 +43,16 @@ export function injectPageHmr(config) {
|
|
|
43
43
|
/*
|
|
44
44
|
* This mutable config-local state spans ordinary Page mount/unmount and one DevTools re-registration lifecycle. Lifecycle
|
|
45
45
|
* wrappers close over this exact object, while a later `injectPageHmr(config)` retrieves it through the symbol and avoids
|
|
46
|
-
* wrapping twice.
|
|
46
|
+
* wrapping twice. Only legacy hosts need the re-registration lifecycle gate.
|
|
47
|
+
* Config-local ownership avoids route maps, runtime-global phase flags, and state shared by independent Page
|
|
47
48
|
* registrations; the state becomes unreachable together with its static config.
|
|
48
49
|
*/
|
|
49
50
|
const state = {
|
|
50
51
|
isReregistering: false,
|
|
51
52
|
mountedPage: undefined
|
|
52
53
|
};
|
|
53
|
-
config
|
|
54
|
+
// Handoff state belongs to the static config, not the properties copied into native registration.
|
|
55
|
+
Object.defineProperty(config, pageHmrStateKey, { value: state });
|
|
54
56
|
config.onUnload = function (...args) {
|
|
55
57
|
if (state.isReregistering) {
|
|
56
58
|
return;
|
|
@@ -67,8 +69,7 @@ export function injectPageHmr(config) {
|
|
|
67
69
|
};
|
|
68
70
|
config.onShow = function (...args) {
|
|
69
71
|
if (state.isReregistering) {
|
|
70
|
-
// DevTools' synthetic unload/load/show cycle ends here
|
|
71
|
-
// forwards ordinary Taro lifecycles instead of being mistaken for the same registration.
|
|
72
|
+
// DevTools' synthetic unload/load/show cycle ends here; the next real navigation forwards lifecycles.
|
|
72
73
|
state.isReregistering = false;
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
// biome-ignore assist/source/organizeImports: VPT runtime must initialize before the Page capsule.
|
|
1
2
|
import '../amphibious/bootstrap.js';
|
|
2
|
-
// @ts-expect-error: The active Mini contract resolves the route-specific Page capsule.
|
|
3
3
|
import pageConfig from '\0vpt:page-capsule';
|
|
4
4
|
Page(pageConfig);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-taro",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12-beta.0",
|
|
4
4
|
"author": "sep2",
|
|
5
5
|
"description": "Vite 8 plugin for building one React/Taro codebase for WeChat, Alipay, TikTok, and H5 targets.",
|
|
6
6
|
"type": "module",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"rolldown": "1.2.12",
|
|
68
68
|
"sval": "0.6.12",
|
|
69
69
|
"tailwindcss": "^4.3.3",
|
|
70
|
-
"vite-plugin-taro-runtime": "0.7.
|
|
70
|
+
"vite-plugin-taro-runtime": "0.7.12-beta.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"react": "^19.3.0",
|