@lytjs/core 4.2.0 → 5.0.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.
@@ -1 +1 @@
1
- var I=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(r,o)=>{for(var t in o)I(r,t,{get:o[t],enumerable:!0})},M=(r,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of h(o))!y.call(r,s)&&s!==t&&I(r,s,{get:()=>o[s],enumerable:!(i=P(o,s))||i.enumerable});return r};var m=r=>M(I({},"__esModule",{value:!0}),r);var V={};d(V,{ErrorBoundary:()=>R,ErrorCategory:()=>n.ErrorCategory,LytError:()=>a,LytErrorCodes:()=>N,NewLytError:()=>E.LytError,NewLytErrorCodes:()=>n.LytErrorCodes,callWithErrorHandling:()=>C,createCompilerError:()=>E.createCompilerError,createComponentError:()=>E.createComponentError,createMessage:()=>L,createRendererError:()=>E.createRendererError,getCategory:()=>n.getCategory,getDevMode:()=>u,getErrorMessage:()=>n.getErrorMessage,handleError:()=>c,resetWarnedMessages:()=>g,setDevMode:()=>f,warn:()=>l,warnOnce:()=>A,warnOnceUtil:()=>A,warnUtil:()=>l});module.exports=m(V);var N=(e=>(e[e.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",e[e.NOT_FOUND=1002]="NOT_FOUND",e[e.ALREADY_EXISTS=1003]="ALREADY_EXISTS",e[e.OPERATION_FAILED=1004]="OPERATION_FAILED",e[e.REACTIVE_READONLY=2001]="REACTIVE_READONLY",e[e.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",e[e.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",e[e.PARSE_ERROR=3001]="PARSE_ERROR",e[e.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",e[e.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",e[e.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",e[e.RENDER_ERROR=4001]="RENDER_ERROR",e[e.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",e[e.INVALID_VNODE=4003]="INVALID_VNODE",e[e.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",e[e.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",e[e.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",e[e.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",e[e.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",e[e.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",e[e.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",e[e.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",e[e.STORE_DUPLICATE=7002]="STORE_DUPLICATE",e))(N||{});var a=class extends Error{constructor(o,t,i){let s=`[Lyt ${o}] ${t}`;super(s),this.name="LytError",this.code=o,this.details=i}};var _=class _{constructor(o){this.errors=[],this.options=o||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(o){_.globalHandler=o}capture(o,t,i){var p;let s={error:o,vm:t,info:i||"",timestamp:Date.now()};this.errors.push(s),this._hasError=!0;let D=(p=this.options.maxErrors)!=null?p:100;this.errors.length>D&&this.errors.splice(0,this.errors.length-D),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(o instanceof a?o:new a(1004,o.message),t,s.info)===!0)&&this.options.onError&&this.options.onError(o instanceof a?o:new a(1004,o.message),t)}getFallback(o){if(!this.options.fallback||this.errors.length===0)return null;let t=this.errors[this.errors.length-1];return this.options.fallback(t.error,t.vm,t.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};_.globalHandler=null;var R=_,O=!0,T=new Set;function f(r){O=r}function u(){return O}function l(r){if(!O)return;let o=console.warn;typeof o=="function"&&o(`[Lyt warn] ${r}`)}function A(r){if(!O||T.has(r))return;T.add(r);let o=console.warn;typeof o=="function"&&o(`[Lyt warn] ${r}`)}function g(){T.clear()}var S={1001:r=>`\u53C2\u6570 "${r}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:r=>`"${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:r=>`"${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:r=>`\u64CD\u4F5C "${r}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:r=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${r}"\u3002\u53EA\u8BFB\u5BF9\u8C61\u4E0D\u5141\u8BB8\u76F4\u63A5\u8D4B\u503C\u3002`,2002:()=>"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002\u8BF7\u521B\u5EFA\u65B0\u7684\u526F\u4F5C\u7528\u3002",2003:()=>"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002\u8BF7\u68C0\u67E5 computed \u51FD\u6570\u662F\u5426\u5F15\u7528\u4E86\u81EA\u8EAB\u3002",3001:r=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:r=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${r}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:r=>`\u65E0\u6548\u7684\u6307\u4EE4 "${r}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:r=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:r=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:r=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${r}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:r=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${r}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:r=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:r=>`\u7EC4\u4EF6 "${r}" \u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002\u8BF7\u786E\u4FDD\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u5305\u542B template \u5B57\u7B26\u4E32\u6216 render \u65B9\u6CD5\u3002`,5003:r=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:r=>`\u8DEF\u7531 "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:r=>`\u8DEF\u7531 "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:r=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${r}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:r=>`\u5BFC\u822A\u5931\u8D25\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:r=>`Store "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:r=>`Store "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function L(r,...o){let t=S[r];if(t){let i=t(...o);return`[Lyt ${r}] ${i}`}return`[Lyt ${r}] \u672A\u77E5\u9519\u8BEF\u3002`}function c(r,o,t){R.globalHandler&&R.globalHandler(r,o,t||""),O&&r instanceof a&&r.details}function C(r,o){try{return r()}catch(t){c(t instanceof Error?t:new Error(String(t)),o);return}}var n=require("@lytjs/common");var E=require("@lytjs/common");
1
+ "use strict";var e=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var h=(E,T)=>{for(var O in T)e(E,O,{get:T[O],enumerable:!0})},G=(E,T,O,i)=>{if(T&&typeof T=="object"||typeof T=="function")for(let N of g(T))!m.call(E,N)&&N!==O&&e(E,N,{get:()=>T[N],enumerable:!(i=u(T,N))||i.enumerable});return E};var v=E=>G(e({},"__esModule",{value:!0}),E);var x={};h(x,{ErrorBoundary:()=>A,ErrorCategory:()=>n.ErrorCategory,LytError:()=>R.LytError,LytErrorCodes:()=>D,callWithErrorHandling:()=>f,callWithErrorHandlingAsync:()=>F,createCompilerError:()=>I.createCompilerError,createComponentError:()=>I.createComponentError,createMessage:()=>U,createRendererError:()=>I.createRendererError,getCategory:()=>n.getCategory,getDevMode:()=>V,getErrorMessage:()=>n.getErrorMessage,handleError:()=>L,resetWarnedMessages:()=>p,setDevMode:()=>l,warn:()=>S,warnOnce:()=>t,warnOnceUtil:()=>t,warnUtil:()=>S});module.exports=v(x);var R=require("@lytjs/common");var D=(_=>(_[_.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",_[_.NOT_FOUND=1002]="NOT_FOUND",_[_.ALREADY_EXISTS=1003]="ALREADY_EXISTS",_[_.OPERATION_FAILED=1004]="OPERATION_FAILED",_[_.REACTIVE_READONLY=2001]="REACTIVE_READONLY",_[_.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",_[_.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",_[_.PARSE_ERROR=3001]="PARSE_ERROR",_[_.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",_[_.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",_[_.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",_[_.RENDER_ERROR=4001]="RENDER_ERROR",_[_.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",_[_.INVALID_VNODE=4003]="INVALID_VNODE",_[_.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",_[_.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",_[_.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",_[_.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",_[_.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",_[_.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",_[_.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",_[_.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",_[_.STORE_DUPLICATE=7002]="STORE_DUPLICATE",_[_.LYT_COMPILER_PARSE_ERROR=R.LytErrorCodes.LYT_COMPILER_PARSE_ERROR]="LYT_COMPILER_PARSE_ERROR",_[_.LYT_COMPILER_INVALID_EXPRESSION=R.LytErrorCodes.LYT_COMPILER_INVALID_EXPRESSION]="LYT_COMPILER_INVALID_EXPRESSION",_[_.LYT_COMPILER_INVALID_TEMPLATE=R.LytErrorCodes.LYT_COMPILER_INVALID_TEMPLATE]="LYT_COMPILER_INVALID_TEMPLATE",_[_.LYT_COMPILER_INVALID_DIRECTIVE=R.LytErrorCodes.LYT_COMPILER_INVALID_DIRECTIVE]="LYT_COMPILER_INVALID_DIRECTIVE",_[_.LYT_COMPILER_CODEGEN_ERROR=R.LytErrorCodes.LYT_COMPILER_CODEGEN_ERROR]="LYT_COMPILER_CODEGEN_ERROR",_[_.LYT_COMPILER_SFC_PARSE_ERROR=R.LytErrorCodes.LYT_COMPILER_SFC_PARSE_ERROR]="LYT_COMPILER_SFC_PARSE_ERROR",_[_.LYT_COMPILER_TRANSFORM_ERROR=R.LytErrorCodes.LYT_COMPILER_TRANSFORM_ERROR]="LYT_COMPILER_TRANSFORM_ERROR",_[_.LYT_RENDERER_MOUNT_FAILED=R.LytErrorCodes.LYT_RENDERER_MOUNT_FAILED]="LYT_RENDERER_MOUNT_FAILED",_[_.LYT_RENDERER_PATCH_FAILED=R.LytErrorCodes.LYT_RENDERER_PATCH_FAILED]="LYT_RENDERER_PATCH_FAILED",_[_.LYT_RENDERER_HYDRATION_MISMATCH=R.LytErrorCodes.LYT_RENDERER_HYDRATION_MISMATCH]="LYT_RENDERER_HYDRATION_MISMATCH",_[_.LYT_RENDERER_INVALID_VNODE=R.LytErrorCodes.LYT_RENDERER_INVALID_VNODE]="LYT_RENDERER_INVALID_VNODE",_[_.LYT_RENDERER_UNMOUNT_FAILED=R.LytErrorCodes.LYT_RENDERER_UNMOUNT_FAILED]="LYT_RENDERER_UNMOUNT_FAILED",_[_.LYT_COMPONENT_INVALID_PROPS=R.LytErrorCodes.LYT_COMPONENT_INVALID_PROPS]="LYT_COMPONENT_INVALID_PROPS",_[_.LYT_COMPONENT_MISSING_RENDER=R.LytErrorCodes.LYT_COMPONENT_MISSING_RENDER]="LYT_COMPONENT_MISSING_RENDER",_[_.LYT_COMPONENT_LIFECYCLE_ERROR=R.LytErrorCodes.LYT_COMPONENT_LIFECYCLE_ERROR]="LYT_COMPONENT_LIFECYCLE_ERROR",_[_.LYT_COMPONENT_INVALID=R.LytErrorCodes.LYT_COMPONENT_INVALID]="LYT_COMPONENT_INVALID",_[_.LYT_COMPONENT_EMIT_INVALID=R.LytErrorCodes.LYT_COMPONENT_EMIT_INVALID]="LYT_COMPONENT_EMIT_INVALID",_[_.LYT_COMPONENT_RENDER_ERROR=R.LytErrorCodes.LYT_COMPONENT_RENDER_ERROR]="LYT_COMPONENT_RENDER_ERROR",_[_.LYT_ROUTER_INVALID_ROUTE=R.LytErrorCodes.LYT_ROUTER_INVALID_ROUTE]="LYT_ROUTER_INVALID_ROUTE",_[_.LYT_ROUTER_NAVIGATION_FAILED=R.LytErrorCodes.LYT_ROUTER_NAVIGATION_FAILED]="LYT_ROUTER_NAVIGATION_FAILED",_[_.LYT_ROUTER_DUPLICATE_ROUTE=R.LytErrorCodes.LYT_ROUTER_DUPLICATE_ROUTE]="LYT_ROUTER_DUPLICATE_ROUTE",_[_.LYT_ROUTER_NAVIGATION_ABORTED=R.LytErrorCodes.LYT_ROUTER_NAVIGATION_ABORTED]="LYT_ROUTER_NAVIGATION_ABORTED",_[_.LYT_ROUTER_GUARD_ERROR=R.LytErrorCodes.LYT_ROUTER_GUARD_ERROR]="LYT_ROUTER_GUARD_ERROR",_[_.LYT_STORE_ALREADY_EXISTS=R.LytErrorCodes.LYT_STORE_ALREADY_EXISTS]="LYT_STORE_ALREADY_EXISTS",_[_.LYT_STORE_NOT_FOUND=R.LytErrorCodes.LYT_STORE_NOT_FOUND]="LYT_STORE_NOT_FOUND",_[_.LYT_STORE_DISPOSED=R.LytErrorCodes.LYT_STORE_DISPOSED]="LYT_STORE_DISPOSED",_[_.LYT_STORE_PATCH_ERROR=R.LytErrorCodes.LYT_STORE_PATCH_ERROR]="LYT_STORE_PATCH_ERROR",_[_.LYT_REACTIVITY_READONLY_SET=R.LytErrorCodes.LYT_REACTIVITY_READONLY_SET]="LYT_REACTIVITY_READONLY_SET",_[_.LYT_REACTIVITY_READONLY_DELETE=R.LytErrorCodes.LYT_REACTIVITY_READONLY_DELETE]="LYT_REACTIVITY_READONLY_DELETE",_[_.LYT_REACTIVITY_EFFECT_ERROR=R.LytErrorCodes.LYT_REACTIVITY_EFFECT_ERROR]="LYT_REACTIVITY_EFFECT_ERROR",_[_.LYT_REACTIVITY_COMPUTED_CYCLE=R.LytErrorCodes.LYT_REACTIVITY_COMPUTED_CYCLE]="LYT_REACTIVITY_COMPUTED_CYCLE",_[_.LYT_REACTIVITY_EFFECT_DISPOSED=R.LytErrorCodes.LYT_REACTIVITY_EFFECT_DISPOSED]="LYT_REACTIVITY_EFFECT_DISPOSED",_[_.LYT_REACTIVITY_CIRCULAR_DEPENDENCY=R.LytErrorCodes.LYT_REACTIVITY_CIRCULAR_DEPENDENCY]="LYT_REACTIVITY_CIRCULAR_DEPENDENCY",_[_.LYT_REACTIVITY_SIGNAL_DISPOSED=R.LytErrorCodes.LYT_REACTIVITY_SIGNAL_DISPOSED]="LYT_REACTIVITY_SIGNAL_DISPOSED",_[_.LYT_CORE_PLUGIN_ERROR=R.LytErrorCodes.LYT_CORE_PLUGIN_ERROR]="LYT_CORE_PLUGIN_ERROR",_[_.LYT_CORE_MOUNT_NO_CONTAINER=R.LytErrorCodes.LYT_CORE_MOUNT_NO_CONTAINER]="LYT_CORE_MOUNT_NO_CONTAINER",_[_.LYT_CORE_ALREADY_MOUNTED=R.LytErrorCodes.LYT_CORE_ALREADY_MOUNTED]="LYT_CORE_ALREADY_MOUNTED",_[_.LYT_CORE_INVALID_ARGUMENT=R.LytErrorCodes.LYT_CORE_INVALID_ARGUMENT]="LYT_CORE_INVALID_ARGUMENT",_[_.LYT_CORE_NOT_FOUND=R.LytErrorCodes.LYT_CORE_NOT_FOUND]="LYT_CORE_NOT_FOUND",_[_.LYT_CORE_ALREADY_EXISTS=R.LytErrorCodes.LYT_CORE_ALREADY_EXISTS]="LYT_CORE_ALREADY_EXISTS",_[_.LYT_CORE_OPERATION_FAILED=R.LytErrorCodes.LYT_CORE_OPERATION_FAILED]="LYT_CORE_OPERATION_FAILED",_[_.LYT_CLI_SCAFFOLD_FAILED=R.LytErrorCodes.LYT_CLI_SCAFFOLD_FAILED]="LYT_CLI_SCAFFOLD_FAILED",_[_.LYT_CLI_BUILD_FAILED=R.LytErrorCodes.LYT_CLI_BUILD_FAILED]="LYT_CLI_BUILD_FAILED",_[_.LYT_CLI_DEV_SERVER_ERROR=R.LytErrorCodes.LYT_CLI_DEV_SERVER_ERROR]="LYT_CLI_DEV_SERVER_ERROR",_[_.LYT_CLI_CONFIG_INVALID=R.LytErrorCodes.LYT_CLI_CONFIG_INVALID]="LYT_CLI_CONFIG_INVALID",_[_.LYT_CLI_HMR_CONNECTION_FAILED=R.LytErrorCodes.LYT_CLI_HMR_CONNECTION_FAILED]="LYT_CLI_HMR_CONNECTION_FAILED",_[_.LYT_DEVTOOLS_CONNECTION_FAILED=R.LytErrorCodes.LYT_DEVTOOLS_CONNECTION_FAILED]="LYT_DEVTOOLS_CONNECTION_FAILED",_[_.LYT_DEVTOOLS_PANEL_ERROR=R.LytErrorCodes.LYT_DEVTOOLS_PANEL_ERROR]="LYT_DEVTOOLS_PANEL_ERROR",_[_.LYT_DEVTOOLS_PERF_OVERFLOW=R.LytErrorCodes.LYT_DEVTOOLS_PERF_OVERFLOW]="LYT_DEVTOOLS_PERF_OVERFLOW",_[_.LYT_DEVTOOLS_COMPONENT_TREE_ERROR=R.LytErrorCodes.LYT_DEVTOOLS_COMPONENT_TREE_ERROR]="LYT_DEVTOOLS_COMPONENT_TREE_ERROR",_[_.LYT_PLUGIN_INSTALL_FAILED=R.LytErrorCodes.LYT_PLUGIN_INSTALL_FAILED]="LYT_PLUGIN_INSTALL_FAILED",_[_.LYT_PLUGIN_ALREADY_INSTALLED=R.LytErrorCodes.LYT_PLUGIN_ALREADY_INSTALLED]="LYT_PLUGIN_ALREADY_INSTALLED",_[_.LYT_PLUGIN_INVALID=R.LytErrorCodes.LYT_PLUGIN_INVALID]="LYT_PLUGIN_INVALID",_[_.LYT_PLUGIN_UNINSTALL_FAILED=R.LytErrorCodes.LYT_PLUGIN_UNINSTALL_FAILED]="LYT_PLUGIN_UNINSTALL_FAILED",_[_.LYT_RENDERER_VAPOR_ERROR=R.LytErrorCodes.LYT_RENDERER_VAPOR_ERROR]="LYT_RENDERER_VAPOR_ERROR",_[_.LYT_RENDERER_VAPOR_COMPILER_ERROR=R.LytErrorCodes.LYT_RENDERER_VAPOR_COMPILER_ERROR]="LYT_RENDERER_VAPOR_COMPILER_ERROR",_[_.LYT_RENDERER_VAPOR_COMPONENT_ERROR=R.LytErrorCodes.LYT_RENDERER_VAPOR_COMPONENT_ERROR]="LYT_RENDERER_VAPOR_COMPONENT_ERROR",_[_.LYT_SSR_STREAM_ERROR=R.LytErrorCodes.LYT_SSR_STREAM_ERROR]="LYT_SSR_STREAM_ERROR",_[_.LYT_SSR_SUSPENSE_TIMEOUT=R.LytErrorCodes.LYT_SSR_SUSPENSE_TIMEOUT]="LYT_SSR_SUSPENSE_TIMEOUT",_[_.LYT_SSR_HYDRATION_ERROR=R.LytErrorCodes.LYT_SSR_HYDRATION_ERROR]="LYT_SSR_HYDRATION_ERROR",_[_.LYT_SSR_ISLAND_ERROR=R.LytErrorCodes.LYT_SSR_ISLAND_ERROR]="LYT_SSR_ISLAND_ERROR",_))(D||{});var a=class a{constructor(T){this.errors=[],this.options=T||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(T){a.globalHandler=T}capture(T,O,i){var c;let N={error:T,vm:O,info:i||"",timestamp:Date.now()};this.errors.push(N),this._hasError=!0;let M=(c=this.options.maxErrors)!=null?c:100;this.errors.length>M&&this.errors.splice(0,this.errors.length-M),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(T instanceof R.LytError?T:new R.LytError(D.LYT_CORE_OPERATION_FAILED,T.message),O,N.info)===!0)&&this.options.onError&&this.options.onError(T instanceof R.LytError?T:new R.LytError(D.LYT_CORE_OPERATION_FAILED,T.message),O)}getFallback(T){if(!this.options.fallback||this.errors.length===0)return null;let O=this.errors[this.errors.length-1];return this.options.fallback(O.error,O.vm,O.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};a.globalHandler=null;var A=a,Y=!0,P=new Set;function l(E){Y=E}function V(){return Y}function S(E){if(!Y)return;let T=console.warn;typeof T=="function"&&T(`[Lyt warn] ${E}`)}function t(E){if(!Y||P.has(E))return;P.add(E);let T=console.warn;typeof T=="function"&&T(`[Lyt warn] ${E}`)}function p(){P.clear()}function U(E,...T){let O=(0,R.getErrorMessage)(E);return`[Lyt ${E}] ${O}`}function L(E,T,O){A.globalHandler&&A.globalHandler(E,T,O||""),Y?E instanceof R.LytError&&E.details:typeof reportError=="function"&&reportError(E)}function f(E,T){try{return E()}catch(O){L(O instanceof Error?O:new Error(String(O)),T);return}}async function F(E,T){try{return await E()}catch(O){L(O instanceof Error?O:new Error(String(O)),T);return}}var n=require("@lytjs/common");var I=require("@lytjs/common");
@@ -1 +1 @@
1
- var T=(e=>(e[e.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",e[e.NOT_FOUND=1002]="NOT_FOUND",e[e.ALREADY_EXISTS=1003]="ALREADY_EXISTS",e[e.OPERATION_FAILED=1004]="OPERATION_FAILED",e[e.REACTIVE_READONLY=2001]="REACTIVE_READONLY",e[e.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",e[e.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",e[e.PARSE_ERROR=3001]="PARSE_ERROR",e[e.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",e[e.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",e[e.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",e[e.RENDER_ERROR=4001]="RENDER_ERROR",e[e.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",e[e.INVALID_VNODE=4003]="INVALID_VNODE",e[e.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",e[e.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",e[e.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",e[e.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",e[e.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",e[e.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",e[e.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",e[e.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",e[e.STORE_DUPLICATE=7002]="STORE_DUPLICATE",e))(T||{});var n=class extends Error{constructor(o,t,E){let i=`[Lyt ${o}] ${t}`;super(i),this.name="LytError",this.code=o,this.details=E}};var R=class R{constructor(o){this.errors=[],this.options=o||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(o){R.globalHandler=o}capture(o,t,E){var I;let i={error:o,vm:t,info:E||"",timestamp:Date.now()};this.errors.push(i),this._hasError=!0;let _=(I=this.options.maxErrors)!=null?I:100;this.errors.length>_&&this.errors.splice(0,this.errors.length-_),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(o instanceof n?o:new n(1004,o.message),t,i.info)===!0)&&this.options.onError&&this.options.onError(o instanceof n?o:new n(1004,o.message),t)}getFallback(o){if(!this.options.fallback||this.errors.length===0)return null;let t=this.errors[this.errors.length-1];return this.options.fallback(t.error,t.vm,t.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};R.globalHandler=null;var s=R,a=!0,O=new Set;function c(r){a=r}function D(){return a}function N(r){if(!a)return;let o=console.warn;typeof o=="function"&&o(`[Lyt warn] ${r}`)}function l(r){if(!a||O.has(r))return;O.add(r);let o=console.warn;typeof o=="function"&&o(`[Lyt warn] ${r}`)}function p(){O.clear()}var f={1001:r=>`\u53C2\u6570 "${r}" \u65E0\u6548\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684\u503C\u7C7B\u578B\u548C\u8303\u56F4\u3002`,1002:r=>`"${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8D44\u6E90\u540D\u79F0\u6216\u8DEF\u5F84\u662F\u5426\u6B63\u786E\u3002`,1003:r=>`"${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u4F7F\u7528\u4E0D\u540C\u7684\u540D\u79F0\u3002`,1004:r=>`\u64CD\u4F5C "${r}" \u6267\u884C\u5931\u8D25\u3002\u8BF7\u68C0\u67E5\u76F8\u5173\u914D\u7F6E\u548C\u72B6\u6001\u3002`,2001:r=>`\u65E0\u6CD5\u4FEE\u6539\u53EA\u8BFB\u54CD\u5E94\u5F0F\u5C5E\u6027 "${r}"\u3002\u53EA\u8BFB\u5BF9\u8C61\u4E0D\u5141\u8BB8\u76F4\u63A5\u8D4B\u503C\u3002`,2002:()=>"\u526F\u4F5C\u7528\u51FD\u6570\u5DF2\u88AB\u9500\u6BC1\uFF0C\u65E0\u6CD5\u518D\u6B21\u6267\u884C\u3002\u8BF7\u521B\u5EFA\u65B0\u7684\u526F\u4F5C\u7528\u3002",2003:()=>"\u8BA1\u7B97\u5C5E\u6027\u68C0\u6D4B\u5230\u5FAA\u73AF\u4F9D\u8D56\u3002\u8BF7\u68C0\u67E5 computed \u51FD\u6570\u662F\u5426\u5F15\u7528\u4E86\u81EA\u8EAB\u3002",3001:r=>`\u6A21\u677F\u89E3\u6790\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u8BED\u6CD5\u662F\u5426\u6B63\u786E\u3002`,3002:r=>`\u65E0\u6548\u7684\u8868\u8FBE\u5F0F "${r}"\u3002\u8BF7\u68C0\u67E5\u8868\u8FBE\u5F0F\u8BED\u6CD5\u3002`,3003:r=>`\u65E0\u6548\u7684\u6307\u4EE4 "${r}"\u3002\u8BF7\u786E\u8BA4\u6307\u4EE4\u540D\u79F0\u662F\u5426\u6B63\u786E\u3002`,3004:r=>`\u65E0\u6548\u7684\u6A21\u677F\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u6A21\u677F\u5185\u5BB9\u3002`,4001:r=>`\u6E32\u67D3\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u7EC4\u4EF6\u7684 render \u51FD\u6570\u6216\u6A21\u677F\u3002`,4002:r=>`\u6C34\u5408\u4E0D\u5339\u914D\uFF1A${r}\u3002\u670D\u52A1\u7AEF\u6E32\u67D3\u4E0E\u5BA2\u6237\u7AEF\u6E32\u67D3\u7ED3\u679C\u4E0D\u4E00\u81F4\u3002`,4003:r=>`\u65E0\u6548\u7684\u865A\u62DF\u8282\u70B9\uFF1A${r}\u3002VNode \u7F3A\u5C11\u5FC5\u8981\u7684 type \u6216\u5176\u4ED6\u5C5E\u6027\u3002`,5001:r=>`\u7EC4\u4EF6\u5C5E\u6027\u65E0\u6548\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u4F20\u5165\u7684 props \u662F\u5426\u7B26\u5408\u7EC4\u4EF6\u5B9A\u4E49\u3002`,5002:r=>`\u7EC4\u4EF6 "${r}" \u7F3A\u5C11 template \u6216 render \u51FD\u6570\u3002\u8BF7\u786E\u4FDD\u7EC4\u4EF6\u5B9A\u4E49\u4E2D\u5305\u542B template \u5B57\u7B26\u4E32\u6216 render \u65B9\u6CD5\u3002`,5003:r=>`\u7EC4\u4EF6\u751F\u547D\u5468\u671F\u9519\u8BEF\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u751F\u547D\u5468\u671F\u94A9\u5B50\u51FD\u6570\u3002`,6001:r=>`\u8DEF\u7531 "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4\u8DEF\u7531\u8DEF\u5F84\u662F\u5426\u5DF2\u6CE8\u518C\u3002`,6002:r=>`\u8DEF\u7531 "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u6CE8\u518C\u76F8\u540C\u7684\u8DEF\u7531\u8DEF\u5F84\u3002`,6003:r=>`\u5BFC\u822A\u88AB\u4E2D\u6B62\uFF1A${r}\u3002\u53EF\u80FD\u88AB\u5BFC\u822A\u5B88\u536B\u62E6\u622A\u3002`,6004:r=>`\u5BFC\u822A\u5931\u8D25\uFF1A${r}\u3002\u8BF7\u68C0\u67E5\u76EE\u6807\u8DEF\u7531\u662F\u5426\u6709\u6548\u3002`,7001:r=>`Store "${r}" \u672A\u627E\u5230\u3002\u8BF7\u786E\u8BA4 store \u662F\u5426\u5DF2\u6CE8\u518C\u3002`,7002:r=>`Store "${r}" \u5DF2\u5B58\u5728\u3002\u8BF7\u907F\u514D\u91CD\u590D\u521B\u5EFA\u76F8\u540C ID \u7684 store\u3002`};function u(r,...o){let t=f[r];if(t){let E=t(...o);return`[Lyt ${r}] ${E}`}return`[Lyt ${r}] \u672A\u77E5\u9519\u8BEF\u3002`}function A(r,o,t){s.globalHandler&&s.globalHandler(r,o,t||""),a&&r instanceof n&&r.details}function g(r,o){try{return r()}catch(t){A(t instanceof Error?t:new Error(String(t)),o);return}}import{LytErrorCodes as L,ErrorCategory as C,getErrorMessage as P,getCategory as h}from"@lytjs/common";import{LytError as y,createCompilerError as d,createRendererError as M,createComponentError as m}from"@lytjs/common";export{s as ErrorBoundary,C as ErrorCategory,n as LytError,T as LytErrorCodes,y as NewLytError,L as NewLytErrorCodes,g as callWithErrorHandling,d as createCompilerError,m as createComponentError,u as createMessage,M as createRendererError,h as getCategory,D as getDevMode,P as getErrorMessage,A as handleError,p as resetWarnedMessages,c as setDevMode,N as warn,l as warnOnce,l as warnOnceUtil,N as warnUtil};
1
+ import{LytError as n,LytErrorCodes as R,getErrorMessage as M}from"@lytjs/common";var A=(_=>(_[_.INVALID_ARGUMENT=1001]="INVALID_ARGUMENT",_[_.NOT_FOUND=1002]="NOT_FOUND",_[_.ALREADY_EXISTS=1003]="ALREADY_EXISTS",_[_.OPERATION_FAILED=1004]="OPERATION_FAILED",_[_.REACTIVE_READONLY=2001]="REACTIVE_READONLY",_[_.REACTIVE_EFFECT_DISPOSED=2002]="REACTIVE_EFFECT_DISPOSED",_[_.COMPUTED_CYCLE=2003]="COMPUTED_CYCLE",_[_.PARSE_ERROR=3001]="PARSE_ERROR",_[_.INVALID_EXPRESSION=3002]="INVALID_EXPRESSION",_[_.INVALID_DIRECTIVE=3003]="INVALID_DIRECTIVE",_[_.INVALID_TEMPLATE=3004]="INVALID_TEMPLATE",_[_.RENDER_ERROR=4001]="RENDER_ERROR",_[_.HYDRATION_MISMATCH=4002]="HYDRATION_MISMATCH",_[_.INVALID_VNODE=4003]="INVALID_VNODE",_[_.COMPONENT_INVALID_PROPS=5001]="COMPONENT_INVALID_PROPS",_[_.COMPONENT_MISSING_TEMPLATE=5002]="COMPONENT_MISSING_TEMPLATE",_[_.COMPONENT_LIFECYCLE_ERROR=5003]="COMPONENT_LIFECYCLE_ERROR",_[_.ROUTE_NOT_FOUND=6001]="ROUTE_NOT_FOUND",_[_.ROUTE_DUPLICATE=6002]="ROUTE_DUPLICATE",_[_.NAVIGATION_ABORTED=6003]="NAVIGATION_ABORTED",_[_.NAVIGATION_FAILED=6004]="NAVIGATION_FAILED",_[_.STORE_NOT_FOUND=7001]="STORE_NOT_FOUND",_[_.STORE_DUPLICATE=7002]="STORE_DUPLICATE",_[_.LYT_COMPILER_PARSE_ERROR=R.LYT_COMPILER_PARSE_ERROR]="LYT_COMPILER_PARSE_ERROR",_[_.LYT_COMPILER_INVALID_EXPRESSION=R.LYT_COMPILER_INVALID_EXPRESSION]="LYT_COMPILER_INVALID_EXPRESSION",_[_.LYT_COMPILER_INVALID_TEMPLATE=R.LYT_COMPILER_INVALID_TEMPLATE]="LYT_COMPILER_INVALID_TEMPLATE",_[_.LYT_COMPILER_INVALID_DIRECTIVE=R.LYT_COMPILER_INVALID_DIRECTIVE]="LYT_COMPILER_INVALID_DIRECTIVE",_[_.LYT_COMPILER_CODEGEN_ERROR=R.LYT_COMPILER_CODEGEN_ERROR]="LYT_COMPILER_CODEGEN_ERROR",_[_.LYT_COMPILER_SFC_PARSE_ERROR=R.LYT_COMPILER_SFC_PARSE_ERROR]="LYT_COMPILER_SFC_PARSE_ERROR",_[_.LYT_COMPILER_TRANSFORM_ERROR=R.LYT_COMPILER_TRANSFORM_ERROR]="LYT_COMPILER_TRANSFORM_ERROR",_[_.LYT_RENDERER_MOUNT_FAILED=R.LYT_RENDERER_MOUNT_FAILED]="LYT_RENDERER_MOUNT_FAILED",_[_.LYT_RENDERER_PATCH_FAILED=R.LYT_RENDERER_PATCH_FAILED]="LYT_RENDERER_PATCH_FAILED",_[_.LYT_RENDERER_HYDRATION_MISMATCH=R.LYT_RENDERER_HYDRATION_MISMATCH]="LYT_RENDERER_HYDRATION_MISMATCH",_[_.LYT_RENDERER_INVALID_VNODE=R.LYT_RENDERER_INVALID_VNODE]="LYT_RENDERER_INVALID_VNODE",_[_.LYT_RENDERER_UNMOUNT_FAILED=R.LYT_RENDERER_UNMOUNT_FAILED]="LYT_RENDERER_UNMOUNT_FAILED",_[_.LYT_COMPONENT_INVALID_PROPS=R.LYT_COMPONENT_INVALID_PROPS]="LYT_COMPONENT_INVALID_PROPS",_[_.LYT_COMPONENT_MISSING_RENDER=R.LYT_COMPONENT_MISSING_RENDER]="LYT_COMPONENT_MISSING_RENDER",_[_.LYT_COMPONENT_LIFECYCLE_ERROR=R.LYT_COMPONENT_LIFECYCLE_ERROR]="LYT_COMPONENT_LIFECYCLE_ERROR",_[_.LYT_COMPONENT_INVALID=R.LYT_COMPONENT_INVALID]="LYT_COMPONENT_INVALID",_[_.LYT_COMPONENT_EMIT_INVALID=R.LYT_COMPONENT_EMIT_INVALID]="LYT_COMPONENT_EMIT_INVALID",_[_.LYT_COMPONENT_RENDER_ERROR=R.LYT_COMPONENT_RENDER_ERROR]="LYT_COMPONENT_RENDER_ERROR",_[_.LYT_ROUTER_INVALID_ROUTE=R.LYT_ROUTER_INVALID_ROUTE]="LYT_ROUTER_INVALID_ROUTE",_[_.LYT_ROUTER_NAVIGATION_FAILED=R.LYT_ROUTER_NAVIGATION_FAILED]="LYT_ROUTER_NAVIGATION_FAILED",_[_.LYT_ROUTER_DUPLICATE_ROUTE=R.LYT_ROUTER_DUPLICATE_ROUTE]="LYT_ROUTER_DUPLICATE_ROUTE",_[_.LYT_ROUTER_NAVIGATION_ABORTED=R.LYT_ROUTER_NAVIGATION_ABORTED]="LYT_ROUTER_NAVIGATION_ABORTED",_[_.LYT_ROUTER_GUARD_ERROR=R.LYT_ROUTER_GUARD_ERROR]="LYT_ROUTER_GUARD_ERROR",_[_.LYT_STORE_ALREADY_EXISTS=R.LYT_STORE_ALREADY_EXISTS]="LYT_STORE_ALREADY_EXISTS",_[_.LYT_STORE_NOT_FOUND=R.LYT_STORE_NOT_FOUND]="LYT_STORE_NOT_FOUND",_[_.LYT_STORE_DISPOSED=R.LYT_STORE_DISPOSED]="LYT_STORE_DISPOSED",_[_.LYT_STORE_PATCH_ERROR=R.LYT_STORE_PATCH_ERROR]="LYT_STORE_PATCH_ERROR",_[_.LYT_REACTIVITY_READONLY_SET=R.LYT_REACTIVITY_READONLY_SET]="LYT_REACTIVITY_READONLY_SET",_[_.LYT_REACTIVITY_READONLY_DELETE=R.LYT_REACTIVITY_READONLY_DELETE]="LYT_REACTIVITY_READONLY_DELETE",_[_.LYT_REACTIVITY_EFFECT_ERROR=R.LYT_REACTIVITY_EFFECT_ERROR]="LYT_REACTIVITY_EFFECT_ERROR",_[_.LYT_REACTIVITY_COMPUTED_CYCLE=R.LYT_REACTIVITY_COMPUTED_CYCLE]="LYT_REACTIVITY_COMPUTED_CYCLE",_[_.LYT_REACTIVITY_EFFECT_DISPOSED=R.LYT_REACTIVITY_EFFECT_DISPOSED]="LYT_REACTIVITY_EFFECT_DISPOSED",_[_.LYT_REACTIVITY_CIRCULAR_DEPENDENCY=R.LYT_REACTIVITY_CIRCULAR_DEPENDENCY]="LYT_REACTIVITY_CIRCULAR_DEPENDENCY",_[_.LYT_REACTIVITY_SIGNAL_DISPOSED=R.LYT_REACTIVITY_SIGNAL_DISPOSED]="LYT_REACTIVITY_SIGNAL_DISPOSED",_[_.LYT_CORE_PLUGIN_ERROR=R.LYT_CORE_PLUGIN_ERROR]="LYT_CORE_PLUGIN_ERROR",_[_.LYT_CORE_MOUNT_NO_CONTAINER=R.LYT_CORE_MOUNT_NO_CONTAINER]="LYT_CORE_MOUNT_NO_CONTAINER",_[_.LYT_CORE_ALREADY_MOUNTED=R.LYT_CORE_ALREADY_MOUNTED]="LYT_CORE_ALREADY_MOUNTED",_[_.LYT_CORE_INVALID_ARGUMENT=R.LYT_CORE_INVALID_ARGUMENT]="LYT_CORE_INVALID_ARGUMENT",_[_.LYT_CORE_NOT_FOUND=R.LYT_CORE_NOT_FOUND]="LYT_CORE_NOT_FOUND",_[_.LYT_CORE_ALREADY_EXISTS=R.LYT_CORE_ALREADY_EXISTS]="LYT_CORE_ALREADY_EXISTS",_[_.LYT_CORE_OPERATION_FAILED=R.LYT_CORE_OPERATION_FAILED]="LYT_CORE_OPERATION_FAILED",_[_.LYT_CLI_SCAFFOLD_FAILED=R.LYT_CLI_SCAFFOLD_FAILED]="LYT_CLI_SCAFFOLD_FAILED",_[_.LYT_CLI_BUILD_FAILED=R.LYT_CLI_BUILD_FAILED]="LYT_CLI_BUILD_FAILED",_[_.LYT_CLI_DEV_SERVER_ERROR=R.LYT_CLI_DEV_SERVER_ERROR]="LYT_CLI_DEV_SERVER_ERROR",_[_.LYT_CLI_CONFIG_INVALID=R.LYT_CLI_CONFIG_INVALID]="LYT_CLI_CONFIG_INVALID",_[_.LYT_CLI_HMR_CONNECTION_FAILED=R.LYT_CLI_HMR_CONNECTION_FAILED]="LYT_CLI_HMR_CONNECTION_FAILED",_[_.LYT_DEVTOOLS_CONNECTION_FAILED=R.LYT_DEVTOOLS_CONNECTION_FAILED]="LYT_DEVTOOLS_CONNECTION_FAILED",_[_.LYT_DEVTOOLS_PANEL_ERROR=R.LYT_DEVTOOLS_PANEL_ERROR]="LYT_DEVTOOLS_PANEL_ERROR",_[_.LYT_DEVTOOLS_PERF_OVERFLOW=R.LYT_DEVTOOLS_PERF_OVERFLOW]="LYT_DEVTOOLS_PERF_OVERFLOW",_[_.LYT_DEVTOOLS_COMPONENT_TREE_ERROR=R.LYT_DEVTOOLS_COMPONENT_TREE_ERROR]="LYT_DEVTOOLS_COMPONENT_TREE_ERROR",_[_.LYT_PLUGIN_INSTALL_FAILED=R.LYT_PLUGIN_INSTALL_FAILED]="LYT_PLUGIN_INSTALL_FAILED",_[_.LYT_PLUGIN_ALREADY_INSTALLED=R.LYT_PLUGIN_ALREADY_INSTALLED]="LYT_PLUGIN_ALREADY_INSTALLED",_[_.LYT_PLUGIN_INVALID=R.LYT_PLUGIN_INVALID]="LYT_PLUGIN_INVALID",_[_.LYT_PLUGIN_UNINSTALL_FAILED=R.LYT_PLUGIN_UNINSTALL_FAILED]="LYT_PLUGIN_UNINSTALL_FAILED",_[_.LYT_RENDERER_VAPOR_ERROR=R.LYT_RENDERER_VAPOR_ERROR]="LYT_RENDERER_VAPOR_ERROR",_[_.LYT_RENDERER_VAPOR_COMPILER_ERROR=R.LYT_RENDERER_VAPOR_COMPILER_ERROR]="LYT_RENDERER_VAPOR_COMPILER_ERROR",_[_.LYT_RENDERER_VAPOR_COMPONENT_ERROR=R.LYT_RENDERER_VAPOR_COMPONENT_ERROR]="LYT_RENDERER_VAPOR_COMPONENT_ERROR",_[_.LYT_SSR_STREAM_ERROR=R.LYT_SSR_STREAM_ERROR]="LYT_SSR_STREAM_ERROR",_[_.LYT_SSR_SUSPENSE_TIMEOUT=R.LYT_SSR_SUSPENSE_TIMEOUT]="LYT_SSR_SUSPENSE_TIMEOUT",_[_.LYT_SSR_HYDRATION_ERROR=R.LYT_SSR_HYDRATION_ERROR]="LYT_SSR_HYDRATION_ERROR",_[_.LYT_SSR_ISLAND_ERROR=R.LYT_SSR_ISLAND_ERROR]="LYT_SSR_ISLAND_ERROR",_))(A||{});var D=class D{constructor(T){this.errors=[],this.options=T||{},this._hasError=!1}get hasError(){return this._hasError}static setGlobalHandler(T){D.globalHandler=T}capture(T,E,t){var e;let a={error:T,vm:E,info:t||"",timestamp:Date.now()};this.errors.push(a),this._hasError=!0;let L=(e=this.options.maxErrors)!=null?e:100;this.errors.length>L&&this.errors.splice(0,this.errors.length-L),!(this.options.onErrorCaptured&&this.options.onErrorCaptured(T instanceof n?T:new n(A.LYT_CORE_OPERATION_FAILED,T.message),E,a.info)===!0)&&this.options.onError&&this.options.onError(T instanceof n?T:new n(A.LYT_CORE_OPERATION_FAILED,T.message),E)}getFallback(T){if(!this.options.fallback||this.errors.length===0)return null;let E=this.errors[this.errors.length-1];return this.options.fallback(E.error,E.vm,E.info)}getErrors(){return this.errors.slice()}getErrorCount(){return this.errors.length}getLastErrors(){return this.errors.length===0?null:{...this.errors[this.errors.length-1]}}clear(){this.errors=[],this._hasError=!1}};D.globalHandler=null;var I=D,N=!0,Y=new Set;function c(O){N=O}function l(){return N}function P(O){if(!N)return;let T=console.warn;typeof T=="function"&&T(`[Lyt warn] ${O}`)}function S(O){if(!N||Y.has(O))return;Y.add(O);let T=console.warn;typeof T=="function"&&T(`[Lyt warn] ${O}`)}function V(){Y.clear()}function p(O,...T){let E=M(O);return`[Lyt ${O}] ${E}`}function i(O,T,E){I.globalHandler&&I.globalHandler(O,T,E||""),N?O instanceof n&&O.details:typeof reportError=="function"&&reportError(O)}function U(O,T){try{return O()}catch(E){i(E instanceof Error?E:new Error(String(E)),T);return}}async function f(O,T){try{return await O()}catch(E){i(E instanceof Error?E:new Error(String(E)),T);return}}import{LytErrorCodes as b,ErrorCategory as F,getErrorMessage as u,getCategory as g}from"@lytjs/common";import{LytError as W,createCompilerError as m,createRendererError as h,createComponentError as G}from"@lytjs/common";export{I as ErrorBoundary,F as ErrorCategory,n as LytError,A as LytErrorCodes,U as callWithErrorHandling,f as callWithErrorHandlingAsync,m as createCompilerError,G as createComponentError,p as createMessage,h as createRendererError,g as getCategory,l as getDevMode,u as getErrorMessage,i as handleError,V as resetWarnedMessages,c as setDevMode,P as warn,S as warnOnce,S as warnOnceUtil,P as warnUtil};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- var O=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var Y=(n,e)=>{for(var t in e)O(n,t,{get:e[t],enumerable:!0})},h=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of q(e))!X.call(n,o)&&o!==t&&O(n,o,{get:()=>e[o],enumerable:!(i=$(e,o))||i.enumerable});return n},A=(n,e,t)=>(h(n,e,"default"),t&&h(t,e,"default"));var K=n=>h(O({},"__esModule",{value:!0}),n);var v={};Y(v,{Fragment:()=>j,ShapeFlags:()=>L,createApp:()=>B,h:()=>I});module.exports=K(v);var y=require("@lytjs/common"),L=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(L||{}),j=Symbol("Fragment");function Z(n,e){if(e!=null)if((0,y.isStringOrNumber)(e))n.children=String(e),n.shapeFlag|=8;else if((0,y.isArray)(e)){let t=[];for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean"))if((0,y.isArray)(o))for(let d=0;d<o.length;d++){let s=o[d];s!=null&&typeof s!="boolean"&&t.push((0,y.isVNode)(s)?s:E(String(s)))}else(0,y.isVNode)(o)?t.push(o):t.push(E(String(o)))}n.children=t,n.shapeFlag|=16}else typeof e=="object"&&(n.children=e,n.shapeFlag|=32)}function E(n,e=null,t=null){var u,f;let i=0;typeof n=="string"?i=1:n===j?i=0:typeof n=="function"?i=2:typeof n=="object"&&n!==null&&(n.setup||n.__vccOpts||n.render)&&(i=4);let o=(u=e==null?void 0:e.key)!=null?u:null,d=(f=e==null?void 0:e.ref)!=null?f:null,s=e;if(e){let{key:C,ref:p,...P}=e;s=P}let b={type:n,props:s,children:null,key:o,ref:d,shapeFlag:i,el:null,component:null};return t!=null&&Z(b,t),b}function I(n,e,t){return E(n,e||null,t||null)}var N=require("@lytjs/common");function D(n){return Object.create(n||null)}function V(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function _(n){return typeof n=="function"}function F(n,e,...t){if(V(e)){let i=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if((0,N.isPromise)(i))return i.then(()=>{let o=e.install(n,...t);if((0,N.isPromise)(o))return o.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let o=e.install(n,...t);if((0,N.isPromise)(o))return o.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(_(e))return e(n,...t)}function S(n,e){if(V(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else _(e)}var T=require("@lytjs/reactivity"),H=require("@lytjs/compiler"),c=require("@lytjs/component"),M=require("@lytjs/renderer"),G=100,g=new Map;function J(n){let e=g.get(n);if(e)return g.delete(n),g.set(n,e),e;let{code:t}=(0,H.compile)(n);if(e=new Function("h","_ctx",`return ${t}`),g.size>=G){let i=g.keys().next().value;i!==void 0&&g.delete(i)}return g.set(n,e),e}function Q(n){let e={...n};if(n.state&&typeof n.state!="function"){let t=n.state;e.state=()=>({...t})}if(typeof n.render=="function"){let t=n.render;e.render=(i,o)=>t(i)}if(n.computed){let t={};for(let i of Object.keys(n.computed)){let o=n.computed[i];typeof o=="function"?t[i]={get:o}:t[i]=o}e.computed=t}if(typeof n.init=="function"){let t=n.init;e.init=function(i,o){return t.call(this,i)}}return e}function W(){return{createElement(n){return document.createElement(n)},createText(n){return document.createTextNode(n)},createComment(n){return document.createComment(n)},setAttribute(n,e,t){n.setAttribute(e,String(t))},removeAttribute(n,e){n.removeAttribute(e)},setStyle(n,e){if(typeof e=="string")n.style.cssText=e;else if(e&&typeof e=="object")for(let t in e)n.style[t]=e[t]},setClass(n,e){if(typeof e=="string")n.className=e;else if(e&&typeof e=="object"){let t=[];for(let[i,o]of Object.entries(e))o&&t.push(i);n.className=t.join(" ")}else n.className=""},insert(n,e,t){t!=null?n.insertBefore(e,t):n.appendChild(e)},remove(n){n.parentNode&&n.parentNode.removeChild(n)},replace(n,e,t){n.replaceChild(t,e)},addEventListener(n,e,t,i){n.addEventListener(e,t,i)},removeEventListener(n,e,t){n.removeEventListener(e,t)},nextTick(n){Promise.resolve().then(n)},parentNode(n){return n.parentNode},nextSibling(n){return n.nextSibling},querySelector(n){return document.querySelector(n)}}}function B(n,e){let t=new Set,i={},o={},d=D(),s={},b={},u=null,f=null,C=null,p=null,P=!1,w=Q(typeof n=="function"?{render:n}:n),U=(0,c.defineComponent)(w),r={config:s,globalProperties:b,get _instance(){return u},mount(a){if(P)return r;let l;if(typeof a=="string"){if(l=document.querySelector(a),!l)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${a}"`)}else l=a;p=l;let m=W();f=(0,M.createRenderer)(m),u=(0,c.createComponentInstance)(U),(0,c.setupComponent)(u,e||{},null);let R=u.type;if(!R.render&&R.template){let k=J(R.template);R.render=(x,z)=>k(x,z.renderProxy)}return(0,c.mountComponent)(u,I),u.subTree&&f.mount(u.subTree,l),C=(0,T.effect)(()=>{if(!(!u||!u.isMounted||!f)&&((0,c.updateComponent)(u,I),u.subTree&&p)){let k=p.firstChild,x=u.subTree;p.innerHTML="",f.mount(x,p)}},{lazy:!0}),P=!0,r},unmount(){P&&(C&&((0,T.stop)(C),C=null),u&&(0,c.unmountComponent)(u),p&&(p.innerHTML=""),u=null,f=null,p=null,P=!1)},use(a,...l){if(t.has(a))return r;t.add(a);let m=F({use:r.use.bind(r),unuse:r.unuse.bind(r),isInstalled:r.isInstalled.bind(r),provide:r.provide.bind(r),inject:r.inject.bind(r),config:s,globalProperties:b},a,...l);return m instanceof Promise?m.then(()=>r):r},unuse(a){if(!t.has(a))return r;t.delete(a);let l=S({use:r.use.bind(r),unuse:r.unuse.bind(r),isInstalled:r.isInstalled.bind(r),provide:r.provide.bind(r),inject:r.inject.bind(r),config:s,globalProperties:b},a);return l instanceof Promise?l.then(()=>r):r},isInstalled(a){return t.has(a)},provide(a,l){return d[a]=l,r},inject(a,l){let m=d[a];return m!==void 0?m:l},component(a,l){return l?(i[a]=l,r):i[a]},directive(a,l){return l?(o[a]=l,r):o[a]}};return r}A(v,require("@lytjs/common"),module.exports);
1
+ "use strict";var E=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var Y=(n,e)=>{for(var t in e)E(n,t,{get:e[t],enumerable:!0})},O=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of q(e))!X.call(n,o)&&o!==t&&E(n,o,{get:()=>e[o],enumerable:!(i=$(e,o))||i.enumerable});return n},A=(n,e,t)=>(O(n,e,"default"),t&&O(t,e,"default"));var K=n=>O(E({},"__esModule",{value:!0}),n);var v={};Y(v,{Fragment:()=>x.Fragment,ShapeFlags:()=>L,createApp:()=>S,h:()=>R});module.exports=K(v);var y=require("@lytjs/common"),x=require("@lytjs/vdom");var L=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(L||{});function Z(n,e){if(e!=null)if((0,y.isStringOrNumber)(e))n.children=String(e),n.shapeFlag|=8;else if((0,y.isArray)(e)){let t=[];for(let i=0;i<e.length;i++){let o=e[i];if(!(o==null||typeof o=="boolean"))if((0,y.isArray)(o))for(let p=0;p<o.length;p++){let s=o[p];s!=null&&typeof s!="boolean"&&t.push((0,y.isVNode)(s)?s:j(String(s)))}else(0,y.isVNode)(o)?t.push(o):t.push(j(String(o)))}n.children=t,n.shapeFlag|=16}else typeof e=="object"&&(n.children=e,n.shapeFlag|=32)}function j(n,e=null,t=null){var u,f;let i=0;typeof n=="string"?i=1:n===x.Fragment?i=0:typeof n=="function"?i=2:typeof n=="object"&&n!==null&&(n.setup||n.__vccOpts||n.render)&&(i=4);let o=(u=e==null?void 0:e.key)!=null?u:null,p=(f=e==null?void 0:e.ref)!=null?f:null,s=e;if(e){let{key:C,ref:d,...b}=e;s=b}let P={type:n,props:s,children:null,key:o,ref:p,shapeFlag:i,el:null,component:null};return t!=null&&Z(P,t),P}function R(n,e,t){return j(n,e||null,t||null)}var k=require("@lytjs/common");function w(n){return Object.create(n||null)}function D(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function V(n){return typeof n=="function"}function _(n,e,...t){if(D(e)){let i=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if((0,k.isPromise)(i))return i.then(()=>{let o=e.install(n,...t);if((0,k.isPromise)(o))return o.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let o=e.install(n,...t);if((0,k.isPromise)(o))return o.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(V(e))return e(n,...t)}function F(n,e){if(D(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else V(e)}var T=require("@lytjs/reactivity"),H=require("@lytjs/compiler"),c=require("@lytjs/component"),M=require("@lytjs/renderer"),G=100,g=new Map;function J(n){let e=g.get(n);if(e)return g.delete(n),g.set(n,e),e;let{code:t}=(0,H.compile)(n);if(e=new Function("h","_ctx",`return ${t}`),g.size>=G){let i=g.keys().next().value;i!==void 0&&g.delete(i)}return g.set(n,e),e}function Q(n){let e={...n};if(n.state&&typeof n.state!="function"){let t=n.state;e.state=()=>({...t})}if(typeof n.render=="function"){let t=n.render;e.render=(i,o)=>t(i)}if(n.computed){let t={};for(let i of Object.keys(n.computed)){let o=n.computed[i];typeof o=="function"?t[i]={get:o}:t[i]=o}e.computed=t}if(typeof n.init=="function"){let t=n.init;e.init=function(i,o){return t.call(this,i)}}return e}function W(){return{createElement(n){return document.createElement(n)},createText(n){return document.createTextNode(n)},createComment(n){return document.createComment(n)},setAttribute(n,e,t){n.setAttribute(e,String(t))},removeAttribute(n,e){n.removeAttribute(e)},setStyle(n,e){if(typeof e=="string")n.style.cssText=e;else if(e&&typeof e=="object")for(let t in e)n.style[t]=e[t]},setClass(n,e){if(typeof e=="string")n.className=e;else if(e&&typeof e=="object"){let t=[];for(let[i,o]of Object.entries(e))o&&t.push(i);n.className=t.join(" ")}else n.className=""},insert(n,e,t){t!=null?n.insertBefore(e,t):n.appendChild(e)},remove(n){n.parentNode&&n.parentNode.removeChild(n)},replace(n,e,t){n.replaceChild(t,e)},addEventListener(n,e,t,i){n.addEventListener(e,t,i)},removeEventListener(n,e,t){n.removeEventListener(e,t)},nextTick(n){Promise.resolve().then(n)},parentNode(n){return n.parentNode},nextSibling(n){return n.nextSibling},querySelector(n){return document.querySelector(n)}}}function S(n,e){let t=new Set,i={},o={},p=w(),s={},P={},u=null,f=null,C=null,d=null,b=!1,B=Q(typeof n=="function"?{render:n}:n),U=(0,c.defineComponent)(B),r={config:s,globalProperties:P,get _instance(){return u},mount(l){if(b)return r;let a;if(typeof l=="string"){let I=document.querySelector(l);if(!I)throw new Error(`[Lyt] \u6302\u8F7D\u76EE\u6807 "${l}" \u672A\u627E\u5230`);a=I}else a=l;d=a;let m=W();f=(0,M.createRenderer)(m),u=(0,c.createComponentInstance)(U),(0,c.setupComponent)(u,e||{},null);let N=u.type;if(!N.render&&N.template){let I=J(N.template);N.render=(h,z)=>I(h,z.renderProxy)}return(0,c.mountComponent)(u,R),u.subTree&&f.mount(u.subTree,a),C=(0,T.effect)(()=>{if(!(!u||!u.isMounted||!f)&&((0,c.updateComponent)(u,R),u.subTree&&d)){let I=d.firstChild,h=u.subTree;for(;d.firstChild;)d.removeChild(d.firstChild);f.mount(h,d)}},{lazy:!0}),b=!0,r},unmount(){if(b){if(C&&((0,T.stop)(C),C=null),u&&(0,c.unmountComponent)(u),d)for(;d.firstChild;)d.removeChild(d.firstChild);u=null,f=null,d=null,b=!1}},use(l,...a){if(t.has(l))return r;t.add(l);let m=_({use:r.use.bind(r),unuse:r.unuse.bind(r),isInstalled:r.isInstalled.bind(r),provide:r.provide.bind(r),inject:r.inject.bind(r),config:s,globalProperties:P},l,...a);return m instanceof Promise?m.then(()=>r):r},unuse(l){if(!t.has(l))return r;t.delete(l);let a=F({use:r.use.bind(r),unuse:r.unuse.bind(r),isInstalled:r.isInstalled.bind(r),provide:r.provide.bind(r),inject:r.inject.bind(r),config:s,globalProperties:P},l);return a instanceof Promise?a.then(()=>r):r},isInstalled(l){return t.has(l)},provide(l,a){return p[l]=a,r},inject(l,a){let m=p[l];return m!==void 0?m:a},component(l,a){return a?(i[l]=a,r):i[l]},directive(l,a){return a?(o[l]=a,r):o[l]}};return r}A(v,require("@lytjs/common"),module.exports);
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{isStringOrNumber as F,isArray as N,isVNode as T}from"@lytjs/common";var x=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(x||{}),h=Symbol("Fragment");function S(n,e){if(e!=null)if(F(e))n.children=String(e),n.shapeFlag|=8;else if(N(e)){let t=[];for(let i=0;i<e.length;i++){let r=e[i];if(!(r==null||typeof r=="boolean"))if(N(r))for(let c=0;c<r.length;c++){let s=r[c];s!=null&&typeof s!="boolean"&&t.push(T(s)?s:C(String(s)))}else T(r)?t.push(r):t.push(C(String(r)))}n.children=t,n.shapeFlag|=16}else typeof e=="object"&&(n.children=e,n.shapeFlag|=32)}function C(n,e=null,t=null){var u,p;let i=0;typeof n=="string"?i=1:n===h?i=0:typeof n=="function"?i=2:typeof n=="object"&&n!==null&&(n.setup||n.__vccOpts||n.render)&&(i=4);let r=(u=e==null?void 0:e.key)!=null?u:null,c=(p=e==null?void 0:e.ref)!=null?p:null,s=e;if(e){let{key:v,ref:d,...g}=e;s=g}let m={type:n,props:s,children:null,key:r,ref:c,shapeFlag:i,el:null,component:null};return t!=null&&S(m,t),m}function P(n,e,t){return C(n,e||null,t||null)}import{isPromise as I}from"@lytjs/common";function O(n){return Object.create(n||null)}function E(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function L(n){return typeof n=="function"}function j(n,e,...t){if(E(e)){let i=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if(I(i))return i.then(()=>{let r=e.install(n,...t);if(I(r))return r.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let r=e.install(n,...t);if(I(r))return r.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(L(e))return e(n,...t)}function k(n,e){if(E(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else L(e)}import{effect as H,stop as M}from"@lytjs/reactivity";import{compile as B}from"@lytjs/compiler";import{defineComponent as w,createComponentInstance as U,setupComponent as z,mountComponent as $,updateComponent as q,unmountComponent as X}from"@lytjs/component";import{createRenderer as Y}from"@lytjs/renderer";var K=100,y=new Map;function Z(n){let e=y.get(n);if(e)return y.delete(n),y.set(n,e),e;let{code:t}=B(n);if(e=new Function("h","_ctx",`return ${t}`),y.size>=K){let i=y.keys().next().value;i!==void 0&&y.delete(i)}return y.set(n,e),e}function G(n){let e={...n};if(n.state&&typeof n.state!="function"){let t=n.state;e.state=()=>({...t})}if(typeof n.render=="function"){let t=n.render;e.render=(i,r)=>t(i)}if(n.computed){let t={};for(let i of Object.keys(n.computed)){let r=n.computed[i];typeof r=="function"?t[i]={get:r}:t[i]=r}e.computed=t}if(typeof n.init=="function"){let t=n.init;e.init=function(i,r){return t.call(this,i)}}return e}function J(){return{createElement(n){return document.createElement(n)},createText(n){return document.createTextNode(n)},createComment(n){return document.createComment(n)},setAttribute(n,e,t){n.setAttribute(e,String(t))},removeAttribute(n,e){n.removeAttribute(e)},setStyle(n,e){if(typeof e=="string")n.style.cssText=e;else if(e&&typeof e=="object")for(let t in e)n.style[t]=e[t]},setClass(n,e){if(typeof e=="string")n.className=e;else if(e&&typeof e=="object"){let t=[];for(let[i,r]of Object.entries(e))r&&t.push(i);n.className=t.join(" ")}else n.className=""},insert(n,e,t){t!=null?n.insertBefore(e,t):n.appendChild(e)},remove(n){n.parentNode&&n.parentNode.removeChild(n)},replace(n,e,t){n.replaceChild(t,e)},addEventListener(n,e,t,i){n.addEventListener(e,t,i)},removeEventListener(n,e,t){n.removeEventListener(e,t)},nextTick(n){Promise.resolve().then(n)},parentNode(n){return n.parentNode},nextSibling(n){return n.nextSibling},querySelector(n){return document.querySelector(n)}}}function Q(n,e){let t=new Set,i={},r={},c=O(),s={},m={},u=null,p=null,v=null,d=null,g=!1,D=G(typeof n=="function"?{render:n}:n),V=w(D),o={config:s,globalProperties:m,get _instance(){return u},mount(a){if(g)return o;let l;if(typeof a=="string"){if(l=document.querySelector(a),!l)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${a}"`)}else l=a;d=l;let f=J();p=Y(f),u=U(V),z(u,e||{},null);let b=u.type;if(!b.render&&b.template){let R=Z(b.template);b.render=(A,_)=>R(A,_.renderProxy)}return $(u,P),u.subTree&&p.mount(u.subTree,l),v=H(()=>{if(!(!u||!u.isMounted||!p)&&(q(u,P),u.subTree&&d)){let R=d.firstChild,A=u.subTree;d.innerHTML="",p.mount(A,d)}},{lazy:!0}),g=!0,o},unmount(){g&&(v&&(M(v),v=null),u&&X(u),d&&(d.innerHTML=""),u=null,p=null,d=null,g=!1)},use(a,...l){if(t.has(a))return o;t.add(a);let f=j({use:o.use.bind(o),unuse:o.unuse.bind(o),isInstalled:o.isInstalled.bind(o),provide:o.provide.bind(o),inject:o.inject.bind(o),config:s,globalProperties:m},a,...l);return f instanceof Promise?f.then(()=>o):o},unuse(a){if(!t.has(a))return o;t.delete(a);let l=k({use:o.use.bind(o),unuse:o.unuse.bind(o),isInstalled:o.isInstalled.bind(o),provide:o.provide.bind(o),inject:o.inject.bind(o),config:s,globalProperties:m},a);return l instanceof Promise?l.then(()=>o):o},isInstalled(a){return t.has(a)},provide(a,l){return c[a]=l,o},inject(a,l){let f=c[a];return f!==void 0?f:l},component(a,l){return l?(i[a]=l,o):i[a]},directive(a,l){return l?(r[a]=l,o):r[a]}};return o}export*from"@lytjs/common";export{h as Fragment,x as ShapeFlags,Q as createApp,P as h};
1
+ import{isStringOrNumber as _,isArray as N,isVNode as x}from"@lytjs/common";import{Fragment as k}from"@lytjs/vdom";var T=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(T||{});function F(n,e){if(e!=null)if(_(e))n.children=String(e),n.shapeFlag|=8;else if(N(e)){let t=[];for(let i=0;i<e.length;i++){let r=e[i];if(!(r==null||typeof r=="boolean"))if(N(r))for(let c=0;c<r.length;c++){let s=r[c];s!=null&&typeof s!="boolean"&&t.push(x(s)?s:I(String(s)))}else x(r)?t.push(r):t.push(I(String(r)))}n.children=t,n.shapeFlag|=16}else typeof e=="object"&&(n.children=e,n.shapeFlag|=32)}function I(n,e=null,t=null){var u,p;let i=0;typeof n=="string"?i=1:n===k?i=0:typeof n=="function"?i=2:typeof n=="object"&&n!==null&&(n.setup||n.__vccOpts||n.render)&&(i=4);let r=(u=e==null?void 0:e.key)!=null?u:null,c=(p=e==null?void 0:e.ref)!=null?p:null,s=e;if(e){let{key:v,ref:d,...g}=e;s=g}let m={type:n,props:s,children:null,key:r,ref:c,shapeFlag:i,el:null,component:null};return t!=null&&F(m,t),m}function A(n,e,t){return I(n,e||null,t||null)}import{isPromise as R}from"@lytjs/common";function h(n){return Object.create(n||null)}function O(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function E(n){return typeof n=="function"}function j(n,e,...t){if(O(e)){let i=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if(R(i))return i.then(()=>{let r=e.install(n,...t);if(R(r))return r.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let r=e.install(n,...t);if(R(r))return r.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(E(e))return e(n,...t)}function L(n,e){if(O(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else E(e)}import{effect as H,stop as M}from"@lytjs/reactivity";import{compile as S}from"@lytjs/compiler";import{defineComponent as B,createComponentInstance as U,setupComponent as z,mountComponent as $,updateComponent as q,unmountComponent as X}from"@lytjs/component";import{createRenderer as Y}from"@lytjs/renderer";var K=100,y=new Map;function Z(n){let e=y.get(n);if(e)return y.delete(n),y.set(n,e),e;let{code:t}=S(n);if(e=new Function("h","_ctx",`return ${t}`),y.size>=K){let i=y.keys().next().value;i!==void 0&&y.delete(i)}return y.set(n,e),e}function G(n){let e={...n};if(n.state&&typeof n.state!="function"){let t=n.state;e.state=()=>({...t})}if(typeof n.render=="function"){let t=n.render;e.render=(i,r)=>t(i)}if(n.computed){let t={};for(let i of Object.keys(n.computed)){let r=n.computed[i];typeof r=="function"?t[i]={get:r}:t[i]=r}e.computed=t}if(typeof n.init=="function"){let t=n.init;e.init=function(i,r){return t.call(this,i)}}return e}function J(){return{createElement(n){return document.createElement(n)},createText(n){return document.createTextNode(n)},createComment(n){return document.createComment(n)},setAttribute(n,e,t){n.setAttribute(e,String(t))},removeAttribute(n,e){n.removeAttribute(e)},setStyle(n,e){if(typeof e=="string")n.style.cssText=e;else if(e&&typeof e=="object")for(let t in e)n.style[t]=e[t]},setClass(n,e){if(typeof e=="string")n.className=e;else if(e&&typeof e=="object"){let t=[];for(let[i,r]of Object.entries(e))r&&t.push(i);n.className=t.join(" ")}else n.className=""},insert(n,e,t){t!=null?n.insertBefore(e,t):n.appendChild(e)},remove(n){n.parentNode&&n.parentNode.removeChild(n)},replace(n,e,t){n.replaceChild(t,e)},addEventListener(n,e,t,i){n.addEventListener(e,t,i)},removeEventListener(n,e,t){n.removeEventListener(e,t)},nextTick(n){Promise.resolve().then(n)},parentNode(n){return n.parentNode},nextSibling(n){return n.nextSibling},querySelector(n){return document.querySelector(n)}}}function Q(n,e){let t=new Set,i={},r={},c=h(),s={},m={},u=null,p=null,v=null,d=null,g=!1,w=G(typeof n=="function"?{render:n}:n),D=B(w),o={config:s,globalProperties:m,get _instance(){return u},mount(l){if(g)return o;let a;if(typeof l=="string"){let P=document.querySelector(l);if(!P)throw new Error(`[Lyt] \u6302\u8F7D\u76EE\u6807 "${l}" \u672A\u627E\u5230`);a=P}else a=l;d=a;let f=J();p=Y(f),u=U(D),z(u,e||{},null);let b=u.type;if(!b.render&&b.template){let P=Z(b.template);b.render=(C,V)=>P(C,V.renderProxy)}return $(u,A),u.subTree&&p.mount(u.subTree,a),v=H(()=>{if(!(!u||!u.isMounted||!p)&&(q(u,A),u.subTree&&d)){let P=d.firstChild,C=u.subTree;for(;d.firstChild;)d.removeChild(d.firstChild);p.mount(C,d)}},{lazy:!0}),g=!0,o},unmount(){if(g){if(v&&(M(v),v=null),u&&X(u),d)for(;d.firstChild;)d.removeChild(d.firstChild);u=null,p=null,d=null,g=!1}},use(l,...a){if(t.has(l))return o;t.add(l);let f=j({use:o.use.bind(o),unuse:o.unuse.bind(o),isInstalled:o.isInstalled.bind(o),provide:o.provide.bind(o),inject:o.inject.bind(o),config:s,globalProperties:m},l,...a);return f instanceof Promise?f.then(()=>o):o},unuse(l){if(!t.has(l))return o;t.delete(l);let a=L({use:o.use.bind(o),unuse:o.unuse.bind(o),isInstalled:o.isInstalled.bind(o),provide:o.provide.bind(o),inject:o.inject.bind(o),config:s,globalProperties:m},l);return a instanceof Promise?a.then(()=>o):o},isInstalled(l){return t.has(l)},provide(l,a){return c[l]=a,o},inject(l,a){let f=c[l];return f!==void 0?f:a},component(l,a){return a?(i[l]=a,o):i[l]},directive(l,a){return a?(r[l]=a,o):r[l]}};return o}export*from"@lytjs/common";export{k as Fragment,T as ShapeFlags,Q as createApp,A as h};
@@ -1 +1 @@
1
- var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var t in e)a(n,t,{get:e[t],enumerable:!0})},A=(n,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!g.call(n,i)&&i!==t&&a(n,i,{get:()=>e[i],enumerable:!(l=d(e,i))||l.enumerable});return n};var m=n=>A(a({},"__esModule",{value:!0}),n);var I={};y(I,{createProvidesContext:()=>u,getPluginName:()=>P,installPlugin:()=>c,isPluginFunction:()=>r,isPluginObject:()=>o,uninstallPlugin:()=>f});module.exports=m(I);var s=require("@lytjs/common");function u(n){return Object.create(n||null)}function o(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function r(n){return typeof n=="function"}function P(n){return o(n)&&n.name||r(n)&&n.name?n.name:o(n)?"[PluginObject]":"[PluginFunction]"}function c(n,e,...t){if(o(e)){let l=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if((0,s.isPromise)(l))return l.then(()=>{let i=e.install(n,...t);if((0,s.isPromise)(i))return i.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let i=e.install(n,...t);if((0,s.isPromise)(i))return i.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(r(e))return e(n,...t)}function f(n,e){if(o(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else r(e)}
1
+ "use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var y=(n,e)=>{for(var t in e)a(n,t,{get:e[t],enumerable:!0})},A=(n,e,t,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of p(e))!g.call(n,i)&&i!==t&&a(n,i,{get:()=>e[i],enumerable:!(l=d(e,i))||l.enumerable});return n};var m=n=>A(a({},"__esModule",{value:!0}),n);var I={};y(I,{createProvidesContext:()=>u,getPluginName:()=>P,installPlugin:()=>c,isPluginFunction:()=>r,isPluginObject:()=>o,uninstallPlugin:()=>f});module.exports=m(I);var s=require("@lytjs/common");function u(n){return Object.create(n||null)}function o(n){return n!==null&&typeof n=="object"&&typeof n.install=="function"}function r(n){return typeof n=="function"}function P(n){return o(n)&&n.name||r(n)&&n.name?n.name:o(n)?"[PluginObject]":"[PluginFunction]"}function c(n,e,...t){if(o(e)){let l=e.onBeforeInstall?e.onBeforeInstall(n,...t):void 0;if((0,s.isPromise)(l))return l.then(()=>{let i=e.install(n,...t);if((0,s.isPromise)(i))return i.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)});{let i=e.install(n,...t);if((0,s.isPromise)(i))return i.then(()=>{if(e.onInstalled)return e.onInstalled(n,...t)});if(e.onInstalled)return e.onInstalled(n,...t)}}else if(r(e))return e(n,...t)}function f(n,e){if(o(e)){if(typeof e.uninstall=="function")return e.uninstall(n)}else r(e)}
@@ -1 +1 @@
1
- var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("@lytjs/common"),module.exports);
1
+ "use strict";var a=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var p=(r,o,f,x)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of c(o))!d.call(r,e)&&e!==f&&a(r,e,{get:()=>o[e],enumerable:!(x=b(o,e))||x.enumerable});return r},t=(r,o,f)=>(p(r,o,"default"),f&&p(f,o,"default"));var g=r=>p(a({},"__esModule",{value:!0}),r);var m={};module.exports=g(m);t(m,require("@lytjs/common"),module.exports);
@@ -35,29 +35,29 @@ export interface ComponentOptions {
35
35
  /** 组件名称 */
36
36
  name?: string;
37
37
  /** Props 定义 */
38
- props?: Record<string, any>;
38
+ props?: Record<string, unknown>;
39
39
  /** 响应式状态(对象或工厂函数) */
40
- state?: Record<string, any> | (() => Record<string, any>);
40
+ state?: Record<string, unknown> | (() => Record<string, unknown>);
41
41
  /** 计算属性 */
42
- computed?: Record<string, () => any>;
42
+ computed?: Record<string, (...args: unknown[]) => unknown>;
43
43
  /** 方法 */
44
- methods?: Record<string, (...args: any[]) => any>;
44
+ methods?: Record<string, (...args: unknown[]) => unknown>;
45
45
  /** 模板字符串 */
46
46
  template?: string;
47
47
  /** 渲染函数(优先于 template) */
48
- render?: (ctx: any) => VNode;
48
+ render?: (ctx: unknown) => VNode;
49
49
  /** setup 函数(组合式 API) */
50
- setup?: (props: Record<string, any>, ctx: any) => Record<string, any> | void;
50
+ setup?: (props: Record<string, unknown>, ctx: unknown) => Record<string, unknown> | void;
51
51
  /** 初始化函数 */
52
- init?: (this: any, props: Record<string, any>) => void;
52
+ init?: (this: unknown, props: Record<string, unknown>) => void;
53
53
  /** mounted 生命周期 */
54
- mounted?: (this: any) => void;
54
+ mounted?: (this: unknown) => void;
55
55
  /** beforeUnmount 生命周期 */
56
- beforeUnmount?: (this: any) => void;
56
+ beforeUnmount?: (this: unknown) => void;
57
57
  /** unmounted 生命周期 */
58
- unmounted?: (this: any) => void;
58
+ unmounted?: (this: unknown) => void;
59
59
  /** 子组件 */
60
- components?: Record<string, any>;
60
+ components?: Record<string, unknown>;
61
61
  /** 标记为组件定义 */
62
62
  _isComponentDefine?: true;
63
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../../src/create-app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAK,KAAK,KAAK,EAAuC,MAAM,KAAK,CAAC;AACzE,OAAO,EAIL,KAAK,MAAM,EACX,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AA+DlB;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd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,CAAC,CAAC;IACtC,cAAc;IACd,SAAS,EAAE,GAAG,CAAC;CAChB;AAiKD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,SAAS,CACvB,aAAa,EAAE,gBAAgB,GAAG,CAAC,MAAM,KAAK,CAAC,EAC/C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC9B,GAAG,CAsVL"}
@@ -1 +1 @@
1
- {"version":3,"file":"dev-error.d.ts","sourceRoot":"","sources":["../../src/dev-error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAmD9C;AAMD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,GAAG,GAAG,MAAM,CAaxD;AA4ED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAgErD"}
1
+ {"version":3,"file":"dev-error.d.ts","sourceRoot":"","sources":["../../src/dev-error.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAmD9C;AAMD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,GAAG,GAAG,MAAM,CAaxD;AAkFD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAkErD"}
@@ -4,11 +4,11 @@
4
4
  * 按需导入错误处理 API:
5
5
  * import { LytError, ErrorBoundary, handleError } from '@lytjs/core/error'
6
6
  */
7
- export { LytError, LytErrorCodes, ErrorBoundary, handleError, callWithErrorHandling, warn, warnOnce, setDevMode, createMessage, } from './error-handling';
7
+ export { LytError, LytErrorCodes, ErrorBoundary, handleError, callWithErrorHandling, callWithErrorHandlingAsync, warn, warnOnce, setDevMode, createMessage, } from './error-handling';
8
8
  export type { ErrorBoundaryOptions, } from './error-handling';
9
- export { LytErrorCodes as NewLytErrorCodes, ErrorCategory, getErrorMessage, getCategory, } from './error-codes';
9
+ export { ErrorCategory, getErrorMessage, getCategory, } from './error-codes';
10
10
  export type { ErrorCategoryType, } from './error-codes';
11
- export { LytError as NewLytError, createCompilerError, createRendererError, createComponentError, } from './lyt-error';
11
+ export { createCompilerError, createRendererError, createComponentError, } from './lyt-error';
12
12
  export type { SourceLocation, } from './lyt-error';
13
13
  export { warn as warnUtil, warnOnce as warnOnceUtil, getDevMode, resetWarnedMessages, } from './error-handling';
14
14
  //# sourceMappingURL=error-entry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-entry.d.ts","sourceRoot":"","sources":["../../src/error-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,aAAa,GACd,MAAM,kBAAkB,CAAA;AAEzB,YAAY,EACV,oBAAoB,GACrB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,aAAa,IAAI,gBAAgB,EACjC,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,eAAe,CAAA;AAEtB,YAAY,EACV,iBAAiB,GAClB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,QAAQ,IAAI,WAAW,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,cAAc,GACf,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,IAAI,IAAI,QAAQ,EAChB,QAAQ,IAAI,YAAY,EACxB,UAAU,EACV,mBAAmB,GACpB,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"error-entry.d.ts","sourceRoot":"","sources":["../../src/error-entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,0BAA0B,EAC1B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,aAAa,GACd,MAAM,kBAAkB,CAAA;AAEzB,YAAY,EACV,oBAAoB,GACrB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,EACL,aAAa,EACb,eAAe,EACf,WAAW,GACZ,MAAM,eAAe,CAAA;AAEtB,YAAY,EACV,iBAAiB,GAClB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,cAAc,GACf,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,IAAI,IAAI,QAAQ,EAChB,QAAQ,IAAI,YAAY,EACxB,UAAU,EACV,mBAAmB,GACpB,MAAM,kBAAkB,CAAA"}
@@ -3,6 +3,16 @@
3
3
  *
4
4
  * 纯原生零依赖 TypeScript 实现。
5
5
  * 提供统一的错误码、错误类、错误边界、警告系统和友好提示。
6
+ *
7
+ * 错误码和 LytError 类统一使用 @lytjs/common 中的定义。
8
+ */
9
+ import { LytError } from '@lytjs/common';
10
+ export { LytError };
11
+ /**
12
+ * 兼容性 LytErrorCodes 枚举
13
+ *
14
+ * 提供旧版简短命名(NOT_FOUND, OPERATION_FAILED 等),
15
+ * 同时也包含新版 LYT_* 前缀命名。
6
16
  */
7
17
  export declare enum LytErrorCodes {
8
18
  INVALID_ARGUMENT = 1001,
@@ -27,11 +37,73 @@ export declare enum LytErrorCodes {
27
37
  NAVIGATION_ABORTED = 6003,
28
38
  NAVIGATION_FAILED = 6004,
29
39
  STORE_NOT_FOUND = 7001,
30
- STORE_DUPLICATE = 7002
40
+ STORE_DUPLICATE = 7002,
41
+ LYT_COMPILER_PARSE_ERROR = 1001,
42
+ LYT_COMPILER_INVALID_EXPRESSION = 1002,
43
+ LYT_COMPILER_INVALID_TEMPLATE = 1003,
44
+ LYT_COMPILER_INVALID_DIRECTIVE = 1004,
45
+ LYT_COMPILER_CODEGEN_ERROR = 1005,
46
+ LYT_COMPILER_SFC_PARSE_ERROR = 1006,
47
+ LYT_COMPILER_TRANSFORM_ERROR = 1007,
48
+ LYT_RENDERER_MOUNT_FAILED = 2001,
49
+ LYT_RENDERER_PATCH_FAILED = 2002,
50
+ LYT_RENDERER_HYDRATION_MISMATCH = 2003,
51
+ LYT_RENDERER_INVALID_VNODE = 2004,
52
+ LYT_RENDERER_UNMOUNT_FAILED = 2005,
53
+ LYT_COMPONENT_INVALID_PROPS = 3001,
54
+ LYT_COMPONENT_MISSING_RENDER = 3002,
55
+ LYT_COMPONENT_LIFECYCLE_ERROR = 3003,
56
+ LYT_COMPONENT_INVALID = 3004,
57
+ LYT_COMPONENT_EMIT_INVALID = 3005,
58
+ LYT_COMPONENT_RENDER_ERROR = 3006,
59
+ LYT_ROUTER_INVALID_ROUTE = 4001,
60
+ LYT_ROUTER_NAVIGATION_FAILED = 4002,
61
+ LYT_ROUTER_DUPLICATE_ROUTE = 4003,
62
+ LYT_ROUTER_NAVIGATION_ABORTED = 4004,
63
+ LYT_ROUTER_GUARD_ERROR = 4005,
64
+ LYT_STORE_ALREADY_EXISTS = 5001,
65
+ LYT_STORE_NOT_FOUND = 5002,
66
+ LYT_STORE_DISPOSED = 5003,
67
+ LYT_STORE_PATCH_ERROR = 5004,
68
+ LYT_REACTIVITY_READONLY_SET = 6001,
69
+ LYT_REACTIVITY_READONLY_DELETE = 6002,
70
+ LYT_REACTIVITY_EFFECT_ERROR = 6003,
71
+ LYT_REACTIVITY_COMPUTED_CYCLE = 6004,
72
+ LYT_REACTIVITY_EFFECT_DISPOSED = 6005,
73
+ LYT_REACTIVITY_CIRCULAR_DEPENDENCY = 6006,
74
+ LYT_REACTIVITY_SIGNAL_DISPOSED = 6007,
75
+ LYT_CORE_PLUGIN_ERROR = 7001,
76
+ LYT_CORE_MOUNT_NO_CONTAINER = 7002,
77
+ LYT_CORE_ALREADY_MOUNTED = 7003,
78
+ LYT_CORE_INVALID_ARGUMENT = 7004,
79
+ LYT_CORE_NOT_FOUND = 7005,
80
+ LYT_CORE_ALREADY_EXISTS = 7006,
81
+ LYT_CORE_OPERATION_FAILED = 7007,
82
+ LYT_CLI_SCAFFOLD_FAILED = 8001,
83
+ LYT_CLI_BUILD_FAILED = 8002,
84
+ LYT_CLI_DEV_SERVER_ERROR = 8003,
85
+ LYT_CLI_CONFIG_INVALID = 8004,
86
+ LYT_CLI_HMR_CONNECTION_FAILED = 8005,
87
+ LYT_DEVTOOLS_CONNECTION_FAILED = 9001,
88
+ LYT_DEVTOOLS_PANEL_ERROR = 9002,
89
+ LYT_DEVTOOLS_PERF_OVERFLOW = 9003,
90
+ LYT_DEVTOOLS_COMPONENT_TREE_ERROR = 9004,
91
+ LYT_PLUGIN_INSTALL_FAILED = 10001,
92
+ LYT_PLUGIN_ALREADY_INSTALLED = 10002,
93
+ LYT_PLUGIN_INVALID = 10003,
94
+ LYT_PLUGIN_UNINSTALL_FAILED = 10004,
95
+ LYT_RENDERER_VAPOR_ERROR = 11001,
96
+ LYT_RENDERER_VAPOR_COMPILER_ERROR = 11002,
97
+ LYT_RENDERER_VAPOR_COMPONENT_ERROR = 11003,
98
+ LYT_SSR_STREAM_ERROR = 11101,
99
+ LYT_SSR_SUSPENSE_TIMEOUT = 11102,
100
+ LYT_SSR_HYDRATION_ERROR = 11103,
101
+ LYT_SSR_ISLAND_ERROR = 11104
31
102
  }
32
103
  /**
33
- * 扩展错误码常量,使用简短命名覆盖所有模块。
34
- * 与 LytErrorCodes 枚举互补,提供更细粒度的错误分类。
104
+ * 扩展错误码常量
105
+ *
106
+ * 使用简短编号范围(1xx-7xx),用于内部模块。
35
107
  */
36
108
  export declare const ErrorCodes: {
37
109
  readonly APP_MOUNT_FAILED: 100;
@@ -60,29 +132,28 @@ export declare const ErrorCodes: {
60
132
  readonly STORE_DISPOSED: 701;
61
133
  readonly STORE_PATCH_ERROR: 702;
62
134
  };
63
- /** ErrorCodes 的值类型 */
64
- export type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
65
- export declare class LytError extends Error {
66
- code: LytErrorCodes;
67
- details?: any;
68
- constructor(code: LytErrorCodes, message: string, details?: any);
69
- }
70
135
  /**
71
- * 快速创建 LytError 实例的工厂函数
136
+ * 创建 LytError 实例的工厂函数
72
137
  *
73
- * @param code LytErrorCodes 枚举值
74
- * @param message 错误消息
75
- * @param details 附加详情(可选)
138
+ * @param code 错误码
139
+ * @param message 自定义消息
140
+ * @param details 附加详情
76
141
  * @returns LytError 实例
77
142
  */
78
- export declare function createLytError(code: LytErrorCodes, message: string, details?: any): LytError;
143
+ export declare function createLytError(code: number, message: string, details?: any): LytError;
144
+ /** 组件实例接口(最小化) */
145
+ interface ComponentInstance {
146
+ $options?: Record<string, unknown>;
147
+ $parent?: ComponentInstance | null;
148
+ [key: string]: unknown;
149
+ }
79
150
  export interface ErrorBoundaryOptions {
80
- onError?: (error: LytError, vm: any) => void;
81
- onErrorCaptured?: (error: LytError, vm: any, info: string) => boolean | void;
151
+ onError?: (error: LytError, vm: ComponentInstance) => void;
152
+ onErrorCaptured?: (error: LytError, vm: ComponentInstance, info: string) => boolean | void;
82
153
  /** 最大错误记录数,超过后自动丢弃最早的错误,默认 100 */
83
154
  maxErrors?: number;
84
155
  /** 降级 UI 回调,当捕获到错误时调用,返回降级内容 */
85
- fallback?: (error: Error, vm: any, info: string) => any;
156
+ fallback?: (error: Error, vm: ComponentInstance, info: string) => unknown;
86
157
  }
87
158
  export declare class ErrorBoundary {
88
159
  private errors;
@@ -90,23 +161,23 @@ export declare class ErrorBoundary {
90
161
  /** 是否处于错误状态 */
91
162
  private _hasError;
92
163
  /** 全局错误处理器 */
93
- static globalHandler: ((error: Error, vm: any, info: string) => void) | null;
164
+ static globalHandler: ((error: Error, vm: ComponentInstance, info: string) => void) | null;
94
165
  constructor(options?: ErrorBoundaryOptions);
95
166
  /** 是否处于错误状态 */
96
167
  get hasError(): boolean;
97
168
  /**
98
169
  * 设置全局错误处理器
99
170
  */
100
- static setGlobalHandler(handler: (error: Error, vm: any, info: string) => void): void;
171
+ static setGlobalHandler(handler: (error: Error, vm: ComponentInstance, info: string) => void): void;
101
172
  /**
102
173
  * 捕获错误
103
174
  */
104
- capture(error: Error, vm: any, info?: string): void;
175
+ capture(error: Error, vm: ComponentInstance, info?: string): void;
105
176
  /**
106
177
  * 获取降级 UI 内容
107
178
  * 当配置了 fallback 回调时,使用最后捕获的错误生成降级内容
108
179
  */
109
- getFallback(vm?: any): any;
180
+ getFallback(vm?: ComponentInstance): unknown;
110
181
  /**
111
182
  * 获取所有错误
112
183
  */
@@ -162,7 +233,7 @@ export declare function error(msg: string): void;
162
233
  * 根据错误码生成友好的中文提示信息
163
234
  *
164
235
  * @param code 错误码
165
- * @param args 提示模板的参数
236
+ * @param args 提示模板的参数(可选)
166
237
  * @returns 格式化的提示字符串
167
238
  */
168
239
  export declare function createMessage(code: LytErrorCodes, ...args: any[]): string;
@@ -182,4 +253,12 @@ export declare function handleError(err: Error, vm?: any, info?: string): void;
182
253
  * @returns 函数返回值,出错时返回 undefined
183
254
  */
184
255
  export declare function callWithErrorHandling<T>(fn: () => T, instance?: any): T | undefined;
256
+ /**
257
+ * 安全执行异步函数,捕获错误并交给 handleError 处理
258
+ *
259
+ * @param fn 要执行的异步函数
260
+ * @param instance 组件实例(可选)
261
+ * @returns Promise,出错时 resolve undefined
262
+ */
263
+ export declare function callWithErrorHandlingAsync<T>(fn: () => Promise<T>, instance?: any): Promise<T | undefined>;
185
264
  //# sourceMappingURL=error-handling.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/error-handling.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,oBAAY,aAAa;IAEvB,gBAAgB,OAAO;IACvB,SAAS,OAAO;IAChB,cAAc,OAAO;IACrB,gBAAg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ACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAMtC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAQ1C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAKvC;AAMD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAGzE;AAMD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CA4BrE;AAMD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,SAAS,CAOnF;AAED;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAOhH"}
package/dist/types/h.d.ts CHANGED
@@ -11,6 +11,8 @@
11
11
  *
12
12
  * 纯原生零依赖实现。
13
13
  */
14
+ import { Fragment } from '@lytjs/vdom';
15
+ export { Fragment };
14
16
  /** VNode 形状标记(位标记) */
15
17
  export declare const enum ShapeFlags {
16
18
  /** 普通 HTML/SVG 元素 */
@@ -51,8 +53,6 @@ export interface VNode {
51
53
  export type Children = string | number | VNode | Children[];
52
54
  /** h 函数的 props 参数类型 */
53
55
  export type Props = Record<string, any> | null;
54
- /** Fragment 标记 Symbol */
55
- export declare const Fragment: unique symbol;
56
56
  /**
57
57
  * 渲染函数 h()
58
58
  *
@@ -1 +1 @@
1
- {"version":3,"file":"h.d.ts","sourceRoot":"","sources":["../../src/h.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,sBAAsB;AACtB,0BAAkB,UAAU;IAC1B,qBAAqB;IACrB,OAAO,IAAI;IACX,YAAY;IACZ,oBAAoB,IAAI;IACxB,YAAY;IACZ,kBAAkB,IAAI;IACtB,cAAc;IACd,aAAa,IAAI;IACjB,aAAa;IACb,cAAc,KAAK;IACnB,aAAa;IACb,cAAc,KAAK;CACpB;AAED,sBAAsB;AACtB,MAAM,WAAW,KAAK;IACpB,kCAAkC;IAClC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/B,WAAW;IACX,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAClC,UAAU;IACV,QAAQ,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACxD,aAAa;IACb,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,qBAAqB;IACrB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI,CAAC;IACnD,WAAW;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,EAAE,EAAE,GAAG,CAAC;IACR,cAAc;IACd,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,0BAA0B;AAC1B,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAC;AAE5D,uBAAuB;AACvB,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,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,qBAAqB;IACrB,EAAE,EAAE,GAAG,CAAC;IACR,cAAc;IACd,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,0BAA0B;AAC1B,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAC;AAE5D,uBAAuB;AACvB,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAmI/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,CAAC,CACf,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAC9B,KAAK,CAAC,EAAE,KAAK,EACb,QAAQ,CAAC,EAAE,QAAQ,GAClB,KAAK,CAEP"}
@@ -1,32 +1,8 @@
1
1
  /**
2
2
  * Lyt.js 警告与错误输出工具
3
3
  *
4
- * 提供 warn、warnOnce、error 等工具函数。
5
- * 开发模式下输出详细信息,生产模式下静默。
6
- * 纯原生零依赖 TypeScript 实现。
4
+ * 已移至 @lytjs/common
5
+ * 保持向后兼容性 - 重新导出自 @lytjs/common
7
6
  */
8
- /**
9
- * 设置开发/生产模式
10
- */
11
- export declare function setDevMode(mode: boolean): void;
12
- /**
13
- * 获取当前是否为开发模式
14
- */
15
- export declare function getDevMode(): boolean;
16
- /**
17
- * 仅开发模式输出警告
18
- */
19
- export declare function warn(msg: string): void;
20
- /**
21
- * 每条消息只警告一次
22
- */
23
- export declare function warnOnce(msg: string): void;
24
- /**
25
- * 始终输出错误信息(不受开发/生产模式限制)
26
- */
27
- export declare function error(msg: string): void;
28
- /**
29
- * 重置已警告消息集合(仅用于测试)
30
- */
31
- export declare function resetWarnedMessages(): void;
7
+ export { warn, warnOnce, setDevMode, getDevMode, error, resetWarnedMessages, } from '@lytjs/common';
32
8
  //# sourceMappingURL=warn.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../../src/warn.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AAQH;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE9C;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AASD;;GAEG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGtC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAK1C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
1
+ {"version":3,"file":"warn.d.ts","sourceRoot":"","sources":["../../src/warn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,KAAK,EACL,mBAAmB,GACpB,MAAM,eAAe,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"web-component.d.ts","sourceRoot":"","sources":["../../src/web-component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAiB,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAM9D;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IAC9B,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,yBAAyB;IACzB,mBAAmB,CAAC,EAAE,MAAM,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AAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACrC,uCAAuC;IACvC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,yBAAyB;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC,CAAA;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,kBAAkB;IAClB,SAAS,EAAE,gBAAgB,CAAA;IAC3B,wBAAwB;IACxB,OAAO,CAAC,EAAE,oBAAoB,CAAA;CAC/B;AAMD;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAOnC;AAurBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,CAAC,EAAE,oBAAoB,GAC7B,IAAI,CAsBN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,qBAAqB,EAAE,GAClC,IAAI,CAIN;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAgBvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,IAAI,CAAC,CA6Df"}
@@ -1,2 +1,6 @@
1
- var S=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},k=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of G(t))!Q.call(e,c)&&c!==n&&S(e,c,{get:()=>t[c],enumerable:!(a=J(t,c))||a.enumerable});return e},R=(e,t,n)=>(k(e,t,"default"),n&&k(n,t,"default"));var ee=e=>k(S({},"__esModule",{value:!0}),e);var de={};F(de,{defineCustomElement:()=>j,defineCustomElementFromSFC:()=>Y,isBrowser:()=>I,registerComponents:()=>K,unregisterElement:()=>X});module.exports=ee(de);var E={};F(E,{Fragment:()=>M,ShapeFlags:()=>V,createApp:()=>z,h:()=>_});var A=require("@lytjs/common"),V=(f=>(f[f.ELEMENT=1]="ELEMENT",f[f.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",f[f.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",f[f.TEXT_CHILDREN=8]="TEXT_CHILDREN",f[f.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",f[f.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",f))(V||{}),M=Symbol("Fragment");function te(e,t){if(t!=null)if((0,A.isStringOrNumber)(t))e.children=String(t),e.shapeFlag|=8;else if((0,A.isArray)(t)){let n=[];for(let a=0;a<t.length;a++){let c=t[a];if(!(c==null||typeof c=="boolean"))if((0,A.isArray)(c))for(let m=0;m<c.length;m++){let f=c[m];f!=null&&typeof f!="boolean"&&n.push((0,A.isVNode)(f)?f:w(String(f)))}else(0,A.isVNode)(c)?n.push(c):n.push(w(String(c)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function w(e,t=null,n=null){var y,h;let a=0;typeof e=="string"?a=1:e===M?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let c=(y=t==null?void 0:t.key)!=null?y:null,m=(h=t==null?void 0:t.ref)!=null?h:null,f=t;if(t){let{key:b,ref:o,...i}=t;f=i}let g={type:e,props:f,children:null,key:c,ref:m,shapeFlag:a,el:null,component:null};return n!=null&&te(g,n),g}function _(e,t,n){return w(e,t||null,n||null)}var T=require("@lytjs/common");function D(e){return Object.create(e||null)}function H(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function B(e){return typeof e=="function"}function U(e,t,...n){if(H(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if((0,T.isPromise)(a))return a.then(()=>{let c=t.install(e,...n);if((0,T.isPromise)(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let c=t.install(e,...n);if((0,T.isPromise)(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(B(t))return t(e,...n)}function $(e,t){if(H(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else B(t)}var x=require("@lytjs/reactivity"),W=require("@lytjs/compiler"),v=require("@lytjs/component"),q=require("@lytjs/renderer"),ne=100,P=new Map;function oe(e){let t=P.get(e);if(t)return P.delete(e),P.set(e,t),t;let{code:n}=(0,W.compile)(e);if(t=new Function("h","_ctx",`return ${n}`),P.size>=ne){let a=P.keys().next().value;a!==void 0&&P.delete(a)}return P.set(e,t),t}function re(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,c)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let c=e.computed[a];typeof c=="function"?n[a]={get:c}:n[a]=c}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,c){return n.call(this,a)}}return t}function ie(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,c]of Object.entries(t))c&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function z(e,t){let n=new Set,a={},c={},m=D(),f={},g={},y=null,h=null,b=null,o=null,i=!1,r=re(typeof e=="function"?{render:e}:e),u=(0,v.defineComponent)(r),s={config:f,globalProperties:g,get _instance(){return y},mount(d){if(i)return s;let p;if(typeof d=="string"){if(p=document.querySelector(d),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${d}"`)}else p=d;o=p;let C=ie();h=(0,q.createRenderer)(C),y=(0,v.createComponentInstance)(u),(0,v.setupComponent)(y,t||{},null);let N=y.type;if(!N.render&&N.template){let L=oe(N.template);N.render=(O,Z)=>L(O,Z.renderProxy)}return(0,v.mountComponent)(y,_),y.subTree&&h.mount(y.subTree,p),b=(0,x.effect)(()=>{if(!(!y||!y.isMounted||!h)&&((0,v.updateComponent)(y,_),y.subTree&&o)){let L=o.firstChild,O=y.subTree;o.innerHTML="",h.mount(O,o)}},{lazy:!0}),i=!0,s},unmount(){i&&(b&&((0,x.stop)(b),b=null),y&&(0,v.unmountComponent)(y),o&&(o.innerHTML=""),y=null,h=null,o=null,i=!1)},use(d,...p){if(n.has(d))return s;n.add(d);let C=U({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:f,globalProperties:g},d,...p);return C instanceof Promise?C.then(()=>s):s},unuse(d){if(!n.has(d))return s;n.delete(d);let p=$({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:f,globalProperties:g},d);return p instanceof Promise?p.then(()=>s):s},isInstalled(d){return n.has(d)},provide(d,p){return m[d]=p,s},inject(d,p){let C=m[d];return C!==void 0?C:p},component(d,p){return p?(a[d]=p,s):a[d]},directive(d,p){return p?(c[d]=p,s):c[d]}};return s}R(E,require("@lytjs/common"));function I(){return typeof globalThis.window!="undefined"&&typeof globalThis.document!="undefined"&&typeof globalThis.HTMLElement!="undefined"&&typeof globalThis.customElements!="undefined"}function se(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ae(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function le(e,t){return t&&t[e]?t[e]:se(e)}function ce(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let c=a.charAt(2).toLowerCase()+a.slice(3);t.push(c)}}return t}function ue(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:c,eventMappings:m={},attributeConverters:f={}}=t,g=t.observedAttributes||[],y=ce(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let o=document.createElement("style");o.textContent=a,this._shadowRoot.appendChild(o)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let o of this._eventCleanups)o();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(o,i,l){i!==l&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let o={};for(let i of g)if(this.hasAttribute(i)){let l=this.getAttribute(i),r=le(i,c);f[i]?o[r]=f[i](l):o[r]=ae(l)}if(e.props){for(let[i,l]of Object.entries(e.props))if(o[i]===void 0){let r=l;r&&typeof r=="object"&&"default"in r?o[i]=typeof r.default=="function"?r.default():r.default:r==null}}this._props=o}_mountComponent(){let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let i=this._createComponentContext(),l=o.call(i,_,i);l&&this._container&&this._renderVNode(l,this._container),this._setupReactiveUpdates(i,o)}_compileTemplate(o){try{let i=Function("return require")(),{compile:l}=i("../../compiler/src/index.ts"),{code:r}=l(o);return new Function("h","_ctx",`return ${r}`)}catch(i){return null}}_createComponentContext(){let o=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},l=e.methods||{},r={...this._props,...o};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(r,u,{get:s.bind(r),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(r,u,{get:s.get.bind(r),enumerable:!0});for(let[u,s]of Object.entries(l))typeof s=="function"&&(r[u]=s.bind(r));return r.emit=(u,...s)=>{let d=m[u]||u,p=new CustomEvent(d,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},r.$el=this._container,r.$attrs={...this._props},r.$slots=this._getSlotContent(),r}_setupReactiveUpdates(o,i){try{let l=Function("return require")(),{effect:r,stop:u}=l("../../reactivity/src/index.ts"),s=r(()=>{if(!this._connected||!this._container)return;let p=i.call(o,_,o);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),d=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of d){let C=o[p];Object.defineProperty(o,p,{get(){return C},set(N){C=N;try{s()}catch(L){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(l){let r=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of r){let d=o[u],p=this;Object.defineProperty(o,u,{get(){return d},set(C){d=C,p._scheduleUpdate(o,i)},enumerable:!0})}}}_scheduleUpdate(o,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let l=i.call(o,_,o);l&&(this._container.innerHTML="",this._renderVNode(l,this._container))}))}_updateComponent(){if(!this._container)return;let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let i=this._createComponentContext(),l=o.call(i,_,i);this._container.innerHTML="",l&&this._renderVNode(l,this._container)}_renderVNode(o,i){let l=this._vNodeToElement(o);l&&i.appendChild(l)}_vNodeToElement(o){if(!o)return null;if(typeof o.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(o.children))for(let l of o.children){let r=this._vNodeToElement(l);r&&i.appendChild(r)}return i}if(typeof o.children=="string")return document.createTextNode(o.children);if(typeof o.type=="string"){let i=document.createElement(o.type);if(o.props)for(let[l,r]of Object.entries(o.props))if(l==="style"&&typeof r=="object")for(let[u,s]of Object.entries(r))i.style[u]=s;else if(l==="class"){if(typeof r=="string")i.className=r;else if(typeof r=="object"){let u=[];for(let[s,d]of Object.entries(r))d&&u.push(s);i.className=u.join(" ")}}else if(l.startsWith("on")&&typeof r=="function"){let u=l.slice(2).toLowerCase();i.addEventListener(u,r),this._eventCleanups.push(()=>{i.removeEventListener(u,r)})}else l==="ref"&&typeof r=="function"?r(i):i.setAttribute(l,String(r));if(Array.isArray(o.children))for(let l of o.children){let r=this._vNodeToElement(l);r&&i.appendChild(r)}else typeof o.children=="string"&&(i.textContent=o.children);return i}return typeof o.type=="object"||typeof o.type=="function"?o.component?this._vNodeToElement(o.component.subTree||o):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let o=this.querySelectorAll("[slot]");for(let l of o){let r=l.getAttribute("slot")||"default",u=document.createElement("slot");r!=="default"&&u.setAttribute("name",r),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var r;let o={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";o[s]||(o[s]=[]),o[s].push(u.cloneNode(!0))}let l=[];for(let u of Array.from(this.childNodes))(r=u.hasAttribute)!=null&&r.call(u,"slot")||l.push(u.cloneNode(!0));return l.length>0&&(o.default=l),o}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function j(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!I())return;let a=ue(t,n);customElements.define(e,a)}function K(e){for(let{tagName:t,component:n,options:a}of e)j(t,n,a)}function X(e){if(I())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function Y(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),c=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),m=/<style[^>]*>([\s\S]*?)<\/style>/g,f=[],g;for(;(g=m.exec(t))!==null;)f.push(g);let y=(n==null?void 0:n.styles)||"";for(let i of f)y+=i[1]+`
2
- `;let h=a?a[1].trim():void 0,b={};if(c){let i=c[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let r={},u={exports:r};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,r),b=u.exports||r}catch(r){}}let o={...n,styles:y};h&&!b.template&&!b.render&&(b.template=h),j(e,b,o)}
1
+ "use strict";var xe=Object.defineProperty;var Cn=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var Rn=Object.prototype.hasOwnProperty;var v=(e,t)=>()=>(e&&(t=e(e=0)),t);var se=(e,t)=>{for(var n in t)xe(e,n,{get:t[n],enumerable:!0})},we=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Sn(t))!Rn.call(e,o)&&o!==n&&xe(e,o,{get:()=>t[o],enumerable:!(r=Cn(t,o))||r.enumerable});return e},X=(e,t,n)=>(we(e,t,"default"),n&&we(n,t,"default"));var _n=e=>we(xe({},"__esModule",{value:!0}),e);function j(e,t,n,r){return{start:e,end:t,line:n,column:r}}function ue(e){return{type:"Root",children:[],helpers:new Set,loc:e}}function fe(e,t,n=!1){return{type:"Element",tag:e,props:[],children:[],isComponent:/^[A-Z]/.test(e),directives:[],staticFlag:-1,isSelfClosing:n,loc:t}}function pe(e,t){return{type:"Text",content:e,isExpression:/\{\{.*?\}\}/s.test(e),staticFlag:-1,loc:t}}function de(e,t,n){return{type:"Attribute",name:e,value:t,isDynamic:/^:|^v-bind:/.test(e),isEvent:/^@|^v-on:/.test(e),loc:n}}function _(e,t,n="",r=[],o={start:0,end:0,line:1,column:1}){return{type:"Directive",name:e,value:t,arg:n,modifiers:r,loc:o}}var Pe=v(()=>{"use strict"});function Ie(e){let t=new Oe(e);for(;!t.isEOF();)switch(t.state){case 0:In(t);break;case 1:Fn(t);break;case 2:jn(t);break;case 3:Dn(t);break;case 4:Ln(t);break;case 5:Mn(t);break}return gt(t),t.root}function In(e){for(e.textBuffer===""&&(e.textStart=e.pos);!e.isEOF();){let t=e.peek();if(t==="<"){gt(e),e.advance(),e.state=1;return}if(t==="{"&&e.peekAt(1)==="{"){for(e.textBuffer+=e.advance(),e.textBuffer+=e.advance();!e.isEOF();){let n=e.peek();if(e.textBuffer+=e.advance(),n==="}"&&e.peek()==="}"){e.textBuffer+=e.advance();break}}continue}e.textBuffer+=e.advance()}}function Fn(e){if(e.skipWhitespace(),e.startsWith("!--")){e.state=5,e.commentBuffer="",e.advance(),e.advance(),e.advance();return}e.peek()==="/"?(e.isClosingTag=!0,e.advance()):e.isClosingTag=!1,e.tagNameBuffer="",e.tagNameStart=e.pos,e.state=2}function jn(e){for(;!e.isEOF();){let r=e.peek();if(/\s/.test(r)||r===">"||r==="/")break;e.tagNameBuffer+=e.advance()}if(e.isClosingTag){e.state=4;return}let t=j(e.tagNameStart,e.pos,e.line,e.column-e.tagNameBuffer.length),n=fe(e.tagNameBuffer.toLowerCase(),t);e.currentElement=n,e.state=3}function Dn(e){if(e.skipWhitespace(),e.isEOF())return;let t=e.peek();if(t===">"){e.advance(),ht(e);return}if(t==="/"&&e.peekAt(1)===">"){e.advance(),e.advance(),ht(e,!0);return}e.attrNameBuffer="",e.attrValueBuffer="",e.inAttrValue=!1,e.attrValueQuote="";let n=e.pos;for(;!e.isEOF();){let i=e.peek();if(/\s/.test(i)||i==="="||i===">"||i==="/")break;e.attrNameBuffer+=e.advance()}if(e.skipWhitespace(),e.peek()==="="){e.advance(),e.skipWhitespace();let i=e.peek();if(i==='"'||i==="'")for(e.attrValueQuote=i,e.advance(),e.inAttrValue=!0;!e.isEOF();){if(e.peek()===e.attrValueQuote){e.advance(),e.inAttrValue=!1;break}e.attrValueBuffer+=e.advance()}else for(;!e.isEOF();){let s=e.peek();if(/\s/.test(s)||s===">"||s==="/")break;e.attrValueBuffer+=e.advance()}}let r=j(n,e.pos,e.line,e.column),o=Bn(e.attrNameBuffer,e.attrValueBuffer||null,r);e.currentElement&&(o.type==="Directive"?e.currentElement.directives.push(o):e.currentElement.props.push(o))}function Ln(e){e.skipWhitespace(),e.peek()===">"&&e.advance();let t=e.tagNameBuffer.toLowerCase(),n=!1;for(let r=e.parentStack.length-1;r>=0;r--)if(e.parentStack[r].tag===t){e.parentStack.splice(r),e.currentElement=e.parentStack.length>0?e.parentStack[e.parentStack.length-1]:null,n=!0;break}e.state=0}function Mn(e){for(;!e.isEOF();){if(e.startsWith("-->")){e.advance(),e.advance(),e.advance(),e.state=0;return}e.commentBuffer+=e.advance()}}function gt(e){let t=e.textBuffer.trim();if(t.length===0){e.textBuffer="";return}let n=pe(t,j(e.textStart,e.pos,e.line,e.column));e.currentElement?e.currentElement.children.push(n):e.root.children.push(n),e.textBuffer=""}function ht(e,t=!1){if(!e.currentElement)return;e.currentElement.isSelfClosing=t;let n=Pn.has(e.currentElement.tag),r=e.parentStack.length>0?e.parentStack[e.parentStack.length-1]:null;r?r.children.push(e.currentElement):e.root.children.push(e.currentElement),!t&&!n?e.parentStack.push(e.currentElement):e.currentElement=r,e.state=0}function Bn(e,t,n){if(e.startsWith("v-")){let r=e.slice(2);if(r.startsWith("on")){let s=r.slice(2),f=s.indexOf("."),p=s,m=[];return f!==-1&&(p=s.slice(0,f),m.push(...s.slice(f+1).split("."))),_("on",t||"",p,m,n)}if(r.startsWith("bind")){let s=r.slice(4).replace(/^:/,"");return _("bind",t||"",s,[],n)}if(r.startsWith("slot")){let s=r.slice(4).replace(/^:/,"");return _("slot",t||"",s,[],n)}if(r==="model")return _("bind",t||"","model",[],n);if(r==="ref")return _("ref",t||"","",[],n);let o=r.indexOf(":"),i=o!==-1?r.slice(0,o):r;if(On.has(i)){let s=o!==-1?r.slice(o+1):"";return _(i,t||"",s,[],n)}}if(e.startsWith(":")){let r=e.slice(1);return _("bind",t||"",r,[],n)}if(e.startsWith("@")){let r=e.slice(1),o=r.indexOf("."),i=r,s=[];return o!==-1&&(i=r.slice(0,o),s.push(...r.slice(o+1).split("."))),_("on",t||"",i,s,n)}if(e.startsWith("#")){let r=e.slice(1);return _("slot",t||"",r,[],n)}return de(e,t,n)}var Pn,On,Oe,yt=v(()=>{"use strict";Pe();Pn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),On=new Set(["if","each","bind","on","slot","ref"]),Oe=class{constructor(t){this.template=t,this.pos=0,this.line=1,this.column=1,this.state=0,this.root=ue(j(0,t.length,1,1)),this.currentElement=null,this.parentStack=[],this.textBuffer="",this.textStart=0,this.tagNameBuffer="",this.tagNameStart=0,this.attrNameBuffer="",this.attrValueBuffer="",this.attrValueQuote="",this.inAttrValue=!1,this.commentBuffer="",this.isClosingTag=!1}currentPos(){return j(this.pos,this.pos,this.line,this.column)}advance(){let t=this.template[this.pos++];return t===`
2
+ `?(this.line++,this.column=1):this.column++,t}peek(){return this.template[this.pos]||""}peekAt(t){return this.template[this.pos+t]||""}isEOF(){return this.pos>=this.template.length}startsWith(t){return this.template.substring(this.pos,this.pos+t.length)===t}skipWhitespace(){for(;!this.isEOF()&&/\s/.test(this.peek());)this.advance()}}});function je(e,t={}){let n=new q(e,t),r=[Vn,$n,Wn,Hn,Kn,Gn],o=[...t.nodeTransforms||[],...r];me(e,n,o),Fe(e,n)}function me(e,t,n){t.parent=e;for(let r of n){let o=r(e,t);if(o&&t.onExitCallbacks.push(i=>o()),t.replaceNode){let i=t.replaceNode;t.replaceNode=null,me(i,t,n);return}if(t.removeNode){t.removeNode=null;return}}switch(e.type){case"Root":for(let r=0;r<e.children.length;r++)t.childIndex=r,me(e.children[r],t,n);break;case"Element":for(let r=0;r<e.children.length;r++)t.childIndex=r,me(e.children[r],t,n);break}}function Fe(e,t){let n=t.onExitCallbacks.splice(0);for(let r of n)r(e);switch(e.type){case"Root":for(let r of e.children)Fe(r,t);break;case"Element":for(let r of e.children)Fe(r,t);break}}function Vn(e,t){if(e.type!=="Element")return;let n=e.directives.find(r=>r.name==="if");n&&(Object.assign(e,{ifCondition:n.value,ifBranches:[]}),t.root.helpers.add("createConditionalVNode"),e.directives=e.directives.filter(r=>r!==n))}function $n(e,t){if(e.type!=="Element")return;let n=e.directives.find(o=>o.name==="each");if(!n)return;let r=Un(n.value);r&&(Object.assign(e,{eachInfo:r}),t.root.helpers.add("renderList")),e.directives=e.directives.filter(o=>o!==n)}function Wn(e,t){if(e.type!=="Element")return;let n=e.directives.filter(o=>o.name==="bind");if(n.length===0)return;let r=[];for(let o of n){let i=o.arg==="model";r.push({arg:o.arg,value:o.value,isModel:i}),i&&t.root.helpers.add("createModelBinding")}Object.assign(e,{bindings:r}),e.directives=e.directives.filter(o=>o.name!=="bind")}function Hn(e,t){if(e.type!=="Element")return;let n=e.directives.filter(o=>o.name==="on");if(n.length===0)return;let r=[];for(let o of n)r.push({name:o.arg,value:o.value,modifiers:o.modifiers}),t.root.helpers.add("createEventHandler");Object.assign(e,{events:r}),e.directives=e.directives.filter(o=>o.name!=="on")}function Kn(e,t){if(e.type!=="Element")return;let n=e.directives.find(r=>r.name==="slot");n&&(Object.assign(e,{slotInfo:{name:n.arg||"default",value:n.value}}),t.root.helpers.add("renderSlot"),e.directives=e.directives.filter(r=>r!==n))}function Gn(e,t){if(e.type!=="Element")return;let n=e.directives.find(r=>r.name==="ref");n&&(Object.assign(e,{refInfo:{name:n.value}}),t.root.helpers.add("createRef"),e.directives=e.directives.filter(r=>r!==n))}function Un(e){let t=e.match(/^\s*(?:\((\w+)\s*,\s*(\w+)\)|(\w+))\s+(?:in|of)\s+(\S+)\s*$/);return t?{item:t[1]||t[3],index:t[2]||"",collection:t[4]}:null}var q,De=v(()=>{"use strict";q=class{constructor(t,n={}){this.root=t,this.parent=null,this.childIndex=0,this.options={markStatic:!0,...n},this.onExitCallbacks=[],this.replaceNode=null,this.removeNode=null}}});function Le(e){let t={hoistedNodes:[],hoistedNames:[]},n=0;for(let r of e.children)bt(r,t,()=>(n++,`_hoisted_${n}`));return t}function bt(e,t,n){switch(e.type){case"Text":return Yn(e,t,n);case"Element":return zn(e,t,n);default:return!1}}function Yn(e,t,n){return e.isExpression?(e.staticFlag=0,!1):(e.staticFlag=1,!0)}function zn(e,t,n){if(e.directives.length>0)return e.staticFlag=0,!1;let r=e;if(r.ifCondition||r.eachInfo||r.bindings&&r.bindings.length>0||r.events&&r.events.length>0||r.slotInfo||r.refInfo)return e.staticFlag=0,!1;for(let i of e.props)if(i.isDynamic||i.isEvent)return e.staticFlag=0,!1;let o=!0;for(let i of e.children)bt(i,t,n)||(o=!1);if(o){if(e.staticFlag=1,e.children.length>0){let i=n();t.hoistedNodes.push(e),t.hoistedNames.push(i),e.hoistedName=i}return!0}return e.staticFlag=0,!1}function Me(e){if(e.type==="Text")return!e.isExpression;if(e.type==="Element"){if(e.staticFlag!==-1)return e.staticFlag===1;let t=e;if(e.directives.length>0||t.ifCondition||t.eachInfo||t.bindings&&t.bindings.length>0||t.events&&t.events.length>0||t.slotInfo||t.refInfo)return!1;for(let n of e.props)if(n.isDynamic||n.isEvent)return!1;for(let n of e.children)if(!Me(n))return!1;return!0}return!1}var vt=v(()=>{"use strict"});var Be,Tt=v(()=>{"use strict";Be=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.EVENT=32]="EVENT",l[l.SLOTS=64]="SLOTS",l[l.STABLE_FRAGMENT=128]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=256]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=512]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=1024]="NEED_PATCH",l[l.DYNAMIC_SLOTS=2048]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(Be||{})});function He(e,t={}){let n=new he;if(Xn(e,n),n.hoistedDecls.length>0){for(let r of n.hoistedDecls)n.pushLine(r);n.newline()}return qn(e.children,n),{code:n.code,hoisted:n.hoistedDecls,helpers:Array.from(n.helpers.keys())}}function Xn(e,t){t.helpers.set("h","Lyt");for(let n of e.helpers)switch(n){case"createConditionalVNode":break;case"renderList":t.helpers.set("renderList","Lyt");break;case"createModelBinding":break;case"createEventHandler":break;case"renderSlot":t.helpers.set("renderSlot","Lyt");break;case"createRef":break;default:t.helpers.set(n,"Lyt")}}function qn(e,t){if(e.length===0){t.push("null");return}if(e.length===1){$e(e[0],t);return}t.push("["),t.indentIn();for(let n=0;n<e.length;n++)n>0&&t.pushLine(","),$e(e[n],t);t.indentOut(),t.pushLine(""),t.push("]")}function $e(e,t){switch(e.type){case"Element":Jn(e,t);break;case"Text":tr(e,t);break}}function Jn(e,t){let n=e;if(n.ifCondition){let r=n.ifCondition;t.push(`(${k(r)} ? (`),Ve(e,t),t.push(") : null)");return}if(n.eachInfo){let r=n.eachInfo;t.push(`renderList(${k(r.collection)}, (${r.item}`),r.index&&t.push(`, ${r.index}`),t.push(") => "),Ve(e,t),t.push(")");return}Ve(e,t)}function Ve(e,t){let n=e,r=Qn(e,t),o=er(e.children,t),i=e.isComponent?e.tag:`'${e.tag}'`;t.push(`h(${i}`),t.push(r?`, ${r}`:", null"),o&&o!=="null"&&t.push(`, ${o}`),t.push(")")}function Qn(e,t){let n=e,r=[],o=Zn(e);if(o&&r.push(o),n.bindings){let i=n.bindings;for(let s of i)s.isModel?r.push(`model: { value: ${k(s.value)}, callback: $event => ${k(s.value)} = $event }`):r.push(`'${s.arg}': ${k(s.value)}`)}if(n.events){let i=n.events;for(let s of i){let f=`on${sr(s.name)}`,p=k(s.value);if(s.modifiers.length>0){let m=s.modifiers.map(g=>{switch(g){case"stop":return"$event.stopPropagation()";case"prevent":return"$event.preventDefault()";case"capture":return null;case"once":return null;default:return null}}).filter(Boolean);m.length>0&&(p=`($event) => { ${m.join("; ")}; ${k(s.value)}($event) }`)}r.push(`'${f}': ${p}`)}}if(n.refInfo){let i=n.refInfo;r.push(`ref: '${i.name}'`)}if(n.slotInfo){let i=n.slotInfo;r.push(`'slot': '${i.name}'`)}return r.length===0?"":`{ ${r.join(", ")} }`}function Zn(e){let t=[];for(let n of e.props)n.isDynamic||n.isEvent||(n.value===null?t.push(`'${n.name}': true`):t.push(`'${n.name}': '${We(n.value)}'`));return t.join(", ")}function er(e,t){if(e.length===0)return"";let n=[],r=new he;for(let o of e)$e(o,r),n.push(r.code),r.code="";return n.length===0?"":n.length===1?n[0]:`[${n.join(", ")}]`}function tr(e,t){if(!e.isExpression){t.push(`'${We(e.content)}'`);return}let n=ir(e.content);if(n.length===1&&n[0].type==="expression"){t.push(k(n[0].value));return}let r=n.map(o=>o.type==="text"?`'${We(o.value)}'`:k(o.value));t.push(r.join(" + "))}function ir(e){let t=[],n=/\{\{([\s\S]*?)\}\}/g,r=0,o;for(;(o=n.exec(e))!==null;)o.index>r&&t.push({type:"text",value:e.slice(r,o.index)}),t.push({type:"expression",value:o[1].trim()}),r=n.lastIndex;return r<e.length&&t.push({type:"text",value:e.slice(r)}),t}function k(e){if(e=e.trim(),e.startsWith("_ctx."))return e;if(/^\w+(\.\w+)*$/.test(e))return`_ctx.${e}`;if(e.match(/^(\w+(?:\.\w+)*)\s*\(/))return`_ctx.${e}`;if(e.includes("=>"))return e;let n=[],r=e.replace(/(['"`])(?:(?!\1|\\).|\\.)*\1/g,o=>(n.push(o),`__PH${n.length-1}__`));r=r.replace(/(?<!_ctx\.)(?<!\w)(\w+(?:\.\w+)*)/g,o=>nr.has(o)||rr.has(o)||or.has(o)||/^\d/.test(o)||/^__PH\d+__$/.test(o)?o:`_ctx.${o}`);for(let o=0;o<n.length;o++)r=r.replace(`__PH${o}__`,n[o]);return r}function We(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function sr(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}var he,nr,rr,or,Et=v(()=>{"use strict";he=class{constructor(){this.code="",this.indentLevel=0,this.indent=" ",this.needsNewline=!0,this.helpers=new Map,this.hoistedDecls=[]}push(t){this.needsNewline&&(this.code+=this.indent.repeat(this.indentLevel),this.needsNewline=!1),this.code+=t}pushLine(t){this.push(t),this.newline()}newline(){this.code+=`
3
+ `,this.needsNewline=!0}indentIn(){this.indentLevel++}indentOut(){this.indentLevel--}};nr=new Set(["true","false","null","undefined","this","super","new","delete","typeof","instanceof","in","of","void","throw","return","yield","await","async","if","else","for","while","do","switch","case","break","continue","try","catch","finally","class","extends","import","export","from","default","var","let","const","function","debugger"]),rr=new Set(["console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","RegExp","Error","TypeError","RangeError","SyntaxError","Map","Set","WeakMap","WeakSet","Promise","Symbol","Proxy","Reflect","parseInt","parseFloat","isNaN","isFinite","NaN","Infinity"]),or=new Set(["$event","$refs","$el","$emit","$slots","$parent","$root"])});function ur(e){let t={};if(!e||!e.trim())return t;Rt.lastIndex=0;let n;for(;(n=Rt.exec(e))!==null;){let r=n[1],o=n[2]!==void 0?n[2]:n[3]!==void 0?n[3]:n[4]!==void 0?n[4]:"";t[r]=o}return t}function fr(e,t,n,r){let o=1,i=r;for(;i<e.length&&o>0;){let s=e.slice(i).search(t),f=e.indexOf(n,i);if(f===-1)return-1;if(s!==-1&&s+i<f)o++,i=s+i+1;else{if(o--,o===0)return f+n.length;i=f+n.length}}return-1}function Ke(e,t,n){t.lastIndex=0;let r=t.exec(e);if(!r)return null;let o=r.index,i=r[1]||"",s=ur(i),f=r.index+r[0].length,p=fr(e,t,n,f);return p===-1?null:{content:e.slice(f,p-n.length).trim(),start:o,end:p,attrs:s}}function J(e,t="anonymous.lyt"){let n=e.replace(ar,""),r=Ke(n,lr,"</template>"),o=r?{type:"template",content:r.content,start:r.start,end:r.end,attrs:r.attrs}:null,i=Ke(n,cr,"<\/script>"),s=i?{type:"script",content:i.content,start:i.start,end:i.end,attrs:i.attrs}:null,f=[],p=n;for(Ct.lastIndex=0;;){let m=Ke(p,Ct,"</style>");if(!m)break;f.push({type:"style",content:m.content,start:m.start,end:m.end,attrs:m.attrs,scoped:"scoped"in m.attrs}),p=p.slice(m.end)}return{filename:t,template:o,script:s,styles:f}}function Ge(e){St.lastIndex=0;let t=St.exec(e);return t?t[1].trim():null}var ar,lr,cr,Ct,St,Rt,ge=v(()=>{"use strict";ar=/<!--[\s\S]*?-->/g,lr=/<template(\s[^>]*)?\s*>/,cr=/<script(\s[^>]*)?\s*>/,Ct=/<style(\s[^>]*)?\s*>/,St=/export\s+default\s*\{([\s\S]*?)\}\s*$/,Rt=/(\w[\w-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|(\S+)))?/g});function dr(e,t){let n=5381,r=e+"\0"+t;for(let o=0;o<r.length;o++)n=(n<<5)+n+r.charCodeAt(o)&4294967295;return pr+(n>>>0).toString(16).slice(0,6)}function Q(e,t){let n="",r=0,o=e.length;for(;r<o;){if(e[r]==="@"){let m=e.slice(r).match(/^@([\w-]+)/);if(m){let g=m[1];if(["keyframes","-webkit-keyframes","-moz-keyframes","font-face"].includes(g)){let c=e.indexOf("{",r+m[0].length);if(c!==-1){let d=Ue(e,c+1);if(d!==-1){n+=e.slice(r,d),r=d;continue}}}if(["media","supports","document"].includes(g)){let c=e.indexOf("{",r+m[0].length);if(c!==-1){let d=Ue(e,c+1);if(d!==-1){let l=e.slice(r,c+1),h=e.slice(c+1,d-1),u=Q(h,t);n+=l+u+"}",r=d;continue}}}let a=e.indexOf(";",r);if(a!==-1){n+=e.slice(r,a+1),r=a+1;continue}}}let i=e.indexOf("{",r);if(i===-1){n+=e.slice(r);break}let s=e.slice(r,i).trim();if(!s){n+=e.slice(r,i+1),r=i+1;continue}let f=Ue(e,i+1);if(f===-1){n+=e.slice(r);break}let p=mr(s,t);n+=p+e.slice(i,f),r=f}return n}function Ue(e,t){let n=1,r=t;for(;r<e.length&&n>0;)e[r]==="{"?n++:e[r]==="}"&&n--,r++;return n===0?r:-1}function mr(e,t){return hr(e).map(r=>gr(r.trim(),t)).join(", ")}function hr(e){let t=[],n=0,r="";for(let o=0;o<e.length;o++){let i=e[o];i==="("?(n++,r+=i):i===")"?(n--,r+=i):i===","&&n===0?(t.push(r),r=""):r+=i}return r.trim()&&t.push(r),t}function gr(e,t){let n=/(::(?:before|after|first-line|first-letter|selection|placeholder|backdrop|marker|spelling-error|grammar-error)[\s\S]*)$/,r=e.match(n),o=e,i="";r&&(o=e.slice(0,e.length-r[0].length),i=r[0]);let s=/(:(?:hover|focus|active|visited|link|first-child|last-child|nth-child\([^)]*\)|nth-of-type\([^)]*\)|not\([^)]*\)|root|empty|checked|disabled|enabled|valid|invalid|required|optional|read-only|read-write)[\s\S]*)$/,f=o.match(s),p=o,m="";return f&&(p=o.slice(0,o.length-f[0].length),m=f[0]),p=p.replace(/\s+$/,""),`${p}[${t}]${m}${i}`}function Ye(e){let{template:t,script:n,styles:r,filename:o}=e,i=[(t==null?void 0:t.content)||"",(n==null?void 0:n.content)||"",...r.map(a=>a.content)].join("\0"),s=dr(o,i),f="null";t&&(f=`function(_ctx) { return ${ze(t.content).code} }`);let p="{}";if(n){let a=Ge(n.content);a&&(p=`{ ${a} }`)}let m=[];for(let a of r){let c=a.content;a.scoped&&(c=Q(c,s)),m.push(c)}return{code:yr(f,p,s,m),styles:m,scopedId:s}}function yr(e,t,n,r){let o=[];if(o.push("// Generated by Lyt.js SFC Compiler"),o.push(""),o.push(`const _sfcId = '${n}'`),o.push(""),r.length>0){o.push("const _styles = [");for(let i of r)o.push(` ${JSON.stringify(i)},`);o.push("]"),o.push(""),o.push("function _injectStyles() {"),o.push(" if (typeof document === 'undefined') {"),o.push(" throw new Error('[Lyt Compiler] SFC \u7F16\u8BD1\u9700\u8981 DOM \u73AF\u5883')"),o.push(" }"),o.push(" for (const css of _styles) {"),o.push(' const style = document.createElement("style")'),o.push(' style.setAttribute("data-sfc-id", _sfcId)'),o.push(" style.textContent = css"),o.push(" document.head.appendChild(style)"),o.push(" }"),o.push("}"),o.push(""),o.push("_injectStyles()"),o.push("")}return o.push("export default {"),o.push(" __sfcId: _sfcId,"),o.push(` render: ${e},`),o.push(` ...${t},`),o.push("}"),o.join(`
4
+ `)}var pr,_t=v(()=>{"use strict";Xe();ge();pr="data-v-"});var Nt=v(()=>{"use strict";ge();_t()});function br(e){let t=e.match(/props:\s*(\{[^}]+\}|\[[^\]]+\])/);return t?t[1]:null}function vr(e){let t=e.match(/emits:\s*(\{[^}]+\}|\[[^\]]+\])/);return t?t[1]:null}function qe(e,t={}){let{filename:n="Component"}=t,r=n.replace(/\.lyt$/,""),o=[];if(o.push("/**"),o.push(` * ${r} \u7EC4\u4EF6\u7C7B\u578B\u58F0\u660E`),o.push(" * \u7531 @lytjs/compiler \u81EA\u52A8\u751F\u6210"),o.push(" */"),o.push(""),o.push("export interface ComponentProps {"),e.script){let i=br(e.script.content);i&&o.push(` // Props \u5B9A\u4E49: ${i}`)}if(o.push(" [key: string]: any;"),o.push("}"),o.push(""),o.push("export interface ComponentEmits {"),e.script){let i=vr(e.script.content);i&&o.push(` // Emits \u5B9A\u4E49: ${i}`)}return o.push(" [key: string]: (...args: any[]) => any;"),o.push("}"),o.push(""),o.push("/**"),o.push(" * \u7EC4\u4EF6\u7C7B\u578B\u5B9A\u4E49"),o.push(" */"),o.push("declare const component: import('@lytjs/component').ComponentDefine;"),o.push(""),o.push("export default component;"),o.join(`
5
+ `)}function Je(e,t="Component.lyt"){let n=J(e,t);return qe(n,{filename:t,generateDts:!0})}function wt(){return{name:"lytjs-types",transform(e,t){if(t.endsWith(".lyt")){let n=Je(e,t);return{code:e,map:null,dts:n}}return null}}}var xt=v(()=>{"use strict";ge()});var kt={};se(kt,{CompilerPatchFlags:()=>Be,TransformContext:()=>q,compile:()=>ze,compileSFC:()=>Ye,createAttributeNode:()=>de,createDirectiveNode:()=>_,createElementNode:()=>fe,createPosition:()=>j,createRootNode:()=>ue,createTextNode:()=>pe,createTypePlugin:()=>wt,generate:()=>He,generateDtsForLytFile:()=>Je,generateTypeDeclarations:()=>qe,isStatic:()=>Me,optimize:()=>Le,parseHTML:()=>Ie,parseSFC:()=>J,scopeCSS:()=>Q,transform:()=>je});function ze(e,t={}){let n=Ie(e);je(n,t.transform);let r=Le(n),o=He(n,t.codegen);return{code:o.code,ast:n,hoistResult:r,helpers:o.helpers}}var Xe=v(()=>{"use strict";Pe();yt();De();De();vt();Tt();Et();Nt();xt()});function be(){Pt.push(ye),ye=!1}function ve(){let e=Pt.pop();ye=e===void 0?!0:e}function At(e){let{deps:t}=e;for(let n of t)n.delete(e);t.clear()}function T(e,t){if(!ye||!E)return;let n=Qe.get(e);n||(n=new Map,Qe.set(e,n));let r=n.get(t);r||(r=new Set,n.set(t,r)),r.has(E)||(r.add(E),E.deps.add(r))}function C(e,t,n,r){let o=Qe.get(e);if(!o)return;let i=new Set,s=f=>{if(f)for(let p of f)(p!==E||p.allowRecurse)&&i.add(p)};if(s(o.get(t)),(n==="add"||n==="delete")&&s(o.get($)),n==="set"&&Array.isArray(e)){let f=o.get("length");f&&typeof t=="number"&&t<e.length&&s(f)}for(let f of i)f.scheduler?f.scheduler(f):f.run()}function Ot(e,t={}){let n=new w(e,t);t.lazy||n.run();let r=n.run.bind(n);return r.effect=n,r.stop=()=>n.stop(),r}function It(e){var t;(t=e==null?void 0:e.effect)==null||t.stop()}var E,Z,Tr,Qe,w,ye,Pt,$,K=v(()=>{"use strict";E=null,Z=[],Tr=0,Qe=new WeakMap,w=class{constructor(t,n={}){this.active=!0;this.deps=new Set;this.fn=t,this.scheduler=n.scheduler,this.beforeRun=n.beforeRun,this.afterRun=n.afterRun,this.lazy=n.lazy,this.id=Tr++}run(){var t,n;if(!this.active)return this.fn();if(Z.includes(this))return this.fn();try{return(t=this.beforeRun)==null||t.call(this),Z.push(this),E=this,At(this),this.fn()}finally{(n=this.afterRun)==null||n.call(this),Z.pop(),E=Z[Z.length-1]||null}}stop(){this.active&&(At(this),this.onStop&&this.onStop(),this.active=!1)}},ye=!0,Pt=[];$=Symbol("iterate")});function ee(e){return e!==null&&typeof e=="object"}function Mt(e,t){return!Object.is(e,t)}function Te(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Bt(e){return typeof e=="string"&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e}function te(e,t={}){if(!ee(e)||e[W])return e;if(e[A])return Ce(e);let n=Ft.get(e);if(n)return n;let r=new Proxy(e,Er);return Ft.set(e,r),r}function Ce(e){if(!ee(e))return e;let t=jt.get(e);if(t)return t;e[A]=!0;let n=new Proxy(e,Cr);return jt.set(e,n),n}function Vt(e){if(!ee(e))return e;let t=Dt.get(e);if(t)return t;let n=new Proxy(e,Sr);return Dt.set(e,n),n}function D(e){let t=e&&e[P];return t?D(t):e}function G(e){return Ze(e)?G(e[P]):!!(e&&e[W])}function Ze(e){return!!(e&&e[A])}function $t(e){return e[A]=!0,e}function Wt(e){return e[Lt]=!0,e}var A,P,W,Lt,Ft,jt,Dt,Ee,Er,Cr,Sr,Se=v(()=>{"use strict";K();A=Symbol("readonly"),P=Symbol("raw"),W=Symbol("reactive"),Lt=Symbol("skip"),Ft=new WeakMap,jt=new WeakMap,Dt=new WeakMap;Ee={};["includes","indexOf","lastIndexOf"].forEach(e=>{Ee[e]=function(...t){let n=D(this);for(let r=0;r<n.length;r++)T(n,String(r));return T(n,"length"),n[e](...t)}});["push","pop","shift","unshift","splice","sort","reverse"].forEach(e=>{Ee[e]=function(...t){be();let n=Array.prototype[e].apply(this,t);return ve(),C(D(this),"length","set",D(this).length),n}});Er={get(e,t,n){if(t===P)return e;if(t===W)return!0;if(Array.isArray(e)&&Ee.hasOwnProperty(t))return Ee[t];T(e,t);let r=Reflect.get(e,t,n);return t===A?e[A]===!0:!ee(r)||e[Lt]?r:te(r)},set(e,t,n,r){let o=e[t],i=Array.isArray(e)&&Bt(t)?Number(t)<e.length:Te(e,t),s=Reflect.set(e,t,n,r);return(e===(r==null?void 0:r[P])||e===D(r))&&(i?Mt(n,o)&&C(e,t,"set",n):C(e,t,"add",n)),s},deleteProperty(e,t){let n=Te(e,t),r=Reflect.deleteProperty(e,t);return r&&n&&C(e,t,"delete"),r},has(e,t){return T(e,t),Reflect.has(e,t)},ownKeys(e){return T(e,$),Reflect.ownKeys(e)}},Cr={get(e,t,n){if(t===P)return e;if(t===W||t===A)return!0;T(e,t);let r=Reflect.get(e,t,n);return ee(r)?Ce(r):r},set(e,t,n,r){return!1},deleteProperty(e,t){return!1},has(e,t){return T(e,t),Reflect.has(e,t)},ownKeys(e){return T(e,$),Reflect.ownKeys(e)}},Sr={get(e,t,n){return t===P?e:t===W?!0:(T(e,t),Reflect.get(e,t,n))},set(e,t,n,r){let o=e[t],i=Array.isArray(e)&&Bt(t)?Number(t)<e.length:Te(e,t),s=Reflect.set(e,t,n,r);return(e===(r==null?void 0:r[P])||e===D(r))&&(i?Mt(n,o)&&C(e,t,"set",n):C(e,t,"add",n)),s},deleteProperty(e,t){let n=Te(e,t),r=Reflect.deleteProperty(e,t);return r&&n&&C(e,t,"delete"),r},has(e,t){return T(e,t),Reflect.has(e,t)},ownKeys(e){return T(e,$),Reflect.ownKeys(e)}}});function Rr(e){return tt.get(e)||e}function Kt(e){if(O(e))return e;let t={_value:Gt(e),_rawValue:e,__v_isRef:!0,[U]:!0},n=new Proxy(t,_r);return tt.set(n,t),n}function Gt(e){return(0,Ht.isObject)(e)?te(e):e}function Ut(e){if(O(e))return e;let t={_value:e,_rawValue:e,__v_isRef:!0,__v_isShallow:!0,[U]:!0,[et]:!0},n=new Proxy(t,Nr);return tt.set(n,t),n}function O(e){return!!(e&&e.__v_isRef===!0)}function Yt(e){return O(e)?e.value:e}function nt(e,t){let n=e[t];return O(n)?n:new Proxy({_obj:e,_key:t,__v_isRef:!0},{get(r,o,i){return o==="value"?r._obj[r._key]:o==="__v_isRef"?!0:Reflect.get(r,o,i)},set(r,o,i,s){return o==="value"?(r._obj[r._key]=i,!0):Reflect.set(r,o,i,s)}})}function zt(e){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=nt(e,n));return t}function Xt(e){let t=Rr(e);C(t,"value","set",t._rawValue)}var Ht,U,et,tt,_r,Nr,rt=v(()=>{"use strict";K();Se();Ht=require("@lytjs/common"),U=Symbol("ref"),et=Symbol("shallowRef"),tt=new WeakMap;_r={get(e,t,n){return t==="value"?(T(e,"value"),e._value):t===U||t==="__v_isRef"?!0:t==="_rawValue"?e._rawValue:Reflect.get(e,t,n)},set(e,t,n,r){if(t==="value"){let o=e._rawValue;return Object.is(o,n)||(e._rawValue=n,e._value=Gt(n),C(e,"value","set",n)),!0}return Reflect.set(e,t,n,r)}};Nr={get(e,t,n){return t==="value"?(T(e,"value"),e._value):t===U||t==="__v_isRef"||t==="__v_isShallow"?!0:t==="_rawValue"?e._rawValue:Reflect.get(e,t,n)},set(e,t,n,r){if(t==="value"){let o=e._rawValue;return Object.is(o,n)||(e._rawValue=n,e._value=n,C(e,"value","set",n)),!0}return Reflect.set(e,t,n,r)}}});function qt(e){let t,n;return typeof e=="function"?(t=e,n=void 0):(t=e.get,n=e.set),new ot(t,n)}var ot,Jt=v(()=>{"use strict";K();ot=class{constructor(t,n){this._dirty=!0;this.__v_isRef=!0;this.deps=new Set;this._setter=n,this._effect=new w(t,{scheduler:()=>{this._dirty||(this._dirty=!0,this.triggerDep())},lazy:!0}),this._value=void 0}get value(){return T(this,"value"),E&&!this.deps.has(E)&&(this.deps.add(E),E.deps.add(this.deps)),this._dirty&&(this._value=this._effect.run(),this._dirty=!1),this._value}set value(t){this._setter&&this._setter(t)}triggerDep(){for(let t of this.deps)t.scheduler?t.scheduler(t):t.run()}}});function ne(e,t=1/0,n){if(!(0,I.isObject)(e)||t<=0||(n||(n=new Set),n.has(e)))return e;if(n.add(e),O(e))ne(e.value,t-1,n);else if(Array.isArray(e))for(let r=0;r<e.length;r++)ne(e[r],t-1,n);else for(let r of Object.keys(e))ne(e[r],t-1,n);return e}function Qt(e){return O(e)?()=>e.value:G(e)?()=>ne(e):typeof e=="function"?e:()=>ne(e)}function Zt(e,t,n={}){let r,o=!1;if(Array.isArray(e)){o=!0;let g=e.map(a=>Qt(a));r=()=>g.map(a=>a())}else r=Qt(e);G(e)&&n.deep!==!1&&(n.deep=!0);let i=o?[]:void 0,s,f=g=>{s=g},p=()=>{s&&(s(),s=void 0);let g=m.run();(o?g.some((a,c)=>!Object.is(a,i[c])):!Object.is(g,i)||n.deep&&(0,I.isObject)(g))&&(t(g,o?[...i]:i,f),i=o?[...g]:g)},m=new w(r,{lazy:!0,scheduler:()=>{n.flush==="sync"?p():(0,I.queueJob)(p)}});return n.immediate?p():i=m.run(),()=>{m.stop()}}function en(e,t={}){let n,r=()=>{n&&(n(),n=void 0),e(i=>{n=i})},o=new w(r,{scheduler:()=>{t.flush==="sync"?r():(0,I.queueJob)(r)}});return o.run(),()=>{o.stop(),n&&(n(),n=void 0)}}var I,tn=v(()=>{"use strict";K();rt();Se();I=require("@lytjs/common")});function Re(e){let t=e,n=new Set,r=function(){return x&&!re&&n.add(x),t};return r.set=function(o){Object.is(t,o)||(t=o,cn(n))},r.update=function(o){r.set(o(t))},r._subscribe=function(o){n.add(o)},r._unsubscribe=function(o){n.delete(o)},r.dispose=function(){n.clear()},r}function rn(e){let t,n=!0,r=!1,o=new Set,i=new Set,s=function(){if(x&&!re&&i.add(x),n){if(r)throw new nn.LytError("LYT_REACTIVITY_CIRCULAR_DEPENDENCY","computed \u5728\u5176\u81EA\u8EAB\u7684\u8BA1\u7B97\u56FE\u4E2D");r=!0;for(let g of o)g._unsubscribe(s);o.clear();let m=x;x=s;try{t=e()}finally{x=m,r=!1}n=!1}return t},f={_dirty:!1,notify(){n=!0,cn(i)}};return s.notify=f.notify.bind(f),s._dirty=!1,s._subscribe=function(p){i.add(p)},s._unsubscribe=function(p){i.delete(p)},s}function on(e){let t=null,n=!1,r=new Set,o=()=>{if(n)return;t&&(t(),t=null);for(let f of r)f._unsubscribe(i);r.clear();let s=x;x=i;try{e(f=>{t=f})}finally{x=s}},i={_dirty:!1,notify(){oe>0?Y.add(i):o()}};return o(),()=>{n=!0,t&&(t(),t=null);for(let s of r)s._unsubscribe(i);r.clear(),Y.delete(i)}}function sn(e){oe++;try{e()}finally{oe--,oe===0&&an()}}function an(){if(!it){it=!0;try{let e=new Set(Y);Y.clear();for(let t of e)t.notify();Y.size>0&&an()}finally{it=!1}}}function ln(e){let t=re;re=!0;try{return e()}finally{re=t}}function cn(e){if(oe>0)for(let t of e)Y.add(t);else for(let t of e)t.notify()}var nn,x,re,oe,Y,it,st=v(()=>{"use strict";nn=require("@lytjs/common"),x=null,re=!1,oe=0,Y=new Set,it=!1});function un(){return z.length>0?z[z.length-1]:null}function fn(e){return e()}function pn(e){let t=Re(e),n=o=>t.set(o),r=un();return[t,n]}function dn(){let e={_cleanupFns:[]};return z.push(e),()=>{for(let n of e._cleanupFns)n();e._cleanupFns.length=0;let t=z.indexOf(e);t!==-1&&z.splice(t,1)}}function mn(e){let t=un();t&&t._cleanupFns.push(e)}var z,hn=v(()=>{"use strict";st();z=[]});var gn={};se(gn,{ITERATE_KEY:()=>$,ReactiveEffect:()=>w,activeEffect:()=>E,batch:()=>sn,clearQueue:()=>L.clearQueue,computed:()=>qt,computedSignal:()=>rn,effect:()=>Ot,enterSignalComponentContext:()=>dn,hasPendingJob:()=>L.hasPendingJob,isReactive:()=>G,isReadonly:()=>Ze,isRef:()=>O,markReadOnly:()=>$t,markSkip:()=>Wt,nextTick:()=>I.nextTick,onSignalCleanup:()=>mn,pauseTracking:()=>be,queueJob:()=>L.queueJob,queuePostFlushCb:()=>L.queuePostFlushCb,rawSymbol:()=>P,reactive:()=>te,reactiveFlag:()=>W,readonly:()=>Ce,readonlyFlag:()=>A,ref:()=>Kt,refSymbol:()=>U,resetTracking:()=>ve,shallowReactive:()=>Vt,shallowRef:()=>Ut,shallowRefSymbol:()=>et,signal:()=>Re,signalEffect:()=>on,stop:()=>It,toRaw:()=>D,toRef:()=>nt,toRefs:()=>zt,track:()=>T,trigger:()=>C,triggerRef:()=>Xt,unref:()=>Yt,untrack:()=>ln,useSignal:()=>fn,useSignalState:()=>pn,watch:()=>Zt,watchEffect:()=>en});var L,yn=v(()=>{"use strict";K();Se();rt();Jt();tn();L=require("@lytjs/common");st();hn()});var Or={};se(Or,{defineCustomElement:()=>Ne,defineCustomElementFromSFC:()=>Tn,isBrowser:()=>_e,registerComponents:()=>bn,unregisterElement:()=>vn});module.exports=_n(Or);var V={};se(V,{Fragment:()=>ae.Fragment,ShapeFlags:()=>Ae,createApp:()=>mt,h:()=>N});var F=require("@lytjs/common"),ae=require("@lytjs/vdom");var Ae=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(Ae||{});function Nn(e,t){if(t!=null)if((0,F.isStringOrNumber)(t))e.children=String(t),e.shapeFlag|=8;else if((0,F.isArray)(t)){let n=[];for(let r=0;r<t.length;r++){let o=t[r];if(!(o==null||typeof o=="boolean"))if((0,F.isArray)(o))for(let i=0;i<o.length;i++){let s=o[i];s!=null&&typeof s!="boolean"&&n.push((0,F.isVNode)(s)?s:ke(String(s)))}else(0,F.isVNode)(o)?n.push(o):n.push(ke(String(o)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function ke(e,t=null,n=null){var p,m;let r=0;typeof e=="string"?r=1:e===ae.Fragment?r=0:typeof e=="function"?r=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(r=4);let o=(p=t==null?void 0:t.key)!=null?p:null,i=(m=t==null?void 0:t.ref)!=null?m:null,s=t;if(t){let{key:g,ref:a,...c}=t;s=c}let f={type:e,props:s,children:null,key:o,ref:i,shapeFlag:r,el:null,component:null};return n!=null&&Nn(f,n),f}function N(e,t,n){return ke(e,t||null,n||null)}var le=require("@lytjs/common");function at(e){return Object.create(e||null)}function lt(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function ct(e){return typeof e=="function"}function ut(e,t,...n){if(lt(t)){let r=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if((0,le.isPromise)(r))return r.then(()=>{let o=t.install(e,...n);if((0,le.isPromise)(o))return o.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let o=t.install(e,...n);if((0,le.isPromise)(o))return o.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(ct(t))return t(e,...n)}function ft(e,t){if(lt(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else ct(t)}var ce=require("@lytjs/reactivity"),pt=require("@lytjs/compiler"),R=require("@lytjs/component"),dt=require("@lytjs/renderer"),wn=100,B=new Map;function xn(e){let t=B.get(e);if(t)return B.delete(e),B.set(e,t),t;let{code:n}=(0,pt.compile)(e);if(t=new Function("h","_ctx",`return ${n}`),B.size>=wn){let r=B.keys().next().value;r!==void 0&&B.delete(r)}return B.set(e,t),t}function kn(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(r,o)=>n(r)}if(e.computed){let n={};for(let r of Object.keys(e.computed)){let o=e.computed[r];typeof o=="function"?n[r]={get:o}:n[r]=o}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(r,o){return n.call(this,r)}}return t}function An(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[r,o]of Object.entries(t))o&&n.push(r);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,r){e.addEventListener(t,n,r)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function mt(e,t){let n=new Set,r={},o={},i=at(),s={},f={},p=null,m=null,g=null,a=null,c=!1,l=kn(typeof e=="function"?{render:e}:e),h=(0,R.defineComponent)(l),u={config:s,globalProperties:f,get _instance(){return p},mount(y){if(c)return u;let b;if(typeof y=="string"){let M=document.querySelector(y);if(!M)throw new Error(`[Lyt] \u6302\u8F7D\u76EE\u6807 "${y}" \u672A\u627E\u5230`);b=M}else b=y;a=b;let S=An();m=(0,dt.createRenderer)(S),p=(0,R.createComponentInstance)(h),(0,R.setupComponent)(p,t||{},null);let H=p.type;if(!H.render&&H.template){let M=xn(H.template);H.render=(ie,En)=>M(ie,En.renderProxy)}return(0,R.mountComponent)(p,N),p.subTree&&m.mount(p.subTree,b),g=(0,ce.effect)(()=>{if(!(!p||!p.isMounted||!m)&&((0,R.updateComponent)(p,N),p.subTree&&a)){let M=a.firstChild,ie=p.subTree;for(;a.firstChild;)a.removeChild(a.firstChild);m.mount(ie,a)}},{lazy:!0}),c=!0,u},unmount(){if(c){if(g&&((0,ce.stop)(g),g=null),p&&(0,R.unmountComponent)(p),a)for(;a.firstChild;)a.removeChild(a.firstChild);p=null,m=null,a=null,c=!1}},use(y,...b){if(n.has(y))return u;n.add(y);let S=ut({use:u.use.bind(u),unuse:u.unuse.bind(u),isInstalled:u.isInstalled.bind(u),provide:u.provide.bind(u),inject:u.inject.bind(u),config:s,globalProperties:f},y,...b);return S instanceof Promise?S.then(()=>u):u},unuse(y){if(!n.has(y))return u;n.delete(y);let b=ft({use:u.use.bind(u),unuse:u.unuse.bind(u),isInstalled:u.isInstalled.bind(u),provide:u.provide.bind(u),inject:u.inject.bind(u),config:s,globalProperties:f},y);return b instanceof Promise?b.then(()=>u):u},isInstalled(y){return n.has(y)},provide(y,b){return i[y]=b,u},inject(y,b){let S=i[y];return S!==void 0?S:b},component(y,b){return b?(r[y]=b,u):r[y]},directive(y,b){return b?(o[y]=b,u):o[y]}};return u}X(V,require("@lytjs/common"));function _e(){return typeof globalThis.window!="undefined"&&typeof globalThis.document!="undefined"&&typeof globalThis.HTMLElement!="undefined"&&typeof globalThis.customElements!="undefined"}function wr(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function xr(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function kr(e,t){return t&&t[e]?t[e]:wr(e)}function Ar(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let r of Object.keys(n.methods))if(r.startsWith("on")&&r.length>2){let o=r.charAt(2).toLowerCase()+r.slice(3);t.push(o)}}return t}function Pr(e,t={}){let{shadowMode:n="open",styles:r="",propMappings:o,eventMappings:i={},attributeConverters:s={}}=t,f=t.observedAttributes||[],p=Ar(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._originalDescriptors=new Map;this._compiledTemplate=null;this._updateScheduled=!1}static get observedAttributes(){return f}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),r){let a=document.createElement("style");a.textContent=r,this._shadowRoot.appendChild(a)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let a of this._eventCleanups)a();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._originalDescriptors.clear(),this._compiledTemplate=null,this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(a,c,d){c!==d&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let a={};for(let c of f)if(this.hasAttribute(c)){let d=this.getAttribute(c),l=kr(c,o);s[c]?a[l]=s[c](d):a[l]=xr(d)}if(e.props){for(let[c,d]of Object.entries(e.props))if(a[c]===void 0){let l=d;l&&typeof l=="object"&&"default"in l?a[c]=typeof l.default=="function"?l.default():l.default:l==null}}this._props=a}async _mountComponent(){let a=e.render?e.render:e.template?await this._compileTemplate(e.template):null;if(!a)return;let c=this._createComponentContext(),d=a.call(c,N,c);d&&this._container&&this._renderVNode(d,this._container),this._setupReactiveUpdates(c,a)}async _compileTemplate(a){try{let c=await Promise.resolve().then(()=>(Xe(),kt)),{compile:d}=c,{code:l}=d(a);return new Function("h","_ctx",`return ${l}`)}catch(c){return null}}_createComponentContext(){let a=e.state?typeof e.state=="function"?e.state():{...e.state}:{},c=e.computed||{},d=e.methods||{},l={...this._props,...a};for(let[h,u]of Object.entries(c))typeof u=="function"?Object.defineProperty(l,h,{get:u.bind(l),enumerable:!0}):u&&typeof u=="object"&&"get"in u&&Object.defineProperty(l,h,{get:u.get.bind(l),enumerable:!0});for(let[h,u]of Object.entries(d))typeof u=="function"&&(l[h]=u.bind(l));return l.emit=(h,...u)=>{let y=i[h]||h,b=new CustomEvent(y,{detail:u.length===1?u[0]:u,bubbles:!0,composed:!0});this.dispatchEvent(b)},l.$el=this._container,l.$attrs={...this._props},l.$slots=this._getSlotContent(),l}_setupReactiveUpdates(a,c){try{Promise.resolve().then(()=>(yn(),gn)).then(d=>{let{effect:l,stop:h}=d,u=l(()=>{if(!this._connected||!this._container)return;let b=c.call(a,N,a);b&&(this._container.innerHTML="",this._renderVNode(b,this._container))},{lazy:!0}),y=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let b of y){let S=a[b],H=Object.getOwnPropertyDescriptor(a,b);this._originalDescriptors.set(b,H),Object.defineProperty(a,b,{get(){return S},set(M){S=M;try{u()}catch(ie){}},enumerable:!0})}this._effectCleanup=()=>{try{h(u)}catch(b){}}}).catch(()=>{this._setupReactiveUpdatesFallback(a,c)})}catch(d){this._setupReactiveUpdatesFallback(a,c)}}_setupReactiveUpdatesFallback(a,c){let d=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let l of d){let u=a[l],y=Object.getOwnPropertyDescriptor(a,l);this._originalDescriptors.set(l,y);let b=this;Object.defineProperty(a,l,{get(){return u},set(S){u=S,b._scheduleUpdate(a,c)},enumerable:!0})}}_scheduleUpdate(a,c){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let d=c.call(a,N,a);d&&(this._container.innerHTML="",this._renderVNode(d,this._container))}))}async _updateComponent(){if(!this._container)return;let a=e.render||null;if(!a&&e.template&&(this._compiledTemplate&&this._compiledTemplate.template===e.template?a=this._compiledTemplate.render:(a=await this._compileTemplate(e.template),a&&(this._compiledTemplate={template:e.template,render:a}))),!a)return;let c=this._createComponentContext(),d=a.call(c,N,c);this._container.innerHTML="",d&&this._renderVNode(d,this._container)}_renderVNode(a,c){let d=this._vNodeToElement(a);d&&c.appendChild(d)}_vNodeToElement(a){if(!a)return null;if(typeof a.type=="symbol"){let c=document.createDocumentFragment();if(Array.isArray(a.children))for(let d of a.children){let l=this._vNodeToElement(d);l&&c.appendChild(l)}return c}if(typeof a.children=="string")return document.createTextNode(a.children);if(typeof a.type=="string"){let c=document.createElement(a.type);if(a.props)for(let[d,l]of Object.entries(a.props))if(d==="style"&&typeof l=="object")for(let[h,u]of Object.entries(l))c.style[h]=u;else if(d==="class"){if(typeof l=="string")c.className=l;else if(typeof l=="object"){let h=[];for(let[u,y]of Object.entries(l))y&&h.push(u);c.className=h.join(" ")}}else if(d.startsWith("on")&&typeof l=="function"){let h=d.slice(2).toLowerCase();c.addEventListener(h,l),this._eventCleanups.push(()=>{c.removeEventListener(h,l)})}else d==="ref"&&typeof l=="function"?l(c):c.setAttribute(d,String(l));if(Array.isArray(a.children))for(let d of a.children){let l=this._vNodeToElement(d);l&&c.appendChild(l)}else typeof a.children=="string"&&(c.textContent=a.children);return c}return typeof a.type=="object"||typeof a.type=="function"?a.component?this._vNodeToElement(a.component.subTree||a):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let a=this.querySelectorAll("[slot]");for(let d of a){let l=d.getAttribute("slot")||"default",h=document.createElement("slot");l!=="default"&&h.setAttribute("name",l),this._container.appendChild(h)}let c=document.createElement("slot");this._container.appendChild(c)}_getSlotContent(){var l;let a={},c=this.querySelectorAll("[slot]");for(let h of c){let u=h.getAttribute("slot")||"default";a[u]||(a[u]=[]),a[u].push(h.cloneNode(!0))}let d=[];for(let h of Array.from(this.childNodes))(l=h.hasAttribute)!=null&&l.call(h,"slot")||d.push(h.cloneNode(!0));return d.length>0&&(a.default=d),a}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function Ne(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!_e())return;let r=Pr(t,n);customElements.define(e,r)}function bn(e){for(let{tagName:t,component:n,options:r}of e)Ne(t,n,r)}function vn(e){if(_e())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function Tn(e,t,n){let r=t.match(/<template>([\s\S]*?)<\/template>/),o=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),i=/<style[^>]*>([\s\S]*?)<\/style>/g,s=[],f;for(;(f=i.exec(t))!==null;)s.push(f);let p=(n==null?void 0:n.styles)||"";for(let c of s)p+=c[1]+`
6
+ `;let m=r?r[1].trim():void 0,g={};if(o){let c=o[1].trim();if(c.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let l={},h={exports:l};new Function("module","exports",`"use strict"; ${c.replace(/export\s+default\s*/,"module.exports =")}`)(h,l),g=h.exports||l}catch(l){}}let a={...n,styles:p};m&&!g.template&&!g.render&&(g.template=m),Ne(e,g,a)}
@@ -1,2 +1,6 @@
1
- var S=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},k=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of q(t))!z.call(e,c)&&c!==n&&S(e,c,{get:()=>t[c],enumerable:!(a=W(t,c))||a.enumerable});return e},E=(e,t,n)=>(k(e,t,"default"),n&&k(n,t,"default"));var A={};K(A,{Fragment:()=>I,ShapeFlags:()=>x,createApp:()=>U,h:()=>v});import{isStringOrNumber as X,isArray as w,isVNode as V}from"@lytjs/common";var x=(f=>(f[f.ELEMENT=1]="ELEMENT",f[f.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",f[f.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",f[f.TEXT_CHILDREN=8]="TEXT_CHILDREN",f[f.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",f[f.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",f))(x||{}),I=Symbol("Fragment");function Y(e,t){if(t!=null)if(X(t))e.children=String(t),e.shapeFlag|=8;else if(w(t)){let n=[];for(let a=0;a<t.length;a++){let c=t[a];if(!(c==null||typeof c=="boolean"))if(w(c))for(let m=0;m<c.length;m++){let f=c[m];f!=null&&typeof f!="boolean"&&n.push(V(f)?f:T(String(f)))}else V(c)?n.push(c):n.push(T(String(c)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function T(e,t=null,n=null){var y,h;let a=0;typeof e=="string"?a=1:e===I?a=0:typeof e=="function"?a=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(a=4);let c=(y=t==null?void 0:t.key)!=null?y:null,m=(h=t==null?void 0:t.ref)!=null?h:null,f=t;if(t){let{key:b,ref:o,...i}=t;f=i}let g={type:e,props:f,children:null,key:c,ref:m,shapeFlag:a,el:null,component:null};return n!=null&&Y(g,n),g}function v(e,t,n){return T(e,t||null,n||null)}import{isPromise as j}from"@lytjs/common";function M(e){return Object.create(e||null)}function F(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function D(e){return typeof e=="function"}function H(e,t,...n){if(F(t)){let a=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if(j(a))return a.then(()=>{let c=t.install(e,...n);if(j(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let c=t.install(e,...n);if(j(c))return c.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(D(t))return t(e,...n)}function B(e,t){if(F(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else D(t)}import{effect as Z,stop as J}from"@lytjs/reactivity";import{compile as G}from"@lytjs/compiler";import{defineComponent as Q,createComponentInstance as ee,setupComponent as te,mountComponent as ne,updateComponent as oe,unmountComponent as re}from"@lytjs/component";import{createRenderer as ie}from"@lytjs/renderer";var se=100,_=new Map;function ae(e){let t=_.get(e);if(t)return _.delete(e),_.set(e,t),t;let{code:n}=G(e);if(t=new Function("h","_ctx",`return ${n}`),_.size>=se){let a=_.keys().next().value;a!==void 0&&_.delete(a)}return _.set(e,t),t}function le(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(a,c)=>n(a)}if(e.computed){let n={};for(let a of Object.keys(e.computed)){let c=e.computed[a];typeof c=="function"?n[a]={get:c}:n[a]=c}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(a,c){return n.call(this,a)}}return t}function ce(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[a,c]of Object.entries(t))c&&n.push(a);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,a){e.addEventListener(t,n,a)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function U(e,t){let n=new Set,a={},c={},m=M(),f={},g={},y=null,h=null,b=null,o=null,i=!1,r=le(typeof e=="function"?{render:e}:e),u=Q(r),s={config:f,globalProperties:g,get _instance(){return y},mount(d){if(i)return s;let p;if(typeof d=="string"){if(p=document.querySelector(d),!p)throw new Error(`[Lyt] \u627E\u4E0D\u5230\u6302\u8F7D\u76EE\u6807: "${d}"`)}else p=d;o=p;let C=ce();h=ie(C),y=ee(u),te(y,t||{},null);let P=y.type;if(!P.render&&P.template){let N=ae(P.template);P.render=(R,$)=>N(R,$.renderProxy)}return ne(y,v),y.subTree&&h.mount(y.subTree,p),b=Z(()=>{if(!(!y||!y.isMounted||!h)&&(oe(y,v),y.subTree&&o)){let N=o.firstChild,R=y.subTree;o.innerHTML="",h.mount(R,o)}},{lazy:!0}),i=!0,s},unmount(){i&&(b&&(J(b),b=null),y&&re(y),o&&(o.innerHTML=""),y=null,h=null,o=null,i=!1)},use(d,...p){if(n.has(d))return s;n.add(d);let C=H({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:f,globalProperties:g},d,...p);return C instanceof Promise?C.then(()=>s):s},unuse(d){if(!n.has(d))return s;n.delete(d);let p=B({use:s.use.bind(s),unuse:s.unuse.bind(s),isInstalled:s.isInstalled.bind(s),provide:s.provide.bind(s),inject:s.inject.bind(s),config:f,globalProperties:g},d);return p instanceof Promise?p.then(()=>s):s},isInstalled(d){return n.has(d)},provide(d,p){return m[d]=p,s},inject(d,p){let C=m[d];return C!==void 0?C:p},component(d,p){return p?(a[d]=p,s):a[d]},directive(d,p){return p?(c[d]=p,s):c[d]}};return s}E(A,Fe);import*as Fe from"@lytjs/common";function L(){return typeof globalThis.window!="undefined"&&typeof globalThis.document!="undefined"&&typeof globalThis.HTMLElement!="undefined"&&typeof globalThis.customElements!="undefined"}function ue(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function de(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function fe(e,t){return t&&t[e]?t[e]:ue(e)}function pe(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let a of Object.keys(n.methods))if(a.startsWith("on")&&a.length>2){let c=a.charAt(2).toLowerCase()+a.slice(3);t.push(c)}}return t}function ye(e,t={}){let{shadowMode:n="open",styles:a="",propMappings:c,eventMappings:m={},attributeConverters:f={}}=t,g=t.observedAttributes||[],y=pe(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._updateScheduled=!1}static get observedAttributes(){return g}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),a){let o=document.createElement("style");o.textContent=a,this._shadowRoot.appendChild(o)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let o of this._eventCleanups)o();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(o,i,l){i!==l&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let o={};for(let i of g)if(this.hasAttribute(i)){let l=this.getAttribute(i),r=fe(i,c);f[i]?o[r]=f[i](l):o[r]=de(l)}if(e.props){for(let[i,l]of Object.entries(e.props))if(o[i]===void 0){let r=l;r&&typeof r=="object"&&"default"in r?o[i]=typeof r.default=="function"?r.default():r.default:r==null}}this._props=o}_mountComponent(){let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let i=this._createComponentContext(),l=o.call(i,v,i);l&&this._container&&this._renderVNode(l,this._container),this._setupReactiveUpdates(i,o)}_compileTemplate(o){try{let i=Function("return require")(),{compile:l}=i("../../compiler/src/index.ts"),{code:r}=l(o);return new Function("h","_ctx",`return ${r}`)}catch(i){return null}}_createComponentContext(){let o=e.state?typeof e.state=="function"?e.state():{...e.state}:{},i=e.computed||{},l=e.methods||{},r={...this._props,...o};for(let[u,s]of Object.entries(i))typeof s=="function"?Object.defineProperty(r,u,{get:s.bind(r),enumerable:!0}):s&&typeof s=="object"&&"get"in s&&Object.defineProperty(r,u,{get:s.get.bind(r),enumerable:!0});for(let[u,s]of Object.entries(l))typeof s=="function"&&(r[u]=s.bind(r));return r.emit=(u,...s)=>{let d=m[u]||u,p=new CustomEvent(d,{detail:s.length===1?s[0]:s,bubbles:!0,composed:!0});this.dispatchEvent(p)},r.$el=this._container,r.$attrs={...this._props},r.$slots=this._getSlotContent(),r}_setupReactiveUpdates(o,i){try{let l=Function("return require")(),{effect:r,stop:u}=l("../../reactivity/src/index.ts"),s=r(()=>{if(!this._connected||!this._container)return;let p=i.call(o,v,o);p&&(this._container.innerHTML="",this._renderVNode(p,this._container))},{lazy:!0}),d=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let p of d){let C=o[p];Object.defineProperty(o,p,{get(){return C},set(P){C=P;try{s()}catch(N){}},enumerable:!0})}this._effectCleanup=()=>{try{u(s)}catch(p){}}}catch(l){let r=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let u of r){let d=o[u],p=this;Object.defineProperty(o,u,{get(){return d},set(C){d=C,p._scheduleUpdate(o,i)},enumerable:!0})}}}_scheduleUpdate(o,i){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let l=i.call(o,v,o);l&&(this._container.innerHTML="",this._renderVNode(l,this._container))}))}_updateComponent(){if(!this._container)return;let o=e.render?e.render:e.template?this._compileTemplate(e.template):null;if(!o)return;let i=this._createComponentContext(),l=o.call(i,v,i);this._container.innerHTML="",l&&this._renderVNode(l,this._container)}_renderVNode(o,i){let l=this._vNodeToElement(o);l&&i.appendChild(l)}_vNodeToElement(o){if(!o)return null;if(typeof o.type=="symbol"){let i=document.createDocumentFragment();if(Array.isArray(o.children))for(let l of o.children){let r=this._vNodeToElement(l);r&&i.appendChild(r)}return i}if(typeof o.children=="string")return document.createTextNode(o.children);if(typeof o.type=="string"){let i=document.createElement(o.type);if(o.props)for(let[l,r]of Object.entries(o.props))if(l==="style"&&typeof r=="object")for(let[u,s]of Object.entries(r))i.style[u]=s;else if(l==="class"){if(typeof r=="string")i.className=r;else if(typeof r=="object"){let u=[];for(let[s,d]of Object.entries(r))d&&u.push(s);i.className=u.join(" ")}}else if(l.startsWith("on")&&typeof r=="function"){let u=l.slice(2).toLowerCase();i.addEventListener(u,r),this._eventCleanups.push(()=>{i.removeEventListener(u,r)})}else l==="ref"&&typeof r=="function"?r(i):i.setAttribute(l,String(r));if(Array.isArray(o.children))for(let l of o.children){let r=this._vNodeToElement(l);r&&i.appendChild(r)}else typeof o.children=="string"&&(i.textContent=o.children);return i}return typeof o.type=="object"||typeof o.type=="function"?o.component?this._vNodeToElement(o.component.subTree||o):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let o=this.querySelectorAll("[slot]");for(let l of o){let r=l.getAttribute("slot")||"default",u=document.createElement("slot");r!=="default"&&u.setAttribute("name",r),this._container.appendChild(u)}let i=document.createElement("slot");this._container.appendChild(i)}_getSlotContent(){var r;let o={},i=this.querySelectorAll("[slot]");for(let u of i){let s=u.getAttribute("slot")||"default";o[s]||(o[s]=[]),o[s].push(u.cloneNode(!0))}let l=[];for(let u of Array.from(this.childNodes))(r=u.hasAttribute)!=null&&r.call(u,"slot")||l.push(u.cloneNode(!0));return l.length>0&&(o.default=l),o}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function O(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!L())return;let a=ye(t,n);customElements.define(e,a)}function me(e){for(let{tagName:t,component:n,options:a}of e)O(t,n,a)}function ge(e){if(L())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function he(e,t,n){let a=t.match(/<template>([\s\S]*?)<\/template>/),c=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),m=/<style[^>]*>([\s\S]*?)<\/style>/g,f=[],g;for(;(g=m.exec(t))!==null;)f.push(g);let y=(n==null?void 0:n.styles)||"";for(let i of f)y+=i[1]+`
2
- `;let h=a?a[1].trim():void 0,b={};if(c){let i=c[1].trim();if(i.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let r={},u={exports:r};new Function("module","exports",`"use strict"; ${i.replace(/export\s+default\s*/,"module.exports =")}`)(u,r),b=u.exports||r}catch(r){}}let o={...n,styles:y};h&&!b.template&&!b.render&&(b.template=h),O(e,b,o)}export{O as defineCustomElement,he as defineCustomElementFromSFC,L as isBrowser,me as registerComponents,ge as unregisterElement};
1
+ var tt=Object.defineProperty;var hn=Object.getOwnPropertyDescriptor;var gn=Object.getOwnPropertyNames;var yn=Object.prototype.hasOwnProperty;var v=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var n in t)tt(e,n,{get:t[n],enumerable:!0})},et=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of gn(t))!yn.call(e,o)&&o!==n&&tt(e,o,{get:()=>t[o],enumerable:!(r=hn(t,o))||r.enumerable});return e},G=(e,t,n)=>(et(e,t,"default"),n&&et(n,t,"default"));function O(e,t,n,r){return{start:e,end:t,line:n,column:r}}function ne(e){return{type:"Root",children:[],helpers:new Set,loc:e}}function re(e,t,n=!1){return{type:"Element",tag:e,props:[],children:[],isComponent:/^[A-Z]/.test(e),directives:[],staticFlag:-1,isSelfClosing:n,loc:t}}function oe(e,t){return{type:"Text",content:e,isExpression:/\{\{.*?\}\}/s.test(e),staticFlag:-1,loc:t}}function ie(e,t,n){return{type:"Attribute",name:e,value:t,isDynamic:/^:|^v-bind:/.test(e),isEvent:/^@|^v-on:/.test(e),loc:n}}function R(e,t,n="",r=[],o={start:0,end:0,line:1,column:1}){return{type:"Directive",name:e,value:t,arg:n,modifiers:r,loc:o}}var Ce=v(()=>{"use strict"});function Re(e){let t=new Se(e);for(;!t.isEOF();)switch(t.state){case 0:Dn(t);break;case 1:Ln(t);break;case 2:Mn(t);break;case 3:Bn(t);break;case 4:Vn(t);break;case 5:$n(t);break}return ft(t),t.root}function Dn(e){for(e.textBuffer===""&&(e.textStart=e.pos);!e.isEOF();){let t=e.peek();if(t==="<"){ft(e),e.advance(),e.state=1;return}if(t==="{"&&e.peekAt(1)==="{"){for(e.textBuffer+=e.advance(),e.textBuffer+=e.advance();!e.isEOF();){let n=e.peek();if(e.textBuffer+=e.advance(),n==="}"&&e.peek()==="}"){e.textBuffer+=e.advance();break}}continue}e.textBuffer+=e.advance()}}function Ln(e){if(e.skipWhitespace(),e.startsWith("!--")){e.state=5,e.commentBuffer="",e.advance(),e.advance(),e.advance();return}e.peek()==="/"?(e.isClosingTag=!0,e.advance()):e.isClosingTag=!1,e.tagNameBuffer="",e.tagNameStart=e.pos,e.state=2}function Mn(e){for(;!e.isEOF();){let r=e.peek();if(/\s/.test(r)||r===">"||r==="/")break;e.tagNameBuffer+=e.advance()}if(e.isClosingTag){e.state=4;return}let t=O(e.tagNameStart,e.pos,e.line,e.column-e.tagNameBuffer.length),n=re(e.tagNameBuffer.toLowerCase(),t);e.currentElement=n,e.state=3}function Bn(e){if(e.skipWhitespace(),e.isEOF())return;let t=e.peek();if(t===">"){e.advance(),ut(e);return}if(t==="/"&&e.peekAt(1)===">"){e.advance(),e.advance(),ut(e,!0);return}e.attrNameBuffer="",e.attrValueBuffer="",e.inAttrValue=!1,e.attrValueQuote="";let n=e.pos;for(;!e.isEOF();){let i=e.peek();if(/\s/.test(i)||i==="="||i===">"||i==="/")break;e.attrNameBuffer+=e.advance()}if(e.skipWhitespace(),e.peek()==="="){e.advance(),e.skipWhitespace();let i=e.peek();if(i==='"'||i==="'")for(e.attrValueQuote=i,e.advance(),e.inAttrValue=!0;!e.isEOF();){if(e.peek()===e.attrValueQuote){e.advance(),e.inAttrValue=!1;break}e.attrValueBuffer+=e.advance()}else for(;!e.isEOF();){let s=e.peek();if(/\s/.test(s)||s===">"||s==="/")break;e.attrValueBuffer+=e.advance()}}let r=O(n,e.pos,e.line,e.column),o=Wn(e.attrNameBuffer,e.attrValueBuffer||null,r);e.currentElement&&(o.type==="Directive"?e.currentElement.directives.push(o):e.currentElement.props.push(o))}function Vn(e){e.skipWhitespace(),e.peek()===">"&&e.advance();let t=e.tagNameBuffer.toLowerCase(),n=!1;for(let r=e.parentStack.length-1;r>=0;r--)if(e.parentStack[r].tag===t){e.parentStack.splice(r),e.currentElement=e.parentStack.length>0?e.parentStack[e.parentStack.length-1]:null,n=!0;break}e.state=0}function $n(e){for(;!e.isEOF();){if(e.startsWith("-->")){e.advance(),e.advance(),e.advance(),e.state=0;return}e.commentBuffer+=e.advance()}}function ft(e){let t=e.textBuffer.trim();if(t.length===0){e.textBuffer="";return}let n=oe(t,O(e.textStart,e.pos,e.line,e.column));e.currentElement?e.currentElement.children.push(n):e.root.children.push(n),e.textBuffer=""}function ut(e,t=!1){if(!e.currentElement)return;e.currentElement.isSelfClosing=t;let n=Fn.has(e.currentElement.tag),r=e.parentStack.length>0?e.parentStack[e.parentStack.length-1]:null;r?r.children.push(e.currentElement):e.root.children.push(e.currentElement),!t&&!n?e.parentStack.push(e.currentElement):e.currentElement=r,e.state=0}function Wn(e,t,n){if(e.startsWith("v-")){let r=e.slice(2);if(r.startsWith("on")){let s=r.slice(2),f=s.indexOf("."),p=s,m=[];return f!==-1&&(p=s.slice(0,f),m.push(...s.slice(f+1).split("."))),R("on",t||"",p,m,n)}if(r.startsWith("bind")){let s=r.slice(4).replace(/^:/,"");return R("bind",t||"",s,[],n)}if(r.startsWith("slot")){let s=r.slice(4).replace(/^:/,"");return R("slot",t||"",s,[],n)}if(r==="model")return R("bind",t||"","model",[],n);if(r==="ref")return R("ref",t||"","",[],n);let o=r.indexOf(":"),i=o!==-1?r.slice(0,o):r;if(jn.has(i)){let s=o!==-1?r.slice(o+1):"";return R(i,t||"",s,[],n)}}if(e.startsWith(":")){let r=e.slice(1);return R("bind",t||"",r,[],n)}if(e.startsWith("@")){let r=e.slice(1),o=r.indexOf("."),i=r,s=[];return o!==-1&&(i=r.slice(0,o),s.push(...r.slice(o+1).split("."))),R("on",t||"",i,s,n)}if(e.startsWith("#")){let r=e.slice(1);return R("slot",t||"",r,[],n)}return ie(e,t,n)}var Fn,jn,Se,pt=v(()=>{"use strict";Ce();Fn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jn=new Set(["if","each","bind","on","slot","ref"]),Se=class{constructor(t){this.template=t,this.pos=0,this.line=1,this.column=1,this.state=0,this.root=ne(O(0,t.length,1,1)),this.currentElement=null,this.parentStack=[],this.textBuffer="",this.textStart=0,this.tagNameBuffer="",this.tagNameStart=0,this.attrNameBuffer="",this.attrValueBuffer="",this.attrValueQuote="",this.inAttrValue=!1,this.commentBuffer="",this.isClosingTag=!1}currentPos(){return O(this.pos,this.pos,this.line,this.column)}advance(){let t=this.template[this.pos++];return t===`
2
+ `?(this.line++,this.column=1):this.column++,t}peek(){return this.template[this.pos]||""}peekAt(t){return this.template[this.pos+t]||""}isEOF(){return this.pos>=this.template.length}startsWith(t){return this.template.substring(this.pos,this.pos+t.length)===t}skipWhitespace(){for(;!this.isEOF()&&/\s/.test(this.peek());)this.advance()}}});function Ne(e,t={}){let n=new U(e,t),r=[Hn,Kn,Gn,Un,Yn,zn],o=[...t.nodeTransforms||[],...r];se(e,n,o),_e(e,n)}function se(e,t,n){t.parent=e;for(let r of n){let o=r(e,t);if(o&&t.onExitCallbacks.push(i=>o()),t.replaceNode){let i=t.replaceNode;t.replaceNode=null,se(i,t,n);return}if(t.removeNode){t.removeNode=null;return}}switch(e.type){case"Root":for(let r=0;r<e.children.length;r++)t.childIndex=r,se(e.children[r],t,n);break;case"Element":for(let r=0;r<e.children.length;r++)t.childIndex=r,se(e.children[r],t,n);break}}function _e(e,t){let n=t.onExitCallbacks.splice(0);for(let r of n)r(e);switch(e.type){case"Root":for(let r of e.children)_e(r,t);break;case"Element":for(let r of e.children)_e(r,t);break}}function Hn(e,t){if(e.type!=="Element")return;let n=e.directives.find(r=>r.name==="if");n&&(Object.assign(e,{ifCondition:n.value,ifBranches:[]}),t.root.helpers.add("createConditionalVNode"),e.directives=e.directives.filter(r=>r!==n))}function Kn(e,t){if(e.type!=="Element")return;let n=e.directives.find(o=>o.name==="each");if(!n)return;let r=Xn(n.value);r&&(Object.assign(e,{eachInfo:r}),t.root.helpers.add("renderList")),e.directives=e.directives.filter(o=>o!==n)}function Gn(e,t){if(e.type!=="Element")return;let n=e.directives.filter(o=>o.name==="bind");if(n.length===0)return;let r=[];for(let o of n){let i=o.arg==="model";r.push({arg:o.arg,value:o.value,isModel:i}),i&&t.root.helpers.add("createModelBinding")}Object.assign(e,{bindings:r}),e.directives=e.directives.filter(o=>o.name!=="bind")}function Un(e,t){if(e.type!=="Element")return;let n=e.directives.filter(o=>o.name==="on");if(n.length===0)return;let r=[];for(let o of n)r.push({name:o.arg,value:o.value,modifiers:o.modifiers}),t.root.helpers.add("createEventHandler");Object.assign(e,{events:r}),e.directives=e.directives.filter(o=>o.name!=="on")}function Yn(e,t){if(e.type!=="Element")return;let n=e.directives.find(r=>r.name==="slot");n&&(Object.assign(e,{slotInfo:{name:n.arg||"default",value:n.value}}),t.root.helpers.add("renderSlot"),e.directives=e.directives.filter(r=>r!==n))}function zn(e,t){if(e.type!=="Element")return;let n=e.directives.find(r=>r.name==="ref");n&&(Object.assign(e,{refInfo:{name:n.value}}),t.root.helpers.add("createRef"),e.directives=e.directives.filter(r=>r!==n))}function Xn(e){let t=e.match(/^\s*(?:\((\w+)\s*,\s*(\w+)\)|(\w+))\s+(?:in|of)\s+(\S+)\s*$/);return t?{item:t[1]||t[3],index:t[2]||"",collection:t[4]}:null}var U,we=v(()=>{"use strict";U=class{constructor(t,n={}){this.root=t,this.parent=null,this.childIndex=0,this.options={markStatic:!0,...n},this.onExitCallbacks=[],this.replaceNode=null,this.removeNode=null}}});function xe(e){let t={hoistedNodes:[],hoistedNames:[]},n=0;for(let r of e.children)dt(r,t,()=>(n++,`_hoisted_${n}`));return t}function dt(e,t,n){switch(e.type){case"Text":return qn(e,t,n);case"Element":return Jn(e,t,n);default:return!1}}function qn(e,t,n){return e.isExpression?(e.staticFlag=0,!1):(e.staticFlag=1,!0)}function Jn(e,t,n){if(e.directives.length>0)return e.staticFlag=0,!1;let r=e;if(r.ifCondition||r.eachInfo||r.bindings&&r.bindings.length>0||r.events&&r.events.length>0||r.slotInfo||r.refInfo)return e.staticFlag=0,!1;for(let i of e.props)if(i.isDynamic||i.isEvent)return e.staticFlag=0,!1;let o=!0;for(let i of e.children)dt(i,t,n)||(o=!1);if(o){if(e.staticFlag=1,e.children.length>0){let i=n();t.hoistedNodes.push(e),t.hoistedNames.push(i),e.hoistedName=i}return!0}return e.staticFlag=0,!1}function ke(e){if(e.type==="Text")return!e.isExpression;if(e.type==="Element"){if(e.staticFlag!==-1)return e.staticFlag===1;let t=e;if(e.directives.length>0||t.ifCondition||t.eachInfo||t.bindings&&t.bindings.length>0||t.events&&t.events.length>0||t.slotInfo||t.refInfo)return!1;for(let n of e.props)if(n.isDynamic||n.isEvent)return!1;for(let n of e.children)if(!ke(n))return!1;return!0}return!1}var mt=v(()=>{"use strict"});var Ae,ht=v(()=>{"use strict";Ae=(l=>(l[l.TEXT=1]="TEXT",l[l.CLASS=2]="CLASS",l[l.STYLE=4]="STYLE",l[l.PROPS=8]="PROPS",l[l.FULL_PROPS=16]="FULL_PROPS",l[l.EVENT=32]="EVENT",l[l.SLOTS=64]="SLOTS",l[l.STABLE_FRAGMENT=128]="STABLE_FRAGMENT",l[l.KEYED_FRAGMENT=256]="KEYED_FRAGMENT",l[l.UNKEYED_FRAGMENT=512]="UNKEYED_FRAGMENT",l[l.NEED_PATCH=1024]="NEED_PATCH",l[l.DYNAMIC_SLOTS=2048]="DYNAMIC_SLOTS",l[l.HOISTED=-1]="HOISTED",l[l.BAIL=-2]="BAIL",l))(Ae||{})});function Fe(e,t={}){let n=new ae;if(Qn(e,n),n.hoistedDecls.length>0){for(let r of n.hoistedDecls)n.pushLine(r);n.newline()}return Zn(e.children,n),{code:n.code,hoisted:n.hoistedDecls,helpers:Array.from(n.helpers.keys())}}function Qn(e,t){t.helpers.set("h","Lyt");for(let n of e.helpers)switch(n){case"createConditionalVNode":break;case"renderList":t.helpers.set("renderList","Lyt");break;case"createModelBinding":break;case"createEventHandler":break;case"renderSlot":t.helpers.set("renderSlot","Lyt");break;case"createRef":break;default:t.helpers.set(n,"Lyt")}}function Zn(e,t){if(e.length===0){t.push("null");return}if(e.length===1){Oe(e[0],t);return}t.push("["),t.indentIn();for(let n=0;n<e.length;n++)n>0&&t.pushLine(","),Oe(e[n],t);t.indentOut(),t.pushLine(""),t.push("]")}function Oe(e,t){switch(e.type){case"Element":er(e,t);break;case"Text":or(e,t);break}}function er(e,t){let n=e;if(n.ifCondition){let r=n.ifCondition;t.push(`(${x(r)} ? (`),Pe(e,t),t.push(") : null)");return}if(n.eachInfo){let r=n.eachInfo;t.push(`renderList(${x(r.collection)}, (${r.item}`),r.index&&t.push(`, ${r.index}`),t.push(") => "),Pe(e,t),t.push(")");return}Pe(e,t)}function Pe(e,t){let n=e,r=tr(e,t),o=rr(e.children,t),i=e.isComponent?e.tag:`'${e.tag}'`;t.push(`h(${i}`),t.push(r?`, ${r}`:", null"),o&&o!=="null"&&t.push(`, ${o}`),t.push(")")}function tr(e,t){let n=e,r=[],o=nr(e);if(o&&r.push(o),n.bindings){let i=n.bindings;for(let s of i)s.isModel?r.push(`model: { value: ${x(s.value)}, callback: $event => ${x(s.value)} = $event }`):r.push(`'${s.arg}': ${x(s.value)}`)}if(n.events){let i=n.events;for(let s of i){let f=`on${cr(s.name)}`,p=x(s.value);if(s.modifiers.length>0){let m=s.modifiers.map(g=>{switch(g){case"stop":return"$event.stopPropagation()";case"prevent":return"$event.preventDefault()";case"capture":return null;case"once":return null;default:return null}}).filter(Boolean);m.length>0&&(p=`($event) => { ${m.join("; ")}; ${x(s.value)}($event) }`)}r.push(`'${f}': ${p}`)}}if(n.refInfo){let i=n.refInfo;r.push(`ref: '${i.name}'`)}if(n.slotInfo){let i=n.slotInfo;r.push(`'slot': '${i.name}'`)}return r.length===0?"":`{ ${r.join(", ")} }`}function nr(e){let t=[];for(let n of e.props)n.isDynamic||n.isEvent||(n.value===null?t.push(`'${n.name}': true`):t.push(`'${n.name}': '${Ie(n.value)}'`));return t.join(", ")}function rr(e,t){if(e.length===0)return"";let n=[],r=new ae;for(let o of e)Oe(o,r),n.push(r.code),r.code="";return n.length===0?"":n.length===1?n[0]:`[${n.join(", ")}]`}function or(e,t){if(!e.isExpression){t.push(`'${Ie(e.content)}'`);return}let n=lr(e.content);if(n.length===1&&n[0].type==="expression"){t.push(x(n[0].value));return}let r=n.map(o=>o.type==="text"?`'${Ie(o.value)}'`:x(o.value));t.push(r.join(" + "))}function lr(e){let t=[],n=/\{\{([\s\S]*?)\}\}/g,r=0,o;for(;(o=n.exec(e))!==null;)o.index>r&&t.push({type:"text",value:e.slice(r,o.index)}),t.push({type:"expression",value:o[1].trim()}),r=n.lastIndex;return r<e.length&&t.push({type:"text",value:e.slice(r)}),t}function x(e){if(e=e.trim(),e.startsWith("_ctx."))return e;if(/^\w+(\.\w+)*$/.test(e))return`_ctx.${e}`;if(e.match(/^(\w+(?:\.\w+)*)\s*\(/))return`_ctx.${e}`;if(e.includes("=>"))return e;let n=[],r=e.replace(/(['"`])(?:(?!\1|\\).|\\.)*\1/g,o=>(n.push(o),`__PH${n.length-1}__`));r=r.replace(/(?<!_ctx\.)(?<!\w)(\w+(?:\.\w+)*)/g,o=>ir.has(o)||sr.has(o)||ar.has(o)||/^\d/.test(o)||/^__PH\d+__$/.test(o)?o:`_ctx.${o}`);for(let o=0;o<n.length;o++)r=r.replace(`__PH${o}__`,n[o]);return r}function Ie(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function cr(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}var ae,ir,sr,ar,gt=v(()=>{"use strict";ae=class{constructor(){this.code="",this.indentLevel=0,this.indent=" ",this.needsNewline=!0,this.helpers=new Map,this.hoistedDecls=[]}push(t){this.needsNewline&&(this.code+=this.indent.repeat(this.indentLevel),this.needsNewline=!1),this.code+=t}pushLine(t){this.push(t),this.newline()}newline(){this.code+=`
3
+ `,this.needsNewline=!0}indentIn(){this.indentLevel++}indentOut(){this.indentLevel--}};ir=new Set(["true","false","null","undefined","this","super","new","delete","typeof","instanceof","in","of","void","throw","return","yield","await","async","if","else","for","while","do","switch","case","break","continue","try","catch","finally","class","extends","import","export","from","default","var","let","const","function","debugger"]),sr=new Set(["console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","RegExp","Error","TypeError","RangeError","SyntaxError","Map","Set","WeakMap","WeakSet","Promise","Symbol","Proxy","Reflect","parseInt","parseFloat","isNaN","isFinite","NaN","Infinity"]),ar=new Set(["$event","$refs","$el","$emit","$slots","$parent","$root"])});function dr(e){let t={};if(!e||!e.trim())return t;vt.lastIndex=0;let n;for(;(n=vt.exec(e))!==null;){let r=n[1],o=n[2]!==void 0?n[2]:n[3]!==void 0?n[3]:n[4]!==void 0?n[4]:"";t[r]=o}return t}function mr(e,t,n,r){let o=1,i=r;for(;i<e.length&&o>0;){let s=e.slice(i).search(t),f=e.indexOf(n,i);if(f===-1)return-1;if(s!==-1&&s+i<f)o++,i=s+i+1;else{if(o--,o===0)return f+n.length;i=f+n.length}}return-1}function je(e,t,n){t.lastIndex=0;let r=t.exec(e);if(!r)return null;let o=r.index,i=r[1]||"",s=dr(i),f=r.index+r[0].length,p=mr(e,t,n,f);return p===-1?null:{content:e.slice(f,p-n.length).trim(),start:o,end:p,attrs:s}}function Y(e,t="anonymous.lyt"){let n=e.replace(ur,""),r=je(n,fr,"</template>"),o=r?{type:"template",content:r.content,start:r.start,end:r.end,attrs:r.attrs}:null,i=je(n,pr,"<\/script>"),s=i?{type:"script",content:i.content,start:i.start,end:i.end,attrs:i.attrs}:null,f=[],p=n;for(yt.lastIndex=0;;){let m=je(p,yt,"</style>");if(!m)break;f.push({type:"style",content:m.content,start:m.start,end:m.end,attrs:m.attrs,scoped:"scoped"in m.attrs}),p=p.slice(m.end)}return{filename:t,template:o,script:s,styles:f}}function De(e){bt.lastIndex=0;let t=bt.exec(e);return t?t[1].trim():null}var ur,fr,pr,yt,bt,vt,le=v(()=>{"use strict";ur=/<!--[\s\S]*?-->/g,fr=/<template(\s[^>]*)?\s*>/,pr=/<script(\s[^>]*)?\s*>/,yt=/<style(\s[^>]*)?\s*>/,bt=/export\s+default\s*\{([\s\S]*?)\}\s*$/,vt=/(\w[\w-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|(\S+)))?/g});function gr(e,t){let n=5381,r=e+"\0"+t;for(let o=0;o<r.length;o++)n=(n<<5)+n+r.charCodeAt(o)&4294967295;return hr+(n>>>0).toString(16).slice(0,6)}function z(e,t){let n="",r=0,o=e.length;for(;r<o;){if(e[r]==="@"){let m=e.slice(r).match(/^@([\w-]+)/);if(m){let g=m[1];if(["keyframes","-webkit-keyframes","-moz-keyframes","font-face"].includes(g)){let c=e.indexOf("{",r+m[0].length);if(c!==-1){let d=Le(e,c+1);if(d!==-1){n+=e.slice(r,d),r=d;continue}}}if(["media","supports","document"].includes(g)){let c=e.indexOf("{",r+m[0].length);if(c!==-1){let d=Le(e,c+1);if(d!==-1){let l=e.slice(r,c+1),h=e.slice(c+1,d-1),u=z(h,t);n+=l+u+"}",r=d;continue}}}let a=e.indexOf(";",r);if(a!==-1){n+=e.slice(r,a+1),r=a+1;continue}}}let i=e.indexOf("{",r);if(i===-1){n+=e.slice(r);break}let s=e.slice(r,i).trim();if(!s){n+=e.slice(r,i+1),r=i+1;continue}let f=Le(e,i+1);if(f===-1){n+=e.slice(r);break}let p=yr(s,t);n+=p+e.slice(i,f),r=f}return n}function Le(e,t){let n=1,r=t;for(;r<e.length&&n>0;)e[r]==="{"?n++:e[r]==="}"&&n--,r++;return n===0?r:-1}function yr(e,t){return br(e).map(r=>vr(r.trim(),t)).join(", ")}function br(e){let t=[],n=0,r="";for(let o=0;o<e.length;o++){let i=e[o];i==="("?(n++,r+=i):i===")"?(n--,r+=i):i===","&&n===0?(t.push(r),r=""):r+=i}return r.trim()&&t.push(r),t}function vr(e,t){let n=/(::(?:before|after|first-line|first-letter|selection|placeholder|backdrop|marker|spelling-error|grammar-error)[\s\S]*)$/,r=e.match(n),o=e,i="";r&&(o=e.slice(0,e.length-r[0].length),i=r[0]);let s=/(:(?:hover|focus|active|visited|link|first-child|last-child|nth-child\([^)]*\)|nth-of-type\([^)]*\)|not\([^)]*\)|root|empty|checked|disabled|enabled|valid|invalid|required|optional|read-only|read-write)[\s\S]*)$/,f=o.match(s),p=o,m="";return f&&(p=o.slice(0,o.length-f[0].length),m=f[0]),p=p.replace(/\s+$/,""),`${p}[${t}]${m}${i}`}function Me(e){let{template:t,script:n,styles:r,filename:o}=e,i=[(t==null?void 0:t.content)||"",(n==null?void 0:n.content)||"",...r.map(a=>a.content)].join("\0"),s=gr(o,i),f="null";t&&(f=`function(_ctx) { return ${Be(t.content).code} }`);let p="{}";if(n){let a=De(n.content);a&&(p=`{ ${a} }`)}let m=[];for(let a of r){let c=a.content;a.scoped&&(c=z(c,s)),m.push(c)}return{code:Tr(f,p,s,m),styles:m,scopedId:s}}function Tr(e,t,n,r){let o=[];if(o.push("// Generated by Lyt.js SFC Compiler"),o.push(""),o.push(`const _sfcId = '${n}'`),o.push(""),r.length>0){o.push("const _styles = [");for(let i of r)o.push(` ${JSON.stringify(i)},`);o.push("]"),o.push(""),o.push("function _injectStyles() {"),o.push(" if (typeof document === 'undefined') {"),o.push(" throw new Error('[Lyt Compiler] SFC \u7F16\u8BD1\u9700\u8981 DOM \u73AF\u5883')"),o.push(" }"),o.push(" for (const css of _styles) {"),o.push(' const style = document.createElement("style")'),o.push(' style.setAttribute("data-sfc-id", _sfcId)'),o.push(" style.textContent = css"),o.push(" document.head.appendChild(style)"),o.push(" }"),o.push("}"),o.push(""),o.push("_injectStyles()"),o.push("")}return o.push("export default {"),o.push(" __sfcId: _sfcId,"),o.push(` render: ${e},`),o.push(` ...${t},`),o.push("}"),o.join(`
4
+ `)}var hr,Tt=v(()=>{"use strict";Ve();le();hr="data-v-"});var Et=v(()=>{"use strict";le();Tt()});function Er(e){let t=e.match(/props:\s*(\{[^}]+\}|\[[^\]]+\])/);return t?t[1]:null}function Cr(e){let t=e.match(/emits:\s*(\{[^}]+\}|\[[^\]]+\])/);return t?t[1]:null}function $e(e,t={}){let{filename:n="Component"}=t,r=n.replace(/\.lyt$/,""),o=[];if(o.push("/**"),o.push(` * ${r} \u7EC4\u4EF6\u7C7B\u578B\u58F0\u660E`),o.push(" * \u7531 @lytjs/compiler \u81EA\u52A8\u751F\u6210"),o.push(" */"),o.push(""),o.push("export interface ComponentProps {"),e.script){let i=Er(e.script.content);i&&o.push(` // Props \u5B9A\u4E49: ${i}`)}if(o.push(" [key: string]: any;"),o.push("}"),o.push(""),o.push("export interface ComponentEmits {"),e.script){let i=Cr(e.script.content);i&&o.push(` // Emits \u5B9A\u4E49: ${i}`)}return o.push(" [key: string]: (...args: any[]) => any;"),o.push("}"),o.push(""),o.push("/**"),o.push(" * \u7EC4\u4EF6\u7C7B\u578B\u5B9A\u4E49"),o.push(" */"),o.push("declare const component: import('@lytjs/component').ComponentDefine;"),o.push(""),o.push("export default component;"),o.join(`
5
+ `)}function We(e,t="Component.lyt"){let n=Y(e,t);return $e(n,{filename:t,generateDts:!0})}function Ct(){return{name:"lytjs-types",transform(e,t){if(t.endsWith(".lyt")){let n=We(e,t);return{code:e,map:null,dts:n}}return null}}}var St=v(()=>{"use strict";le()});var Rt={};ye(Rt,{CompilerPatchFlags:()=>Ae,TransformContext:()=>U,compile:()=>Be,compileSFC:()=>Me,createAttributeNode:()=>ie,createDirectiveNode:()=>R,createElementNode:()=>re,createPosition:()=>O,createRootNode:()=>ne,createTextNode:()=>oe,createTypePlugin:()=>Ct,generate:()=>Fe,generateDtsForLytFile:()=>We,generateTypeDeclarations:()=>$e,isStatic:()=>ke,optimize:()=>xe,parseHTML:()=>Re,parseSFC:()=>Y,scopeCSS:()=>z,transform:()=>Ne});function Be(e,t={}){let n=Re(e);Ne(n,t.transform);let r=xe(n),o=Fe(n,t.codegen);return{code:o.code,ast:n,hoistResult:r,helpers:o.helpers}}var Ve=v(()=>{"use strict";Ce();pt();we();we();mt();ht();gt();Et();St()});function ue(){Nt.push(ce),ce=!1}function fe(){let e=Nt.pop();ce=e===void 0?!0:e}function _t(e){let{deps:t}=e;for(let n of t)n.delete(e);t.clear()}function T(e,t){if(!ce||!E)return;let n=He.get(e);n||(n=new Map,He.set(e,n));let r=n.get(t);r||(r=new Set,n.set(t,r)),r.has(E)||(r.add(E),E.deps.add(r))}function C(e,t,n,r){let o=He.get(e);if(!o)return;let i=new Set,s=f=>{if(f)for(let p of f)(p!==E||p.allowRecurse)&&i.add(p)};if(s(o.get(t)),(n==="add"||n==="delete")&&s(o.get(L)),n==="set"&&Array.isArray(e)){let f=o.get("length");f&&typeof t=="number"&&t<e.length&&s(f)}for(let f of i)f.scheduler?f.scheduler(f):f.run()}function wt(e,t={}){let n=new N(e,t);t.lazy||n.run();let r=n.run.bind(n);return r.effect=n,r.stop=()=>n.stop(),r}function xt(e){var t;(t=e==null?void 0:e.effect)==null||t.stop()}var E,X,Sr,He,N,ce,Nt,L,V=v(()=>{"use strict";E=null,X=[],Sr=0,He=new WeakMap,N=class{constructor(t,n={}){this.active=!0;this.deps=new Set;this.fn=t,this.scheduler=n.scheduler,this.beforeRun=n.beforeRun,this.afterRun=n.afterRun,this.lazy=n.lazy,this.id=Sr++}run(){var t,n;if(!this.active)return this.fn();if(X.includes(this))return this.fn();try{return(t=this.beforeRun)==null||t.call(this),X.push(this),E=this,_t(this),this.fn()}finally{(n=this.afterRun)==null||n.call(this),X.pop(),E=X[X.length-1]||null}}stop(){this.active&&(_t(this),this.onStop&&this.onStop(),this.active=!1)}},ce=!0,Nt=[];L=Symbol("iterate")});function q(e){return e!==null&&typeof e=="object"}function It(e,t){return!Object.is(e,t)}function pe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ft(e){return typeof e=="string"&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e}function J(e,t={}){if(!q(e)||e[M])return e;if(e[k])return me(e);let n=kt.get(e);if(n)return n;let r=new Proxy(e,Rr);return kt.set(e,r),r}function me(e){if(!q(e))return e;let t=At.get(e);if(t)return t;e[k]=!0;let n=new Proxy(e,_r);return At.set(e,n),n}function jt(e){if(!q(e))return e;let t=Pt.get(e);if(t)return t;let n=new Proxy(e,Nr);return Pt.set(e,n),n}function I(e){let t=e&&e[A];return t?I(t):e}function $(e){return Ke(e)?$(e[A]):!!(e&&e[M])}function Ke(e){return!!(e&&e[k])}function Dt(e){return e[k]=!0,e}function Lt(e){return e[Ot]=!0,e}var k,A,M,Ot,kt,At,Pt,de,Rr,_r,Nr,he=v(()=>{"use strict";V();k=Symbol("readonly"),A=Symbol("raw"),M=Symbol("reactive"),Ot=Symbol("skip"),kt=new WeakMap,At=new WeakMap,Pt=new WeakMap;de={};["includes","indexOf","lastIndexOf"].forEach(e=>{de[e]=function(...t){let n=I(this);for(let r=0;r<n.length;r++)T(n,String(r));return T(n,"length"),n[e](...t)}});["push","pop","shift","unshift","splice","sort","reverse"].forEach(e=>{de[e]=function(...t){ue();let n=Array.prototype[e].apply(this,t);return fe(),C(I(this),"length","set",I(this).length),n}});Rr={get(e,t,n){if(t===A)return e;if(t===M)return!0;if(Array.isArray(e)&&de.hasOwnProperty(t))return de[t];T(e,t);let r=Reflect.get(e,t,n);return t===k?e[k]===!0:!q(r)||e[Ot]?r:J(r)},set(e,t,n,r){let o=e[t],i=Array.isArray(e)&&Ft(t)?Number(t)<e.length:pe(e,t),s=Reflect.set(e,t,n,r);return(e===(r==null?void 0:r[A])||e===I(r))&&(i?It(n,o)&&C(e,t,"set",n):C(e,t,"add",n)),s},deleteProperty(e,t){let n=pe(e,t),r=Reflect.deleteProperty(e,t);return r&&n&&C(e,t,"delete"),r},has(e,t){return T(e,t),Reflect.has(e,t)},ownKeys(e){return T(e,L),Reflect.ownKeys(e)}},_r={get(e,t,n){if(t===A)return e;if(t===M||t===k)return!0;T(e,t);let r=Reflect.get(e,t,n);return q(r)?me(r):r},set(e,t,n,r){return!1},deleteProperty(e,t){return!1},has(e,t){return T(e,t),Reflect.has(e,t)},ownKeys(e){return T(e,L),Reflect.ownKeys(e)}},Nr={get(e,t,n){return t===A?e:t===M?!0:(T(e,t),Reflect.get(e,t,n))},set(e,t,n,r){let o=e[t],i=Array.isArray(e)&&Ft(t)?Number(t)<e.length:pe(e,t),s=Reflect.set(e,t,n,r);return(e===(r==null?void 0:r[A])||e===I(r))&&(i?It(n,o)&&C(e,t,"set",n):C(e,t,"add",n)),s},deleteProperty(e,t){let n=pe(e,t),r=Reflect.deleteProperty(e,t);return r&&n&&C(e,t,"delete"),r},has(e,t){return T(e,t),Reflect.has(e,t)},ownKeys(e){return T(e,L),Reflect.ownKeys(e)}}});import{isObject as wr}from"@lytjs/common";function xr(e){return Ue.get(e)||e}function Mt(e){if(P(e))return e;let t={_value:Bt(e),_rawValue:e,__v_isRef:!0,[W]:!0},n=new Proxy(t,kr);return Ue.set(n,t),n}function Bt(e){return wr(e)?J(e):e}function Vt(e){if(P(e))return e;let t={_value:e,_rawValue:e,__v_isRef:!0,__v_isShallow:!0,[W]:!0,[Ge]:!0},n=new Proxy(t,Ar);return Ue.set(n,t),n}function P(e){return!!(e&&e.__v_isRef===!0)}function $t(e){return P(e)?e.value:e}function Ye(e,t){let n=e[t];return P(n)?n:new Proxy({_obj:e,_key:t,__v_isRef:!0},{get(r,o,i){return o==="value"?r._obj[r._key]:o==="__v_isRef"?!0:Reflect.get(r,o,i)},set(r,o,i,s){return o==="value"?(r._obj[r._key]=i,!0):Reflect.set(r,o,i,s)}})}function Wt(e){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=Ye(e,n));return t}function Ht(e){let t=xr(e);C(t,"value","set",t._rawValue)}var W,Ge,Ue,kr,Ar,ze=v(()=>{"use strict";V();he();W=Symbol("ref"),Ge=Symbol("shallowRef"),Ue=new WeakMap;kr={get(e,t,n){return t==="value"?(T(e,"value"),e._value):t===W||t==="__v_isRef"?!0:t==="_rawValue"?e._rawValue:Reflect.get(e,t,n)},set(e,t,n,r){if(t==="value"){let o=e._rawValue;return Object.is(o,n)||(e._rawValue=n,e._value=Bt(n),C(e,"value","set",n)),!0}return Reflect.set(e,t,n,r)}};Ar={get(e,t,n){return t==="value"?(T(e,"value"),e._value):t===W||t==="__v_isRef"||t==="__v_isShallow"?!0:t==="_rawValue"?e._rawValue:Reflect.get(e,t,n)},set(e,t,n,r){if(t==="value"){let o=e._rawValue;return Object.is(o,n)||(e._rawValue=n,e._value=n,C(e,"value","set",n)),!0}return Reflect.set(e,t,n,r)}}});function Kt(e){let t,n;return typeof e=="function"?(t=e,n=void 0):(t=e.get,n=e.set),new Xe(t,n)}var Xe,Gt=v(()=>{"use strict";V();Xe=class{constructor(t,n){this._dirty=!0;this.__v_isRef=!0;this.deps=new Set;this._setter=n,this._effect=new N(t,{scheduler:()=>{this._dirty||(this._dirty=!0,this.triggerDep())},lazy:!0}),this._value=void 0}get value(){return T(this,"value"),E&&!this.deps.has(E)&&(this.deps.add(E),E.deps.add(this.deps)),this._dirty&&(this._value=this._effect.run(),this._dirty=!1),this._value}set value(t){this._setter&&this._setter(t)}triggerDep(){for(let t of this.deps)t.scheduler?t.scheduler(t):t.run()}}});import{queueJob as Yt,nextTick as zt,isObject as Xt}from"@lytjs/common";function Q(e,t=1/0,n){if(!Xt(e)||t<=0||(n||(n=new Set),n.has(e)))return e;if(n.add(e),P(e))Q(e.value,t-1,n);else if(Array.isArray(e))for(let r=0;r<e.length;r++)Q(e[r],t-1,n);else for(let r of Object.keys(e))Q(e[r],t-1,n);return e}function Ut(e){return P(e)?()=>e.value:$(e)?()=>Q(e):typeof e=="function"?e:()=>Q(e)}function qt(e,t,n={}){let r,o=!1;if(Array.isArray(e)){o=!0;let g=e.map(a=>Ut(a));r=()=>g.map(a=>a())}else r=Ut(e);$(e)&&n.deep!==!1&&(n.deep=!0);let i=o?[]:void 0,s,f=g=>{s=g},p=()=>{s&&(s(),s=void 0);let g=m.run();(o?g.some((a,c)=>!Object.is(a,i[c])):!Object.is(g,i)||n.deep&&Xt(g))&&(t(g,o?[...i]:i,f),i=o?[...g]:g)},m=new N(r,{lazy:!0,scheduler:()=>{n.flush==="sync"?p():Yt(p)}});return n.immediate?p():i=m.run(),()=>{m.stop()}}function Jt(e,t={}){let n,r=()=>{n&&(n(),n=void 0),e(i=>{n=i})},o=new N(r,{scheduler:()=>{t.flush==="sync"?r():Yt(r)}});return o.run(),()=>{o.stop(),n&&(n(),n=void 0)}}var Qt=v(()=>{"use strict";V();ze();he()});import{LytError as Pr}from"@lytjs/common";function ge(e){let t=e,n=new Set,r=function(){return w&&!Z&&n.add(w),t};return r.set=function(o){Object.is(t,o)||(t=o,on(n))},r.update=function(o){r.set(o(t))},r._subscribe=function(o){n.add(o)},r._unsubscribe=function(o){n.delete(o)},r.dispose=function(){n.clear()},r}function Zt(e){let t,n=!0,r=!1,o=new Set,i=new Set,s=function(){if(w&&!Z&&i.add(w),n){if(r)throw new Pr("LYT_REACTIVITY_CIRCULAR_DEPENDENCY","computed \u5728\u5176\u81EA\u8EAB\u7684\u8BA1\u7B97\u56FE\u4E2D");r=!0;for(let g of o)g._unsubscribe(s);o.clear();let m=w;w=s;try{t=e()}finally{w=m,r=!1}n=!1}return t},f={_dirty:!1,notify(){n=!0,on(i)}};return s.notify=f.notify.bind(f),s._dirty=!1,s._subscribe=function(p){i.add(p)},s._unsubscribe=function(p){i.delete(p)},s}function en(e){let t=null,n=!1,r=new Set,o=()=>{if(n)return;t&&(t(),t=null);for(let f of r)f._unsubscribe(i);r.clear();let s=w;w=i;try{e(f=>{t=f})}finally{w=s}},i={_dirty:!1,notify(){ee>0?H.add(i):o()}};return o(),()=>{n=!0,t&&(t(),t=null);for(let s of r)s._unsubscribe(i);r.clear(),H.delete(i)}}function tn(e){ee++;try{e()}finally{ee--,ee===0&&nn()}}function nn(){if(!qe){qe=!0;try{let e=new Set(H);H.clear();for(let t of e)t.notify();H.size>0&&nn()}finally{qe=!1}}}function rn(e){let t=Z;Z=!0;try{return e()}finally{Z=t}}function on(e){if(ee>0)for(let t of e)H.add(t);else for(let t of e)t.notify()}var w,Z,ee,H,qe,Je=v(()=>{"use strict";w=null,Z=!1,ee=0,H=new Set,qe=!1});function sn(){return K.length>0?K[K.length-1]:null}function an(e){return e()}function ln(e){let t=ge(e),n=o=>t.set(o),r=sn();return[t,n]}function cn(){let e={_cleanupFns:[]};return K.push(e),()=>{for(let n of e._cleanupFns)n();e._cleanupFns.length=0;let t=K.indexOf(e);t!==-1&&K.splice(t,1)}}function un(e){let t=sn();t&&t._cleanupFns.push(e)}var K,fn=v(()=>{"use strict";Je();K=[]});var pn={};ye(pn,{ITERATE_KEY:()=>L,ReactiveEffect:()=>N,activeEffect:()=>E,batch:()=>tn,clearQueue:()=>jr,computed:()=>Kt,computedSignal:()=>Zt,effect:()=>wt,enterSignalComponentContext:()=>cn,hasPendingJob:()=>Fr,isReactive:()=>$,isReadonly:()=>Ke,isRef:()=>P,markReadOnly:()=>Dt,markSkip:()=>Lt,nextTick:()=>zt,onSignalCleanup:()=>un,pauseTracking:()=>ue,queueJob:()=>Or,queuePostFlushCb:()=>Ir,rawSymbol:()=>A,reactive:()=>J,reactiveFlag:()=>M,readonly:()=>me,readonlyFlag:()=>k,ref:()=>Mt,refSymbol:()=>W,resetTracking:()=>fe,shallowReactive:()=>jt,shallowRef:()=>Vt,shallowRefSymbol:()=>Ge,signal:()=>ge,signalEffect:()=>en,stop:()=>xt,toRaw:()=>I,toRef:()=>Ye,toRefs:()=>Wt,track:()=>T,trigger:()=>C,triggerRef:()=>Ht,unref:()=>$t,untrack:()=>rn,useSignal:()=>an,useSignalState:()=>ln,watch:()=>qt,watchEffect:()=>Jt});import{queueJob as Or,queuePostFlushCb as Ir,hasPendingJob as Fr,clearQueue as jr}from"@lytjs/common";var dn=v(()=>{"use strict";V();he();ze();Gt();Qt();Je();fn()});var D={};ye(D,{Fragment:()=>ve,ShapeFlags:()=>Te,createApp:()=>ct,h:()=>_});import{isStringOrNumber as bn,isArray as nt,isVNode as rt}from"@lytjs/common";import{Fragment as ve}from"@lytjs/vdom";var Te=(s=>(s[s.ELEMENT=1]="ELEMENT",s[s.FUNCTIONAL_COMPONENT=2]="FUNCTIONAL_COMPONENT",s[s.STATEFUL_COMPONENT=4]="STATEFUL_COMPONENT",s[s.TEXT_CHILDREN=8]="TEXT_CHILDREN",s[s.ARRAY_CHILDREN=16]="ARRAY_CHILDREN",s[s.SLOTS_CHILDREN=32]="SLOTS_CHILDREN",s))(Te||{});function vn(e,t){if(t!=null)if(bn(t))e.children=String(t),e.shapeFlag|=8;else if(nt(t)){let n=[];for(let r=0;r<t.length;r++){let o=t[r];if(!(o==null||typeof o=="boolean"))if(nt(o))for(let i=0;i<o.length;i++){let s=o[i];s!=null&&typeof s!="boolean"&&n.push(rt(s)?s:be(String(s)))}else rt(o)?n.push(o):n.push(be(String(o)))}e.children=n,e.shapeFlag|=16}else typeof t=="object"&&(e.children=t,e.shapeFlag|=32)}function be(e,t=null,n=null){var p,m;let r=0;typeof e=="string"?r=1:e===ve?r=0:typeof e=="function"?r=2:typeof e=="object"&&e!==null&&(e.setup||e.__vccOpts||e.render)&&(r=4);let o=(p=t==null?void 0:t.key)!=null?p:null,i=(m=t==null?void 0:t.ref)!=null?m:null,s=t;if(t){let{key:g,ref:a,...c}=t;s=c}let f={type:e,props:s,children:null,key:o,ref:i,shapeFlag:r,el:null,component:null};return n!=null&&vn(f,n),f}function _(e,t,n){return be(e,t||null,n||null)}import{isPromise as Ee}from"@lytjs/common";function ot(e){return Object.create(e||null)}function it(e){return e!==null&&typeof e=="object"&&typeof e.install=="function"}function st(e){return typeof e=="function"}function at(e,t,...n){if(it(t)){let r=t.onBeforeInstall?t.onBeforeInstall(e,...n):void 0;if(Ee(r))return r.then(()=>{let o=t.install(e,...n);if(Ee(o))return o.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)});{let o=t.install(e,...n);if(Ee(o))return o.then(()=>{if(t.onInstalled)return t.onInstalled(e,...n)});if(t.onInstalled)return t.onInstalled(e,...n)}}else if(st(t))return t(e,...n)}function lt(e,t){if(it(t)){if(typeof t.uninstall=="function")return t.uninstall(e)}else st(t)}import{effect as Tn,stop as En}from"@lytjs/reactivity";import{compile as Cn}from"@lytjs/compiler";import{defineComponent as Sn,createComponentInstance as Rn,setupComponent as _n,mountComponent as Nn,updateComponent as wn,unmountComponent as xn}from"@lytjs/component";import{createRenderer as kn}from"@lytjs/renderer";var An=100,j=new Map;function Pn(e){let t=j.get(e);if(t)return j.delete(e),j.set(e,t),t;let{code:n}=Cn(e);if(t=new Function("h","_ctx",`return ${n}`),j.size>=An){let r=j.keys().next().value;r!==void 0&&j.delete(r)}return j.set(e,t),t}function On(e){let t={...e};if(e.state&&typeof e.state!="function"){let n=e.state;t.state=()=>({...n})}if(typeof e.render=="function"){let n=e.render;t.render=(r,o)=>n(r)}if(e.computed){let n={};for(let r of Object.keys(e.computed)){let o=e.computed[r];typeof o=="function"?n[r]={get:o}:n[r]=o}t.computed=n}if(typeof e.init=="function"){let n=e.init;t.init=function(r,o){return n.call(this,r)}}return t}function In(){return{createElement(e){return document.createElement(e)},createText(e){return document.createTextNode(e)},createComment(e){return document.createComment(e)},setAttribute(e,t,n){e.setAttribute(t,String(n))},removeAttribute(e,t){e.removeAttribute(t)},setStyle(e,t){if(typeof t=="string")e.style.cssText=t;else if(t&&typeof t=="object")for(let n in t)e.style[n]=t[n]},setClass(e,t){if(typeof t=="string")e.className=t;else if(t&&typeof t=="object"){let n=[];for(let[r,o]of Object.entries(t))o&&n.push(r);e.className=n.join(" ")}else e.className=""},insert(e,t,n){n!=null?e.insertBefore(t,n):e.appendChild(t)},remove(e){e.parentNode&&e.parentNode.removeChild(e)},replace(e,t,n){e.replaceChild(n,t)},addEventListener(e,t,n,r){e.addEventListener(t,n,r)},removeEventListener(e,t,n){e.removeEventListener(t,n)},nextTick(e){Promise.resolve().then(e)},parentNode(e){return e.parentNode},nextSibling(e){return e.nextSibling},querySelector(e){return document.querySelector(e)}}}function ct(e,t){let n=new Set,r={},o={},i=ot(),s={},f={},p=null,m=null,g=null,a=null,c=!1,l=On(typeof e=="function"?{render:e}:e),h=Sn(l),u={config:s,globalProperties:f,get _instance(){return p},mount(y){if(c)return u;let b;if(typeof y=="string"){let F=document.querySelector(y);if(!F)throw new Error(`[Lyt] \u6302\u8F7D\u76EE\u6807 "${y}" \u672A\u627E\u5230`);b=F}else b=y;a=b;let S=In();m=kn(S),p=Rn(h),_n(p,t||{},null);let B=p.type;if(!B.render&&B.template){let F=Pn(B.template);B.render=(te,mn)=>F(te,mn.renderProxy)}return Nn(p,_),p.subTree&&m.mount(p.subTree,b),g=Tn(()=>{if(!(!p||!p.isMounted||!m)&&(wn(p,_),p.subTree&&a)){let F=a.firstChild,te=p.subTree;for(;a.firstChild;)a.removeChild(a.firstChild);m.mount(te,a)}},{lazy:!0}),c=!0,u},unmount(){if(c){if(g&&(En(g),g=null),p&&xn(p),a)for(;a.firstChild;)a.removeChild(a.firstChild);p=null,m=null,a=null,c=!1}},use(y,...b){if(n.has(y))return u;n.add(y);let S=at({use:u.use.bind(u),unuse:u.unuse.bind(u),isInstalled:u.isInstalled.bind(u),provide:u.provide.bind(u),inject:u.inject.bind(u),config:s,globalProperties:f},y,...b);return S instanceof Promise?S.then(()=>u):u},unuse(y){if(!n.has(y))return u;n.delete(y);let b=lt({use:u.use.bind(u),unuse:u.unuse.bind(u),isInstalled:u.isInstalled.bind(u),provide:u.provide.bind(u),inject:u.inject.bind(u),config:s,globalProperties:f},y);return b instanceof Promise?b.then(()=>u):u},isInstalled(y){return n.has(y)},provide(y,b){return i[y]=b,u},inject(y,b){let S=i[y];return S!==void 0?S:b},component(y,b){return b?(r[y]=b,u):r[y]},directive(y,b){return b?(o[y]=b,u):o[y]}};return u}G(D,fo);import*as fo from"@lytjs/common";function Qe(){return typeof globalThis.window!="undefined"&&typeof globalThis.document!="undefined"&&typeof globalThis.HTMLElement!="undefined"&&typeof globalThis.customElements!="undefined"}function Dr(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Lr(e){if(e===""||e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e==="undefined")return;let t=Number(e);if(!isNaN(t)&&e.trim()!=="")return t;if(e.startsWith("{")&&e.endsWith("}")||e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch(n){}return e}function Mr(e,t){return t&&t[e]?t[e]:Dr(e)}function Br(e){let t=[],n=e;if(n.emits&&(Array.isArray(n.emits)?t.push(...n.emits):typeof n.emits=="object"&&t.push(...Object.keys(n.emits))),n.methods){for(let r of Object.keys(n.methods))if(r.startsWith("on")&&r.length>2){let o=r.charAt(2).toLowerCase()+r.slice(3);t.push(o)}}return t}function Vr(e,t={}){let{shadowMode:n="open",styles:r="",propMappings:o,eventMappings:i={},attributeConverters:s={}}=t,f=t.observedAttributes||[],p=Br(e);return class extends HTMLElement{constructor(){super();this._shadowRoot=null;this._instance=null;this._props={};this._container=null;this._connected=!1;this._eventCleanups=[];this._effectCleanup=null;this._originalDescriptors=new Map;this._compiledTemplate=null;this._updateScheduled=!1}static get observedAttributes(){return f}connectedCallback(){if(!this._connected){if(this._connected=!0,this._shadowRoot=this.attachShadow({mode:n}),r){let a=document.createElement("style");a.textContent=r,this._shadowRoot.appendChild(a)}this._container=document.createElement("div"),this._shadowRoot.appendChild(this._container),this._syncAttributesToProps(),this._mountComponent(),this._forwardSlots()}}disconnectedCallback(){if(this._connected){this._connected=!1;for(let a of this._eventCleanups)a();this._eventCleanups=[],this._effectCleanup&&(this._effectCleanup(),this._effectCleanup=null),this._originalDescriptors.clear(),this._compiledTemplate=null,this._instance=null,this._container&&(this._container.innerHTML="")}}attributeChangedCallback(a,c,d){c!==d&&this._connected&&(this._syncAttributesToProps(),this._updateComponent())}_syncAttributesToProps(){let a={};for(let c of f)if(this.hasAttribute(c)){let d=this.getAttribute(c),l=Mr(c,o);s[c]?a[l]=s[c](d):a[l]=Lr(d)}if(e.props){for(let[c,d]of Object.entries(e.props))if(a[c]===void 0){let l=d;l&&typeof l=="object"&&"default"in l?a[c]=typeof l.default=="function"?l.default():l.default:l==null}}this._props=a}async _mountComponent(){let a=e.render?e.render:e.template?await this._compileTemplate(e.template):null;if(!a)return;let c=this._createComponentContext(),d=a.call(c,_,c);d&&this._container&&this._renderVNode(d,this._container),this._setupReactiveUpdates(c,a)}async _compileTemplate(a){try{let c=await Promise.resolve().then(()=>(Ve(),Rt)),{compile:d}=c,{code:l}=d(a);return new Function("h","_ctx",`return ${l}`)}catch(c){return null}}_createComponentContext(){let a=e.state?typeof e.state=="function"?e.state():{...e.state}:{},c=e.computed||{},d=e.methods||{},l={...this._props,...a};for(let[h,u]of Object.entries(c))typeof u=="function"?Object.defineProperty(l,h,{get:u.bind(l),enumerable:!0}):u&&typeof u=="object"&&"get"in u&&Object.defineProperty(l,h,{get:u.get.bind(l),enumerable:!0});for(let[h,u]of Object.entries(d))typeof u=="function"&&(l[h]=u.bind(l));return l.emit=(h,...u)=>{let y=i[h]||h,b=new CustomEvent(y,{detail:u.length===1?u[0]:u,bubbles:!0,composed:!0});this.dispatchEvent(b)},l.$el=this._container,l.$attrs={...this._props},l.$slots=this._getSlotContent(),l}_setupReactiveUpdates(a,c){try{Promise.resolve().then(()=>(dn(),pn)).then(d=>{let{effect:l,stop:h}=d,u=l(()=>{if(!this._connected||!this._container)return;let b=c.call(a,_,a);b&&(this._container.innerHTML="",this._renderVNode(b,this._container))},{lazy:!0}),y=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let b of y){let S=a[b],B=Object.getOwnPropertyDescriptor(a,b);this._originalDescriptors.set(b,B),Object.defineProperty(a,b,{get(){return S},set(F){S=F;try{u()}catch(te){}},enumerable:!0})}this._effectCleanup=()=>{try{h(u)}catch(b){}}}).catch(()=>{this._setupReactiveUpdatesFallback(a,c)})}catch(d){this._setupReactiveUpdatesFallback(a,c)}}_setupReactiveUpdatesFallback(a,c){let d=e.state?typeof e.state=="function"?Object.keys(e.state()):Object.keys(e.state):[];for(let l of d){let u=a[l],y=Object.getOwnPropertyDescriptor(a,l);this._originalDescriptors.set(l,y);let b=this;Object.defineProperty(a,l,{get(){return u},set(S){u=S,b._scheduleUpdate(a,c)},enumerable:!0})}}_scheduleUpdate(a,c){this._updateScheduled||(this._updateScheduled=!0,Promise.resolve().then(()=>{if(this._updateScheduled=!1,!this._connected||!this._container)return;let d=c.call(a,_,a);d&&(this._container.innerHTML="",this._renderVNode(d,this._container))}))}async _updateComponent(){if(!this._container)return;let a=e.render||null;if(!a&&e.template&&(this._compiledTemplate&&this._compiledTemplate.template===e.template?a=this._compiledTemplate.render:(a=await this._compileTemplate(e.template),a&&(this._compiledTemplate={template:e.template,render:a}))),!a)return;let c=this._createComponentContext(),d=a.call(c,_,c);this._container.innerHTML="",d&&this._renderVNode(d,this._container)}_renderVNode(a,c){let d=this._vNodeToElement(a);d&&c.appendChild(d)}_vNodeToElement(a){if(!a)return null;if(typeof a.type=="symbol"){let c=document.createDocumentFragment();if(Array.isArray(a.children))for(let d of a.children){let l=this._vNodeToElement(d);l&&c.appendChild(l)}return c}if(typeof a.children=="string")return document.createTextNode(a.children);if(typeof a.type=="string"){let c=document.createElement(a.type);if(a.props)for(let[d,l]of Object.entries(a.props))if(d==="style"&&typeof l=="object")for(let[h,u]of Object.entries(l))c.style[h]=u;else if(d==="class"){if(typeof l=="string")c.className=l;else if(typeof l=="object"){let h=[];for(let[u,y]of Object.entries(l))y&&h.push(u);c.className=h.join(" ")}}else if(d.startsWith("on")&&typeof l=="function"){let h=d.slice(2).toLowerCase();c.addEventListener(h,l),this._eventCleanups.push(()=>{c.removeEventListener(h,l)})}else d==="ref"&&typeof l=="function"?l(c):c.setAttribute(d,String(l));if(Array.isArray(a.children))for(let d of a.children){let l=this._vNodeToElement(d);l&&c.appendChild(l)}else typeof a.children=="string"&&(c.textContent=a.children);return c}return typeof a.type=="object"||typeof a.type=="function"?a.component?this._vNodeToElement(a.component.subTree||a):document.createComment("component"):null}_forwardSlots(){if(!this._shadowRoot||!this._container)return;let a=this.querySelectorAll("[slot]");for(let d of a){let l=d.getAttribute("slot")||"default",h=document.createElement("slot");l!=="default"&&h.setAttribute("name",l),this._container.appendChild(h)}let c=document.createElement("slot");this._container.appendChild(c)}_getSlotContent(){var l;let a={},c=this.querySelectorAll("[slot]");for(let h of c){let u=h.getAttribute("slot")||"default";a[u]||(a[u]=[]),a[u].push(h.cloneNode(!0))}let d=[];for(let h of Array.from(this.childNodes))(l=h.hasAttribute)!=null&&l.call(h,"slot")||d.push(h.cloneNode(!0));return d.length>0&&(a.default=d),a}get _lytInstance(){return this._instance}get _lytProps(){return{...this._props}}}}function Ze(e,t,n){if(!e.includes("-"))throw new Error(`[Lyt Web Component] \u6807\u7B7E\u540D "${e}" \u5FC5\u987B\u5305\u542B\u8FDE\u5B57\u7B26 (-)\u3002\u8FD9\u662F Custom Element \u89C4\u8303\u7684\u8981\u6C42\u3002`);if(!Qe())return;let r=Vr(t,n);customElements.define(e,r)}function $r(e){for(let{tagName:t,component:n,options:r}of e)Ze(t,n,r)}function Wr(e){if(Qe())try{let t=customElements;t.__unregister&&t.__unregister(e)}catch(t){}}async function Hr(e,t,n){let r=t.match(/<template>([\s\S]*?)<\/template>/),o=t.match(/<script[^>]*>([\s\S]*?)<\/script>/),i=/<style[^>]*>([\s\S]*?)<\/style>/g,s=[],f;for(;(f=i.exec(t))!==null;)s.push(f);let p=(n==null?void 0:n.styles)||"";for(let c of s)p+=c[1]+`
6
+ `;let m=r?r[1].trim():void 0,g={};if(o){let c=o[1].trim();if(c.match(/export\s+default\s*(\{[\s\S]*\}|\([\s\S]*\)[\s\S]*?\))/))try{let l={},h={exports:l};new Function("module","exports",`"use strict"; ${c.replace(/export\s+default\s*/,"module.exports =")}`)(h,l),g=h.exports||l}catch(l){}}let a={...n,styles:p};m&&!g.template&&!g.render&&(g.template=m),Ze(e,g,a)}export{Ze as defineCustomElement,Hr as defineCustomElementFromSFC,Qe as isBrowser,$r as registerComponents,Wr as unregisterElement};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lytjs/core",
3
- "version": "4.2.0",
3
+ "version": "5.0.0",
4
4
  "description": "Lyt.js 核心入口 - 整合响应式、编译器、虚拟 DOM、渲染器和组件系统",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -61,12 +61,12 @@
61
61
  "createApp"
62
62
  ],
63
63
  "dependencies": {
64
- "@lytjs/common": "^4.2.0",
65
- "@lytjs/reactivity": "^4.2.0",
66
- "@lytjs/compiler": "^4.2.0",
67
- "@lytjs/vdom": "^4.2.0",
68
- "@lytjs/renderer": "^4.2.0",
69
- "@lytjs/component": "^4.2.0"
64
+ "@lytjs/common": "^5.0.0",
65
+ "@lytjs/reactivity": "^5.0.0",
66
+ "@lytjs/compiler": "^5.0.0",
67
+ "@lytjs/vdom": "^5.0.0",
68
+ "@lytjs/renderer": "^5.0.0",
69
+ "@lytjs/component": "^5.0.0"
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=18.0.0"