@neeloong/form 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/index.d.mts +100 -2
- package/index.js +27 -6
- package/index.min.js +2 -2
- package/index.min.mjs +2 -2
- package/index.mjs +26 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -311,6 +311,7 @@ render(store, layouts, app);
|
|
|
311
311
|
- `$creatable` 只读 值是否可创建(`$new` 为 `true` 时,字段只读)
|
|
312
312
|
- `$immutable` 只读 值是否不可改变(`$new` 为 `false` 时,字段只读)
|
|
313
313
|
- `$new` 只读 是否新建项
|
|
314
|
+
- `$loading` 只读 加载状态
|
|
314
315
|
- `$readonly` 只读 是否只读
|
|
315
316
|
- `$hidden` 只读 是否可隐藏
|
|
316
317
|
- `$clearable` 只读 是否可清除
|
package/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.14.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -922,6 +922,8 @@ declare class Store<T = any, M = any> {
|
|
|
922
922
|
get kind(): string;
|
|
923
923
|
get ref(): Ref;
|
|
924
924
|
schema: Schema.Field<M>;
|
|
925
|
+
set loading(loading: boolean);
|
|
926
|
+
get loading(): boolean;
|
|
925
927
|
/** 存储对象自身 */
|
|
926
928
|
get store(): this;
|
|
927
929
|
/** 父级存储对象 */
|
|
@@ -1073,6 +1075,102 @@ declare class Store<T = any, M = any> {
|
|
|
1073
1075
|
#private;
|
|
1074
1076
|
}
|
|
1075
1077
|
|
|
1078
|
+
/** @import { Schema } from '../types.mjs' */
|
|
1079
|
+
/**
|
|
1080
|
+
* @template {Record<string, any>} [T=Record<string, any>]
|
|
1081
|
+
* @template [M=any]
|
|
1082
|
+
* @extends {Store<T, M>}
|
|
1083
|
+
*/
|
|
1084
|
+
declare class ObjectStore<T extends Record<string, any> = Record<string, any>, M = any> extends Store<T, M> {
|
|
1085
|
+
/**
|
|
1086
|
+
* @param {Schema.Object<M> & Schema.Attr<M>} schema
|
|
1087
|
+
* @param {object} [options]
|
|
1088
|
+
* @param {Store?} [options.parent]
|
|
1089
|
+
* @param {number | string | null} [options.index]
|
|
1090
|
+
* @param {boolean} [options.new]
|
|
1091
|
+
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdate]
|
|
1092
|
+
* @param {((value: T?, index: any, store: Store) => void)?} [options.onUpdateState]
|
|
1093
|
+
*/
|
|
1094
|
+
constructor(schema: Schema.Object<M> & Schema.Attr<M>, { parent, index, new: isNew, onUpdate, onUpdateState }?: {
|
|
1095
|
+
parent?: Store<any, any> | null | undefined;
|
|
1096
|
+
index?: string | number | null | undefined;
|
|
1097
|
+
new?: boolean | undefined;
|
|
1098
|
+
onUpdate?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
1099
|
+
onUpdateState?: ((value: T | null, index: any, store: Store) => void) | null | undefined;
|
|
1100
|
+
});
|
|
1101
|
+
[Symbol.iterator](): Generator<[string, Store<any, any>], void, unknown>;
|
|
1102
|
+
#private;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
/** @import { Schema } from '../types.mjs' */
|
|
1106
|
+
/**
|
|
1107
|
+
* @template [T=any]
|
|
1108
|
+
* @template [M=any]
|
|
1109
|
+
* @extends {Store<(T | null)[], M>}
|
|
1110
|
+
*/
|
|
1111
|
+
declare class ArrayStore<T = any, M = any> extends Store<(T | null)[], M> {
|
|
1112
|
+
/**
|
|
1113
|
+
* @param {Schema.Field<M>} schema
|
|
1114
|
+
* @param {object} [options]
|
|
1115
|
+
* @param {Store?} [options.parent]
|
|
1116
|
+
* @param {string | number | null} [options.index]
|
|
1117
|
+
* @param {boolean} [options.new]
|
|
1118
|
+
* @param {boolean} [options.addable]
|
|
1119
|
+
* @param {(value: any, index: any, store: Store) => void} [options.onUpdate]
|
|
1120
|
+
* @param {(value: any, index: any, store: Store) => void} [options.onUpdateState]
|
|
1121
|
+
*/
|
|
1122
|
+
constructor(schema: Schema.Field<M>, { parent, onUpdate, onUpdateState, index, new: isNew, addable }?: {
|
|
1123
|
+
parent?: Store<any, any> | null | undefined;
|
|
1124
|
+
index?: string | number | null | undefined;
|
|
1125
|
+
new?: boolean | undefined;
|
|
1126
|
+
addable?: boolean | undefined;
|
|
1127
|
+
onUpdate?: ((value: any, index: any, store: Store) => void) | undefined;
|
|
1128
|
+
onUpdateState?: ((value: any, index: any, store: Store) => void) | undefined;
|
|
1129
|
+
});
|
|
1130
|
+
get children(): Store<any, any>[];
|
|
1131
|
+
set selfAddable(v: boolean | null);
|
|
1132
|
+
get selfAddable(): boolean | null;
|
|
1133
|
+
set addable(v: boolean);
|
|
1134
|
+
/** 是否禁用字段 */
|
|
1135
|
+
get addable(): boolean;
|
|
1136
|
+
/**
|
|
1137
|
+
*
|
|
1138
|
+
* @param {number} index
|
|
1139
|
+
* @param {T?} [value]
|
|
1140
|
+
* @param {boolean} [isNew]
|
|
1141
|
+
* @returns
|
|
1142
|
+
*/
|
|
1143
|
+
insert(index: number, value?: T | null, isNew?: boolean): boolean;
|
|
1144
|
+
/**
|
|
1145
|
+
*
|
|
1146
|
+
* @param {T?} [value]
|
|
1147
|
+
* @returns
|
|
1148
|
+
*/
|
|
1149
|
+
add(value?: T | null): boolean;
|
|
1150
|
+
/**
|
|
1151
|
+
*
|
|
1152
|
+
* @param {number} index
|
|
1153
|
+
* @returns
|
|
1154
|
+
*/
|
|
1155
|
+
remove(index: number): T | null | undefined;
|
|
1156
|
+
/**
|
|
1157
|
+
*
|
|
1158
|
+
* @param {number} from
|
|
1159
|
+
* @param {number} to
|
|
1160
|
+
* @returns
|
|
1161
|
+
*/
|
|
1162
|
+
move(from: number, to: number): boolean;
|
|
1163
|
+
/**
|
|
1164
|
+
*
|
|
1165
|
+
* @param {number} a
|
|
1166
|
+
* @param {number} b
|
|
1167
|
+
* @returns
|
|
1168
|
+
*/
|
|
1169
|
+
exchange(a: number, b: number): boolean;
|
|
1170
|
+
[Symbol.iterator](): Generator<[number, Store<any, any>], undefined, unknown>;
|
|
1171
|
+
#private;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1076
1174
|
/**
|
|
1077
1175
|
* @param {Store} store 存储实例
|
|
1078
1176
|
* @param {Layout.Child[]} layouts 布局信息
|
|
@@ -1113,4 +1211,4 @@ declare function watch<T>(getter: () => T, callback: (value: T) => void, immedia
|
|
|
1113
1211
|
*/
|
|
1114
1212
|
declare function effect(fn: () => void): () => void;
|
|
1115
1213
|
|
|
1116
|
-
export { type AsyncValidator, Component, Enhancement, index_d as Layout, type Ref, type Relatedness, Schema, Store, type Validator, type VerifyError, effect, render, watch };
|
|
1214
|
+
export { ArrayStore, type AsyncValidator, Component, Enhancement, index_d as Layout, ObjectStore, type Ref, type Relatedness, Schema, Store, type Validator, type VerifyError, effect, render, watch };
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.14.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -978,8 +978,12 @@
|
|
|
978
978
|
if (parent) {
|
|
979
979
|
this.#parent = parent;
|
|
980
980
|
this.#root = parent.#root;
|
|
981
|
+
this.#loading = parent.#loading;
|
|
981
982
|
// TODO: 事件向上冒泡
|
|
982
983
|
}
|
|
984
|
+
const loading = new exports.Signal.State(false);
|
|
985
|
+
this.#selfLoading = loading;
|
|
986
|
+
this.#loading = loading;
|
|
983
987
|
this.#type = schema.type;
|
|
984
988
|
this.#meta = schema.meta;
|
|
985
989
|
this.#component = schema.component;
|
|
@@ -1095,6 +1099,18 @@
|
|
|
1095
1099
|
#meta;
|
|
1096
1100
|
/** @readonly @type {any} */
|
|
1097
1101
|
#component;
|
|
1102
|
+
/** @type {Signal.State<boolean>?} */
|
|
1103
|
+
#selfLoading = null
|
|
1104
|
+
/** @type {Signal.State<boolean>} */
|
|
1105
|
+
#loading;
|
|
1106
|
+
get loading() {
|
|
1107
|
+
return this.#loading.get();
|
|
1108
|
+
}
|
|
1109
|
+
set loading(loading) {
|
|
1110
|
+
const s = this.#selfLoading;
|
|
1111
|
+
if (!s) { return }
|
|
1112
|
+
s.set(Boolean(loading));
|
|
1113
|
+
}
|
|
1098
1114
|
/** 存储对象自身 */
|
|
1099
1115
|
get store() { return this; }
|
|
1100
1116
|
/** 父级存储对象 */
|
|
@@ -2990,6 +3006,7 @@
|
|
|
2990
3006
|
immutable: true,
|
|
2991
3007
|
changed: true,
|
|
2992
3008
|
|
|
3009
|
+
loading: true,
|
|
2993
3010
|
required: true,
|
|
2994
3011
|
clearable: true,
|
|
2995
3012
|
hidden: true,
|
|
@@ -3159,7 +3176,7 @@
|
|
|
3159
3176
|
return '_$'.includes(key[1]);
|
|
3160
3177
|
}
|
|
3161
3178
|
/**
|
|
3162
|
-
* @param {Record<string, Store | {get?(): any; set?(v: any): void; exec
|
|
3179
|
+
* @param {Record<string, Store | {get?(): any; set?(v: any): void; exec?: any; calc?: any }>?} [global]
|
|
3163
3180
|
*/
|
|
3164
3181
|
function toGlobal(global) {
|
|
3165
3182
|
/** @type {Record<string, ValueDefine | ExecDefine | CalcDefine>} */
|
|
@@ -3179,11 +3196,11 @@
|
|
|
3179
3196
|
items[key] = typeof set === 'function' ? {get,set} : {get};
|
|
3180
3197
|
continue;
|
|
3181
3198
|
}
|
|
3182
|
-
if (typeof calc === 'function') {
|
|
3199
|
+
if (typeof calc === 'function' || calc && typeof calc === 'object') {
|
|
3183
3200
|
items[key] = {calc};
|
|
3184
3201
|
continue;
|
|
3185
3202
|
}
|
|
3186
|
-
if (typeof exec === 'function') {
|
|
3203
|
+
if (typeof exec === 'function' || calc && typeof calc === 'object') {
|
|
3187
3204
|
items[key] = {exec};
|
|
3188
3205
|
continue;
|
|
3189
3206
|
}
|
|
@@ -3216,8 +3233,8 @@
|
|
|
3216
3233
|
|
|
3217
3234
|
|
|
3218
3235
|
/** @typedef {{get(): any; set?(v: any): void; exec?: null; store?: Store; calc?: null; }} ValueDefine */
|
|
3219
|
-
/** @typedef {{get?: null; exec(...
|
|
3220
|
-
/** @typedef {{get?: null; calc(...
|
|
3236
|
+
/** @typedef {{get?: null; exec: ((...v: any[]) => void) | Record<string, any>; calc?: null}} ExecDefine */
|
|
3237
|
+
/** @typedef {{get?: null; calc: ((...v: any[]) => void) | Record<string, any>; exec?: null;}} CalcDefine */
|
|
3221
3238
|
|
|
3222
3239
|
/**
|
|
3223
3240
|
* @template {Store} [T=Store]
|
|
@@ -3396,7 +3413,9 @@
|
|
|
3396
3413
|
const item = this.#items[name];
|
|
3397
3414
|
if (!item) { return null }
|
|
3398
3415
|
const {exec, calc} = item;
|
|
3416
|
+
// @ts-ignore
|
|
3399
3417
|
if (typeof exec === 'function') { return exec }
|
|
3418
|
+
// @ts-ignore
|
|
3400
3419
|
if (typeof calc === 'function') { return calc }
|
|
3401
3420
|
return null
|
|
3402
3421
|
|
|
@@ -5265,7 +5284,9 @@
|
|
|
5265
5284
|
return renderChildren(layouts, parent, null, env, templates, [], allEnhancements, relateFn, component);
|
|
5266
5285
|
}
|
|
5267
5286
|
|
|
5287
|
+
exports.ArrayStore = ArrayStore;
|
|
5268
5288
|
exports.Layout = index;
|
|
5289
|
+
exports.ObjectStore = ObjectStore;
|
|
5269
5290
|
exports.Store = Store;
|
|
5270
5291
|
exports.effect = effect;
|
|
5271
5292
|
exports.render = render;
|
package/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.14.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -57,4 +57,4 @@ function(){throw new Error};function j(){return h(this),this.value}function L(e,
|
|
|
57
57
|
* Use of this source code is governed by an MIT-style license that can be
|
|
58
58
|
* found in the LICENSE file at https://angular.io/license
|
|
59
59
|
*/
|
|
60
|
-
function(e){const t=Object.create(T);t.value=e;const n=()=>(h(t),t.value);return n[u]=t,n}(r),l=a[u];if(this[M]=l,l.wrapper=this,i){const t=i.equals;t&&(l.equal=t),l.watched=i[e.subtle.watched],l.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return j.call(this[M])}set(t){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(l)throw new Error("Writes to signals not permitted during Watcher callback");L(this[M],t)}};c=M,p=new WeakSet,e.isComputed=e=>r(p,e),e.Computed=class{constructor(t,r){s(this,p),n(this,c);const i=function(e){const t=Object.create($);t.computation=e;const n=()=>S(t);return n[u]=t,n}(t),o=i[u];if(o.consumerAllowSignalWrites=!0,this[M]=o,o.wrapper=this,r){const t=r.equals;t&&(o.equal=t),o.watched=r[e.subtle.watched],o.unwatched=r[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return S(this[M])}},(t=>{var o,l,c,u;t.untrack=function(e){let t,n=null;try{n=f(null),t=e()}finally{f(n)}return t},t.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[M].producerNode)?void 0:n.map((e=>e.wrapper)))??[]},t.introspectSinks=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(n=t[M].liveConsumerNode)?void 0:n.map((e=>e.wrapper)))??[]},t.hasSinks=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called hasSinks without a Signal argument");const n=t[M].liveConsumerNode;return!!n&&n.length>0},t.hasSources=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called hasSources without a Computed or Watcher argument");const n=t[M].producerNode;return!!n&&n.length>0};o=M,l=new WeakSet,c=new WeakSet,u=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>r(l,e),t.Watcher=class{constructor(e){s(this,l),s(this,c),n(this,o);let t=Object.create(d);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[M]=t}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,u).call(this,t);const n=this[M];n.dirty=!1;const r=f(n);for(const e of t)h(e[M]);f(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,u).call(this,t);const n=this[M];w(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){v(n.producerNode[e],n.producerIndexOfThis[e]);const t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){const t=n.producerIndexOfThis[e],r=n.producerNode[e];x(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[M].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},t.currentComputed=function(){var e;return null==(e=a)?void 0:e.wrapper},t.watched=Symbol("watched"),t.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(e.Signal||(e.Signal={}));const k=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,P=e=>e instanceof RegExp?e:null,U=Boolean;function B(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(B).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const R=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(B).filter(U);return t.length?t:null};function q(t,n,r,s){const i=new e.Signal.State(n(r));let o;if("function"==typeof s){const r=s;o=new e.Signal.Computed((()=>n(r(t))))}else{const t=n(s);o=new e.Signal.Computed((()=>t))}const a=new e.Signal.Computed((()=>{const e=i.get();return null===e?o.get():e}));return[i,a]}const _=Symbol();function V(e){const t={[_]:e};for(const[n,r]of e)Object.defineProperty(t,n,{get:()=>r.ref,configurable:!1,enumerable:!0});return Object.defineProperty(t,_,{get:()=>e,configurable:!1,enumerable:!0}),t}let D=null,W=null,K=Object.create(null);function z(e,t){const n=e.type;let r=Y;if(!e.array||W&&t?.parent instanceof W)if("string"==typeof n){const e=K[n];e&&(r=e)}else n&&"object"==typeof n&&D&&(r=D);else W&&(r=W);return new r(e,t)}function H(e){return e?e instanceof Error?e.message:"string"!=typeof e?"":e:""}function F(t,...n){const r=n.flat().filter((e=>"function"==typeof e));if(!r.length)return[()=>Promise.resolve([]),new e.Signal.Computed((()=>[])),()=>{}];const s=new e.Signal.State([]);let i=null;return[function(){i?.abort(),i=new AbortController;const e=i.signal;return s.set([]),Promise.all(r.map((n=>async function(e,n){let r=[];try{r.push(await e(t,n))}catch(e){r.push(e)}const i=r.flat().map(H).filter(Boolean);return!n.aborted&&i.length&&s.set([...s.get(),...i]),i}(n,e)))).then((e=>e.flat()))},new e.Signal.Computed((()=>s.get())),()=>{i?.abort(),s.set([])}]}class Y{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let i=r.get(s);return i||(i=new Set,r.set(s,i)),i.add(n),()=>{i?.delete(n)}}static create(e,t={}){return z({type:e},{...t,parent:null})}static setStore(e,t){return function(e,t){K[e]=t}(e,t)}#t=!1;get null(){return this.#t}get kind(){return""}#n=null;get ref(){return this.#n||V(this)}constructor(t,{null:n,state:r,ref:s,setValue:i,setState:o,convert:a,onUpdate:l,onUpdateState:c,validator:u,validators:f,index:d,size:h,new:p,parent:g,hidden:m,clearable:b,required:v,disabled:y,readonly:w,removable:x,label:S,description:O,placeholder:E,min:C,max:$,step:A,minLength:j,maxLength:L,pattern:T,values:M}={}){this.schema=t,this.#r.set("object"==typeof r&&r||{});const U=g instanceof Y?g:null;U&&(this.#s=U,this.#i=U.#i),this.#o=t.type,this.#a=t.meta,this.#l=t.component;const B=new e.Signal.State(Boolean(p));this.#c=B;const _=U?new e.Signal.Computed((()=>U.#u.get()||B.get())):new e.Signal.Computed((()=>B.get()));this.#u=_;const D=Boolean(t.immutable),W=!1!==t.creatable;this.#f=D,this.#d=W;const K=t.readonly,z=new e.Signal.State("boolean"==typeof w?w:null);let G;if("function"==typeof K)G=new e.Signal.Computed((()=>Boolean(K(this))));else{const t=Boolean(K);G=new e.Signal.Computed((()=>t))}const Q=()=>{if(_.get()?!W:D)return!0;const e=z.get();return null===e?G.get():e},Z=U?U.#h:null;this.#p=z,this.#h=Z?new e.Signal.Computed((()=>Z.get()||Q())):new e.Signal.Computed(Q),[this.#g,this.#m]=N(this,m,t.hidden,U?U.#m:null),[this.#b,this.#v]=N(this,b,t.clearable,U?U.#v:null),[this.#y,this.#w]=N(this,v,t.required,U?U.#w:null),[this.#x,this.#S]=N(this,y,t.disabled,U?U.#S:null),[this.#O,this.#E]=q(this,k,S,t.label),[this.#C,this.#$]=q(this,k,O,t.description),[this.#A,this.#j]=q(this,k,E,t.placeholder),[this.#L,this.#T]=q(this,I,C,t.min),[this.#M,this.#N]=q(this,I,$,t.max),[this.#k,this.#I]=q(this,I,A,t.step),[this.#P,this.#U]=q(this,I,j,t.minLength),[this.#B,this.#R]=q(this,I,L,t.maxLength),[this.#q,this.#_]=q(this,P,T,t.pattern),[this.#V,this.#D]=q(this,R,M,t.values),[this.#W,this.#K]=N(this,x,t.removable??!0);const X=function(t,...n){const r=n.flat().filter((e=>"function"==typeof e));return r.length?new e.Signal.Computed((()=>{const e=[];for(const n of r)try{e.push(n(t))}catch(t){e.push(t)}return e.flat().map(H).filter(Boolean)})):new e.Signal.Computed((()=>[]))}(this,t.validator,u),[J,ee,te]=F(this,t.validators?.change,f?.change),[ne,re,se]=F(this,t.validators?.blur,f?.blur);if(this.listen("change",(()=>{J()})),this.listen("blur",(()=>{ne()})),this.#z=function(...t){const n=t.filter(Boolean);return new e.Signal.Computed((()=>n.flatMap((e=>e.get()))))}(X,ee,re),this.#H=X,this.#F=J,this.#Y=ne,this.#G=te,this.#Q=se,h instanceof e.Signal.State||h instanceof e.Signal.Computed?this.#Z=h:this.#Z=new e.Signal.State(h||0),n)return this.#t=!0,void(this.#n=V(this));this.#n=s||null,this.#X=l||null,this.#J=c||null,this.#ee="function"==typeof i?i:null,this.#te="function"==typeof o?o:null,this.#ne="function"==typeof a?a:null,this.#re.set(d??"");for(const[e,n]of Object.entries(t.events||{}))"function"==typeof n&&this.listen(e,n)}#ee=null;#te=null;#ne=null;#X=null;#J=null;#s=null;#i=this;#o;#a;#l;get store(){return this}get parent(){return this.#s}get root(){return this.#i}get type(){return this.#o}get meta(){return this.#a}get component(){return this.#l}#Z;get size(){return this.#Z.get()}#re=new e.Signal.State("");get index(){return this.#re.get()}set index(e){this.#re.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#d=!0;get creatable(){return this.#d}#f=!1;get immutable(){return this.#f}#u;#c;get selfNew(){return this.#c.get()}set selfNew(e){this.#c.set(Boolean(e))}get new(){return this.#u.get()}set new(e){this.#c.set(Boolean(e))}#g;#m;get selfHidden(){return this.#g.get()}set selfHidden(e){this.#g.set("boolean"==typeof e?e:null)}get hidden(){return this.#m.get()}set hidden(e){this.#g.set("boolean"==typeof e?e:null)}#b;#v;get selfClearable(){return this.#b.get()}set selfClearable(e){this.#b.set("boolean"==typeof e?e:null)}get clearable(){return this.#v.get()}set clearable(e){this.#b.set("boolean"==typeof e?e:null)}#y;#w;get selfRequired(){return this.#y.get()}set selfRequired(e){this.#y.set("boolean"==typeof e?e:null)}get required(){return this.#w.get()}set required(e){this.#y.set("boolean"==typeof e?e:null)}#x;#S;get selfDisabled(){return this.#x.get()}set selfDisabled(e){this.#x.set("boolean"==typeof e?e:null)}get disabled(){return this.#S.get()}set disabled(e){this.#x.set("boolean"==typeof e?e:null)}#p;#h;get selfReadonly(){return this.#p.get()}set selfReadonly(e){this.#p.set("boolean"==typeof e?e:null)}get readonly(){return this.#h.get()}set readonly(e){this.#p.set("boolean"==typeof e?e:null)}#W;#K;get selfRemovable(){return this.#W.get()}set selfRemovable(e){this.#W.set("boolean"==typeof e?e:null)}get removable(){return this.#K.get()}set removable(e){this.#W.set("boolean"==typeof e?e:null)}#O;#E;get selfLabel(){return this.#O.get()}set selfLabel(e){this.#O.set(k(e))}get label(){return this.#E.get()}set label(e){this.#O.set(k(e))}#C;#$;get selfDescription(){return this.#C.get()}set selfDescription(e){this.#C.set(k(e))}get description(){return this.#$.get()}set description(e){this.#C.set(k(e))}#A;#j;get selfPlaceholder(){return this.#A.get()}set selfPlaceholder(e){this.#A.set(k(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#A.set(k(e))}#L;#T;get selfMin(){return this.#L.get()}set selfMin(e){this.#L.set(I(e))}get min(){return this.#T.get()}set min(e){this.#L.set(I(e))}#M;#N;get selfMax(){return this.#M.get()}set selfMax(e){this.#M.set(I(e))}get max(){return this.#N.get()}set max(e){this.#M.set(I(e))}#k;#I;get selfStep(){return this.#k.get()}set selfStep(e){this.#k.set(I(e))}get step(){return this.#I.get()}set step(e){this.#k.set(I(e))}#P;#U;get selfMinLength(){return this.#P.get()}set selfMinLength(e){this.#P.set(I(e))}get minLength(){return this.#U.get()}set minLength(e){this.#P.set(I(e))}#B;#R;get selfMaxLength(){return this.#B.get()}set selfMaxLength(e){this.#B.set(I(e))}get maxLength(){return this.#R.get()}set maxLength(e){this.#B.set(I(e))}#q;#_;get selfPattern(){return this.#q.get()}set selfPattern(e){this.#q.set(P(e))}get pattern(){return this.#_.get()}set pattern(e){this.#q.set(P(e))}#V;#D;get selfValues(){return this.#V.get()}set selfValues(e){this.#V.set(R(e))}get values(){return this.#D.get()}set values(e){this.#V.set(R(e))}#z;#H;#F;#Y;#G;#Q;get errors(){return this.#z.get()}get error(){return this.#z.get()[0]}*[Symbol.iterator](){}child(e){return null}#se=!1;#ie=new e.Signal.State(null);#oe=new e.Signal.State(this.#ie.get());#r=new e.Signal.State(null);get changed(){return this.#oe.get()===this.#ie.get()}get value(){return this.#oe.get()}set value(e){const t=this.#ee?.(e),n=void 0===t?e:t;this.#oe.set(n),this.#se||this.#ie.set(n),this.#X?.(n,this.#re.get(),this),this.#ae()}get state(){return this.#r.get()}set state(e){const t=this.#te?.(e),n=void 0===t?e:t;this.#r.set(n),this.#J?.(n,this.#re.get(),this),this.#ae()}#ae(){this.#le||(this.#le=!0,queueMicrotask((()=>{const e=this.#oe.get(),t=this.#r.get();this.#ce(e,t)})))}reset(e=this.#ie.get()){this.#ue(e)}#ue(e){const t=this.#ee?.(e),n=void 0===t?e:t;if(this.#G(),this.#Q(),this.#se=!0,!n||"object"!=typeof n){for(const[,e]of this)e.#ue(null);return this.#oe.set(n),this.#ie.set(n),n}const r=Array.isArray(n)?[...n]:{...n};for(const[e,t]of this)r[e]=t.#ue(r[e]);return this.#oe.set(r),this.#ie.set(r),this.#X?.(r,this.#re.get(),this),r}#le=!1;#fe(e,t){const[n,r]=this.#ne?.(e,t)||[e,t];return this.#oe.get()===n&&this.#r.get()===r?[n,r]:(this.#oe.set(n),this.#r.set(r),this.#ce(n,r))}#ce(e,t){this.#le=!1;let n=e;if(e&&"object"==typeof e){let r=Array.isArray(e)?[...e]:{...e},s=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},i=!1;for(const[n,o]of this){const a=e[n],l=t?.[n],[c,u]=o.#fe(a,l);a!==c&&(r[n]=c,i=!0),l!==u&&(s[n]=u,i=!0)}i&&(t=s,n=e=r,this.#oe.set(e),this.#r.set(s))}return this.#se||(this.#se=!0,this.#ie.set(n)),[e,t]}validate(e){if(!Array.isArray(e))return Promise.all([this.#H.get(),this.#F(),this.#Y()]).then((e=>{const t=e.flat();return t.length?t:null}));const t=[this.validate().then((t=>t?.length?[{path:[...e],store:this,errors:t}]:[]))];for(const[n,r]of this)t.push(r.validate([...e,n]));return Promise.all(t).then((e=>e.flat()))}}class G extends Y{get kind(){return"object"}#de;*[Symbol.iterator](){yield*Object.entries(this.#de)}child(e){return this.#de[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:i}={}){const o=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:i,size:o.length,setValue:e=>"object"==typeof e?e:null,setState:e=>"object"==typeof e?e:null,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t,n)=>{n===this.#de[t]&&(this.value={...this.value,[t]:e})},onUpdateState:(e,t,n)=>{n===this.#de[t]&&(this.state={...this.state,[t]:e})}};for(const[e,t]of o)a[e]=z(t,{...l,index:e});this.#de=a}}D=G;class Q extends Y{#he=()=>{throw new Error};#de;get children(){return[...this.#de.get()]}*[Symbol.iterator](){return yield*[...this.#de.get().entries()]}child(e){const t=this.#de.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(t,{parent:n,onUpdate:r,onUpdateState:s,index:i,new:o,addable:a}={}){const l=new e.Signal.State([]),c=e=>{const t=Array.isArray(e)&&e.length||0,n=[...l.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#he(e));n.length=t,r!==t&&l.set(n)};super(t,{index:i,new:o,parent:n,size:new e.Signal.Computed((()=>l.get().length)),state:[],setValue:e=>Array.isArray(e)?e:null==e?null:[e],setState:e=>Array.isArray(e)?e:null==e?null:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?null:[e];return c(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t,n)=>{c(e),r?.(e,t,n)},onUpdateState:s}),[this.#pe,this.#ge]=N(this,a,t.addable??!0),this.#de=l;const u={parent:this,onUpdate:(e,t,n)=>{if(l.get()[t]!==n)return;const r=[...this.value||[]];r.length<t&&(r.length=t),r[t]=e,this.value=r},onUpdateState:(e,t,n)=>{if(l.get()[t]!==n)return;const r=[...this.state||[]];r.length<t&&(r.length=t),r[t]=e,this.state=r}};this.#he=(e,n)=>{const r=z(t,{...u,index:e,new:n});return r.index=e,r}}#pe;#ge;get selfAddable(){return this.#pe.get()}set selfAddable(e){this.#pe.set("boolean"==typeof e?e:null)}get addable(){return this.#ge.get()}set addable(e){this.#pe.set("boolean"==typeof e?e:null)}insert(e,t=null,n){if(!this.addable)return!1;const r=this.value||[];if(!Array.isArray(r))return!1;const s=[...this.#de.get()],i=Math.max(0,Math.min(Math.floor(e),s.length)),o=this.#he(i,n);o.new=!0,s.splice(i,0,o);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(i,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(i,0,{}),this.state=e}return this.#de.set(s),this.value=a,!0}add(e=null){return this.insert(this.#de.get().length,e)}remove(e){const t=this.value;if(!Array.isArray(t))return;const n=[...this.#de.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;const i=[...t],[o]=i.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.#de.set(n),this.value=i,o}move(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#de.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let i=Math.min(e,t),o=Math.max(e,t);for(let e=i;e<=o;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.#de.set(r),this.value=a,!0}exchange(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#de.get()],s=r[e],i=r[t];if(!s||!i)return!1;r[t]=s,r[e]=i,s.index=t,i.index=e;const o=[...n],a=o[e],l=o[t];o[t]=a,o[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.#de.set(r),this.value=o,!0}}function Z(e){if(!e?.length)return[];const t=[];let n=[],r=Object.create(null),s=!1;for(const t of e){if("string"==typeof t)continue;const e=t.template;if(!e)continue;s=!0;const n=X(t);r[e]={params:t.params,children:n?[n]:[]}}function i(e){e.length&&t.push({type:"divergent",children:e.map((([e,t])=>{const n=X(t);return n?"string"!=typeof n&&"fragment"===n.type?[n,e]:[{children:[n]},e]:[{children:[]},e]}))})}for(const r of e){if("string"==typeof r){i(n),n=[],t.push(r);continue}if(r.template){i(n),n=[];continue}if(n.length&&r.else){const e=r.if||null;n.push([e,r]),e||(i(n),n=[]);continue}i(n),n=[];const e=r.if;if(e){n.push([e,r]);continue}const s=X(r);s&&t.push(s)}return i(n),s?[{type:"fragment",templates:r,children:t}]:t}function X(e){let t=function(e){const t=e.fragment;if(t&&"string"==typeof t)return{type:"template",template:t,attrs:e.attrs,children:[]};const n=function({text:e,html:t}){return null!=e?{type:"content",value:e}:null!=t?{type:"content",value:t,html:!0}:void 0}(e),r=n?[n]:Z(e.children);return!e.name||t?n||{type:"fragment",children:r}:{name:e.name,is:e.is,attrs:e.attrs,events:e.events,classes:e.classes,styles:e.styles,enhancements:e.enhancements,bind:e.bind,comment:e.comment,children:r}}(e),n=e.vars;n.length&&t&&"string"!=typeof t&&(t.vars?t.vars=[...n,...t.vars]:t?t.vars=n:t={type:"fragment",vars:n,children:[]},n=null);const r=e.enum,s=e.value;return r&&(t={type:"enum",value:r,sort:e.sort,vars:n,children:t?[t]:[]},n=null),s&&(t={type:"value",name:s,vars:n,children:t?[t]:[]},n=null),n?.length&&(t={type:"fragment",vars:n,children:t?[t]:[]}),t}!function(e){W=e}(Q);const J=/^([+-]?(\d(_?\d)*(\.(\d(_?\d)*)?)?|\.\d(_?\d)*)(?:e[+-]?\d(_?\d)*)|0(b[01](?:_?[01])*|o[0-7](?:_?[0-7])*|x[\dA-F](?:_?[\dA-F])*))$/is;const ee={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class te extends Error{constructor(e,...t){const n=ee[e];super("function"==typeof n?n(...t):n),this.code=e}}const ne=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,re=/^~(?<enhancement>[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_\d\.]*)(?:(?<decorator>[:@!])(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*))?$/u,se=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function ie(e,t){const n=e[t];if(n)return n;const r={attrs:Object.create(null),events:Object.create(null)};return e[t]=r,r}function oe(e,t){const n=e.replace(/$\s+|\s+$/gs,"");if("null"===n)return{value:null};if("true"===n)return{value:!0};if("false"===n)return{value:!1};const r=function(e){return J.test(e)?Number(e.replaceAll("_","")):NaN}(n);return Number.isNaN(r)?se.test(n)?{name:n}:{calc:t(e)}:{value:r}}function ae(e,t,n,r,s){const{attrs:i,events:o,classes:a,styles:l,vars:c,params:u,enhancements:f}=e;return function(d,h){const p=d.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"),g=(ne.exec(p)||re.exec(p))?.groups;if(!g)throw new te("ATTR",d);const{name:m,enhancement:b}=g,v=g.decorator?.toLowerCase();if(b){if(":"===v)ie(f,b).attrs[m]=h?oe(h,t):{name:m};else if("@"===v)ie(f,b).events[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m};else if("!"===v){if("bind"===m)ie(f,b).bind=h||!0}else ie(f,b).value=oe(h,t);return}if(!v)return void(i[m]={value:h});if(":"===v)return void(i[m]=h?oe(h,t):{name:m});if("."===v)return void(a[m]=h?oe(h,t):{name:m});if("style:"===v)return void(l[m]=oe(h,t));if("@"===v)return void(o[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m});if("+"===v)return void c.push({...h?oe(h,n):{value:void 0},variable:m,init:!0});if("*"===v)return void c.push({...oe(h,t),variable:m,init:!1});if("?"===v)return void(u[m]=oe(h,t));if("!"!==v)return;switch(m.toString()){case"fragment":e.fragment=h||!0;break;case"else":e.else=!0;break;case"enum":e.enum=h?oe(h,t):{value:!0};break;case"sort":e.sort=h?oe(h,t):{value:!0};break;case"if":e.if=oe(h,t);break;case"text":e.text=oe(h,t);break;case"html":s&&(e.html=oe(h,t));break;case"template":e.template=h;break;case"bind":e.bind=h||!0;break;case"value":e.value=h;break;case"comment":e.comment=h}}}function le(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:[],params:Object.create(null),enhancements:Object.create(null)}}var ce={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};const ue=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function fe(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function de(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function he(...e){console.error(new te(...e))}function pe(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in ce?ce[t]:(he("ENTITY",e),e)}var ge=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new te("CALC")},createInit:n=t,createEvent:r=()=>{throw new te("EVENT")},simpleTag:s=new Set,enableHTML:i=!1}={}){const o=[],a={children:o},l=[];let c=null,u=a;function f(){c=l.pop()||null,u=c||a}function d(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&u.children.push(e)}let h={},p=0;function g(t){if(t<=p)return;d(e.substring(p,t).replace(/&#?\w+;/g,pe)),p=t}for(;;){const m=e.indexOf("<",p);if(m<0){const A=e.substring(p);A.match(/^\s*$/)||d(A);break}m>p&&g(m);const b=e.charAt(m+1);if("!"===b){let j=m+2,L=">";if("--"===e.slice(m+2,m+4)&&(j+=4,L="--\x3e"),p=e.indexOf(L,j),p<0)break;p++;continue}if("/"===b){p=e.indexOf(">",m+3);let T=e.substring(m+2,p);if(p<0?(T=e.substring(m+2).replace(/[\s<].*/,""),he("UNCOMPLETED",T,c?.name),p=m+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),he("UNCOMPLETED",T),p=m+1+T.length),c){const M=c.name;if(M===T)f();else{if(M.toLowerCase()!=T.toLowerCase())throw new te("CLOSE",T,c.name);f()}}p++;continue}function v(t){let n=p+1;if(p=e.indexOf(t,n),p<0)throw new te("QUOTE",t);const r=e.slice(n,p).replace(/&#?\w+;/g,pe);return p++,r}function y(){let t=e.charAt(p);for(;t<=" "||""===t;t=e.charAt(++p));return t}function w(){let t=p,n=e.charAt(p);for(;fe(n);)p++,n=e.charAt(p);return e.slice(t,p)}p=m+1;let x=e.charAt(p);switch(x){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case">":case"/":throw new te("SYMBOL",x);case"":throw new te("EOF")}const S=w(),O=ue.exec(S)?.groups;if(!O)throw new te("TAG",S);l.push(c),c=le(O.name,O.is),u.children.push(c),u=c;const E=ae(c,t,n,r,i);let C=!0,$=!1;e:for(;C;){let N=y();switch(N){case"":he("EOF"),p++;break e;case">":p++;break e;case"/":$=!0;break e;case'"':case"'":throw new te("ATTR_VALUE");case"=":throw new te("SYMBOL",N)}const k=w();if(!k){he("EOF"),p++;break e}switch(N=y(),N){case"":he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),$=!0;break e;case"=":p++;break;case"'":case'"':E(k,v(N));continue;default:E(k,"");continue}switch(N=y(),N){case"":E(k,""),he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),$=!0;break e;case"'":case'"':E(k,v(N));continue}E(k,w())}if($){for(;;){p++;const I=e.charAt(p);if("/"!==I&&!(I<=" "||""===I))break}switch(e.charAt(p)){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case"":he("EOF");break;case">":p++;break;default:throw new te("CLOSE_SYMBOL")}f()}else(s.has(S)||de(e,p,S,h))&&f()}return Z(o)}});function me(t){let n=!0;const r=new e.Signal.subtle.Watcher((()=>{n&&(n=!1,queueMicrotask((()=>{n=!0;for(const e of r.getPending())e.get();r.watch()})))})),s=new e.Signal.Computed(t);return r.watch(s),s.get(),()=>{r.unwatch(s)}}function be(e,t,n){let r,s=!1;return me((()=>{const i=e();if(!s)return s=!0,r=i,void(n&&t(i));Object.is(i,r)||(r=i,t(i))}))}const ve=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,ref:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,changed:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,minLength:!0,maxLength:!0,pattern:!0,values:!0,null:!0,index:!0,no:!0,size:!0,error:!0,errors:!0}));function*ye(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of ve)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],yield[`${t}${n}reset`,{exec:()=>e.reset()}],yield[`${t}${n}validate`,{exec:t=>e.validate(t?[]:null)}],e instanceof Q?(yield[`${t}${n}addable`,{get:()=>e.addable}],yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}]):yield[`${t}${n}addable`,{get:()=>!1}]}function we(e,t,n){for(const[n,r]of t){for(const[t,s]of ye(r,n))e[t]=s;for(const[t,s]of ye(r,n,"$$"))e[t]=s}}const xe={value$:{calc:e=>e?.[_].value},state$:{calc:e=>e?.[_].state}};var Se=Object.getOwnPropertyDescriptors(xe);function Oe(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function Ee(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class Ce{exec({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#me[e];if("function"!=typeof t?.get)return;return t.get()}return"function"==typeof t?t(this.getters):n}get({name:t,calc:n,value:r}){if("string"==typeof t){const e=this.#me[t];if("function"!=typeof e?.get)return;const{get:n,set:r}=e;return{get:n,set:r}}if("function"==typeof n){const t=new e.Signal.Computed((()=>n(this.getters)));return{get:()=>t.get()}}return{get:()=>r}}watch(e,t){return be((()=>this.exec(e)),t,!0)}enum(e){const{name:t,calc:n}=e;if("function"==typeof n)return()=>n(this.getters);if("string"==typeof t){const e=this.#me[t];if("function"!=typeof e?.get)return null;const n=e.store;return n instanceof Y?n:e.get}return this.store}getStore(e){if(!e)return null;const t=this.#me[!0===e?"":e];return t?.get&&t.store||null}bind(e,t,n){const r=this.#me[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?ve.has(t)?be((()=>s[t]),n,!0):void 0:"value"===t?be((()=>r.get()),n,!0):void 0}bindAll(e){const t=this.#me[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>be(e,t,!0)}}return Object.fromEntries([...ve].map((e=>[`$${e}`,t=>be((()=>n[e]),t,!0)])))}getBindAll(e){const t=this.#me[!0===e?"":e];if(!t?.get)return{};const{store:n}=t;if(!n){const{get:e,set:n}=t;return{$value:{get:e,set:n}}}return Object.fromEntries([...ve].map((e=>[`$${e}`,"value"===e||"state"===e?{get:()=>n[e],set:t=>{n[e]=t}}:{get:()=>n[e]}])))}bindSet(e,t){const n=this.#me[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#me[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)},$reset:e=>{n.reset()},$validate:e=>{n.validate(e?[]:null)}}}getEvent({name:e,event:t}){if("function"==typeof t)return t;const n=this.#me[e];if(!n)return null;const{exec:r,calc:s}=n;return"function"==typeof r?r:"function"==typeof s?s:null}constructor(e,t){if(this.store=e,t instanceof Ce){this.#be=t.#be;const e=this.#ve;for(const[n,r]of Object.entries(t.#ve))e[n]=r;const n=this.#ye;for(const[e,r]of Object.entries(t.#ye))n[e]=r}else we(this.#ve,e),this.#be=function(e){const t=Object.create(null,Se);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!Oe(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof Y){for(const[e,s]of ye(r,n))t[e]=s;continue}const{get:e,set:s,exec:i,calc:o}=r;"function"!=typeof e?"function"!=typeof o?"function"!=typeof i||(t[n]={exec:i}):t[n]={calc:o}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#be;#ve=Object.create(null);#ye=Object.create(null);store;#we=null;#s=null;#xe=null;get#me(){const e=this.#xe;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#ve,...this.#be,...this.#ye})),n=this.store,r=this.#s,s=this.#we;for(const[e,r]of ye(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof Q))return yield[`${n}${r}removable`,{get:()=>!1}],yield[`${n}${r}upMovable`,{get:()=>!1}],yield[`${n}${r}downMovable`,{get:()=>!1}],yield[`${n}${r}remove`,{exec:()=>{}}],yield[`${n}${r}upMove`,{exec:()=>{}}],void(yield[`${n}${r}downMove`,{exec:()=>{}}]);yield[`${n}${r}removable`,{get:()=>!e.readonly&&!e.disabled&&!!t.removable}],yield[`${n}${r}upMovable`,{get:()=>{if(e.readonly)return!1;if(e.disabled)return!1;const n=t.index;return"number"==typeof n&&!(n<=0)}}],yield[`${n}${r}downMovable`,{get:()=>{if(e.readonly)return!1;if(e.disabled)return!1;const n=t.index;return"number"==typeof n&&!(n>=e.size-1)}}],yield[`${n}${r}remove`,{exec:()=>{e.readonly||e.disabled||t.removable&&e.remove(Number(t.index))}}],yield[`${n}${r}upMove`,{exec:()=>{if(e.readonly)return;if(e.disabled)return;const n=t.index;"number"==typeof n&&(n<=0||e.move(n,n-1))}}],yield[`${n}${r}downMove`,{exec:()=>{if(e.readonly)return;if(e.disabled)return;const n=t.index;"number"==typeof n&&(n>=e.size-1||e.move(n,n+1))}}]}(r,n))t[e]=s;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};return this.#xe=t,t}setStore(e,t,n){const r=new Ce(e,this);return t&&(r.#s=t),we(r.#ve,e),n&&(r.#we=n),r}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new Ce(t,this);return we(n.#ve,t),n}params(t,n,r,s){let i=this.store;if(!0===s)i=r.store;else if(s){const e=r.#me[s],t=e?.get&&e.store;t&&(i=t)}if(0===Object.keys(t).length)return this;const o=new Ce(i,this);o.#s=this.#s,o.#we=this.#we;const a=o.#ye,l=o.#me;for(const[s,i]of Object.entries(t)){const t=s in n?n[s]:null;if(t){const{name:n,calc:i,value:o}=t;if(n){const e=r.#me[n];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ye(e.store,s))a[t]=l[t]=n;continue}if("function"==typeof i){const t=new e.Signal.Computed((()=>i(r.getters)));a[s]=l[s]={get:()=>t.get()};continue}a[s]=l[s]={get:()=>o}}else{const{name:t,calc:n,value:r}=i;if("function"==typeof n){const t=o.getters;o.#Se=null;const r=new e.Signal.Computed((()=>n(t)));a[s]=l[s]={get:()=>r.get()};continue}if(t){const e=l[t];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ye(e.store,s))a[t]=l[t]=n;continue}a[s]=l[s]={get:()=>r}}}return o}setObject(e){const t=new Ce(this.store,this);return t.#we=e,t}set(t){if(!t?.length)return this;const n=new Ce(this.store,this);n.#s=this.#s,n.#we=this.#we;const r=n.#ye,s=n.#me;for(const{variable:i,name:o,calc:a,value:l,init:c}of t)if(c){const t=new e.Signal.State(l);if("function"==typeof a){const e=n.settable;n.#Oe=null,t.set(a(e))}else if(o){const e=s[o];if(!e?.get)continue;t.set(e.get())}r[i]=s[i]={get:()=>t.get(),set:e=>{t.set(e)}}}else if("function"!=typeof a)if(o){const e=s[o];if(!e)continue;if(!e.get||!e.store){r[i]=s[i]=e;continue}for(const[t,n]of ye(e.store,i))r[t]=s[t]=n}else r[i]=s[i]={get:()=>l};else{const t=n.getters;n.#Se=null;const o=new e.Signal.Computed((()=>a(t)));r[i]=s[i]={get:()=>o.get()}}return n}#Ee=null;get all(){const e=this.#Ee;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#me))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc?Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1}):Object.defineProperty(t,e,{value:n.exec,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Ee=t,t}#Oe=null;get settable(){const e=this.#Oe;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#me))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Oe=t,t}#Se=null;get getters(){const e=this.#Se;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#me))n.get?Object.defineProperty(t,e,{get:n.get,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Se=t,t}}const $e={width:"px",height:"px",top:"px",right:"px",bottom:"px",left:"px",border:"px","border-top":"px","border-right":"px","border-left":"px","border-bottom":"px","border-width":"px","border-top-width":"px","border-right-width":"px","border-left-width":"px","border-bottom-width":"px","border-radius":"px","border-top-left-radius":"px","border-top-right-radius":"px","border-bottom-left-radius":"px","border-bottom-right-radius":"px",padding:"px","padding-top":"px","padding-right":"px","padding-left":"px","padding-bottom":"px",margin:"px","margin-top":"px","margin-right":"px","margin-left":"px","margin-bottom":"px"};function Ae(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in $e?`${s}${$e[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class je{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let i=r.get(s);return i||(i=new Set,r.set(s,i)),i.add(n),()=>{i?.delete(n)}}}const Le={stop(e){e instanceof Event&&e.stopPropagation()},prevent(e){e instanceof Event&&e.preventDefault()},self(e){if(e instanceof Event)return e.target===e.currentTarget},enter(e){if(e instanceof KeyboardEvent)return"Enter"===e.key},tab(e){if(e instanceof KeyboardEvent)return"Tab"===e.key},esc(e){if(e instanceof KeyboardEvent)return"Escape"===e.key},space(e){if(e instanceof KeyboardEvent)return" "===e.key},backspace(e){if(e instanceof KeyboardEvent)return"Backspace"===e.key},delete(e){if(e instanceof KeyboardEvent)return"Delete"===e.key},delBack(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},"del-back"(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},insert(e){if(e instanceof KeyboardEvent)return"Insert"===e.key},repeat(e){if(e instanceof KeyboardEvent)return e.repeat},key(e,t){if(e instanceof KeyboardEvent){const n=e.code.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},main(e){if(e instanceof MouseEvent)return 0===e.button},auxiliary(e){if(e instanceof MouseEvent)return 1===e.button},secondary(e){if(e instanceof MouseEvent)return 2===e.button},left(e){if(e instanceof MouseEvent)return 0===e.button},middle(e){if(e instanceof MouseEvent)return 1===e.button},right(e){if(e instanceof MouseEvent)return 2===e.button},primary(e){if(e instanceof PointerEvent)return e.isPrimary},mouse(e){if(e instanceof PointerEvent)return"mouse"===e.pointerType},pen(e){if(e instanceof PointerEvent)return"pen"===e.pointerType},touch(e){if(e instanceof PointerEvent)return"touch"===e.pointerType},pointer(e,t){if(e instanceof PointerEvent){const n=e.pointerType.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},ctrl(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey},alt(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.altKey},shift(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.shiftKey},meta(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.metaKey},cmd(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey||e.metaKey}};function Te(e,t,n){const r=[];if(t)for(let s=e.shift();s;s=e.shift()){const e=s.indexOf(":"),i=e>=0?s.slice(0,e):s,o=e>=0?s.slice(e+1).split(":"):[],a=i.replace(/^-+/,""),l=(i.length-a.length)%2==1;let c=t[a]||a;if(n)switch(c){case"once":case"passive":case"capture":n[c]=!l;continue}"string"==typeof c&&(c=Le[c]),"function"==typeof c&&r.push([c,o,l])}return r}function Me(e,t,n){return r=>{const s=e.all;for(const[e,t,i]of n)if(e(r,t,s)===i)return;t(r,s)}}function Ne(e){return"number"==typeof e||"bigint"==typeof e?String(e):"boolean"==typeof e?e?"":null:"string"==typeof e?e:null===(e??null)?null:String(e)}function ke(e){return null===(e??null)?"":String(e)}function Ie(e,t){if(e instanceof HTMLInputElement&&"checked"===t)switch(e.type.toLowerCase()){case"checkbox":case"radio":return Boolean}if((e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&"value"===t)return ke;if(e instanceof HTMLDetailsElement&&"open"===t)return Boolean;if(e instanceof HTMLMediaElement){if("muted"===t)return Boolean;if("paused"===t)return Boolean;if("currentTime"===t)return!0;if("playbackRate"===t)return!0;if("volume"===t)return!0}return!1}const Pe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ke(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Ue(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watch:s,props:i}=e;return["input","textarea","select"].includes(t.toLowerCase())&&e.relate(r),e.listen("init",(({events:n})=>{const o=Pe[t.toLowerCase()],a=o?.attrs||{},l=o?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,i]=n;r.addEventListener(e,(e=>t(i(e,r))),s)}}if(i)for(const[t,n]of Object.entries(e.attrs))if(s(t,(e=>{if(i.has(t))r[t]=e;else{const n=Ne(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),i.has(t))r[t]=n;else{const e=Ne(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.attrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=Ne(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=Ie(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let i=Ne(n);null!==i&&r.setAttribute(t,i),s(t,(e=>{const n=Ne(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Be(e){return null===(e??null)?"":String(e)}function Re(e,t,n,r,s){if(!s){const s=e.insertBefore(document.createTextNode(""),t),i=n.watch(r,(e=>s.textContent=Be(e)));return()=>{s.remove(),i()}}const i=e.insertBefore(document.createComment(""),t),o=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=i.nextSibling;e&&e!==o;e=i.nextSibling)e.remove()}const c=n.watch(r,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=i.firstChild)e.insertBefore(t,o)}(Be(t))}));return()=>{c(),l(),i.remove(),o.remove()}}function qe(e,t){if("bigint"==typeof e&&"bigint"==typeof t)return Number(e-t);if(!("number"!=typeof e&&"bigint"!=typeof e||"number"!=typeof t&&"bigint"!=typeof t))return Number(e)-Number(t);const n=String(e),r=String(t);return n>r?1:n<r?-1:0}const _e=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function Ve(e,t,n,r,s){const i=e.children;if(!i.length)return()=>{};const o=t.insertBefore(document.createComment(""),n);let a=null,l=()=>{};const c=be((()=>i.find((([,e])=>!e||r.exec(e)))||null),(e=>{if(e===a)return;a=e,l(),l=()=>{};const t=e?.[0];t&&(l=s(t.children,t.vars,t.templates))}),!0);let u=!1;return()=>{u||(u=!0,c(),l(),l=()=>{},o.remove())}}function De(t,n,r,s,i,o,a,l,c){const u=t.bind,f=[...o,t.name],d=c?.(f);if(c&&!d)return()=>{};const{context:h,handler:p}=function(t,n,r,s){const i="string"==typeof t?t:t.tag,{attrs:o,events:a}="string"!=typeof t&&t||{attrs:null,events:null};let l=!1;const c=new e.Signal.State(!1);let u=!1;const f=new e.Signal.State(!1),d=Object.create(null),h=Object.create(null),p=new Set,g=[],m=new je;return{context:{events:g,props:o?new Set(Object.entries(o).filter((([,e])=>e.isProp)).map((([e])=>e))):null,attrs:h,watch(e,t){if(l)return()=>{};const n=d[e];if(!n)return()=>{};let r=n.get();const s=be((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}),!0);return p.add(s),()=>{p.delete(s),s()}},relate(e){if(!r||!s||l)return()=>{};try{const t=s(r,e);return"function"!=typeof t?()=>{}:(p.add(t),()=>{p.delete(t),t()})}catch{return()=>{}}},get destroyed(){return c.get()},get init(){return f.get()},listen:(e,t)=>m.listen(e,t)},handler:{tag:i,set(t,n){if(o&&!(t in o))return;let r=d[t];if(r)return void r.set(n);const s=new e.Signal.State(n);d[t]=s,Object.defineProperty(h,t,{configurable:!0,enumerable:!0,get:s.get.bind(s)})},addEvent(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),i=a?a[r].filters:{};if(!i)return;const o={},l=Te(s,i,o);g.push([r,Me(n,t,l),o])},destroy(){if(!l){l=!0,c.set(!0);for(const e of p)e();m.emit("destroy")}},mount(){u||(u=!0,f.set(!0),m.emit("init",{events:g}))}}}}(d||t.name,s,s.getStore(u),l),g=d?.attrs,m=g?function(e,t,n,r,s){let i=new Set;for(const[o,a]of Object.entries(r)){if("class"===o||"style"===o)continue;if(o in n){const r=n[o],{name:s,calc:l,value:c}=n[o];if(!s&&!l){e.set(o,c);continue}a.immutable&&e.set(o,t.exec(r)),i.add(t.watch(r,(t=>e.set(o,t))));continue}const r=a.bind;if(!s||!r){e.set(o,a.default);continue}if("string"==typeof r){const n=t.bind(s,r,(t=>e.set(o,t)));n?i.add(n):e.set(o,a.default);continue}if(!Array.isArray(r)){e.set(o,a.default);continue}const[l,c,u]=r;if(!l||"function"!=typeof c)continue;if(!u){const n=!0===s?"":s;i.add(t.watch({name:n},(t=>e.set(o,t)))),e.addEvent(l,((...e)=>{t.all[n]=c(...e)}));continue}const f=t.bind(s,"state",(t=>e.set(o,t)));if(!f)continue;i.add(f);const d=t.bindSet(s,"state");d&&e.addEvent(l,((...e)=>{d(c(...e))}))}return()=>{const e=i;i=new Set;for(const t of e)t()}}(p,s,t.attrs,g,u):function(e,t,n){const r=e.tag;let s=new Set;for(const[i,o]of Object.entries(n)){if("class"===i||"style"===i)continue;const{name:n,calc:a,value:l}=o;if(n||a)if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==i.toLocaleLowerCase())s.add(t.watch(o,(t=>e.set(i,t))));else{const n=t.exec(o);e.set(i,n)}else e.set(i,l)}return()=>{const e=s;s=new Set;for(const t of e)t()}}(p,s,t.attrs);for(const[e,n]of Object.entries(t.events)){const t=s.getEvent(n);t&&p.addEvent(e,t)}const b=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,i]of Object.entries(t.bindAll(n)||{}))"function"==typeof i&&r.add(i((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(p,s,u),v=d?"function"==typeof d.tag?d.tag(h):Ue(h,d.tag,d.is):Ue(h,t.name,t.is),y=Array.isArray(v)?v[0]:v,w=Array.isArray(v)?v[1]:y;n.insertBefore(y,r);const x=w?ze(t.children||[],w,null,s,i,o,a,l,c):()=>{},S=function(e,t,n,r){if(!(e instanceof Element))return()=>{};r&&(e.className+=" "+t.exec(r));let s=new Set;for(const[r,i]of Object.entries(n))i.value?e.classList.add(r):s.add(be((()=>Boolean(t.exec(i))),(t=>{t?e.classList.add(r):e.classList.remove(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(y,s,t.classes,t.attrs.class),O=function(e,t,n,r){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};if(r){const n=[e.getAttribute("style")||"",t.exec(r)||""].filter(Boolean).join(";");n&&e.setAttribute("style",n)}let s=new Set;for(const[r,i]of Object.entries(n))s.add(be((()=>Ae(r,t.exec(i))),(t=>{t?e.style.setProperty(r,...t):e.style.removeProperty(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(y,s,t.styles,t.attrs.style);p.mount();const E=function(t,n,r,s,i,o){let a=new Set;for(const[l,{attrs:c,value:u,events:f,bind:d}]of Object.entries(n)){if(!_e(s,l))continue;const h=s[l];if("function"!=typeof h)continue;let p=!1;const g=new e.Signal.State(!1),m=h?.events,b=[],v=Object.create(null),y=new Set,w=new je;function x(e,t){if("function"!=typeof t)return;const[n,...s]=e.split(".").filter(Boolean),i=m?m[n].filters:{};if(!i)return;const o={},a=Te(s,i,o);b.push([n,Me(r,t,a),o])}function S(){if(!p){p=!0,g.set(!0);for(const e of y)e();w.emit("destroy")}}a.add(S);for(const[E,C]of Object.entries(c)){const $=r.get(C);$&&Object.defineProperty(v,E,{...$,configurable:!0,enumerable:!0})}for(const[A,j]of Object.entries(f)){const L=r.getEvent(j);L&&x(A,L)}if(d){for(const[T,M]of Object.entries(r.getBindAll(d)||{}))Object.defineProperty(v,T,{...M,configurable:!0,enumerable:!0});for(const[N,k]of Object.entries(r.bindEvents(d)||{}))x(N,(e=>k(e)))}const O={get value(){return null},events:b,attrs:v,watch(e,t){if(p)return()=>{};let n=v[e];const r=be((()=>v[e]),(r=>{const s=n;n=r,t(r,s,e)}),!0);return y.add(r),()=>{y.delete(r),r()}},get destroyed(){return g.get()},listen:(e,t)=>w.listen(e,t),root:i,slot:o,tag:t};if(u){const I=r.get(u);I&&Object.defineProperty(O,"value",{...I,configurable:!0,enumerable:!0})}h(O)}return()=>{const e=a;a=new Set;for(const t of e)t()}}(p.tag,t.enhancements,s,a,y,w);return()=>{E(),p.destroy(),y.remove(),m(),x(),b(),S(),O()}}function We(e,t,n){if(!n)return t;const r=Object.entries(n);if(!r.length)return t;const s=Object.create(t);for(const[t,n]of r)s[t]=[n,e];return s}function Ke(t,n,r,s,i,o,a,l,c){if("string"==typeof t){const e=document.createTextNode(t);return n.insertBefore(e,r),()=>e.remove()}const u=s.set(t.vars),f=We(u,i,t.templates);if("divergent"===t.type)return Ve(t,n,r,u,((e,t,s)=>{const f=u.set(t),d=We(f,i,s);return ze(e,n,r,f,d,o,a,l,c)}));if("value"===t.type){const e=u.child(t.name);return e?ze(t.children,n,r,e,f,o,a,l,c):()=>{}}if("enum"===t.type){const s=u.enum(t.value),i=(e,r)=>ze(t.children,n,e,r,f,o,a,l,c);return s instanceof Q?function(t,n,r,s,i){const o=t.insertBefore(document.createComment(""),n);let a=new Map;function l(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const c=new e.Signal.State(0),u=be((()=>r.children),(function(e){if(!o.parentNode)return;let n=o.nextSibling;const u=a;a=new Map,c.set(e.length);for(let o of e){const e=u.get(o);if(!e){const e=t.insertBefore(document.createComment(""),n),l=t.insertBefore(document.createComment(""),n),u=i(l,s.setStore(o,r,{get count(){return c.get()},get key(){return o.index},get index(){return o.index},get item(){return o.value}}));a.set(o,[e,l,u]);continue}if(u.delete(o),a.set(o,e),n===e[0]){n=e[1].nextSibling;continue}let l=e[0];for(;l&&l!==e[1];){const e=l;l=l.nextSibling,t.insertBefore(e,n)}t.insertBefore(e[1],n)}l(u)}),!0);return()=>{o.remove(),l(a),u()}}(n,r,s,u,i,t.sort):s instanceof G?function(e,t,n,r,s,i){const o=[],a=[...n],l=a.length,c=i?a.map((([e,t])=>[e,t,r.setStore(t,n).exec(i)])).sort((([,,e],[,,t])=>qe(e,t))).map((([e,t],n)=>[e,t,n])):a.map((([e,t],n)=>[e,t,n]));for(const[e,i,a]of c)o.push(s(t,r.setStore(i,n,{get count(){return l},get key(){return e},get index(){return a},get item(){return i.value}})));return()=>{for(const e of o)e()}}(0,r,s,u,i,t.sort):"function"==typeof s?function(t,n,r,s,i,o){const a=new e.Signal.Computed((()=>{const e=r();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t])):Object.entries(e).map((([e,t])=>[t,e])):[]})),l=o?new e.Signal.Computed((()=>{const e=a.get();return e.map((([t,n],r)=>[n,t,s.setObject({get count(){return e.length},get key(){return t},get item(){return n},get index(){return r}}).exec(o)])).sort((([,,e],[,,t])=>qe(e,t))).map((([e,t],n)=>[t,n,e]))})):new e.Signal.Computed((()=>a.get().map((([e,t],n)=>[t,n,e])))),c=t.insertBefore(document.createComment(""),n);let u=[];function f(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const d=new e.Signal.State(0),h=be((()=>l.get()),(function(n){if(!c.parentNode)return;let r=c.nextSibling;const o=u;u=[],d.set(n.length);for(const[a,l,c]of n){const n=o.findIndex((e=>e[3]===c)),[f]=n>=0?o.splice(n,1):[];if(!f){const n=t.insertBefore(document.createComment(""),r),o=t.insertBefore(document.createComment(""),r),f=new e.Signal.State(a),h=new e.Signal.State(l),p=i(o,s.setObject({get count(){return d.get()},get key(){return c},get item(){return f.get()},get index(){return h.get()}}));u.push([n,o,p,c,f,h]);continue}if(u.push(f),f[4].set(a),f[5].set(l),r===f[0]){r=f[1].nextSibling;continue}let h=f[0];for(;h&&h!==f[1];){const e=h;h=h.nextSibling,t.insertBefore(e,r)}t.insertBefore(f[1],r)}f(o)}),!0);return()=>{c.remove(),f(u),h()}}(n,r,s,u,i,t.sort):()=>{}}if("content"===t.type)return Re(n,r,u,t.value,t.html);if("template"===t.type){const e=f[t.template];if(!e)return()=>{};const[s,d]=e,h=d.params(s.params,t.attrs,u,t.bind),p=We(h,i,s.templates);return ze(s.children,n,r,h,p,o,a,l,c)}return"fragment"===t.type?ze(t.children,n,r,u,f,o,a,l,c):De(t,n,r,u,f,o,a,l,c)}function ze(e,t,n,r,s,i,o,a,l){const c=e.map((e=>Ke(e,t,n,r,s,i,o,a,l)));let u=!1;return()=>{if(!u){u=!0;for(const e of c)e()}}}e.Layout=ge,e.Store=Y,e.effect=me,e.render=function(e,t,n,{component:r,global:s,relate:i,enhancements:o}={}){return ze(t,n,null,new Ce(e,s),Object.create(null),[],o||{},"function"==typeof i?i:null,r)},e.watch=be}));
|
|
60
|
+
function(e){const t=Object.create(T);t.value=e;const n=()=>(h(t),t.value);return n[u]=t,n}(r),l=a[u];if(this[M]=l,l.wrapper=this,i){const t=i.equals;t&&(l.equal=t),l.watched=i[e.subtle.watched],l.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return j.call(this[M])}set(t){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(l)throw new Error("Writes to signals not permitted during Watcher callback");L(this[M],t)}};c=M,p=new WeakSet,e.isComputed=e=>r(p,e),e.Computed=class{constructor(t,r){s(this,p),n(this,c);const i=function(e){const t=Object.create($);t.computation=e;const n=()=>S(t);return n[u]=t,n}(t),o=i[u];if(o.consumerAllowSignalWrites=!0,this[M]=o,o.wrapper=this,r){const t=r.equals;t&&(o.equal=t),o.watched=r[e.subtle.watched],o.unwatched=r[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return S(this[M])}},(t=>{var o,l,c,u;t.untrack=function(e){let t,n=null;try{n=f(null),t=e()}finally{f(n)}return t},t.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[M].producerNode)?void 0:n.map((e=>e.wrapper)))??[]},t.introspectSinks=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(n=t[M].liveConsumerNode)?void 0:n.map((e=>e.wrapper)))??[]},t.hasSinks=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called hasSinks without a Signal argument");const n=t[M].liveConsumerNode;return!!n&&n.length>0},t.hasSources=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called hasSources without a Computed or Watcher argument");const n=t[M].producerNode;return!!n&&n.length>0};o=M,l=new WeakSet,c=new WeakSet,u=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>r(l,e),t.Watcher=class{constructor(e){s(this,l),s(this,c),n(this,o);let t=Object.create(d);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[M]=t}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,u).call(this,t);const n=this[M];n.dirty=!1;const r=f(n);for(const e of t)h(e[M]);f(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");i(this,c,u).call(this,t);const n=this[M];w(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){v(n.producerNode[e],n.producerIndexOfThis[e]);const t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){const t=n.producerIndexOfThis[e],r=n.producerNode[e];x(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[M].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},t.currentComputed=function(){var e;return null==(e=a)?void 0:e.wrapper},t.watched=Symbol("watched"),t.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(e.Signal||(e.Signal={}));const k=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,P=e=>e instanceof RegExp?e:null,U=Boolean;function B(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(B).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const R=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(B).filter(U);return t.length?t:null};function q(t,n,r,s){const i=new e.Signal.State(n(r));let o;if("function"==typeof s){const r=s;o=new e.Signal.Computed((()=>n(r(t))))}else{const t=n(s);o=new e.Signal.Computed((()=>t))}const a=new e.Signal.Computed((()=>{const e=i.get();return null===e?o.get():e}));return[i,a]}const _=Symbol();function V(e){const t={[_]:e};for(const[n,r]of e)Object.defineProperty(t,n,{get:()=>r.ref,configurable:!1,enumerable:!0});return Object.defineProperty(t,_,{get:()=>e,configurable:!1,enumerable:!0}),t}let D=null,W=null,K=Object.create(null);function z(e,t){const n=e.type;let r=Y;if(!e.array||W&&t?.parent instanceof W)if("string"==typeof n){const e=K[n];e&&(r=e)}else n&&"object"==typeof n&&D&&(r=D);else W&&(r=W);return new r(e,t)}function H(e){return e?e instanceof Error?e.message:"string"!=typeof e?"":e:""}function F(t,...n){const r=n.flat().filter((e=>"function"==typeof e));if(!r.length)return[()=>Promise.resolve([]),new e.Signal.Computed((()=>[])),()=>{}];const s=new e.Signal.State([]);let i=null;return[function(){i?.abort(),i=new AbortController;const e=i.signal;return s.set([]),Promise.all(r.map((n=>async function(e,n){let r=[];try{r.push(await e(t,n))}catch(e){r.push(e)}const i=r.flat().map(H).filter(Boolean);return!n.aborted&&i.length&&s.set([...s.get(),...i]),i}(n,e)))).then((e=>e.flat()))},new e.Signal.Computed((()=>s.get())),()=>{i?.abort(),s.set([])}]}class Y{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let i=r.get(s);return i||(i=new Set,r.set(s,i)),i.add(n),()=>{i?.delete(n)}}static create(e,t={}){return z({type:e},{...t,parent:null})}static setStore(e,t){return function(e,t){K[e]=t}(e,t)}#t=!1;get null(){return this.#t}get kind(){return""}#n=null;get ref(){return this.#n||V(this)}constructor(t,{null:n,state:r,ref:s,setValue:i,setState:o,convert:a,onUpdate:l,onUpdateState:c,validator:u,validators:f,index:d,size:h,new:p,parent:g,hidden:m,clearable:b,required:v,disabled:y,readonly:w,removable:x,label:S,description:O,placeholder:E,min:C,max:$,step:A,minLength:j,maxLength:L,pattern:T,values:M}={}){this.schema=t,this.#r.set("object"==typeof r&&r||{});const U=g instanceof Y?g:null;U&&(this.#s=U,this.#i=U.#i,this.#o=U.#o);const B=new e.Signal.State(!1);this.#a=B,this.#o=B,this.#l=t.type,this.#c=t.meta,this.#u=t.component;const _=new e.Signal.State(Boolean(p));this.#f=_;const D=U?new e.Signal.Computed((()=>U.#d.get()||_.get())):new e.Signal.Computed((()=>_.get()));this.#d=D;const W=Boolean(t.immutable),K=!1!==t.creatable;this.#h=W,this.#p=K;const z=t.readonly,G=new e.Signal.State("boolean"==typeof w?w:null);let Q;if("function"==typeof z)Q=new e.Signal.Computed((()=>Boolean(z(this))));else{const t=Boolean(z);Q=new e.Signal.Computed((()=>t))}const Z=()=>{if(D.get()?!K:W)return!0;const e=G.get();return null===e?Q.get():e},X=U?U.#g:null;this.#m=G,this.#g=X?new e.Signal.Computed((()=>X.get()||Z())):new e.Signal.Computed(Z),[this.#b,this.#v]=N(this,m,t.hidden,U?U.#v:null),[this.#y,this.#w]=N(this,b,t.clearable,U?U.#w:null),[this.#x,this.#S]=N(this,v,t.required,U?U.#S:null),[this.#O,this.#E]=N(this,y,t.disabled,U?U.#E:null),[this.#C,this.#$]=q(this,k,S,t.label),[this.#A,this.#j]=q(this,k,O,t.description),[this.#L,this.#T]=q(this,k,E,t.placeholder),[this.#M,this.#N]=q(this,I,C,t.min),[this.#k,this.#I]=q(this,I,$,t.max),[this.#P,this.#U]=q(this,I,A,t.step),[this.#B,this.#R]=q(this,I,j,t.minLength),[this.#q,this.#_]=q(this,I,L,t.maxLength),[this.#V,this.#D]=q(this,P,T,t.pattern),[this.#W,this.#K]=q(this,R,M,t.values),[this.#z,this.#H]=N(this,x,t.removable??!0);const J=function(t,...n){const r=n.flat().filter((e=>"function"==typeof e));return r.length?new e.Signal.Computed((()=>{const e=[];for(const n of r)try{e.push(n(t))}catch(t){e.push(t)}return e.flat().map(H).filter(Boolean)})):new e.Signal.Computed((()=>[]))}(this,t.validator,u),[ee,te,ne]=F(this,t.validators?.change,f?.change),[re,se,ie]=F(this,t.validators?.blur,f?.blur);if(this.listen("change",(()=>{ee()})),this.listen("blur",(()=>{re()})),this.#F=function(...t){const n=t.filter(Boolean);return new e.Signal.Computed((()=>n.flatMap((e=>e.get()))))}(J,te,se),this.#Y=J,this.#G=ee,this.#Q=re,this.#Z=ne,this.#X=ie,h instanceof e.Signal.State||h instanceof e.Signal.Computed?this.#J=h:this.#J=new e.Signal.State(h||0),n)return this.#t=!0,void(this.#n=V(this));this.#n=s||null,this.#ee=l||null,this.#te=c||null,this.#ne="function"==typeof i?i:null,this.#re="function"==typeof o?o:null,this.#se="function"==typeof a?a:null,this.#ie.set(d??"");for(const[e,n]of Object.entries(t.events||{}))"function"==typeof n&&this.listen(e,n)}#ne=null;#re=null;#se=null;#ee=null;#te=null;#s=null;#i=this;#l;#c;#u;#a=null;#o;get loading(){return this.#o.get()}set loading(e){const t=this.#a;t&&t.set(Boolean(e))}get store(){return this}get parent(){return this.#s}get root(){return this.#i}get type(){return this.#l}get meta(){return this.#c}get component(){return this.#u}#J;get size(){return this.#J.get()}#ie=new e.Signal.State("");get index(){return this.#ie.get()}set index(e){this.#ie.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#p=!0;get creatable(){return this.#p}#h=!1;get immutable(){return this.#h}#d;#f;get selfNew(){return this.#f.get()}set selfNew(e){this.#f.set(Boolean(e))}get new(){return this.#d.get()}set new(e){this.#f.set(Boolean(e))}#b;#v;get selfHidden(){return this.#b.get()}set selfHidden(e){this.#b.set("boolean"==typeof e?e:null)}get hidden(){return this.#v.get()}set hidden(e){this.#b.set("boolean"==typeof e?e:null)}#y;#w;get selfClearable(){return this.#y.get()}set selfClearable(e){this.#y.set("boolean"==typeof e?e:null)}get clearable(){return this.#w.get()}set clearable(e){this.#y.set("boolean"==typeof e?e:null)}#x;#S;get selfRequired(){return this.#x.get()}set selfRequired(e){this.#x.set("boolean"==typeof e?e:null)}get required(){return this.#S.get()}set required(e){this.#x.set("boolean"==typeof e?e:null)}#O;#E;get selfDisabled(){return this.#O.get()}set selfDisabled(e){this.#O.set("boolean"==typeof e?e:null)}get disabled(){return this.#E.get()}set disabled(e){this.#O.set("boolean"==typeof e?e:null)}#m;#g;get selfReadonly(){return this.#m.get()}set selfReadonly(e){this.#m.set("boolean"==typeof e?e:null)}get readonly(){return this.#g.get()}set readonly(e){this.#m.set("boolean"==typeof e?e:null)}#z;#H;get selfRemovable(){return this.#z.get()}set selfRemovable(e){this.#z.set("boolean"==typeof e?e:null)}get removable(){return this.#H.get()}set removable(e){this.#z.set("boolean"==typeof e?e:null)}#C;#$;get selfLabel(){return this.#C.get()}set selfLabel(e){this.#C.set(k(e))}get label(){return this.#$.get()}set label(e){this.#C.set(k(e))}#A;#j;get selfDescription(){return this.#A.get()}set selfDescription(e){this.#A.set(k(e))}get description(){return this.#j.get()}set description(e){this.#A.set(k(e))}#L;#T;get selfPlaceholder(){return this.#L.get()}set selfPlaceholder(e){this.#L.set(k(e))}get placeholder(){return this.#T.get()}set placeholder(e){this.#L.set(k(e))}#M;#N;get selfMin(){return this.#M.get()}set selfMin(e){this.#M.set(I(e))}get min(){return this.#N.get()}set min(e){this.#M.set(I(e))}#k;#I;get selfMax(){return this.#k.get()}set selfMax(e){this.#k.set(I(e))}get max(){return this.#I.get()}set max(e){this.#k.set(I(e))}#P;#U;get selfStep(){return this.#P.get()}set selfStep(e){this.#P.set(I(e))}get step(){return this.#U.get()}set step(e){this.#P.set(I(e))}#B;#R;get selfMinLength(){return this.#B.get()}set selfMinLength(e){this.#B.set(I(e))}get minLength(){return this.#R.get()}set minLength(e){this.#B.set(I(e))}#q;#_;get selfMaxLength(){return this.#q.get()}set selfMaxLength(e){this.#q.set(I(e))}get maxLength(){return this.#_.get()}set maxLength(e){this.#q.set(I(e))}#V;#D;get selfPattern(){return this.#V.get()}set selfPattern(e){this.#V.set(P(e))}get pattern(){return this.#D.get()}set pattern(e){this.#V.set(P(e))}#W;#K;get selfValues(){return this.#W.get()}set selfValues(e){this.#W.set(R(e))}get values(){return this.#K.get()}set values(e){this.#W.set(R(e))}#F;#Y;#G;#Q;#Z;#X;get errors(){return this.#F.get()}get error(){return this.#F.get()[0]}*[Symbol.iterator](){}child(e){return null}#oe=!1;#ae=new e.Signal.State(null);#le=new e.Signal.State(this.#ae.get());#r=new e.Signal.State(null);get changed(){return this.#le.get()===this.#ae.get()}get value(){return this.#le.get()}set value(e){const t=this.#ne?.(e),n=void 0===t?e:t;this.#le.set(n),this.#oe||this.#ae.set(n),this.#ee?.(n,this.#ie.get(),this),this.#ce()}get state(){return this.#r.get()}set state(e){const t=this.#re?.(e),n=void 0===t?e:t;this.#r.set(n),this.#te?.(n,this.#ie.get(),this),this.#ce()}#ce(){this.#ue||(this.#ue=!0,queueMicrotask((()=>{const e=this.#le.get(),t=this.#r.get();this.#fe(e,t)})))}reset(e=this.#ae.get()){this.#de(e)}#de(e){const t=this.#ne?.(e),n=void 0===t?e:t;if(this.#Z(),this.#X(),this.#oe=!0,!n||"object"!=typeof n){for(const[,e]of this)e.#de(null);return this.#le.set(n),this.#ae.set(n),n}const r=Array.isArray(n)?[...n]:{...n};for(const[e,t]of this)r[e]=t.#de(r[e]);return this.#le.set(r),this.#ae.set(r),this.#ee?.(r,this.#ie.get(),this),r}#ue=!1;#he(e,t){const[n,r]=this.#se?.(e,t)||[e,t];return this.#le.get()===n&&this.#r.get()===r?[n,r]:(this.#le.set(n),this.#r.set(r),this.#fe(n,r))}#fe(e,t){this.#ue=!1;let n=e;if(e&&"object"==typeof e){let r=Array.isArray(e)?[...e]:{...e},s=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},i=!1;for(const[n,o]of this){const a=e[n],l=t?.[n],[c,u]=o.#he(a,l);a!==c&&(r[n]=c,i=!0),l!==u&&(s[n]=u,i=!0)}i&&(t=s,n=e=r,this.#le.set(e),this.#r.set(s))}return this.#oe||(this.#oe=!0,this.#ae.set(n)),[e,t]}validate(e){if(!Array.isArray(e))return Promise.all([this.#Y.get(),this.#G(),this.#Q()]).then((e=>{const t=e.flat();return t.length?t:null}));const t=[this.validate().then((t=>t?.length?[{path:[...e],store:this,errors:t}]:[]))];for(const[n,r]of this)t.push(r.validate([...e,n]));return Promise.all(t).then((e=>e.flat()))}}class G extends Y{get kind(){return"object"}#pe;*[Symbol.iterator](){yield*Object.entries(this.#pe)}child(e){return this.#pe[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:i}={}){const o=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:i,size:o.length,setValue:e=>"object"==typeof e?e:null,setState:e=>"object"==typeof e?e:null,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t,n)=>{n===this.#pe[t]&&(this.value={...this.value,[t]:e})},onUpdateState:(e,t,n)=>{n===this.#pe[t]&&(this.state={...this.state,[t]:e})}};for(const[e,t]of o)a[e]=z(t,{...l,index:e});this.#pe=a}}D=G;class Q extends Y{#ge=()=>{throw new Error};#pe;get children(){return[...this.#pe.get()]}*[Symbol.iterator](){return yield*[...this.#pe.get().entries()]}child(e){const t=this.#pe.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(t,{parent:n,onUpdate:r,onUpdateState:s,index:i,new:o,addable:a}={}){const l=new e.Signal.State([]),c=e=>{const t=Array.isArray(e)&&e.length||0,n=[...l.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#ge(e));n.length=t,r!==t&&l.set(n)};super(t,{index:i,new:o,parent:n,size:new e.Signal.Computed((()=>l.get().length)),state:[],setValue:e=>Array.isArray(e)?e:null==e?null:[e],setState:e=>Array.isArray(e)?e:null==e?null:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?null:[e];return c(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t,n)=>{c(e),r?.(e,t,n)},onUpdateState:s}),[this.#me,this.#be]=N(this,a,t.addable??!0),this.#pe=l;const u={parent:this,onUpdate:(e,t,n)=>{if(l.get()[t]!==n)return;const r=[...this.value||[]];r.length<t&&(r.length=t),r[t]=e,this.value=r},onUpdateState:(e,t,n)=>{if(l.get()[t]!==n)return;const r=[...this.state||[]];r.length<t&&(r.length=t),r[t]=e,this.state=r}};this.#ge=(e,n)=>{const r=z(t,{...u,index:e,new:n});return r.index=e,r}}#me;#be;get selfAddable(){return this.#me.get()}set selfAddable(e){this.#me.set("boolean"==typeof e?e:null)}get addable(){return this.#be.get()}set addable(e){this.#me.set("boolean"==typeof e?e:null)}insert(e,t=null,n){if(!this.addable)return!1;const r=this.value||[];if(!Array.isArray(r))return!1;const s=[...this.#pe.get()],i=Math.max(0,Math.min(Math.floor(e),s.length)),o=this.#ge(i,n);o.new=!0,s.splice(i,0,o);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(i,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(i,0,{}),this.state=e}return this.#pe.set(s),this.value=a,!0}add(e=null){return this.insert(this.#pe.get().length,e)}remove(e){const t=this.value;if(!Array.isArray(t))return;const n=[...this.#pe.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;const i=[...t],[o]=i.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.#pe.set(n),this.value=i,o}move(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#pe.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let i=Math.min(e,t),o=Math.max(e,t);for(let e=i;e<=o;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.#pe.set(r),this.value=a,!0}exchange(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#pe.get()],s=r[e],i=r[t];if(!s||!i)return!1;r[t]=s,r[e]=i,s.index=t,i.index=e;const o=[...n],a=o[e],l=o[t];o[t]=a,o[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.#pe.set(r),this.value=o,!0}}function Z(e){if(!e?.length)return[];const t=[];let n=[],r=Object.create(null),s=!1;for(const t of e){if("string"==typeof t)continue;const e=t.template;if(!e)continue;s=!0;const n=X(t);r[e]={params:t.params,children:n?[n]:[]}}function i(e){e.length&&t.push({type:"divergent",children:e.map((([e,t])=>{const n=X(t);return n?"string"!=typeof n&&"fragment"===n.type?[n,e]:[{children:[n]},e]:[{children:[]},e]}))})}for(const r of e){if("string"==typeof r){i(n),n=[],t.push(r);continue}if(r.template){i(n),n=[];continue}if(n.length&&r.else){const e=r.if||null;n.push([e,r]),e||(i(n),n=[]);continue}i(n),n=[];const e=r.if;if(e){n.push([e,r]);continue}const s=X(r);s&&t.push(s)}return i(n),s?[{type:"fragment",templates:r,children:t}]:t}function X(e){let t=function(e){const t=e.fragment;if(t&&"string"==typeof t)return{type:"template",template:t,attrs:e.attrs,children:[]};const n=function({text:e,html:t}){return null!=e?{type:"content",value:e}:null!=t?{type:"content",value:t,html:!0}:void 0}(e),r=n?[n]:Z(e.children);return!e.name||t?n||{type:"fragment",children:r}:{name:e.name,is:e.is,attrs:e.attrs,events:e.events,classes:e.classes,styles:e.styles,enhancements:e.enhancements,bind:e.bind,comment:e.comment,children:r}}(e),n=e.vars;n.length&&t&&"string"!=typeof t&&(t.vars?t.vars=[...n,...t.vars]:t?t.vars=n:t={type:"fragment",vars:n,children:[]},n=null);const r=e.enum,s=e.value;return r&&(t={type:"enum",value:r,sort:e.sort,vars:n,children:t?[t]:[]},n=null),s&&(t={type:"value",name:s,vars:n,children:t?[t]:[]},n=null),n?.length&&(t={type:"fragment",vars:n,children:t?[t]:[]}),t}!function(e){W=e}(Q);const J=/^([+-]?(\d(_?\d)*(\.(\d(_?\d)*)?)?|\.\d(_?\d)*)(?:e[+-]?\d(_?\d)*)|0(b[01](?:_?[01])*|o[0-7](?:_?[0-7])*|x[\dA-F](?:_?[\dA-F])*))$/is;const ee={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class te extends Error{constructor(e,...t){const n=ee[e];super("function"==typeof n?n(...t):n),this.code=e}}const ne=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,re=/^~(?<enhancement>[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_\d\.]*)(?:(?<decorator>[:@!])(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*))?$/u,se=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function ie(e,t){const n=e[t];if(n)return n;const r={attrs:Object.create(null),events:Object.create(null)};return e[t]=r,r}function oe(e,t){const n=e.replace(/$\s+|\s+$/gs,"");if("null"===n)return{value:null};if("true"===n)return{value:!0};if("false"===n)return{value:!1};const r=function(e){return J.test(e)?Number(e.replaceAll("_","")):NaN}(n);return Number.isNaN(r)?se.test(n)?{name:n}:{calc:t(e)}:{value:r}}function ae(e,t,n,r,s){const{attrs:i,events:o,classes:a,styles:l,vars:c,params:u,enhancements:f}=e;return function(d,h){const p=d.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"),g=(ne.exec(p)||re.exec(p))?.groups;if(!g)throw new te("ATTR",d);const{name:m,enhancement:b}=g,v=g.decorator?.toLowerCase();if(b){if(":"===v)ie(f,b).attrs[m]=h?oe(h,t):{name:m};else if("@"===v)ie(f,b).events[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m};else if("!"===v){if("bind"===m)ie(f,b).bind=h||!0}else ie(f,b).value=oe(h,t);return}if(!v)return void(i[m]={value:h});if(":"===v)return void(i[m]=h?oe(h,t):{name:m});if("."===v)return void(a[m]=h?oe(h,t):{name:m});if("style:"===v)return void(l[m]=oe(h,t));if("@"===v)return void(o[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m});if("+"===v)return void c.push({...h?oe(h,n):{value:void 0},variable:m,init:!0});if("*"===v)return void c.push({...oe(h,t),variable:m,init:!1});if("?"===v)return void(u[m]=oe(h,t));if("!"!==v)return;switch(m.toString()){case"fragment":e.fragment=h||!0;break;case"else":e.else=!0;break;case"enum":e.enum=h?oe(h,t):{value:!0};break;case"sort":e.sort=h?oe(h,t):{value:!0};break;case"if":e.if=oe(h,t);break;case"text":e.text=oe(h,t);break;case"html":s&&(e.html=oe(h,t));break;case"template":e.template=h;break;case"bind":e.bind=h||!0;break;case"value":e.value=h;break;case"comment":e.comment=h}}}function le(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:[],params:Object.create(null),enhancements:Object.create(null)}}var ce={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};const ue=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function fe(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function de(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function he(...e){console.error(new te(...e))}function pe(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in ce?ce[t]:(he("ENTITY",e),e)}var ge=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new te("CALC")},createInit:n=t,createEvent:r=()=>{throw new te("EVENT")},simpleTag:s=new Set,enableHTML:i=!1}={}){const o=[],a={children:o},l=[];let c=null,u=a;function f(){c=l.pop()||null,u=c||a}function d(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&u.children.push(e)}let h={},p=0;function g(t){if(t<=p)return;d(e.substring(p,t).replace(/&#?\w+;/g,pe)),p=t}for(;;){const m=e.indexOf("<",p);if(m<0){const A=e.substring(p);A.match(/^\s*$/)||d(A);break}m>p&&g(m);const b=e.charAt(m+1);if("!"===b){let j=m+2,L=">";if("--"===e.slice(m+2,m+4)&&(j+=4,L="--\x3e"),p=e.indexOf(L,j),p<0)break;p++;continue}if("/"===b){p=e.indexOf(">",m+3);let T=e.substring(m+2,p);if(p<0?(T=e.substring(m+2).replace(/[\s<].*/,""),he("UNCOMPLETED",T,c?.name),p=m+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),he("UNCOMPLETED",T),p=m+1+T.length),c){const M=c.name;if(M===T)f();else{if(M.toLowerCase()!=T.toLowerCase())throw new te("CLOSE",T,c.name);f()}}p++;continue}function v(t){let n=p+1;if(p=e.indexOf(t,n),p<0)throw new te("QUOTE",t);const r=e.slice(n,p).replace(/&#?\w+;/g,pe);return p++,r}function y(){let t=e.charAt(p);for(;t<=" "||""===t;t=e.charAt(++p));return t}function w(){let t=p,n=e.charAt(p);for(;fe(n);)p++,n=e.charAt(p);return e.slice(t,p)}p=m+1;let x=e.charAt(p);switch(x){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case">":case"/":throw new te("SYMBOL",x);case"":throw new te("EOF")}const S=w(),O=ue.exec(S)?.groups;if(!O)throw new te("TAG",S);l.push(c),c=le(O.name,O.is),u.children.push(c),u=c;const E=ae(c,t,n,r,i);let C=!0,$=!1;e:for(;C;){let N=y();switch(N){case"":he("EOF"),p++;break e;case">":p++;break e;case"/":$=!0;break e;case'"':case"'":throw new te("ATTR_VALUE");case"=":throw new te("SYMBOL",N)}const k=w();if(!k){he("EOF"),p++;break e}switch(N=y(),N){case"":he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),$=!0;break e;case"=":p++;break;case"'":case'"':E(k,v(N));continue;default:E(k,"");continue}switch(N=y(),N){case"":E(k,""),he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),$=!0;break e;case"'":case'"':E(k,v(N));continue}E(k,w())}if($){for(;;){p++;const I=e.charAt(p);if("/"!==I&&!(I<=" "||""===I))break}switch(e.charAt(p)){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case"":he("EOF");break;case">":p++;break;default:throw new te("CLOSE_SYMBOL")}f()}else(s.has(S)||de(e,p,S,h))&&f()}return Z(o)}});function me(t){let n=!0;const r=new e.Signal.subtle.Watcher((()=>{n&&(n=!1,queueMicrotask((()=>{n=!0;for(const e of r.getPending())e.get();r.watch()})))})),s=new e.Signal.Computed(t);return r.watch(s),s.get(),()=>{r.unwatch(s)}}function be(e,t,n){let r,s=!1;return me((()=>{const i=e();if(!s)return s=!0,r=i,void(n&&t(i));Object.is(i,r)||(r=i,t(i))}))}const ve=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,ref:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,changed:!0,loading:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,minLength:!0,maxLength:!0,pattern:!0,values:!0,null:!0,index:!0,no:!0,size:!0,error:!0,errors:!0}));function*ye(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of ve)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],yield[`${t}${n}reset`,{exec:()=>e.reset()}],yield[`${t}${n}validate`,{exec:t=>e.validate(t?[]:null)}],e instanceof Q?(yield[`${t}${n}addable`,{get:()=>e.addable}],yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}]):yield[`${t}${n}addable`,{get:()=>!1}]}function we(e,t,n){for(const[n,r]of t){for(const[t,s]of ye(r,n))e[t]=s;for(const[t,s]of ye(r,n,"$$"))e[t]=s}}const xe={value$:{calc:e=>e?.[_].value},state$:{calc:e=>e?.[_].state}};var Se=Object.getOwnPropertyDescriptors(xe);function Oe(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function Ee(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class Ce{exec({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#ve[e];if("function"!=typeof t?.get)return;return t.get()}return"function"==typeof t?t(this.getters):n}get({name:t,calc:n,value:r}){if("string"==typeof t){const e=this.#ve[t];if("function"!=typeof e?.get)return;const{get:n,set:r}=e;return{get:n,set:r}}if("function"==typeof n){const t=new e.Signal.Computed((()=>n(this.getters)));return{get:()=>t.get()}}return{get:()=>r}}watch(e,t){return be((()=>this.exec(e)),t,!0)}enum(e){const{name:t,calc:n}=e;if("function"==typeof n)return()=>n(this.getters);if("string"==typeof t){const e=this.#ve[t];if("function"!=typeof e?.get)return null;const n=e.store;return n instanceof Y?n:e.get}return this.store}getStore(e){if(!e)return null;const t=this.#ve[!0===e?"":e];return t?.get&&t.store||null}bind(e,t,n){const r=this.#ve[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?ve.has(t)?be((()=>s[t]),n,!0):void 0:"value"===t?be((()=>r.get()),n,!0):void 0}bindAll(e){const t=this.#ve[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>be(e,t,!0)}}return Object.fromEntries([...ve].map((e=>[`$${e}`,t=>be((()=>n[e]),t,!0)])))}getBindAll(e){const t=this.#ve[!0===e?"":e];if(!t?.get)return{};const{store:n}=t;if(!n){const{get:e,set:n}=t;return{$value:{get:e,set:n}}}return Object.fromEntries([...ve].map((e=>[`$${e}`,"value"===e||"state"===e?{get:()=>n[e],set:t=>{n[e]=t}}:{get:()=>n[e]}])))}bindSet(e,t){const n=this.#ve[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#ve[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)},$reset:e=>{n.reset()},$validate:e=>{n.validate(e?[]:null)}}}getEvent({name:e,event:t}){if("function"==typeof t)return t;const n=this.#ve[e];if(!n)return null;const{exec:r,calc:s}=n;return"function"==typeof r?r:"function"==typeof s?s:null}constructor(e,t){if(this.store=e,t instanceof Ce){this.#ye=t.#ye;const e=this.#we;for(const[n,r]of Object.entries(t.#we))e[n]=r;const n=this.#xe;for(const[e,r]of Object.entries(t.#xe))n[e]=r}else we(this.#we,e),this.#ye=function(e){const t=Object.create(null,Se);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!Oe(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof Y){for(const[e,s]of ye(r,n))t[e]=s;continue}const{get:e,set:s,exec:i,calc:o}=r;"function"!=typeof e?"function"==typeof o||o&&"object"==typeof o?t[n]={calc:o}:("function"==typeof i||o&&"object"==typeof o)&&(t[n]={exec:i}):t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#ye;#we=Object.create(null);#xe=Object.create(null);store;#Se=null;#s=null;#Oe=null;get#ve(){const e=this.#Oe;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#we,...this.#ye,...this.#xe})),n=this.store,r=this.#s,s=this.#Se;for(const[e,r]of ye(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof Q))return yield[`${n}${r}removable`,{get:()=>!1}],yield[`${n}${r}upMovable`,{get:()=>!1}],yield[`${n}${r}downMovable`,{get:()=>!1}],yield[`${n}${r}remove`,{exec:()=>{}}],yield[`${n}${r}upMove`,{exec:()=>{}}],void(yield[`${n}${r}downMove`,{exec:()=>{}}]);yield[`${n}${r}removable`,{get:()=>!e.readonly&&!e.disabled&&!!t.removable}],yield[`${n}${r}upMovable`,{get:()=>{if(e.readonly)return!1;if(e.disabled)return!1;const n=t.index;return"number"==typeof n&&!(n<=0)}}],yield[`${n}${r}downMovable`,{get:()=>{if(e.readonly)return!1;if(e.disabled)return!1;const n=t.index;return"number"==typeof n&&!(n>=e.size-1)}}],yield[`${n}${r}remove`,{exec:()=>{e.readonly||e.disabled||t.removable&&e.remove(Number(t.index))}}],yield[`${n}${r}upMove`,{exec:()=>{if(e.readonly)return;if(e.disabled)return;const n=t.index;"number"==typeof n&&(n<=0||e.move(n,n-1))}}],yield[`${n}${r}downMove`,{exec:()=>{if(e.readonly)return;if(e.disabled)return;const n=t.index;"number"==typeof n&&(n>=e.size-1||e.move(n,n+1))}}]}(r,n))t[e]=s;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};return this.#Oe=t,t}setStore(e,t,n){const r=new Ce(e,this);return t&&(r.#s=t),we(r.#we,e),n&&(r.#Se=n),r}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new Ce(t,this);return we(n.#we,t),n}params(t,n,r,s){let i=this.store;if(!0===s)i=r.store;else if(s){const e=r.#ve[s],t=e?.get&&e.store;t&&(i=t)}if(0===Object.keys(t).length)return this;const o=new Ce(i,this);o.#s=this.#s,o.#Se=this.#Se;const a=o.#xe,l=o.#ve;for(const[s,i]of Object.entries(t)){const t=s in n?n[s]:null;if(t){const{name:n,calc:i,value:o}=t;if(n){const e=r.#ve[n];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ye(e.store,s))a[t]=l[t]=n;continue}if("function"==typeof i){const t=new e.Signal.Computed((()=>i(r.getters)));a[s]=l[s]={get:()=>t.get()};continue}a[s]=l[s]={get:()=>o}}else{const{name:t,calc:n,value:r}=i;if("function"==typeof n){const t=o.getters;o.#Ee=null;const r=new e.Signal.Computed((()=>n(t)));a[s]=l[s]={get:()=>r.get()};continue}if(t){const e=l[t];if(!e?.get)continue;if(!e.store){a[s]=l[s]=e;continue}for(const[t,n]of ye(e.store,s))a[t]=l[t]=n;continue}a[s]=l[s]={get:()=>r}}}return o}setObject(e){const t=new Ce(this.store,this);return t.#Se=e,t}set(t){if(!t?.length)return this;const n=new Ce(this.store,this);n.#s=this.#s,n.#Se=this.#Se;const r=n.#xe,s=n.#ve;for(const{variable:i,name:o,calc:a,value:l,init:c}of t)if(c){const t=new e.Signal.State(l);if("function"==typeof a){const e=n.settable;n.#Ce=null,t.set(a(e))}else if(o){const e=s[o];if(!e?.get)continue;t.set(e.get())}r[i]=s[i]={get:()=>t.get(),set:e=>{t.set(e)}}}else if("function"!=typeof a)if(o){const e=s[o];if(!e)continue;if(!e.get||!e.store){r[i]=s[i]=e;continue}for(const[t,n]of ye(e.store,i))r[t]=s[t]=n}else r[i]=s[i]={get:()=>l};else{const t=n.getters;n.#Ee=null;const o=new e.Signal.Computed((()=>a(t)));r[i]=s[i]={get:()=>o.get()}}return n}#$e=null;get all(){const e=this.#$e;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#ve))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc?Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1}):Object.defineProperty(t,e,{value:n.exec,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#$e=t,t}#Ce=null;get settable(){const e=this.#Ce;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#ve))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Ce=t,t}#Ee=null;get getters(){const e=this.#Ee;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#ve))n.get?Object.defineProperty(t,e,{get:n.get,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Ee=t,t}}const $e={width:"px",height:"px",top:"px",right:"px",bottom:"px",left:"px",border:"px","border-top":"px","border-right":"px","border-left":"px","border-bottom":"px","border-width":"px","border-top-width":"px","border-right-width":"px","border-left-width":"px","border-bottom-width":"px","border-radius":"px","border-top-left-radius":"px","border-top-right-radius":"px","border-bottom-left-radius":"px","border-bottom-right-radius":"px",padding:"px","padding-top":"px","padding-right":"px","padding-left":"px","padding-bottom":"px",margin:"px","margin-top":"px","margin-right":"px","margin-left":"px","margin-bottom":"px"};function Ae(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in $e?`${s}${$e[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class je{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let i=r.get(s);return i||(i=new Set,r.set(s,i)),i.add(n),()=>{i?.delete(n)}}}const Le={stop(e){e instanceof Event&&e.stopPropagation()},prevent(e){e instanceof Event&&e.preventDefault()},self(e){if(e instanceof Event)return e.target===e.currentTarget},enter(e){if(e instanceof KeyboardEvent)return"Enter"===e.key},tab(e){if(e instanceof KeyboardEvent)return"Tab"===e.key},esc(e){if(e instanceof KeyboardEvent)return"Escape"===e.key},space(e){if(e instanceof KeyboardEvent)return" "===e.key},backspace(e){if(e instanceof KeyboardEvent)return"Backspace"===e.key},delete(e){if(e instanceof KeyboardEvent)return"Delete"===e.key},delBack(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},"del-back"(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},insert(e){if(e instanceof KeyboardEvent)return"Insert"===e.key},repeat(e){if(e instanceof KeyboardEvent)return e.repeat},key(e,t){if(e instanceof KeyboardEvent){const n=e.code.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},main(e){if(e instanceof MouseEvent)return 0===e.button},auxiliary(e){if(e instanceof MouseEvent)return 1===e.button},secondary(e){if(e instanceof MouseEvent)return 2===e.button},left(e){if(e instanceof MouseEvent)return 0===e.button},middle(e){if(e instanceof MouseEvent)return 1===e.button},right(e){if(e instanceof MouseEvent)return 2===e.button},primary(e){if(e instanceof PointerEvent)return e.isPrimary},mouse(e){if(e instanceof PointerEvent)return"mouse"===e.pointerType},pen(e){if(e instanceof PointerEvent)return"pen"===e.pointerType},touch(e){if(e instanceof PointerEvent)return"touch"===e.pointerType},pointer(e,t){if(e instanceof PointerEvent){const n=e.pointerType.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},ctrl(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey},alt(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.altKey},shift(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.shiftKey},meta(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.metaKey},cmd(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey||e.metaKey}};function Te(e,t,n){const r=[];if(t)for(let s=e.shift();s;s=e.shift()){const e=s.indexOf(":"),i=e>=0?s.slice(0,e):s,o=e>=0?s.slice(e+1).split(":"):[],a=i.replace(/^-+/,""),l=(i.length-a.length)%2==1;let c=t[a]||a;if(n)switch(c){case"once":case"passive":case"capture":n[c]=!l;continue}"string"==typeof c&&(c=Le[c]),"function"==typeof c&&r.push([c,o,l])}return r}function Me(e,t,n){return r=>{const s=e.all;for(const[e,t,i]of n)if(e(r,t,s)===i)return;t(r,s)}}function Ne(e){return"number"==typeof e||"bigint"==typeof e?String(e):"boolean"==typeof e?e?"":null:"string"==typeof e?e:null===(e??null)?null:String(e)}function ke(e){return null===(e??null)?"":String(e)}function Ie(e,t){if(e instanceof HTMLInputElement&&"checked"===t)switch(e.type.toLowerCase()){case"checkbox":case"radio":return Boolean}if((e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&"value"===t)return ke;if(e instanceof HTMLDetailsElement&&"open"===t)return Boolean;if(e instanceof HTMLMediaElement){if("muted"===t)return Boolean;if("paused"===t)return Boolean;if("currentTime"===t)return!0;if("playbackRate"===t)return!0;if("volume"===t)return!0}return!1}const Pe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ke(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Ue(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watch:s,props:i}=e;return["input","textarea","select"].includes(t.toLowerCase())&&e.relate(r),e.listen("init",(({events:n})=>{const o=Pe[t.toLowerCase()],a=o?.attrs||{},l=o?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,i]=n;r.addEventListener(e,(e=>t(i(e,r))),s)}}if(i)for(const[t,n]of Object.entries(e.attrs))if(s(t,(e=>{if(i.has(t))r[t]=e;else{const n=Ne(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),i.has(t))r[t]=n;else{const e=Ne(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.attrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=Ne(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=Ie(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let i=Ne(n);null!==i&&r.setAttribute(t,i),s(t,(e=>{const n=Ne(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Be(e){return null===(e??null)?"":String(e)}function Re(e,t,n,r,s){if(!s){const s=e.insertBefore(document.createTextNode(""),t),i=n.watch(r,(e=>s.textContent=Be(e)));return()=>{s.remove(),i()}}const i=e.insertBefore(document.createComment(""),t),o=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=i.nextSibling;e&&e!==o;e=i.nextSibling)e.remove()}const c=n.watch(r,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=i.firstChild)e.insertBefore(t,o)}(Be(t))}));return()=>{c(),l(),i.remove(),o.remove()}}function qe(e,t){if("bigint"==typeof e&&"bigint"==typeof t)return Number(e-t);if(!("number"!=typeof e&&"bigint"!=typeof e||"number"!=typeof t&&"bigint"!=typeof t))return Number(e)-Number(t);const n=String(e),r=String(t);return n>r?1:n<r?-1:0}const _e=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function Ve(e,t,n,r,s){const i=e.children;if(!i.length)return()=>{};const o=t.insertBefore(document.createComment(""),n);let a=null,l=()=>{};const c=be((()=>i.find((([,e])=>!e||r.exec(e)))||null),(e=>{if(e===a)return;a=e,l(),l=()=>{};const t=e?.[0];t&&(l=s(t.children,t.vars,t.templates))}),!0);let u=!1;return()=>{u||(u=!0,c(),l(),l=()=>{},o.remove())}}function De(t,n,r,s,i,o,a,l,c){const u=t.bind,f=[...o,t.name],d=c?.(f);if(c&&!d)return()=>{};const{context:h,handler:p}=function(t,n,r,s){const i="string"==typeof t?t:t.tag,{attrs:o,events:a}="string"!=typeof t&&t||{attrs:null,events:null};let l=!1;const c=new e.Signal.State(!1);let u=!1;const f=new e.Signal.State(!1),d=Object.create(null),h=Object.create(null),p=new Set,g=[],m=new je;return{context:{events:g,props:o?new Set(Object.entries(o).filter((([,e])=>e.isProp)).map((([e])=>e))):null,attrs:h,watch(e,t){if(l)return()=>{};const n=d[e];if(!n)return()=>{};let r=n.get();const s=be((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}),!0);return p.add(s),()=>{p.delete(s),s()}},relate(e){if(!r||!s||l)return()=>{};try{const t=s(r,e);return"function"!=typeof t?()=>{}:(p.add(t),()=>{p.delete(t),t()})}catch{return()=>{}}},get destroyed(){return c.get()},get init(){return f.get()},listen:(e,t)=>m.listen(e,t)},handler:{tag:i,set(t,n){if(o&&!(t in o))return;let r=d[t];if(r)return void r.set(n);const s=new e.Signal.State(n);d[t]=s,Object.defineProperty(h,t,{configurable:!0,enumerable:!0,get:s.get.bind(s)})},addEvent(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),i=a?a[r].filters:{};if(!i)return;const o={},l=Te(s,i,o);g.push([r,Me(n,t,l),o])},destroy(){if(!l){l=!0,c.set(!0);for(const e of p)e();m.emit("destroy")}},mount(){u||(u=!0,f.set(!0),m.emit("init",{events:g}))}}}}(d||t.name,s,s.getStore(u),l),g=d?.attrs,m=g?function(e,t,n,r,s){let i=new Set;for(const[o,a]of Object.entries(r)){if("class"===o||"style"===o)continue;if(o in n){const r=n[o],{name:s,calc:l,value:c}=n[o];if(!s&&!l){e.set(o,c);continue}a.immutable&&e.set(o,t.exec(r)),i.add(t.watch(r,(t=>e.set(o,t))));continue}const r=a.bind;if(!s||!r){e.set(o,a.default);continue}if("string"==typeof r){const n=t.bind(s,r,(t=>e.set(o,t)));n?i.add(n):e.set(o,a.default);continue}if(!Array.isArray(r)){e.set(o,a.default);continue}const[l,c,u]=r;if(!l||"function"!=typeof c)continue;if(!u){const n=!0===s?"":s;i.add(t.watch({name:n},(t=>e.set(o,t)))),e.addEvent(l,((...e)=>{t.all[n]=c(...e)}));continue}const f=t.bind(s,"state",(t=>e.set(o,t)));if(!f)continue;i.add(f);const d=t.bindSet(s,"state");d&&e.addEvent(l,((...e)=>{d(c(...e))}))}return()=>{const e=i;i=new Set;for(const t of e)t()}}(p,s,t.attrs,g,u):function(e,t,n){const r=e.tag;let s=new Set;for(const[i,o]of Object.entries(n)){if("class"===i||"style"===i)continue;const{name:n,calc:a,value:l}=o;if(n||a)if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==i.toLocaleLowerCase())s.add(t.watch(o,(t=>e.set(i,t))));else{const n=t.exec(o);e.set(i,n)}else e.set(i,l)}return()=>{const e=s;s=new Set;for(const t of e)t()}}(p,s,t.attrs);for(const[e,n]of Object.entries(t.events)){const t=s.getEvent(n);t&&p.addEvent(e,t)}const b=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,i]of Object.entries(t.bindAll(n)||{}))"function"==typeof i&&r.add(i((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(p,s,u),v=d?"function"==typeof d.tag?d.tag(h):Ue(h,d.tag,d.is):Ue(h,t.name,t.is),y=Array.isArray(v)?v[0]:v,w=Array.isArray(v)?v[1]:y;n.insertBefore(y,r);const x=w?ze(t.children||[],w,null,s,i,o,a,l,c):()=>{},S=function(e,t,n,r){if(!(e instanceof Element))return()=>{};r&&(e.className+=" "+t.exec(r));let s=new Set;for(const[r,i]of Object.entries(n))i.value?e.classList.add(r):s.add(be((()=>Boolean(t.exec(i))),(t=>{t?e.classList.add(r):e.classList.remove(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(y,s,t.classes,t.attrs.class),O=function(e,t,n,r){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};if(r){const n=[e.getAttribute("style")||"",t.exec(r)||""].filter(Boolean).join(";");n&&e.setAttribute("style",n)}let s=new Set;for(const[r,i]of Object.entries(n))s.add(be((()=>Ae(r,t.exec(i))),(t=>{t?e.style.setProperty(r,...t):e.style.removeProperty(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(y,s,t.styles,t.attrs.style);p.mount();const E=function(t,n,r,s,i,o){let a=new Set;for(const[l,{attrs:c,value:u,events:f,bind:d}]of Object.entries(n)){if(!_e(s,l))continue;const h=s[l];if("function"!=typeof h)continue;let p=!1;const g=new e.Signal.State(!1),m=h?.events,b=[],v=Object.create(null),y=new Set,w=new je;function x(e,t){if("function"!=typeof t)return;const[n,...s]=e.split(".").filter(Boolean),i=m?m[n].filters:{};if(!i)return;const o={},a=Te(s,i,o);b.push([n,Me(r,t,a),o])}function S(){if(!p){p=!0,g.set(!0);for(const e of y)e();w.emit("destroy")}}a.add(S);for(const[E,C]of Object.entries(c)){const $=r.get(C);$&&Object.defineProperty(v,E,{...$,configurable:!0,enumerable:!0})}for(const[A,j]of Object.entries(f)){const L=r.getEvent(j);L&&x(A,L)}if(d){for(const[T,M]of Object.entries(r.getBindAll(d)||{}))Object.defineProperty(v,T,{...M,configurable:!0,enumerable:!0});for(const[N,k]of Object.entries(r.bindEvents(d)||{}))x(N,(e=>k(e)))}const O={get value(){return null},events:b,attrs:v,watch(e,t){if(p)return()=>{};let n=v[e];const r=be((()=>v[e]),(r=>{const s=n;n=r,t(r,s,e)}),!0);return y.add(r),()=>{y.delete(r),r()}},get destroyed(){return g.get()},listen:(e,t)=>w.listen(e,t),root:i,slot:o,tag:t};if(u){const I=r.get(u);I&&Object.defineProperty(O,"value",{...I,configurable:!0,enumerable:!0})}h(O)}return()=>{const e=a;a=new Set;for(const t of e)t()}}(p.tag,t.enhancements,s,a,y,w);return()=>{E(),p.destroy(),y.remove(),m(),x(),b(),S(),O()}}function We(e,t,n){if(!n)return t;const r=Object.entries(n);if(!r.length)return t;const s=Object.create(t);for(const[t,n]of r)s[t]=[n,e];return s}function Ke(t,n,r,s,i,o,a,l,c){if("string"==typeof t){const e=document.createTextNode(t);return n.insertBefore(e,r),()=>e.remove()}const u=s.set(t.vars),f=We(u,i,t.templates);if("divergent"===t.type)return Ve(t,n,r,u,((e,t,s)=>{const f=u.set(t),d=We(f,i,s);return ze(e,n,r,f,d,o,a,l,c)}));if("value"===t.type){const e=u.child(t.name);return e?ze(t.children,n,r,e,f,o,a,l,c):()=>{}}if("enum"===t.type){const s=u.enum(t.value),i=(e,r)=>ze(t.children,n,e,r,f,o,a,l,c);return s instanceof Q?function(t,n,r,s,i){const o=t.insertBefore(document.createComment(""),n);let a=new Map;function l(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const c=new e.Signal.State(0),u=be((()=>r.children),(function(e){if(!o.parentNode)return;let n=o.nextSibling;const u=a;a=new Map,c.set(e.length);for(let o of e){const e=u.get(o);if(!e){const e=t.insertBefore(document.createComment(""),n),l=t.insertBefore(document.createComment(""),n),u=i(l,s.setStore(o,r,{get count(){return c.get()},get key(){return o.index},get index(){return o.index},get item(){return o.value}}));a.set(o,[e,l,u]);continue}if(u.delete(o),a.set(o,e),n===e[0]){n=e[1].nextSibling;continue}let l=e[0];for(;l&&l!==e[1];){const e=l;l=l.nextSibling,t.insertBefore(e,n)}t.insertBefore(e[1],n)}l(u)}),!0);return()=>{o.remove(),l(a),u()}}(n,r,s,u,i,t.sort):s instanceof G?function(e,t,n,r,s,i){const o=[],a=[...n],l=a.length,c=i?a.map((([e,t])=>[e,t,r.setStore(t,n).exec(i)])).sort((([,,e],[,,t])=>qe(e,t))).map((([e,t],n)=>[e,t,n])):a.map((([e,t],n)=>[e,t,n]));for(const[e,i,a]of c)o.push(s(t,r.setStore(i,n,{get count(){return l},get key(){return e},get index(){return a},get item(){return i.value}})));return()=>{for(const e of o)e()}}(0,r,s,u,i,t.sort):"function"==typeof s?function(t,n,r,s,i,o){const a=new e.Signal.Computed((()=>{const e=r();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t])):Object.entries(e).map((([e,t])=>[t,e])):[]})),l=o?new e.Signal.Computed((()=>{const e=a.get();return e.map((([t,n],r)=>[n,t,s.setObject({get count(){return e.length},get key(){return t},get item(){return n},get index(){return r}}).exec(o)])).sort((([,,e],[,,t])=>qe(e,t))).map((([e,t],n)=>[t,n,e]))})):new e.Signal.Computed((()=>a.get().map((([e,t],n)=>[t,n,e])))),c=t.insertBefore(document.createComment(""),n);let u=[];function f(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const d=new e.Signal.State(0),h=be((()=>l.get()),(function(n){if(!c.parentNode)return;let r=c.nextSibling;const o=u;u=[],d.set(n.length);for(const[a,l,c]of n){const n=o.findIndex((e=>e[3]===c)),[f]=n>=0?o.splice(n,1):[];if(!f){const n=t.insertBefore(document.createComment(""),r),o=t.insertBefore(document.createComment(""),r),f=new e.Signal.State(a),h=new e.Signal.State(l),p=i(o,s.setObject({get count(){return d.get()},get key(){return c},get item(){return f.get()},get index(){return h.get()}}));u.push([n,o,p,c,f,h]);continue}if(u.push(f),f[4].set(a),f[5].set(l),r===f[0]){r=f[1].nextSibling;continue}let h=f[0];for(;h&&h!==f[1];){const e=h;h=h.nextSibling,t.insertBefore(e,r)}t.insertBefore(f[1],r)}f(o)}),!0);return()=>{c.remove(),f(u),h()}}(n,r,s,u,i,t.sort):()=>{}}if("content"===t.type)return Re(n,r,u,t.value,t.html);if("template"===t.type){const e=f[t.template];if(!e)return()=>{};const[s,d]=e,h=d.params(s.params,t.attrs,u,t.bind),p=We(h,i,s.templates);return ze(s.children,n,r,h,p,o,a,l,c)}return"fragment"===t.type?ze(t.children,n,r,u,f,o,a,l,c):De(t,n,r,u,f,o,a,l,c)}function ze(e,t,n,r,s,i,o,a,l){const c=e.map((e=>Ke(e,t,n,r,s,i,o,a,l)));let u=!1;return()=>{if(!u){u=!0;for(const e of c)e()}}}e.ArrayStore=Q,e.Layout=ge,e.ObjectStore=G,e.Store=Y,e.effect=me,e.render=function(e,t,n,{component:r,global:s,relate:i,enhancements:o}={}){return ze(t,n,null,new Ce(e,s),Object.create(null),[],o||{},"function"==typeof i?i:null,r)},e.watch=be}));
|
package/index.min.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.14.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -57,4 +57,4 @@ function(){throw new Error};function A(){return d(this),this.value}function j(e,
|
|
|
57
57
|
* Use of this source code is governed by an MIT-style license that can be
|
|
58
58
|
* found in the LICENSE file at https://angular.io/license
|
|
59
59
|
*/
|
|
60
|
-
function(e){const t=Object.create(L);t.value=e;const n=()=>(d(t),t.value);return n[c]=t,n}(n),a=i[c];if(this[T]=a,a.wrapper=this,s){const t=s.equals;t&&(a.equal=t),a.watched=s[e.subtle.watched],a.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return A.call(this[T])}set(t){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(a)throw new Error("Writes to signals not permitted during Watcher callback");j(this[T],t)}};h=T,p=new WeakSet,e.isComputed=e=>n(p,e),e.Computed=class{constructor(n,s){r(this,p),t(this,h);const o=function(e){const t=Object.create(C);t.computation=e;const n=()=>x(t);return n[c]=t,n}(n),i=o[c];if(i.consumerAllowSignalWrites=!0,this[T]=i,i.wrapper=this,s){const t=s.equals;t&&(i.equal=t),i.watched=s[e.subtle.watched],i.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return x(this[T])}},(o=>{var a,l,c,h;o.untrack=function(e){let t,n=null;try{n=u(null),t=e()}finally{u(n)}return t},o.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[T].producerNode)?void 0:n.map((e=>e.wrapper)))??[]},o.introspectSinks=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(n=t[T].liveConsumerNode)?void 0:n.map((e=>e.wrapper)))??[]},o.hasSinks=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called hasSinks without a Signal argument");const n=t[T].liveConsumerNode;return!!n&&n.length>0},o.hasSources=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called hasSources without a Computed or Watcher argument");const n=t[T].producerNode;return!!n&&n.length>0};a=T,l=new WeakSet,c=new WeakSet,h=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>n(l,e),o.Watcher=class{constructor(e){r(this,l),r(this,c),t(this,a);let n=Object.create(f);n.wrapper=this,n.consumerMarkedDirty=e,n.consumerIsAlwaysLive=!0,n.consumerAllowSignalWrites=!1,n.producerNode=[],this[T]=n}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[T];n.dirty=!1;const r=u(n);for(const e of t)d(e[T]);u(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[T];y(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){b(n.producerNode[e],n.producerIndexOfThis[e]);const t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){const t=n.producerIndexOfThis[e],r=n.producerNode[e];w(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[T].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},o.currentComputed=function(){var e;return null==(e=i)?void 0:e.wrapper},o.watched=Symbol("watched"),o.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(M||(M={}));const k=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,P=e=>e instanceof RegExp?e:null,U=Boolean;function B(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(B).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const R=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(B).filter(U);return t.length?t:null};function q(e,t,n,r){const s=new M.State(t(n));let o;if("function"==typeof r){const n=r;o=new M.Computed((()=>t(n(e))))}else{const e=t(r);o=new M.Computed((()=>e))}const i=new M.Computed((()=>{const e=s.get();return null===e?o.get():e}));return[s,i]}const _=Symbol();function V(e){const t={[_]:e};for(const[n,r]of e)Object.defineProperty(t,n,{get:()=>r.ref,configurable:!1,enumerable:!0});return Object.defineProperty(t,_,{get:()=>e,configurable:!1,enumerable:!0}),t}let D=null,W=null,K=Object.create(null);function z(e,t){const n=e.type;let r=Y;if(!e.array||W&&t?.parent instanceof W)if("string"==typeof n){const e=K[n];e&&(r=e)}else n&&"object"==typeof n&&D&&(r=D);else W&&(r=W);return new r(e,t)}function H(e){return e?e instanceof Error?e.message:"string"!=typeof e?"":e:""}function F(e,...t){const n=t.flat().filter((e=>"function"==typeof e));if(!n.length)return[()=>Promise.resolve([]),new M.Computed((()=>[])),()=>{}];const r=new M.State([]);let s=null;return[function(){s?.abort(),s=new AbortController;const t=s.signal;return r.set([]),Promise.all(n.map((n=>async function(t,n){let s=[];try{s.push(await t(e,n))}catch(e){s.push(e)}const o=s.flat().map(H).filter(Boolean);return!n.aborted&&o.length&&r.set([...r.get(),...o]),o}(n,t)))).then((e=>e.flat()))},new M.Computed((()=>r.get())),()=>{s?.abort(),r.set([])}]}class Y{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}static create(e,t={}){return z({type:e},{...t,parent:null})}static setStore(e,t){return function(e,t){K[e]=t}(e,t)}#t=!1;get null(){return this.#t}get kind(){return""}#n=null;get ref(){return this.#n||V(this)}constructor(e,{null:t,state:n,ref:r,setValue:s,setState:o,convert:i,onUpdate:a,onUpdateState:l,validator:c,validators:u,index:f,size:d,new:h,parent:p,hidden:g,clearable:m,required:b,disabled:v,readonly:y,removable:w,label:x,description:O,placeholder:S,min:E,max:C,step:$,minLength:A,maxLength:j,pattern:L,values:T}={}){this.schema=e,this.#r.set("object"==typeof n&&n||{});const U=p instanceof Y?p:null;U&&(this.#s=U,this.#o=U.#o),this.#i=e.type,this.#a=e.meta,this.#l=e.component;const B=new M.State(Boolean(h));this.#c=B;const _=U?new M.Computed((()=>U.#u.get()||B.get())):new M.Computed((()=>B.get()));this.#u=_;const D=Boolean(e.immutable),W=!1!==e.creatable;this.#f=D,this.#d=W;const K=e.readonly,z=new M.State("boolean"==typeof y?y:null);let G;if("function"==typeof K)G=new M.Computed((()=>Boolean(K(this))));else{const e=Boolean(K);G=new M.Computed((()=>e))}const Q=()=>{if(_.get()?!W:D)return!0;const e=z.get();return null===e?G.get():e},Z=U?U.#h:null;this.#p=z,this.#h=Z?new M.Computed((()=>Z.get()||Q())):new M.Computed(Q),[this.#g,this.#m]=N(this,g,e.hidden,U?U.#m:null),[this.#b,this.#v]=N(this,m,e.clearable,U?U.#v:null),[this.#y,this.#w]=N(this,b,e.required,U?U.#w:null),[this.#x,this.#O]=N(this,v,e.disabled,U?U.#O:null),[this.#S,this.#E]=q(this,k,x,e.label),[this.#C,this.#$]=q(this,k,O,e.description),[this.#A,this.#j]=q(this,k,S,e.placeholder),[this.#L,this.#T]=q(this,I,E,e.min),[this.#M,this.#N]=q(this,I,C,e.max),[this.#k,this.#I]=q(this,I,$,e.step),[this.#P,this.#U]=q(this,I,A,e.minLength),[this.#B,this.#R]=q(this,I,j,e.maxLength),[this.#q,this.#_]=q(this,P,L,e.pattern),[this.#V,this.#D]=q(this,R,T,e.values),[this.#W,this.#K]=N(this,w,e.removable??!0);const X=function(e,...t){const n=t.flat().filter((e=>"function"==typeof e));return n.length?new M.Computed((()=>{const t=[];for(const r of n)try{t.push(r(e))}catch(e){t.push(e)}return t.flat().map(H).filter(Boolean)})):new M.Computed((()=>[]))}(this,e.validator,c),[J,ee,te]=F(this,e.validators?.change,u?.change),[ne,re,se]=F(this,e.validators?.blur,u?.blur);if(this.listen("change",(()=>{J()})),this.listen("blur",(()=>{ne()})),this.#z=function(...e){const t=e.filter(Boolean);return new M.Computed((()=>t.flatMap((e=>e.get()))))}(X,ee,re),this.#H=X,this.#F=J,this.#Y=ne,this.#G=te,this.#Q=se,d instanceof M.State||d instanceof M.Computed?this.#Z=d:this.#Z=new M.State(d||0),t)return this.#t=!0,void(this.#n=V(this));this.#n=r||null,this.#X=a||null,this.#J=l||null,this.#ee="function"==typeof s?s:null,this.#te="function"==typeof o?o:null,this.#ne="function"==typeof i?i:null,this.#re.set(f??"");for(const[t,n]of Object.entries(e.events||{}))"function"==typeof n&&this.listen(t,n)}#ee=null;#te=null;#ne=null;#X=null;#J=null;#s=null;#o=this;#i;#a;#l;get store(){return this}get parent(){return this.#s}get root(){return this.#o}get type(){return this.#i}get meta(){return this.#a}get component(){return this.#l}#Z;get size(){return this.#Z.get()}#re=new M.State("");get index(){return this.#re.get()}set index(e){this.#re.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#d=!0;get creatable(){return this.#d}#f=!1;get immutable(){return this.#f}#u;#c;get selfNew(){return this.#c.get()}set selfNew(e){this.#c.set(Boolean(e))}get new(){return this.#u.get()}set new(e){this.#c.set(Boolean(e))}#g;#m;get selfHidden(){return this.#g.get()}set selfHidden(e){this.#g.set("boolean"==typeof e?e:null)}get hidden(){return this.#m.get()}set hidden(e){this.#g.set("boolean"==typeof e?e:null)}#b;#v;get selfClearable(){return this.#b.get()}set selfClearable(e){this.#b.set("boolean"==typeof e?e:null)}get clearable(){return this.#v.get()}set clearable(e){this.#b.set("boolean"==typeof e?e:null)}#y;#w;get selfRequired(){return this.#y.get()}set selfRequired(e){this.#y.set("boolean"==typeof e?e:null)}get required(){return this.#w.get()}set required(e){this.#y.set("boolean"==typeof e?e:null)}#x;#O;get selfDisabled(){return this.#x.get()}set selfDisabled(e){this.#x.set("boolean"==typeof e?e:null)}get disabled(){return this.#O.get()}set disabled(e){this.#x.set("boolean"==typeof e?e:null)}#p;#h;get selfReadonly(){return this.#p.get()}set selfReadonly(e){this.#p.set("boolean"==typeof e?e:null)}get readonly(){return this.#h.get()}set readonly(e){this.#p.set("boolean"==typeof e?e:null)}#W;#K;get selfRemovable(){return this.#W.get()}set selfRemovable(e){this.#W.set("boolean"==typeof e?e:null)}get removable(){return this.#K.get()}set removable(e){this.#W.set("boolean"==typeof e?e:null)}#S;#E;get selfLabel(){return this.#S.get()}set selfLabel(e){this.#S.set(k(e))}get label(){return this.#E.get()}set label(e){this.#S.set(k(e))}#C;#$;get selfDescription(){return this.#C.get()}set selfDescription(e){this.#C.set(k(e))}get description(){return this.#$.get()}set description(e){this.#C.set(k(e))}#A;#j;get selfPlaceholder(){return this.#A.get()}set selfPlaceholder(e){this.#A.set(k(e))}get placeholder(){return this.#j.get()}set placeholder(e){this.#A.set(k(e))}#L;#T;get selfMin(){return this.#L.get()}set selfMin(e){this.#L.set(I(e))}get min(){return this.#T.get()}set min(e){this.#L.set(I(e))}#M;#N;get selfMax(){return this.#M.get()}set selfMax(e){this.#M.set(I(e))}get max(){return this.#N.get()}set max(e){this.#M.set(I(e))}#k;#I;get selfStep(){return this.#k.get()}set selfStep(e){this.#k.set(I(e))}get step(){return this.#I.get()}set step(e){this.#k.set(I(e))}#P;#U;get selfMinLength(){return this.#P.get()}set selfMinLength(e){this.#P.set(I(e))}get minLength(){return this.#U.get()}set minLength(e){this.#P.set(I(e))}#B;#R;get selfMaxLength(){return this.#B.get()}set selfMaxLength(e){this.#B.set(I(e))}get maxLength(){return this.#R.get()}set maxLength(e){this.#B.set(I(e))}#q;#_;get selfPattern(){return this.#q.get()}set selfPattern(e){this.#q.set(P(e))}get pattern(){return this.#_.get()}set pattern(e){this.#q.set(P(e))}#V;#D;get selfValues(){return this.#V.get()}set selfValues(e){this.#V.set(R(e))}get values(){return this.#D.get()}set values(e){this.#V.set(R(e))}#z;#H;#F;#Y;#G;#Q;get errors(){return this.#z.get()}get error(){return this.#z.get()[0]}*[Symbol.iterator](){}child(e){return null}#se=!1;#oe=new M.State(null);#ie=new M.State(this.#oe.get());#r=new M.State(null);get changed(){return this.#ie.get()===this.#oe.get()}get value(){return this.#ie.get()}set value(e){const t=this.#ee?.(e),n=void 0===t?e:t;this.#ie.set(n),this.#se||this.#oe.set(n),this.#X?.(n,this.#re.get(),this),this.#ae()}get state(){return this.#r.get()}set state(e){const t=this.#te?.(e),n=void 0===t?e:t;this.#r.set(n),this.#J?.(n,this.#re.get(),this),this.#ae()}#ae(){this.#le||(this.#le=!0,queueMicrotask((()=>{const e=this.#ie.get(),t=this.#r.get();this.#ce(e,t)})))}reset(e=this.#oe.get()){this.#ue(e)}#ue(e){const t=this.#ee?.(e),n=void 0===t?e:t;if(this.#G(),this.#Q(),this.#se=!0,!n||"object"!=typeof n){for(const[,e]of this)e.#ue(null);return this.#ie.set(n),this.#oe.set(n),n}const r=Array.isArray(n)?[...n]:{...n};for(const[e,t]of this)r[e]=t.#ue(r[e]);return this.#ie.set(r),this.#oe.set(r),this.#X?.(r,this.#re.get(),this),r}#le=!1;#fe(e,t){const[n,r]=this.#ne?.(e,t)||[e,t];return this.#ie.get()===n&&this.#r.get()===r?[n,r]:(this.#ie.set(n),this.#r.set(r),this.#ce(n,r))}#ce(e,t){this.#le=!1;let n=e;if(e&&"object"==typeof e){let r=Array.isArray(e)?[...e]:{...e},s=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},o=!1;for(const[n,i]of this){const a=e[n],l=t?.[n],[c,u]=i.#fe(a,l);a!==c&&(r[n]=c,o=!0),l!==u&&(s[n]=u,o=!0)}o&&(t=s,n=e=r,this.#ie.set(e),this.#r.set(s))}return this.#se||(this.#se=!0,this.#oe.set(n)),[e,t]}validate(e){if(!Array.isArray(e))return Promise.all([this.#H.get(),this.#F(),this.#Y()]).then((e=>{const t=e.flat();return t.length?t:null}));const t=[this.validate().then((t=>t?.length?[{path:[...e],store:this,errors:t}]:[]))];for(const[n,r]of this)t.push(r.validate([...e,n]));return Promise.all(t).then((e=>e.flat()))}}class G extends Y{get kind(){return"object"}#de;*[Symbol.iterator](){yield*Object.entries(this.#de)}child(e){return this.#de[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o}={}){const i=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o,size:i.length,setValue:e=>"object"==typeof e?e:null,setState:e=>"object"==typeof e?e:null,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t,n)=>{n===this.#de[t]&&(this.value={...this.value,[t]:e})},onUpdateState:(e,t,n)=>{n===this.#de[t]&&(this.state={...this.state,[t]:e})}};for(const[e,t]of i)a[e]=z(t,{...l,index:e});this.#de=a}}D=G;class Q extends Y{#he=()=>{throw new Error};#de;get children(){return[...this.#de.get()]}*[Symbol.iterator](){return yield*[...this.#de.get().entries()]}child(e){const t=this.#de.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(e,{parent:t,onUpdate:n,onUpdateState:r,index:s,new:o,addable:i}={}){const a=new M.State([]),l=e=>{const t=Array.isArray(e)&&e.length||0,n=[...a.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#he(e));n.length=t,r!==t&&a.set(n)};super(e,{index:s,new:o,parent:t,size:new M.Computed((()=>a.get().length)),state:[],setValue:e=>Array.isArray(e)?e:null==e?null:[e],setState:e=>Array.isArray(e)?e:null==e?null:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?null:[e];return l(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t,r)=>{l(e),n?.(e,t,r)},onUpdateState:r}),[this.#pe,this.#ge]=N(this,i,e.addable??!0),this.#de=a;const c={parent:this,onUpdate:(e,t,n)=>{if(a.get()[t]!==n)return;const r=[...this.value||[]];r.length<t&&(r.length=t),r[t]=e,this.value=r},onUpdateState:(e,t,n)=>{if(a.get()[t]!==n)return;const r=[...this.state||[]];r.length<t&&(r.length=t),r[t]=e,this.state=r}};this.#he=(t,n)=>{const r=z(e,{...c,index:t,new:n});return r.index=t,r}}#pe;#ge;get selfAddable(){return this.#pe.get()}set selfAddable(e){this.#pe.set("boolean"==typeof e?e:null)}get addable(){return this.#ge.get()}set addable(e){this.#pe.set("boolean"==typeof e?e:null)}insert(e,t=null,n){if(!this.addable)return!1;const r=this.value||[];if(!Array.isArray(r))return!1;const s=[...this.#de.get()],o=Math.max(0,Math.min(Math.floor(e),s.length)),i=this.#he(o,n);i.new=!0,s.splice(o,0,i);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(o,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(o,0,{}),this.state=e}return this.#de.set(s),this.value=a,!0}add(e=null){return this.insert(this.#de.get().length,e)}remove(e){const t=this.value;if(!Array.isArray(t))return;const n=[...this.#de.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;const o=[...t],[i]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.#de.set(n),this.value=o,i}move(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#de.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let o=Math.min(e,t),i=Math.max(e,t);for(let e=o;e<=i;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.#de.set(r),this.value=a,!0}exchange(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#de.get()],s=r[e],o=r[t];if(!s||!o)return!1;r[t]=s,r[e]=o,s.index=t,o.index=e;const i=[...n],a=i[e],l=i[t];i[t]=a,i[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.#de.set(r),this.value=i,!0}}function Z(e){if(!e?.length)return[];const t=[];let n=[],r=Object.create(null),s=!1;for(const t of e){if("string"==typeof t)continue;const e=t.template;if(!e)continue;s=!0;const n=X(t);r[e]={params:t.params,children:n?[n]:[]}}function o(e){e.length&&t.push({type:"divergent",children:e.map((([e,t])=>{const n=X(t);return n?"string"!=typeof n&&"fragment"===n.type?[n,e]:[{children:[n]},e]:[{children:[]},e]}))})}for(const r of e){if("string"==typeof r){o(n),n=[],t.push(r);continue}if(r.template){o(n),n=[];continue}if(n.length&&r.else){const e=r.if||null;n.push([e,r]),e||(o(n),n=[]);continue}o(n),n=[];const e=r.if;if(e){n.push([e,r]);continue}const s=X(r);s&&t.push(s)}return o(n),s?[{type:"fragment",templates:r,children:t}]:t}function X(e){let t=function(e){const t=e.fragment;if(t&&"string"==typeof t)return{type:"template",template:t,attrs:e.attrs,children:[]};const n=function({text:e,html:t}){return null!=e?{type:"content",value:e}:null!=t?{type:"content",value:t,html:!0}:void 0}(e),r=n?[n]:Z(e.children);return!e.name||t?n||{type:"fragment",children:r}:{name:e.name,is:e.is,attrs:e.attrs,events:e.events,classes:e.classes,styles:e.styles,enhancements:e.enhancements,bind:e.bind,comment:e.comment,children:r}}(e),n=e.vars;n.length&&t&&"string"!=typeof t&&(t.vars?t.vars=[...n,...t.vars]:t?t.vars=n:t={type:"fragment",vars:n,children:[]},n=null);const r=e.enum,s=e.value;return r&&(t={type:"enum",value:r,sort:e.sort,vars:n,children:t?[t]:[]},n=null),s&&(t={type:"value",name:s,vars:n,children:t?[t]:[]},n=null),n?.length&&(t={type:"fragment",vars:n,children:t?[t]:[]}),t}!function(e){W=e}(Q);const J=/^([+-]?(\d(_?\d)*(\.(\d(_?\d)*)?)?|\.\d(_?\d)*)(?:e[+-]?\d(_?\d)*)|0(b[01](?:_?[01])*|o[0-7](?:_?[0-7])*|x[\dA-F](?:_?[\dA-F])*))$/is;const ee={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class te extends Error{constructor(e,...t){const n=ee[e];super("function"==typeof n?n(...t):n),this.code=e}}const ne=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,re=/^~(?<enhancement>[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_\d\.]*)(?:(?<decorator>[:@!])(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*))?$/u,se=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function oe(e,t){const n=e[t];if(n)return n;const r={attrs:Object.create(null),events:Object.create(null)};return e[t]=r,r}function ie(e,t){const n=e.replace(/$\s+|\s+$/gs,"");if("null"===n)return{value:null};if("true"===n)return{value:!0};if("false"===n)return{value:!1};const r=function(e){return J.test(e)?Number(e.replaceAll("_","")):NaN}(n);return Number.isNaN(r)?se.test(n)?{name:n}:{calc:t(e)}:{value:r}}function ae(e,t,n,r,s){const{attrs:o,events:i,classes:a,styles:l,vars:c,params:u,enhancements:f}=e;return function(d,h){const p=d.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"),g=(ne.exec(p)||re.exec(p))?.groups;if(!g)throw new te("ATTR",d);const{name:m,enhancement:b}=g,v=g.decorator?.toLowerCase();if(b){if(":"===v)oe(f,b).attrs[m]=h?ie(h,t):{name:m};else if("@"===v)oe(f,b).events[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m};else if("!"===v){if("bind"===m)oe(f,b).bind=h||!0}else oe(f,b).value=ie(h,t);return}if(!v)return void(o[m]={value:h});if(":"===v)return void(o[m]=h?ie(h,t):{name:m});if("."===v)return void(a[m]=h?ie(h,t):{name:m});if("style:"===v)return void(l[m]=ie(h,t));if("@"===v)return void(i[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m});if("+"===v)return void c.push({...h?ie(h,n):{value:void 0},variable:m,init:!0});if("*"===v)return void c.push({...ie(h,t),variable:m,init:!1});if("?"===v)return void(u[m]=ie(h,t));if("!"!==v)return;switch(m.toString()){case"fragment":e.fragment=h||!0;break;case"else":e.else=!0;break;case"enum":e.enum=h?ie(h,t):{value:!0};break;case"sort":e.sort=h?ie(h,t):{value:!0};break;case"if":e.if=ie(h,t);break;case"text":e.text=ie(h,t);break;case"html":s&&(e.html=ie(h,t));break;case"template":e.template=h;break;case"bind":e.bind=h||!0;break;case"value":e.value=h;break;case"comment":e.comment=h}}}function le(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:[],params:Object.create(null),enhancements:Object.create(null)}}var ce={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};const ue=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function fe(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function de(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function he(...e){console.error(new te(...e))}function pe(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in ce?ce[t]:(he("ENTITY",e),e)}var ge=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new te("CALC")},createInit:n=t,createEvent:r=()=>{throw new te("EVENT")},simpleTag:s=new Set,enableHTML:o=!1}={}){const i=[],a={children:i},l=[];let c=null,u=a;function f(){c=l.pop()||null,u=c||a}function d(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&u.children.push(e)}let h={},p=0;function g(t){if(t<=p)return;d(e.substring(p,t).replace(/&#?\w+;/g,pe)),p=t}for(;;){const m=e.indexOf("<",p);if(m<0){const A=e.substring(p);A.match(/^\s*$/)||d(A);break}m>p&&g(m);const b=e.charAt(m+1);if("!"===b){let j=m+2,L=">";if("--"===e.slice(m+2,m+4)&&(j+=4,L="--\x3e"),p=e.indexOf(L,j),p<0)break;p++;continue}if("/"===b){p=e.indexOf(">",m+3);let T=e.substring(m+2,p);if(p<0?(T=e.substring(m+2).replace(/[\s<].*/,""),he("UNCOMPLETED",T,c?.name),p=m+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),he("UNCOMPLETED",T),p=m+1+T.length),c){const M=c.name;if(M===T)f();else{if(M.toLowerCase()!=T.toLowerCase())throw new te("CLOSE",T,c.name);f()}}p++;continue}function v(t){let n=p+1;if(p=e.indexOf(t,n),p<0)throw new te("QUOTE",t);const r=e.slice(n,p).replace(/&#?\w+;/g,pe);return p++,r}function y(){let t=e.charAt(p);for(;t<=" "||""===t;t=e.charAt(++p));return t}function w(){let t=p,n=e.charAt(p);for(;fe(n);)p++,n=e.charAt(p);return e.slice(t,p)}p=m+1;let x=e.charAt(p);switch(x){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case">":case"/":throw new te("SYMBOL",x);case"":throw new te("EOF")}const O=w(),S=ue.exec(O)?.groups;if(!S)throw new te("TAG",O);l.push(c),c=le(S.name,S.is),u.children.push(c),u=c;const E=ae(c,t,n,r,o);let C=!0,$=!1;e:for(;C;){let N=y();switch(N){case"":he("EOF"),p++;break e;case">":p++;break e;case"/":$=!0;break e;case'"':case"'":throw new te("ATTR_VALUE");case"=":throw new te("SYMBOL",N)}const k=w();if(!k){he("EOF"),p++;break e}switch(N=y(),N){case"":he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),$=!0;break e;case"=":p++;break;case"'":case'"':E(k,v(N));continue;default:E(k,"");continue}switch(N=y(),N){case"":E(k,""),he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),$=!0;break e;case"'":case'"':E(k,v(N));continue}E(k,w())}if($){for(;;){p++;const I=e.charAt(p);if("/"!==I&&!(I<=" "||""===I))break}switch(e.charAt(p)){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case"":he("EOF");break;case">":p++;break;default:throw new te("CLOSE_SYMBOL")}f()}else(s.has(O)||de(e,p,O,h))&&f()}return Z(i)}});function me(e){let t=!0;const n=new M.subtle.Watcher((()=>{t&&(t=!1,queueMicrotask((()=>{t=!0;for(const e of n.getPending())e.get();n.watch()})))})),r=new M.Computed(e);return n.watch(r),r.get(),()=>{n.unwatch(r)}}function be(e,t,n){let r,s=!1;return me((()=>{const o=e();if(!s)return s=!0,r=o,void(n&&t(o));Object.is(o,r)||(r=o,t(o))}))}const ve=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,ref:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,changed:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,minLength:!0,maxLength:!0,pattern:!0,values:!0,null:!0,index:!0,no:!0,size:!0,error:!0,errors:!0}));function*ye(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of ve)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],yield[`${t}${n}reset`,{exec:()=>e.reset()}],yield[`${t}${n}validate`,{exec:t=>e.validate(t?[]:null)}],e instanceof Q?(yield[`${t}${n}addable`,{get:()=>e.addable}],yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}]):yield[`${t}${n}addable`,{get:()=>!1}]}function we(e,t,n){for(const[n,r]of t){for(const[t,s]of ye(r,n))e[t]=s;for(const[t,s]of ye(r,n,"$$"))e[t]=s}}const xe={value$:{calc:e=>e?.[_].value},state$:{calc:e=>e?.[_].state}};var Oe=Object.getOwnPropertyDescriptors(xe);function Se(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function Ee(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class Ce{exec({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#me[e];if("function"!=typeof t?.get)return;return t.get()}return"function"==typeof t?t(this.getters):n}get({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#me[e];if("function"!=typeof t?.get)return;const{get:n,set:r}=t;return{get:n,set:r}}if("function"==typeof t){const e=new M.Computed((()=>t(this.getters)));return{get:()=>e.get()}}return{get:()=>n}}watch(e,t){return be((()=>this.exec(e)),t,!0)}enum(e){const{name:t,calc:n}=e;if("function"==typeof n)return()=>n(this.getters);if("string"==typeof t){const e=this.#me[t];if("function"!=typeof e?.get)return null;const n=e.store;return n instanceof Y?n:e.get}return this.store}getStore(e){if(!e)return null;const t=this.#me[!0===e?"":e];return t?.get&&t.store||null}bind(e,t,n){const r=this.#me[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?ve.has(t)?be((()=>s[t]),n,!0):void 0:"value"===t?be((()=>r.get()),n,!0):void 0}bindAll(e){const t=this.#me[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>be(e,t,!0)}}return Object.fromEntries([...ve].map((e=>[`$${e}`,t=>be((()=>n[e]),t,!0)])))}getBindAll(e){const t=this.#me[!0===e?"":e];if(!t?.get)return{};const{store:n}=t;if(!n){const{get:e,set:n}=t;return{$value:{get:e,set:n}}}return Object.fromEntries([...ve].map((e=>[`$${e}`,"value"===e||"state"===e?{get:()=>n[e],set:t=>{n[e]=t}}:{get:()=>n[e]}])))}bindSet(e,t){const n=this.#me[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#me[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)},$reset:e=>{n.reset()},$validate:e=>{n.validate(e?[]:null)}}}getEvent({name:e,event:t}){if("function"==typeof t)return t;const n=this.#me[e];if(!n)return null;const{exec:r,calc:s}=n;return"function"==typeof r?r:"function"==typeof s?s:null}constructor(e,t){if(this.store=e,t instanceof Ce){this.#be=t.#be;const e=this.#ve;for(const[n,r]of Object.entries(t.#ve))e[n]=r;const n=this.#ye;for(const[e,r]of Object.entries(t.#ye))n[e]=r}else we(this.#ve,e),this.#be=function(e){const t=Object.create(null,Oe);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!Se(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof Y){for(const[e,s]of ye(r,n))t[e]=s;continue}const{get:e,set:s,exec:o,calc:i}=r;"function"!=typeof e?"function"!=typeof i?"function"!=typeof o||(t[n]={exec:o}):t[n]={calc:i}:t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#be;#ve=Object.create(null);#ye=Object.create(null);store;#we=null;#s=null;#xe=null;get#me(){const e=this.#xe;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#ve,...this.#be,...this.#ye})),n=this.store,r=this.#s,s=this.#we;for(const[e,r]of ye(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof Q))return yield[`${n}${r}removable`,{get:()=>!1}],yield[`${n}${r}upMovable`,{get:()=>!1}],yield[`${n}${r}downMovable`,{get:()=>!1}],yield[`${n}${r}remove`,{exec:()=>{}}],yield[`${n}${r}upMove`,{exec:()=>{}}],void(yield[`${n}${r}downMove`,{exec:()=>{}}]);yield[`${n}${r}removable`,{get:()=>!e.readonly&&!e.disabled&&!!t.removable}],yield[`${n}${r}upMovable`,{get:()=>{if(e.readonly)return!1;if(e.disabled)return!1;const n=t.index;return"number"==typeof n&&!(n<=0)}}],yield[`${n}${r}downMovable`,{get:()=>{if(e.readonly)return!1;if(e.disabled)return!1;const n=t.index;return"number"==typeof n&&!(n>=e.size-1)}}],yield[`${n}${r}remove`,{exec:()=>{e.readonly||e.disabled||t.removable&&e.remove(Number(t.index))}}],yield[`${n}${r}upMove`,{exec:()=>{if(e.readonly)return;if(e.disabled)return;const n=t.index;"number"==typeof n&&(n<=0||e.move(n,n-1))}}],yield[`${n}${r}downMove`,{exec:()=>{if(e.readonly)return;if(e.disabled)return;const n=t.index;"number"==typeof n&&(n>=e.size-1||e.move(n,n+1))}}]}(r,n))t[e]=s;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};return this.#xe=t,t}setStore(e,t,n){const r=new Ce(e,this);return t&&(r.#s=t),we(r.#ve,e),n&&(r.#we=n),r}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new Ce(t,this);return we(n.#ve,t),n}params(e,t,n,r){let s=this.store;if(!0===r)s=n.store;else if(r){const e=n.#me[r],t=e?.get&&e.store;t&&(s=t)}if(0===Object.keys(e).length)return this;const o=new Ce(s,this);o.#s=this.#s,o.#we=this.#we;const i=o.#ye,a=o.#me;for(const[r,s]of Object.entries(e)){const e=r in t?t[r]:null;if(e){const{name:t,calc:s,value:o}=e;if(t){const e=n.#me[t];if(!e?.get)continue;if(!e.store){i[r]=a[r]=e;continue}for(const[t,n]of ye(e.store,r))i[t]=a[t]=n;continue}if("function"==typeof s){const e=new M.Computed((()=>s(n.getters)));i[r]=a[r]={get:()=>e.get()};continue}i[r]=a[r]={get:()=>o}}else{const{name:e,calc:t,value:n}=s;if("function"==typeof t){const e=o.getters;o.#Oe=null;const n=new M.Computed((()=>t(e)));i[r]=a[r]={get:()=>n.get()};continue}if(e){const t=a[e];if(!t?.get)continue;if(!t.store){i[r]=a[r]=t;continue}for(const[e,n]of ye(t.store,r))i[e]=a[e]=n;continue}i[r]=a[r]={get:()=>n}}}return o}setObject(e){const t=new Ce(this.store,this);return t.#we=e,t}set(e){if(!e?.length)return this;const t=new Ce(this.store,this);t.#s=this.#s,t.#we=this.#we;const n=t.#ye,r=t.#me;for(const{variable:s,name:o,calc:i,value:a,init:l}of e)if(l){const e=new M.State(a);if("function"==typeof i){const n=t.settable;t.#Se=null,e.set(i(n))}else if(o){const t=r[o];if(!t?.get)continue;e.set(t.get())}n[s]=r[s]={get:()=>e.get(),set:t=>{e.set(t)}}}else if("function"!=typeof i)if(o){const e=r[o];if(!e)continue;if(!e.get||!e.store){n[s]=r[s]=e;continue}for(const[t,o]of ye(e.store,s))n[t]=r[t]=o}else n[s]=r[s]={get:()=>a};else{const e=t.getters;t.#Oe=null;const o=new M.Computed((()=>i(e)));n[s]=r[s]={get:()=>o.get()}}return t}#Ee=null;get all(){const e=this.#Ee;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#me))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc?Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1}):Object.defineProperty(t,e,{value:n.exec,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Ee=t,t}#Se=null;get settable(){const e=this.#Se;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#me))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Se=t,t}#Oe=null;get getters(){const e=this.#Oe;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#me))n.get?Object.defineProperty(t,e,{get:n.get,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Oe=t,t}}const $e={width:"px",height:"px",top:"px",right:"px",bottom:"px",left:"px",border:"px","border-top":"px","border-right":"px","border-left":"px","border-bottom":"px","border-width":"px","border-top-width":"px","border-right-width":"px","border-left-width":"px","border-bottom-width":"px","border-radius":"px","border-top-left-radius":"px","border-top-right-radius":"px","border-bottom-left-radius":"px","border-bottom-right-radius":"px",padding:"px","padding-top":"px","padding-right":"px","padding-left":"px","padding-bottom":"px",margin:"px","margin-top":"px","margin-right":"px","margin-left":"px","margin-bottom":"px"};function Ae(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in $e?`${s}${$e[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class je{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}}const Le={stop(e){e instanceof Event&&e.stopPropagation()},prevent(e){e instanceof Event&&e.preventDefault()},self(e){if(e instanceof Event)return e.target===e.currentTarget},enter(e){if(e instanceof KeyboardEvent)return"Enter"===e.key},tab(e){if(e instanceof KeyboardEvent)return"Tab"===e.key},esc(e){if(e instanceof KeyboardEvent)return"Escape"===e.key},space(e){if(e instanceof KeyboardEvent)return" "===e.key},backspace(e){if(e instanceof KeyboardEvent)return"Backspace"===e.key},delete(e){if(e instanceof KeyboardEvent)return"Delete"===e.key},delBack(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},"del-back"(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},insert(e){if(e instanceof KeyboardEvent)return"Insert"===e.key},repeat(e){if(e instanceof KeyboardEvent)return e.repeat},key(e,t){if(e instanceof KeyboardEvent){const n=e.code.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},main(e){if(e instanceof MouseEvent)return 0===e.button},auxiliary(e){if(e instanceof MouseEvent)return 1===e.button},secondary(e){if(e instanceof MouseEvent)return 2===e.button},left(e){if(e instanceof MouseEvent)return 0===e.button},middle(e){if(e instanceof MouseEvent)return 1===e.button},right(e){if(e instanceof MouseEvent)return 2===e.button},primary(e){if(e instanceof PointerEvent)return e.isPrimary},mouse(e){if(e instanceof PointerEvent)return"mouse"===e.pointerType},pen(e){if(e instanceof PointerEvent)return"pen"===e.pointerType},touch(e){if(e instanceof PointerEvent)return"touch"===e.pointerType},pointer(e,t){if(e instanceof PointerEvent){const n=e.pointerType.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},ctrl(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey},alt(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.altKey},shift(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.shiftKey},meta(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.metaKey},cmd(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey||e.metaKey}};function Te(e,t,n){const r=[];if(t)for(let s=e.shift();s;s=e.shift()){const e=s.indexOf(":"),o=e>=0?s.slice(0,e):s,i=e>=0?s.slice(e+1).split(":"):[],a=o.replace(/^-+/,""),l=(o.length-a.length)%2==1;let c=t[a]||a;if(n)switch(c){case"once":case"passive":case"capture":n[c]=!l;continue}"string"==typeof c&&(c=Le[c]),"function"==typeof c&&r.push([c,i,l])}return r}function Me(e,t,n){return r=>{const s=e.all;for(const[e,t,o]of n)if(e(r,t,s)===o)return;t(r,s)}}function Ne(e){return"number"==typeof e||"bigint"==typeof e?String(e):"boolean"==typeof e?e?"":null:"string"==typeof e?e:null===(e??null)?null:String(e)}function ke(e){return null===(e??null)?"":String(e)}function Ie(e,t){if(e instanceof HTMLInputElement&&"checked"===t)switch(e.type.toLowerCase()){case"checkbox":case"radio":return Boolean}if((e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&"value"===t)return ke;if(e instanceof HTMLDetailsElement&&"open"===t)return Boolean;if(e instanceof HTMLMediaElement){if("muted"===t)return Boolean;if("paused"===t)return Boolean;if("currentTime"===t)return!0;if("playbackRate"===t)return!0;if("volume"===t)return!0}return!1}const Pe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ke(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Ue(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watch:s,props:o}=e;return["input","textarea","select"].includes(t.toLowerCase())&&e.relate(r),e.listen("init",(({events:n})=>{const i=Pe[t.toLowerCase()],a=i?.attrs||{},l=i?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),s)}}if(o)for(const[t,n]of Object.entries(e.attrs))if(s(t,(e=>{if(o.has(t))r[t]=e;else{const n=Ne(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=Ne(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.attrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=Ne(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=Ie(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let o=Ne(n);null!==o&&r.setAttribute(t,o),s(t,(e=>{const n=Ne(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Be(e){return null===(e??null)?"":String(e)}function Re(e,t,n,r,s){if(!s){const s=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>s.textContent=Be(e)));return()=>{s.remove(),o()}}const o=e.insertBefore(document.createComment(""),t),i=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==i;e=o.nextSibling)e.remove()}const c=n.watch(r,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,i)}(Be(t))}));return()=>{c(),l(),o.remove(),i.remove()}}function qe(e,t){if("bigint"==typeof e&&"bigint"==typeof t)return Number(e-t);if(!("number"!=typeof e&&"bigint"!=typeof e||"number"!=typeof t&&"bigint"!=typeof t))return Number(e)-Number(t);const n=String(e),r=String(t);return n>r?1:n<r?-1:0}const _e=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function Ve(e,t,n,r,s){const o=e.children;if(!o.length)return()=>{};const i=t.insertBefore(document.createComment(""),n);let a=null,l=()=>{};const c=be((()=>o.find((([,e])=>!e||r.exec(e)))||null),(e=>{if(e===a)return;a=e,l(),l=()=>{};const t=e?.[0];t&&(l=s(t.children,t.vars,t.templates))}),!0);let u=!1;return()=>{u||(u=!0,c(),l(),l=()=>{},i.remove())}}function De(e,t,n,r,s,o,i,a,l){const c=e.bind,u=[...o,e.name],f=l?.(u);if(l&&!f)return()=>{};const{context:d,handler:h}=function(e,t,n,r){const s="string"==typeof e?e:e.tag,{attrs:o,events:i}="string"!=typeof e&&e||{attrs:null,events:null};let a=!1;const l=new M.State(!1);let c=!1;const u=new M.State(!1),f=Object.create(null),d=Object.create(null),h=new Set,p=[],g=new je;return{context:{events:p,props:o?new Set(Object.entries(o).filter((([,e])=>e.isProp)).map((([e])=>e))):null,attrs:d,watch(e,t){if(a)return()=>{};const n=f[e];if(!n)return()=>{};let r=n.get();const s=be((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}),!0);return h.add(s),()=>{h.delete(s),s()}},relate(e){if(!n||!r||a)return()=>{};try{const t=r(n,e);return"function"!=typeof t?()=>{}:(h.add(t),()=>{h.delete(t),t()})}catch{return()=>{}}},get destroyed(){return l.get()},get init(){return u.get()},listen:(e,t)=>g.listen(e,t)},handler:{tag:s,set(e,t){if(o&&!(e in o))return;let n=f[e];if(n)return void n.set(t);const r=new M.State(t);f[e]=r,Object.defineProperty(d,e,{configurable:!0,enumerable:!0,get:r.get.bind(r)})},addEvent(e,n){if("function"!=typeof n)return;const[r,...s]=e.split(".").filter(Boolean),o=i?i[r].filters:{};if(!o)return;const a={},l=Te(s,o,a);p.push([r,Me(t,n,l),a])},destroy(){if(!a){a=!0,l.set(!0);for(const e of h)e();g.emit("destroy")}},mount(){c||(c=!0,u.set(!0),g.emit("init",{events:p}))}}}}(f||e.name,r,r.getStore(c),a),p=f?.attrs,g=p?function(e,t,n,r,s){let o=new Set;for(const[i,a]of Object.entries(r)){if("class"===i||"style"===i)continue;if(i in n){const r=n[i],{name:s,calc:l,value:c}=n[i];if(!s&&!l){e.set(i,c);continue}a.immutable&&e.set(i,t.exec(r)),o.add(t.watch(r,(t=>e.set(i,t))));continue}const r=a.bind;if(!s||!r){e.set(i,a.default);continue}if("string"==typeof r){const n=t.bind(s,r,(t=>e.set(i,t)));n?o.add(n):e.set(i,a.default);continue}if(!Array.isArray(r)){e.set(i,a.default);continue}const[l,c,u]=r;if(!l||"function"!=typeof c)continue;if(!u){const n=!0===s?"":s;o.add(t.watch({name:n},(t=>e.set(i,t)))),e.addEvent(l,((...e)=>{t.all[n]=c(...e)}));continue}const f=t.bind(s,"state",(t=>e.set(i,t)));if(!f)continue;o.add(f);const d=t.bindSet(s,"state");d&&e.addEvent(l,((...e)=>{d(c(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(h,r,e.attrs,p,c):function(e,t,n){const r=e.tag;let s=new Set;for(const[o,i]of Object.entries(n)){if("class"===o||"style"===o)continue;const{name:n,calc:a,value:l}=i;if(n||a)if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==o.toLocaleLowerCase())s.add(t.watch(i,(t=>e.set(o,t))));else{const n=t.exec(i);e.set(o,n)}else e.set(o,l)}return()=>{const e=s;s=new Set;for(const t of e)t()}}(h,r,e.attrs);for(const[t,n]of Object.entries(e.events)){const e=r.getEvent(n);e&&h.addEvent(t,e)}const m=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,o]of Object.entries(t.bindAll(n)||{}))"function"==typeof o&&r.add(o((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(h,r,c),b=f?"function"==typeof f.tag?f.tag(d):Ue(d,f.tag,f.is):Ue(d,e.name,e.is),v=Array.isArray(b)?b[0]:b,y=Array.isArray(b)?b[1]:v;t.insertBefore(v,n);const w=y?ze(e.children||[],y,null,r,s,o,i,a,l):()=>{},x=function(e,t,n,r){if(!(e instanceof Element))return()=>{};r&&(e.className+=" "+t.exec(r));let s=new Set;for(const[r,o]of Object.entries(n))o.value?e.classList.add(r):s.add(be((()=>Boolean(t.exec(o))),(t=>{t?e.classList.add(r):e.classList.remove(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(v,r,e.classes,e.attrs.class),O=function(e,t,n,r){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};if(r){const n=[e.getAttribute("style")||"",t.exec(r)||""].filter(Boolean).join(";");n&&e.setAttribute("style",n)}let s=new Set;for(const[r,o]of Object.entries(n))s.add(be((()=>Ae(r,t.exec(o))),(t=>{t?e.style.setProperty(r,...t):e.style.removeProperty(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(v,r,e.styles,e.attrs.style);h.mount();const S=function(e,t,n,r,s,o){let i=new Set;for(const[a,{attrs:l,value:c,events:u,bind:f}]of Object.entries(t)){if(!_e(r,a))continue;const d=r[a];if("function"!=typeof d)continue;let h=!1;const p=new M.State(!1),g=d?.events,m=[],b=Object.create(null),v=new Set,y=new je;function w(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),o=g?g[r].filters:{};if(!o)return;const i={},a=Te(s,o,i);m.push([r,Me(n,t,a),i])}function x(){if(!h){h=!0,p.set(!0);for(const e of v)e();y.emit("destroy")}}i.add(x);for(const[S,E]of Object.entries(l)){const C=n.get(E);C&&Object.defineProperty(b,S,{...C,configurable:!0,enumerable:!0})}for(const[$,A]of Object.entries(u)){const j=n.getEvent(A);j&&w($,j)}if(f){for(const[L,T]of Object.entries(n.getBindAll(f)||{}))Object.defineProperty(b,L,{...T,configurable:!0,enumerable:!0});for(const[N,k]of Object.entries(n.bindEvents(f)||{}))w(N,(e=>k(e)))}const O={get value(){return null},events:m,attrs:b,watch(e,t){if(h)return()=>{};let n=b[e];const r=be((()=>b[e]),(r=>{const s=n;n=r,t(r,s,e)}),!0);return v.add(r),()=>{v.delete(r),r()}},get destroyed(){return p.get()},listen:(e,t)=>y.listen(e,t),root:s,slot:o,tag:e};if(c){const I=n.get(c);I&&Object.defineProperty(O,"value",{...I,configurable:!0,enumerable:!0})}d(O)}return()=>{const e=i;i=new Set;for(const t of e)t()}}(h.tag,e.enhancements,r,i,v,y);return()=>{S(),h.destroy(),v.remove(),g(),w(),m(),x(),O()}}function We(e,t,n){if(!n)return t;const r=Object.entries(n);if(!r.length)return t;const s=Object.create(t);for(const[t,n]of r)s[t]=[n,e];return s}function Ke(e,t,n,r,s,o,i,a,l){if("string"==typeof e){const r=document.createTextNode(e);return t.insertBefore(r,n),()=>r.remove()}const c=r.set(e.vars),u=We(c,s,e.templates);if("divergent"===e.type)return Ve(e,t,n,c,((e,r,u)=>{const f=c.set(r),d=We(f,s,u);return ze(e,t,n,f,d,o,i,a,l)}));if("value"===e.type){const r=c.child(e.name);return r?ze(e.children,t,n,r,u,o,i,a,l):()=>{}}if("enum"===e.type){const r=c.enum(e.value),s=(n,r)=>ze(e.children,t,n,r,u,o,i,a,l);return r instanceof Q?function(e,t,n,r,s){const o=e.insertBefore(document.createComment(""),t);let i=new Map;function a(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const l=new M.State(0),c=be((()=>n.children),(function(t){if(!o.parentNode)return;let c=o.nextSibling;const u=i;i=new Map,l.set(t.length);for(let o of t){const t=u.get(o);if(!t){const t=e.insertBefore(document.createComment(""),c),a=e.insertBefore(document.createComment(""),c),u=s(a,r.setStore(o,n,{get count(){return l.get()},get key(){return o.index},get index(){return o.index},get item(){return o.value}}));i.set(o,[t,a,u]);continue}if(u.delete(o),i.set(o,t),c===t[0]){c=t[1].nextSibling;continue}let a=t[0];for(;a&&a!==t[1];){const t=a;a=a.nextSibling,e.insertBefore(t,c)}e.insertBefore(t[1],c)}a(u)}),!0);return()=>{o.remove(),a(i),c()}}(t,n,r,c,s,e.sort):r instanceof G?function(e,t,n,r,s,o){const i=[],a=[...n],l=a.length,c=o?a.map((([e,t])=>[e,t,r.setStore(t,n).exec(o)])).sort((([,,e],[,,t])=>qe(e,t))).map((([e,t],n)=>[e,t,n])):a.map((([e,t],n)=>[e,t,n]));for(const[e,o,a]of c)i.push(s(t,r.setStore(o,n,{get count(){return l},get key(){return e},get index(){return a},get item(){return o.value}})));return()=>{for(const e of i)e()}}(0,n,r,c,s,e.sort):"function"==typeof r?function(e,t,n,r,s,o){const i=new M.Computed((()=>{const e=n();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t])):Object.entries(e).map((([e,t])=>[t,e])):[]})),a=o?new M.Computed((()=>{const e=i.get();return e.map((([t,n],s)=>[n,t,r.setObject({get count(){return e.length},get key(){return t},get item(){return n},get index(){return s}}).exec(o)])).sort((([,,e],[,,t])=>qe(e,t))).map((([e,t],n)=>[t,n,e]))})):new M.Computed((()=>i.get().map((([e,t],n)=>[t,n,e])))),l=e.insertBefore(document.createComment(""),t);let c=[];function u(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const f=new M.State(0),d=be((()=>a.get()),(function(t){if(!l.parentNode)return;let n=l.nextSibling;const o=c;c=[],f.set(t.length);for(const[i,a,l]of t){const t=o.findIndex((e=>e[3]===l)),[u]=t>=0?o.splice(t,1):[];if(!u){const t=e.insertBefore(document.createComment(""),n),o=e.insertBefore(document.createComment(""),n),u=new M.State(i),d=new M.State(a),h=s(o,r.setObject({get count(){return f.get()},get key(){return l},get item(){return u.get()},get index(){return d.get()}}));c.push([t,o,h,l,u,d]);continue}if(c.push(u),u[4].set(i),u[5].set(a),n===u[0]){n=u[1].nextSibling;continue}let d=u[0];for(;d&&d!==u[1];){const t=d;d=d.nextSibling,e.insertBefore(t,n)}e.insertBefore(u[1],n)}u(o)}),!0);return()=>{l.remove(),u(c),d()}}(t,n,r,c,s,e.sort):()=>{}}if("content"===e.type)return Re(t,n,c,e.value,e.html);if("template"===e.type){const r=u[e.template];if(!r)return()=>{};const[f,d]=r,h=d.params(f.params,e.attrs,c,e.bind),p=We(h,s,f.templates);return ze(f.children,t,n,h,p,o,i,a,l)}return"fragment"===e.type?ze(e.children,t,n,c,u,o,i,a,l):De(e,t,n,c,u,o,i,a,l)}function ze(e,t,n,r,s,o,i,a,l){const c=e.map((e=>Ke(e,t,n,r,s,o,i,a,l)));let u=!1;return()=>{if(!u){u=!0;for(const e of c)e()}}}function He(e,t,n,{component:r,global:s,relate:o,enhancements:i}={}){return ze(t,n,null,new Ce(e,s),Object.create(null),[],i||{},"function"==typeof o?o:null,r)}export{ge as Layout,M as Signal,Y as Store,me as effect,He as render,be as watch};
|
|
60
|
+
function(e){const t=Object.create(L);t.value=e;const n=()=>(d(t),t.value);return n[c]=t,n}(n),a=i[c];if(this[T]=a,a.wrapper=this,s){const t=s.equals;t&&(a.equal=t),a.watched=s[e.subtle.watched],a.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return A.call(this[T])}set(t){if(!(0,e.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(a)throw new Error("Writes to signals not permitted during Watcher callback");j(this[T],t)}};h=T,p=new WeakSet,e.isComputed=e=>n(p,e),e.Computed=class{constructor(n,s){r(this,p),t(this,h);const o=function(e){const t=Object.create(C);t.computation=e;const n=()=>x(t);return n[c]=t,n}(n),i=o[c];if(i.consumerAllowSignalWrites=!0,this[T]=i,i.wrapper=this,s){const t=s.equals;t&&(i.equal=t),i.watched=s[e.subtle.watched],i.unwatched=s[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return x(this[T])}},(o=>{var a,l,c,h;o.untrack=function(e){let t,n=null;try{n=u(null),t=e()}finally{u(n)}return t},o.introspectSources=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(n=t[T].producerNode)?void 0:n.map((e=>e.wrapper)))??[]},o.introspectSinks=function(t){var n;if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(n=t[T].liveConsumerNode)?void 0:n.map((e=>e.wrapper)))??[]},o.hasSinks=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw new TypeError("Called hasSinks without a Signal argument");const n=t[T].liveConsumerNode;return!!n&&n.length>0},o.hasSources=function(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw new TypeError("Called hasSources without a Computed or Watcher argument");const n=t[T].producerNode;return!!n&&n.length>0};a=T,l=new WeakSet,c=new WeakSet,h=function(t){for(const n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw new TypeError("Called watch/unwatch without a Computed or State argument")},e.isWatcher=e=>n(l,e),o.Watcher=class{constructor(e){r(this,l),r(this,c),t(this,a);let n=Object.create(f);n.wrapper=this,n.consumerMarkedDirty=e,n.consumerIsAlwaysLive=!0,n.consumerAllowSignalWrites=!1,n.producerNode=[],this[T]=n}watch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[T];n.dirty=!1;const r=u(n);for(const e of t)d(e[T]);u(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");s(this,c,h).call(this,t);const n=this[T];y(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){b(n.producerNode[e],n.producerIndexOfThis[e]);const t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){const t=n.producerIndexOfThis[e],r=n.producerNode[e];w(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[T].producerNode.filter((e=>e.dirty)).map((e=>e.wrapper))}},o.currentComputed=function(){var e;return null==(e=i)?void 0:e.wrapper},o.watched=Symbol("watched"),o.unwatched=Symbol("unwatched")})(e.subtle||(e.subtle={}))})(M||(M={}));const k=e=>"string"==typeof e&&e||null,I=e=>"number"==typeof e&&e||null,P=e=>e instanceof RegExp?e:null,U=Boolean;function B(e){if("number"==typeof e||"string"==typeof e)return{label:e,value:e};if(!e||"object"!=typeof e)return null;const{children:t,label:n,value:r}=e,s=Array.isArray(t)?t.map(B).filter(U):[];return s.length?{children:s,label:n,value:r}:"number"==typeof r||"string"==typeof r?{label:n,value:r}:null}const R=e=>{if(!e||!Array.isArray(e))return null;const t=e.map(B).filter(U);return t.length?t:null};function q(e,t,n,r){const s=new M.State(t(n));let o;if("function"==typeof r){const n=r;o=new M.Computed((()=>t(n(e))))}else{const e=t(r);o=new M.Computed((()=>e))}const i=new M.Computed((()=>{const e=s.get();return null===e?o.get():e}));return[s,i]}const _=Symbol();function V(e){const t={[_]:e};for(const[n,r]of e)Object.defineProperty(t,n,{get:()=>r.ref,configurable:!1,enumerable:!0});return Object.defineProperty(t,_,{get:()=>e,configurable:!1,enumerable:!0}),t}let D=null,W=null,K=Object.create(null);function z(e,t){const n=e.type;let r=Y;if(!e.array||W&&t?.parent instanceof W)if("string"==typeof n){const e=K[n];e&&(r=e)}else n&&"object"==typeof n&&D&&(r=D);else W&&(r=W);return new r(e,t)}function H(e){return e?e instanceof Error?e.message:"string"!=typeof e?"":e:""}function F(e,...t){const n=t.flat().filter((e=>"function"==typeof e));if(!n.length)return[()=>Promise.resolve([]),new M.Computed((()=>[])),()=>{}];const r=new M.State([]);let s=null;return[function(){s?.abort(),s=new AbortController;const t=s.signal;return r.set([]),Promise.all(n.map((n=>async function(t,n){let s=[];try{s.push(await t(e,n))}catch(e){s.push(e)}const o=s.flat().map(H).filter(Boolean);return!n.aborted&&o.length&&r.set([...r.get(),...o]),o}(n,t)))).then((e=>e.flat()))},new M.Computed((()=>r.get())),()=>{s?.abort(),r.set([])}]}class Y{#e=new Map;emit(e,t){const n="number"==typeof e?String(e):e,r=this.#e;let s=!1;for(const e of[...r.get(n)||[]])s=!1===e(t,this)||s;return!s}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}static create(e,t={}){return z({type:e},{...t,parent:null})}static setStore(e,t){return function(e,t){K[e]=t}(e,t)}#t=!1;get null(){return this.#t}get kind(){return""}#n=null;get ref(){return this.#n||V(this)}constructor(e,{null:t,state:n,ref:r,setValue:s,setState:o,convert:i,onUpdate:a,onUpdateState:l,validator:c,validators:u,index:f,size:d,new:h,parent:p,hidden:g,clearable:m,required:b,disabled:v,readonly:y,removable:w,label:x,description:O,placeholder:S,min:E,max:C,step:$,minLength:A,maxLength:j,pattern:L,values:T}={}){this.schema=e,this.#r.set("object"==typeof n&&n||{});const U=p instanceof Y?p:null;U&&(this.#s=U,this.#o=U.#o,this.#i=U.#i);const B=new M.State(!1);this.#a=B,this.#i=B,this.#l=e.type,this.#c=e.meta,this.#u=e.component;const _=new M.State(Boolean(h));this.#f=_;const D=U?new M.Computed((()=>U.#d.get()||_.get())):new M.Computed((()=>_.get()));this.#d=D;const W=Boolean(e.immutable),K=!1!==e.creatable;this.#h=W,this.#p=K;const z=e.readonly,G=new M.State("boolean"==typeof y?y:null);let Q;if("function"==typeof z)Q=new M.Computed((()=>Boolean(z(this))));else{const e=Boolean(z);Q=new M.Computed((()=>e))}const Z=()=>{if(D.get()?!K:W)return!0;const e=G.get();return null===e?Q.get():e},X=U?U.#g:null;this.#m=G,this.#g=X?new M.Computed((()=>X.get()||Z())):new M.Computed(Z),[this.#b,this.#v]=N(this,g,e.hidden,U?U.#v:null),[this.#y,this.#w]=N(this,m,e.clearable,U?U.#w:null),[this.#x,this.#O]=N(this,b,e.required,U?U.#O:null),[this.#S,this.#E]=N(this,v,e.disabled,U?U.#E:null),[this.#C,this.#$]=q(this,k,x,e.label),[this.#A,this.#j]=q(this,k,O,e.description),[this.#L,this.#T]=q(this,k,S,e.placeholder),[this.#M,this.#N]=q(this,I,E,e.min),[this.#k,this.#I]=q(this,I,C,e.max),[this.#P,this.#U]=q(this,I,$,e.step),[this.#B,this.#R]=q(this,I,A,e.minLength),[this.#q,this.#_]=q(this,I,j,e.maxLength),[this.#V,this.#D]=q(this,P,L,e.pattern),[this.#W,this.#K]=q(this,R,T,e.values),[this.#z,this.#H]=N(this,w,e.removable??!0);const J=function(e,...t){const n=t.flat().filter((e=>"function"==typeof e));return n.length?new M.Computed((()=>{const t=[];for(const r of n)try{t.push(r(e))}catch(e){t.push(e)}return t.flat().map(H).filter(Boolean)})):new M.Computed((()=>[]))}(this,e.validator,c),[ee,te,ne]=F(this,e.validators?.change,u?.change),[re,se,oe]=F(this,e.validators?.blur,u?.blur);if(this.listen("change",(()=>{ee()})),this.listen("blur",(()=>{re()})),this.#F=function(...e){const t=e.filter(Boolean);return new M.Computed((()=>t.flatMap((e=>e.get()))))}(J,te,se),this.#Y=J,this.#G=ee,this.#Q=re,this.#Z=ne,this.#X=oe,d instanceof M.State||d instanceof M.Computed?this.#J=d:this.#J=new M.State(d||0),t)return this.#t=!0,void(this.#n=V(this));this.#n=r||null,this.#ee=a||null,this.#te=l||null,this.#ne="function"==typeof s?s:null,this.#re="function"==typeof o?o:null,this.#se="function"==typeof i?i:null,this.#oe.set(f??"");for(const[t,n]of Object.entries(e.events||{}))"function"==typeof n&&this.listen(t,n)}#ne=null;#re=null;#se=null;#ee=null;#te=null;#s=null;#o=this;#l;#c;#u;#a=null;#i;get loading(){return this.#i.get()}set loading(e){const t=this.#a;t&&t.set(Boolean(e))}get store(){return this}get parent(){return this.#s}get root(){return this.#o}get type(){return this.#l}get meta(){return this.#c}get component(){return this.#u}#J;get size(){return this.#J.get()}#oe=new M.State("");get index(){return this.#oe.get()}set index(e){this.#oe.set(e)}get no(){if(this.#t)return"";const e=this.index;return"number"==typeof e?e+1:e}#p=!0;get creatable(){return this.#p}#h=!1;get immutable(){return this.#h}#d;#f;get selfNew(){return this.#f.get()}set selfNew(e){this.#f.set(Boolean(e))}get new(){return this.#d.get()}set new(e){this.#f.set(Boolean(e))}#b;#v;get selfHidden(){return this.#b.get()}set selfHidden(e){this.#b.set("boolean"==typeof e?e:null)}get hidden(){return this.#v.get()}set hidden(e){this.#b.set("boolean"==typeof e?e:null)}#y;#w;get selfClearable(){return this.#y.get()}set selfClearable(e){this.#y.set("boolean"==typeof e?e:null)}get clearable(){return this.#w.get()}set clearable(e){this.#y.set("boolean"==typeof e?e:null)}#x;#O;get selfRequired(){return this.#x.get()}set selfRequired(e){this.#x.set("boolean"==typeof e?e:null)}get required(){return this.#O.get()}set required(e){this.#x.set("boolean"==typeof e?e:null)}#S;#E;get selfDisabled(){return this.#S.get()}set selfDisabled(e){this.#S.set("boolean"==typeof e?e:null)}get disabled(){return this.#E.get()}set disabled(e){this.#S.set("boolean"==typeof e?e:null)}#m;#g;get selfReadonly(){return this.#m.get()}set selfReadonly(e){this.#m.set("boolean"==typeof e?e:null)}get readonly(){return this.#g.get()}set readonly(e){this.#m.set("boolean"==typeof e?e:null)}#z;#H;get selfRemovable(){return this.#z.get()}set selfRemovable(e){this.#z.set("boolean"==typeof e?e:null)}get removable(){return this.#H.get()}set removable(e){this.#z.set("boolean"==typeof e?e:null)}#C;#$;get selfLabel(){return this.#C.get()}set selfLabel(e){this.#C.set(k(e))}get label(){return this.#$.get()}set label(e){this.#C.set(k(e))}#A;#j;get selfDescription(){return this.#A.get()}set selfDescription(e){this.#A.set(k(e))}get description(){return this.#j.get()}set description(e){this.#A.set(k(e))}#L;#T;get selfPlaceholder(){return this.#L.get()}set selfPlaceholder(e){this.#L.set(k(e))}get placeholder(){return this.#T.get()}set placeholder(e){this.#L.set(k(e))}#M;#N;get selfMin(){return this.#M.get()}set selfMin(e){this.#M.set(I(e))}get min(){return this.#N.get()}set min(e){this.#M.set(I(e))}#k;#I;get selfMax(){return this.#k.get()}set selfMax(e){this.#k.set(I(e))}get max(){return this.#I.get()}set max(e){this.#k.set(I(e))}#P;#U;get selfStep(){return this.#P.get()}set selfStep(e){this.#P.set(I(e))}get step(){return this.#U.get()}set step(e){this.#P.set(I(e))}#B;#R;get selfMinLength(){return this.#B.get()}set selfMinLength(e){this.#B.set(I(e))}get minLength(){return this.#R.get()}set minLength(e){this.#B.set(I(e))}#q;#_;get selfMaxLength(){return this.#q.get()}set selfMaxLength(e){this.#q.set(I(e))}get maxLength(){return this.#_.get()}set maxLength(e){this.#q.set(I(e))}#V;#D;get selfPattern(){return this.#V.get()}set selfPattern(e){this.#V.set(P(e))}get pattern(){return this.#D.get()}set pattern(e){this.#V.set(P(e))}#W;#K;get selfValues(){return this.#W.get()}set selfValues(e){this.#W.set(R(e))}get values(){return this.#K.get()}set values(e){this.#W.set(R(e))}#F;#Y;#G;#Q;#Z;#X;get errors(){return this.#F.get()}get error(){return this.#F.get()[0]}*[Symbol.iterator](){}child(e){return null}#ie=!1;#ae=new M.State(null);#le=new M.State(this.#ae.get());#r=new M.State(null);get changed(){return this.#le.get()===this.#ae.get()}get value(){return this.#le.get()}set value(e){const t=this.#ne?.(e),n=void 0===t?e:t;this.#le.set(n),this.#ie||this.#ae.set(n),this.#ee?.(n,this.#oe.get(),this),this.#ce()}get state(){return this.#r.get()}set state(e){const t=this.#re?.(e),n=void 0===t?e:t;this.#r.set(n),this.#te?.(n,this.#oe.get(),this),this.#ce()}#ce(){this.#ue||(this.#ue=!0,queueMicrotask((()=>{const e=this.#le.get(),t=this.#r.get();this.#fe(e,t)})))}reset(e=this.#ae.get()){this.#de(e)}#de(e){const t=this.#ne?.(e),n=void 0===t?e:t;if(this.#Z(),this.#X(),this.#ie=!0,!n||"object"!=typeof n){for(const[,e]of this)e.#de(null);return this.#le.set(n),this.#ae.set(n),n}const r=Array.isArray(n)?[...n]:{...n};for(const[e,t]of this)r[e]=t.#de(r[e]);return this.#le.set(r),this.#ae.set(r),this.#ee?.(r,this.#oe.get(),this),r}#ue=!1;#he(e,t){const[n,r]=this.#se?.(e,t)||[e,t];return this.#le.get()===n&&this.#r.get()===r?[n,r]:(this.#le.set(n),this.#r.set(r),this.#fe(n,r))}#fe(e,t){this.#ue=!1;let n=e;if(e&&"object"==typeof e){let r=Array.isArray(e)?[...e]:{...e},s=Array.isArray(e)?Array.isArray(t)?[...t]:[]:{...t},o=!1;for(const[n,i]of this){const a=e[n],l=t?.[n],[c,u]=i.#he(a,l);a!==c&&(r[n]=c,o=!0),l!==u&&(s[n]=u,o=!0)}o&&(t=s,n=e=r,this.#le.set(e),this.#r.set(s))}return this.#ie||(this.#ie=!0,this.#ae.set(n)),[e,t]}validate(e){if(!Array.isArray(e))return Promise.all([this.#Y.get(),this.#G(),this.#Q()]).then((e=>{const t=e.flat();return t.length?t:null}));const t=[this.validate().then((t=>t?.length?[{path:[...e],store:this,errors:t}]:[]))];for(const[n,r]of this)t.push(r.validate([...e,n]));return Promise.all(t).then((e=>e.flat()))}}class G extends Y{get kind(){return"object"}#pe;*[Symbol.iterator](){yield*Object.entries(this.#pe)}child(e){return this.#pe[e]||null}constructor(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o}={}){const i=Object.entries(e.type);super(e,{parent:t,index:n,new:r,onUpdate:s,onUpdateState:o,size:i.length,setValue:e=>"object"==typeof e?e:null,setState:e=>"object"==typeof e?e:null,convert:(e,t)=>["object"==typeof e?e:{},"object"==typeof t?t:{}]});const a=Object.create(null),l={parent:this,onUpdate:(e,t,n)=>{n===this.#pe[t]&&(this.value={...this.value,[t]:e})},onUpdateState:(e,t,n)=>{n===this.#pe[t]&&(this.state={...this.state,[t]:e})}};for(const[e,t]of i)a[e]=z(t,{...l,index:e});this.#pe=a}}D=G;class Q extends Y{#ge=()=>{throw new Error};#pe;get children(){return[...this.#pe.get()]}*[Symbol.iterator](){return yield*[...this.#pe.get().entries()]}child(e){const t=this.#pe.get();return"number"==typeof e&&e<0?t[t.length+e]||null:t[Number(e)]||null}get kind(){return"array"}constructor(e,{parent:t,onUpdate:n,onUpdateState:r,index:s,new:o,addable:i}={}){const a=new M.State([]),l=e=>{const t=Array.isArray(e)&&e.length||0,n=[...a.get()],r=n.length;for(let e=n.length;e<t;e++)n.push(this.#ge(e));n.length=t,r!==t&&a.set(n)};super(e,{index:s,new:o,parent:t,size:new M.Computed((()=>a.get().length)),state:[],setValue:e=>Array.isArray(e)?e:null==e?null:[e],setState:e=>Array.isArray(e)?e:null==e?null:[e],convert(e,t){const n=Array.isArray(e)?e:null==e?null:[e];return l(n),[n,Array.isArray(t)?t:null==e?[]:[t]]},onUpdate:(e,t,r)=>{l(e),n?.(e,t,r)},onUpdateState:r}),[this.#me,this.#be]=N(this,i,e.addable??!0),this.#pe=a;const c={parent:this,onUpdate:(e,t,n)=>{if(a.get()[t]!==n)return;const r=[...this.value||[]];r.length<t&&(r.length=t),r[t]=e,this.value=r},onUpdateState:(e,t,n)=>{if(a.get()[t]!==n)return;const r=[...this.state||[]];r.length<t&&(r.length=t),r[t]=e,this.state=r}};this.#ge=(t,n)=>{const r=z(e,{...c,index:t,new:n});return r.index=t,r}}#me;#be;get selfAddable(){return this.#me.get()}set selfAddable(e){this.#me.set("boolean"==typeof e?e:null)}get addable(){return this.#be.get()}set addable(e){this.#me.set("boolean"==typeof e?e:null)}insert(e,t=null,n){if(!this.addable)return!1;const r=this.value||[];if(!Array.isArray(r))return!1;const s=[...this.#pe.get()],o=Math.max(0,Math.min(Math.floor(e),s.length)),i=this.#ge(o,n);i.new=!0,s.splice(o,0,i);for(let t=e+1;t<s.length;t++)s[t].index=t;const a=[...r];a.splice(o,0,t);const l=this.state;if(Array.isArray(l)){const e=[...l];e.splice(o,0,{}),this.state=e}return this.#pe.set(s),this.value=a,!0}add(e=null){return this.insert(this.#pe.get().length,e)}remove(e){const t=this.value;if(!Array.isArray(t))return;const n=[...this.#pe.get()],r=Math.max(0,Math.min(Math.floor(e),n.length)),[s]=n.splice(r,1);if(!s)return;for(let t=e;t<n.length;t++)n[t].index=t;const o=[...t],[i]=o.splice(r,1),a=this.state;if(Array.isArray(a)){const e=[...this.state];e.splice(r,1),this.state=e}return this.#pe.set(n),this.value=o,i}move(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#pe.get()],[s]=r.splice(e,1);if(!s)return!1;r.splice(t,0,s);let o=Math.min(e,t),i=Math.max(e,t);for(let e=o;e<=i;e++)r[e].index=e;const a=[...n],[l]=a.splice(e,1);a.splice(t,0,l);const c=this.state;if(Array.isArray(c)){const n=[...c],[r={}]=n.splice(e,1);t<=n.length?n.splice(t,0,r):n[t]=r,this.state=n}return this.#pe.set(r),this.value=a,!0}exchange(e,t){const n=this.value;if(!Array.isArray(n))return!1;const r=[...this.#pe.get()],s=r[e],o=r[t];if(!s||!o)return!1;r[t]=s,r[e]=o,s.index=t,o.index=e;const i=[...n],a=i[e],l=i[t];i[t]=a,i[e]=l;const c=this.state;if(Array.isArray(c)){const n=[...c],r=n[e],s=n[t];n[t]=r,n[e]=s,this.state=n}return this.#pe.set(r),this.value=i,!0}}function Z(e){if(!e?.length)return[];const t=[];let n=[],r=Object.create(null),s=!1;for(const t of e){if("string"==typeof t)continue;const e=t.template;if(!e)continue;s=!0;const n=X(t);r[e]={params:t.params,children:n?[n]:[]}}function o(e){e.length&&t.push({type:"divergent",children:e.map((([e,t])=>{const n=X(t);return n?"string"!=typeof n&&"fragment"===n.type?[n,e]:[{children:[n]},e]:[{children:[]},e]}))})}for(const r of e){if("string"==typeof r){o(n),n=[],t.push(r);continue}if(r.template){o(n),n=[];continue}if(n.length&&r.else){const e=r.if||null;n.push([e,r]),e||(o(n),n=[]);continue}o(n),n=[];const e=r.if;if(e){n.push([e,r]);continue}const s=X(r);s&&t.push(s)}return o(n),s?[{type:"fragment",templates:r,children:t}]:t}function X(e){let t=function(e){const t=e.fragment;if(t&&"string"==typeof t)return{type:"template",template:t,attrs:e.attrs,children:[]};const n=function({text:e,html:t}){return null!=e?{type:"content",value:e}:null!=t?{type:"content",value:t,html:!0}:void 0}(e),r=n?[n]:Z(e.children);return!e.name||t?n||{type:"fragment",children:r}:{name:e.name,is:e.is,attrs:e.attrs,events:e.events,classes:e.classes,styles:e.styles,enhancements:e.enhancements,bind:e.bind,comment:e.comment,children:r}}(e),n=e.vars;n.length&&t&&"string"!=typeof t&&(t.vars?t.vars=[...n,...t.vars]:t?t.vars=n:t={type:"fragment",vars:n,children:[]},n=null);const r=e.enum,s=e.value;return r&&(t={type:"enum",value:r,sort:e.sort,vars:n,children:t?[t]:[]},n=null),s&&(t={type:"value",name:s,vars:n,children:t?[t]:[]},n=null),n?.length&&(t={type:"fragment",vars:n,children:t?[t]:[]}),t}!function(e){W=e}(Q);const J=/^([+-]?(\d(_?\d)*(\.(\d(_?\d)*)?)?|\.\d(_?\d)*)(?:e[+-]?\d(_?\d)*)|0(b[01](?:_?[01])*|o[0-7](?:_?[0-7])*|x[\dA-F](?:_?[\dA-F])*))$/is;const ee={CALC:"no `createCalc` option, no expression parsing support",EVENT:"no `createEvent`, options, no event parsing support",CLOSE:(e,t)=>`end tag name: ${e} is not match the current start tagName: ${t}`,UNCLOSE:e=>`end tag name: ${e} maybe not complete`,QUOTE:e=>`attribute value no end '${e}' match`,CLOSE_SYMBOL:"elements closed character '/' and '>' must be connected to",UNCOMPLETED:(e,t)=>t?`end tag name: ${e} is not complete: ${t}`:`end tag name: ${e} maybe not complete`,ENTITY:e=>`entity not found: ${e}`,SYMBOL:e=>`unexpected symbol: ${e}`,TAG:e=>`invalid tagName: ${e}`,ATTR:e=>`invalid attribute: ${e}`,EQUAL:"attribute equal must after attrName",ATTR_VALUE:'attribute value must after "="',EOF:"unexpected end of file"};class te extends Error{constructor(e,...t){const n=ee[e];super("function"==typeof n?n(...t):n),this.code=e}}const ne=/^(?<decorator>[:@!+*\.?]|style:|样式:)?(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*)$/u,re=/^~(?<enhancement>[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_\d\.]*)(?:(?<decorator>[:@!])(?<name>-?[\w\p{Unified_Ideograph}_][-\w\p{Unified_Ideograph}_:\d\.]*))?$/u,se=/^(?<name>[a-zA-Z$\p{Unified_Ideograph}_][\da-zA-Z$\p{Unified_Ideograph}_]*)?$/u;function oe(e,t){const n=e[t];if(n)return n;const r={attrs:Object.create(null),events:Object.create(null)};return e[t]=r,r}function ie(e,t){const n=e.replace(/$\s+|\s+$/gs,"");if("null"===n)return{value:null};if("true"===n)return{value:!0};if("false"===n)return{value:!1};const r=function(e){return J.test(e)?Number(e.replaceAll("_","")):NaN}(n);return Number.isNaN(r)?se.test(n)?{name:n}:{calc:t(e)}:{value:r}}function ae(e,t,n,r,s){const{attrs:o,events:i,classes:a,styles:l,vars:c,params:u,enhancements:f}=e;return function(d,h){const p=d.replace(/./g,".").replace(/:/g,":").replace(/@/g,"@").replace(/+/g,"+").replace(/-/g,"-").replace(/[*×]/g,"*").replace(/!/g,"!"),g=(ne.exec(p)||re.exec(p))?.groups;if(!g)throw new te("ATTR",d);const{name:m,enhancement:b}=g,v=g.decorator?.toLowerCase();if(b){if(":"===v)oe(f,b).attrs[m]=h?ie(h,t):{name:m};else if("@"===v)oe(f,b).events[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m};else if("!"===v){if("bind"===m)oe(f,b).bind=h||!0}else oe(f,b).value=ie(h,t);return}if(!v)return void(o[m]={value:h});if(":"===v)return void(o[m]=h?ie(h,t):{name:m});if("."===v)return void(a[m]=h?ie(h,t):{name:m});if("style:"===v)return void(l[m]=ie(h,t));if("@"===v)return void(i[m]=h?se.test(h)?{name:h}:{event:r(h)}:{name:m});if("+"===v)return void c.push({...h?ie(h,n):{value:void 0},variable:m,init:!0});if("*"===v)return void c.push({...ie(h,t),variable:m,init:!1});if("?"===v)return void(u[m]=ie(h,t));if("!"!==v)return;switch(m.toString()){case"fragment":e.fragment=h||!0;break;case"else":e.else=!0;break;case"enum":e.enum=h?ie(h,t):{value:!0};break;case"sort":e.sort=h?ie(h,t):{value:!0};break;case"if":e.if=ie(h,t);break;case"text":e.text=ie(h,t);break;case"html":s&&(e.html=ie(h,t));break;case"template":e.template=h;break;case"bind":e.bind=h||!0;break;case"value":e.value=h;break;case"comment":e.comment=h}}}function le(e,t){return{name:e,is:t,children:[],attrs:Object.create(null),events:Object.create(null),classes:Object.create(null),styles:Object.create(null),vars:[],params:Object.create(null),enhancements:Object.create(null)}}var ce={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};const ue=/^(?<name>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_:]*)(?:|(?<is>[\w\p{Unified_Ideograph}_][-\.\|:|d\w\p{Unified_Ideograph}_]*))?$/u;function fe(e){return"="!==e&&"/"!==e&&">"!==e&&e&&"'"!==e&&'"'!==e&&!function(e){return"0x80"===e||e<=" "}(e)}function de(e,t,n,r){let s=r[n];return null==s&&(s=e.lastIndexOf("</"+n+">"),s<t&&(s=e.lastIndexOf("</"+n)),r[n]=s),s<t}function he(...e){console.error(new te(...e))}function pe(e){const t=e.slice(1,-1);return"#"===t.charAt(0)?String.fromCodePoint(parseInt(t.substring(1).replace("x","0x"))):t in ce?ce[t]:(he("ENTITY",e),e)}var ge=Object.freeze({__proto__:null,parse:function(e,{createCalc:t=()=>{throw new te("CALC")},createInit:n=t,createEvent:r=()=>{throw new te("EVENT")},simpleTag:s=new Set,enableHTML:o=!1}={}){const i=[],a={children:i},l=[];let c=null,u=a;function f(){c=l.pop()||null,u=c||a}function d(e){(e=e.replace(/^\n|(?<=\n)\t+|\n\t*$/g,""))&&u.children.push(e)}let h={},p=0;function g(t){if(t<=p)return;d(e.substring(p,t).replace(/&#?\w+;/g,pe)),p=t}for(;;){const m=e.indexOf("<",p);if(m<0){const A=e.substring(p);A.match(/^\s*$/)||d(A);break}m>p&&g(m);const b=e.charAt(m+1);if("!"===b){let j=m+2,L=">";if("--"===e.slice(m+2,m+4)&&(j+=4,L="--\x3e"),p=e.indexOf(L,j),p<0)break;p++;continue}if("/"===b){p=e.indexOf(">",m+3);let T=e.substring(m+2,p);if(p<0?(T=e.substring(m+2).replace(/[\s<].*/,""),he("UNCOMPLETED",T,c?.name),p=m+1+T.length):T.match(/\s</)&&(T=T.replace(/[\s<].*/,""),he("UNCOMPLETED",T),p=m+1+T.length),c){const M=c.name;if(M===T)f();else{if(M.toLowerCase()!=T.toLowerCase())throw new te("CLOSE",T,c.name);f()}}p++;continue}function v(t){let n=p+1;if(p=e.indexOf(t,n),p<0)throw new te("QUOTE",t);const r=e.slice(n,p).replace(/&#?\w+;/g,pe);return p++,r}function y(){let t=e.charAt(p);for(;t<=" "||""===t;t=e.charAt(++p));return t}function w(){let t=p,n=e.charAt(p);for(;fe(n);)p++,n=e.charAt(p);return e.slice(t,p)}p=m+1;let x=e.charAt(p);switch(x){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case">":case"/":throw new te("SYMBOL",x);case"":throw new te("EOF")}const O=w(),S=ue.exec(O)?.groups;if(!S)throw new te("TAG",O);l.push(c),c=le(S.name,S.is),u.children.push(c),u=c;const E=ae(c,t,n,r,o);let C=!0,$=!1;e:for(;C;){let N=y();switch(N){case"":he("EOF"),p++;break e;case">":p++;break e;case"/":$=!0;break e;case'"':case"'":throw new te("ATTR_VALUE");case"=":throw new te("SYMBOL",N)}const k=w();if(!k){he("EOF"),p++;break e}switch(N=y(),N){case"":he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),$=!0;break e;case"=":p++;break;case"'":case'"':E(k,v(N));continue;default:E(k,"");continue}switch(N=y(),N){case"":E(k,""),he("EOF"),p++;break e;case">":E(k,""),p++;break e;case"/":E(k,""),$=!0;break e;case"'":case'"':E(k,v(N));continue}E(k,w())}if($){for(;;){p++;const I=e.charAt(p);if("/"!==I&&!(I<=" "||""===I))break}switch(e.charAt(p)){case"=":throw new te("EQUAL");case'"':case"'":throw new te("ATTR_VALUE");case"":he("EOF");break;case">":p++;break;default:throw new te("CLOSE_SYMBOL")}f()}else(s.has(O)||de(e,p,O,h))&&f()}return Z(i)}});function me(e){let t=!0;const n=new M.subtle.Watcher((()=>{t&&(t=!1,queueMicrotask((()=>{t=!0;for(const e of n.getPending())e.get();n.watch()})))})),r=new M.Computed(e);return n.watch(r),r.get(),()=>{n.unwatch(r)}}function be(e,t,n){let r,s=!1;return me((()=>{const o=e();if(!s)return s=!0,r=o,void(n&&t(o));Object.is(o,r)||(r=o,t(o))}))}const ve=new Set(Object.keys({type:!0,meta:!0,component:!0,kind:!0,value:!0,state:!0,store:!0,parent:!0,root:!0,ref:!0,schema:!0,new:!0,readonly:!0,creatable:!0,immutable:!0,changed:!0,loading:!0,required:!0,clearable:!0,hidden:!0,disabled:!0,label:!0,description:!0,placeholder:!0,min:!0,max:!0,step:!0,minLength:!0,maxLength:!0,pattern:!0,values:!0,null:!0,index:!0,no:!0,size:!0,error:!0,errors:!0}));function*ye(e,t="",n="$"){yield[`${t}`,{get:()=>e.value,set:t=>e.value=t,store:e}];for(const r of ve)yield[`${t}${n}${r}`,{get:()=>e[r]}];yield[`${t}${n}value`,{get:()=>e.value,set:t=>e.value=t}],yield[`${t}${n}state`,{get:()=>e.state,set:t=>e.state=t}],yield[`${t}${n}reset`,{exec:()=>e.reset()}],yield[`${t}${n}validate`,{exec:t=>e.validate(t?[]:null)}],e instanceof Q?(yield[`${t}${n}addable`,{get:()=>e.addable}],yield[`${t}${n}insert`,{exec:(t,n)=>e.insert(t,n)}],yield[`${t}${n}add`,{exec:t=>e.add(t)}],yield[`${t}${n}remove`,{exec:t=>e.remove(t)}],yield[`${t}${n}move`,{exec:(t,n)=>e.move(t,n)}],yield[`${t}${n}exchange`,{exec:(t,n)=>e.exchange(t,n)}]):yield[`${t}${n}addable`,{get:()=>!1}]}function we(e,t,n){for(const[n,r]of t){for(const[t,s]of ye(r,n))e[t]=s;for(const[t,s]of ye(r,n,"$$"))e[t]=s}}const xe={value$:{calc:e=>e?.[_].value},state$:{calc:e=>e?.[_].state}};var Oe=Object.getOwnPropertyDescriptors(xe);function Se(e){if(!e)return!1;const t=e.indexOf("$");return t<0||(e.indexOf("$",t+2)>0||"$"===e[0]&&"_$".includes(e[1]))}function Ee(e,t){Object.defineProperty(t,"$store",{value:e,writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(t,"$root",{value:e.root,writable:!1,configurable:!0,enumerable:!1})}class Ce{exec({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#ve[e];if("function"!=typeof t?.get)return;return t.get()}return"function"==typeof t?t(this.getters):n}get({name:e,calc:t,value:n}){if("string"==typeof e){const t=this.#ve[e];if("function"!=typeof t?.get)return;const{get:n,set:r}=t;return{get:n,set:r}}if("function"==typeof t){const e=new M.Computed((()=>t(this.getters)));return{get:()=>e.get()}}return{get:()=>n}}watch(e,t){return be((()=>this.exec(e)),t,!0)}enum(e){const{name:t,calc:n}=e;if("function"==typeof n)return()=>n(this.getters);if("string"==typeof t){const e=this.#ve[t];if("function"!=typeof e?.get)return null;const n=e.store;return n instanceof Y?n:e.get}return this.store}getStore(e){if(!e)return null;const t=this.#ve[!0===e?"":e];return t?.get&&t.store||null}bind(e,t,n){const r=this.#ve[!0===e?"":e];if(!r?.get)return;const{store:s}=r;return s?ve.has(t)?be((()=>s[t]),n,!0):void 0:"value"===t?be((()=>r.get()),n,!0):void 0}bindAll(e){const t=this.#ve[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.get;if("function"!=typeof e)return;return{$value:t=>be(e,t,!0)}}return Object.fromEntries([...ve].map((e=>[`$${e}`,t=>be((()=>n[e]),t,!0)])))}getBindAll(e){const t=this.#ve[!0===e?"":e];if(!t?.get)return{};const{store:n}=t;if(!n){const{get:e,set:n}=t;return{$value:{get:e,set:n}}}return Object.fromEntries([...ve].map((e=>[`$${e}`,"value"===e||"state"===e?{get:()=>n[e],set:t=>{n[e]=t}}:{get:()=>n[e]}])))}bindSet(e,t){const n=this.#ve[!0===e?"":e];if(!n?.get)return;const{store:r}=n;if(r)switch(t){case"value":return e=>{r.value=e};case"state":return e=>{r.state=e}}}bindEvents(e){const t=this.#ve[!0===e?"":e];if(!t?.get)return;const{store:n}=t;if(!n){const e=t.set;if("function"!=typeof e)return;return{$value:e}}return{$value:e=>{n.value=e},$state:e=>{n.state=e},$input:e=>{n.emit("input",e)},$change:e=>{n.emit("change",e)},$click:e=>{n.emit("click",e)},$focus:e=>{n.emit("focus",e)},$blur:e=>{n.emit("blur",e)},$reset:e=>{n.reset()},$validate:e=>{n.validate(e?[]:null)}}}getEvent({name:e,event:t}){if("function"==typeof t)return t;const n=this.#ve[e];if(!n)return null;const{exec:r,calc:s}=n;return"function"==typeof r?r:"function"==typeof s?s:null}constructor(e,t){if(this.store=e,t instanceof Ce){this.#ye=t.#ye;const e=this.#we;for(const[n,r]of Object.entries(t.#we))e[n]=r;const n=this.#xe;for(const[e,r]of Object.entries(t.#xe))n[e]=r}else we(this.#we,e),this.#ye=function(e){const t=Object.create(null,Oe);if(!e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e)){if(!Se(n))continue;if(!r||"object"!=typeof r)continue;if(r instanceof Y){for(const[e,s]of ye(r,n))t[e]=s;continue}const{get:e,set:s,exec:o,calc:i}=r;"function"!=typeof e?"function"==typeof i||i&&"object"==typeof i?t[n]={calc:i}:("function"==typeof o||i&&"object"==typeof i)&&(t[n]={exec:o}):t[n]="function"==typeof s?{get:e,set:s}:{get:e}}return t}(t)}#ye;#we=Object.create(null);#xe=Object.create(null);store;#Oe=null;#s=null;#Se=null;get#ve(){const e=this.#Se;if(e)return e;const t=Object.create(null,Object.getOwnPropertyDescriptors({...this.#we,...this.#ye,...this.#xe})),n=this.store,r=this.#s,s=this.#Oe;for(const[e,r]of ye(n))t[e]=r;for(const[e,s]of function*(e,t,n="",r="$"){if(!(e instanceof Q))return yield[`${n}${r}removable`,{get:()=>!1}],yield[`${n}${r}upMovable`,{get:()=>!1}],yield[`${n}${r}downMovable`,{get:()=>!1}],yield[`${n}${r}remove`,{exec:()=>{}}],yield[`${n}${r}upMove`,{exec:()=>{}}],void(yield[`${n}${r}downMove`,{exec:()=>{}}]);yield[`${n}${r}removable`,{get:()=>!e.readonly&&!e.disabled&&!!t.removable}],yield[`${n}${r}upMovable`,{get:()=>{if(e.readonly)return!1;if(e.disabled)return!1;const n=t.index;return"number"==typeof n&&!(n<=0)}}],yield[`${n}${r}downMovable`,{get:()=>{if(e.readonly)return!1;if(e.disabled)return!1;const n=t.index;return"number"==typeof n&&!(n>=e.size-1)}}],yield[`${n}${r}remove`,{exec:()=>{e.readonly||e.disabled||t.removable&&e.remove(Number(t.index))}}],yield[`${n}${r}upMove`,{exec:()=>{if(e.readonly)return;if(e.disabled)return;const n=t.index;"number"==typeof n&&(n<=0||e.move(n,n-1))}}],yield[`${n}${r}downMove`,{exec:()=>{if(e.readonly)return;if(e.disabled)return;const n=t.index;"number"==typeof n&&(n>=e.size-1||e.move(n,n+1))}}]}(r,n))t[e]=s;if(s)for(const e of Object.keys(s))t[`$${e}`]={get:()=>s[e]};return this.#Se=t,t}setStore(e,t,n){const r=new Ce(e,this);return t&&(r.#s=t),we(r.#we,e),n&&(r.#Oe=n),r}child(e){if(!e)return this;const t=this.store.child(e);if(!t)return null;const n=new Ce(t,this);return we(n.#we,t),n}params(e,t,n,r){let s=this.store;if(!0===r)s=n.store;else if(r){const e=n.#ve[r],t=e?.get&&e.store;t&&(s=t)}if(0===Object.keys(e).length)return this;const o=new Ce(s,this);o.#s=this.#s,o.#Oe=this.#Oe;const i=o.#xe,a=o.#ve;for(const[r,s]of Object.entries(e)){const e=r in t?t[r]:null;if(e){const{name:t,calc:s,value:o}=e;if(t){const e=n.#ve[t];if(!e?.get)continue;if(!e.store){i[r]=a[r]=e;continue}for(const[t,n]of ye(e.store,r))i[t]=a[t]=n;continue}if("function"==typeof s){const e=new M.Computed((()=>s(n.getters)));i[r]=a[r]={get:()=>e.get()};continue}i[r]=a[r]={get:()=>o}}else{const{name:e,calc:t,value:n}=s;if("function"==typeof t){const e=o.getters;o.#Ee=null;const n=new M.Computed((()=>t(e)));i[r]=a[r]={get:()=>n.get()};continue}if(e){const t=a[e];if(!t?.get)continue;if(!t.store){i[r]=a[r]=t;continue}for(const[e,n]of ye(t.store,r))i[e]=a[e]=n;continue}i[r]=a[r]={get:()=>n}}}return o}setObject(e){const t=new Ce(this.store,this);return t.#Oe=e,t}set(e){if(!e?.length)return this;const t=new Ce(this.store,this);t.#s=this.#s,t.#Oe=this.#Oe;const n=t.#xe,r=t.#ve;for(const{variable:s,name:o,calc:i,value:a,init:l}of e)if(l){const e=new M.State(a);if("function"==typeof i){const n=t.settable;t.#Ce=null,e.set(i(n))}else if(o){const t=r[o];if(!t?.get)continue;e.set(t.get())}n[s]=r[s]={get:()=>e.get(),set:t=>{e.set(t)}}}else if("function"!=typeof i)if(o){const e=r[o];if(!e)continue;if(!e.get||!e.store){n[s]=r[s]=e;continue}for(const[t,o]of ye(e.store,s))n[t]=r[t]=o}else n[s]=r[s]={get:()=>a};else{const e=t.getters;t.#Ee=null;const o=new M.Computed((()=>i(e)));n[s]=r[s]={get:()=>o.get()}}return t}#$e=null;get all(){const e=this.#$e;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#ve))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc?Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1}):Object.defineProperty(t,e,{value:n.exec,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#$e=t,t}#Ce=null;get settable(){const e=this.#Ce;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#ve))n.get?Object.defineProperty(t,e,{get:n.get,set:n.set,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Ce=t,t}#Ee=null;get getters(){const e=this.#Ee;if(e)return e;const t={};for(const[e,n]of Object.entries(this.#ve))n.get?Object.defineProperty(t,e,{get:n.get,configurable:!0,enumerable:!0}):n.calc&&Object.defineProperty(t,e,{value:n.calc,writable:!1,configurable:!0,enumerable:!1});return Ee(this.store,t),this.#Ee=t,t}}const $e={width:"px",height:"px",top:"px",right:"px",bottom:"px",left:"px",border:"px","border-top":"px","border-right":"px","border-left":"px","border-bottom":"px","border-width":"px","border-top-width":"px","border-right-width":"px","border-left-width":"px","border-bottom-width":"px","border-radius":"px","border-top-left-radius":"px","border-top-right-radius":"px","border-bottom-left-radius":"px","border-bottom-right-radius":"px",padding:"px","padding-top":"px","padding-right":"px","padding-left":"px","padding-bottom":"px",margin:"px","margin-top":"px","margin-right":"px","margin-left":"px","margin-bottom":"px"};function Ae(e,t){let n=!!Array.isArray(t)&&Boolean(t[1]),r="";if("string"==typeof t)return r=t.replace(/!important\s*$/,""),r?(n=r!==t,[r,n?"important":void 0]):null;const s=Array.isArray(t)?t[0]:t;return"number"==typeof s||"bigint"==typeof s?r=s&&e in $e?`${s}${$e[e]}`:`${s}`:"string"==typeof s&&(r=s),r?[r,n?"important":void 0]:null}class je{#e=new Map;emit(e,...t){const n="number"==typeof e?String(e):e,r=this.#e;for(const e of[...r.get(n)||[]])e(...t)}listen(e,t){const n=t.bind(this),r=this.#e,s="number"==typeof e?String(e):e;let o=r.get(s);return o||(o=new Set,r.set(s,o)),o.add(n),()=>{o?.delete(n)}}}const Le={stop(e){e instanceof Event&&e.stopPropagation()},prevent(e){e instanceof Event&&e.preventDefault()},self(e){if(e instanceof Event)return e.target===e.currentTarget},enter(e){if(e instanceof KeyboardEvent)return"Enter"===e.key},tab(e){if(e instanceof KeyboardEvent)return"Tab"===e.key},esc(e){if(e instanceof KeyboardEvent)return"Escape"===e.key},space(e){if(e instanceof KeyboardEvent)return" "===e.key},backspace(e){if(e instanceof KeyboardEvent)return"Backspace"===e.key},delete(e){if(e instanceof KeyboardEvent)return"Delete"===e.key},delBack(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},"del-back"(e){if(e instanceof KeyboardEvent)return"Delete"===e.key||"Backspace"===e.key},insert(e){if(e instanceof KeyboardEvent)return"Insert"===e.key},repeat(e){if(e instanceof KeyboardEvent)return e.repeat},key(e,t){if(e instanceof KeyboardEvent){const n=e.code.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},main(e){if(e instanceof MouseEvent)return 0===e.button},auxiliary(e){if(e instanceof MouseEvent)return 1===e.button},secondary(e){if(e instanceof MouseEvent)return 2===e.button},left(e){if(e instanceof MouseEvent)return 0===e.button},middle(e){if(e instanceof MouseEvent)return 1===e.button},right(e){if(e instanceof MouseEvent)return 2===e.button},primary(e){if(e instanceof PointerEvent)return e.isPrimary},mouse(e){if(e instanceof PointerEvent)return"mouse"===e.pointerType},pen(e){if(e instanceof PointerEvent)return"pen"===e.pointerType},touch(e){if(e instanceof PointerEvent)return"touch"===e.pointerType},pointer(e,t){if(e instanceof PointerEvent){const n=e.pointerType.toLowerCase().replace(/-/g,"");for(const e of t)if(n===e.toLowerCase().replace(/-/g,""))return!0;return!1}},ctrl(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey},alt(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.altKey},shift(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.shiftKey},meta(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.metaKey},cmd(e){if(e instanceof MouseEvent||e instanceof KeyboardEvent||e instanceof TouchEvent)return e.ctrlKey||e.metaKey}};function Te(e,t,n){const r=[];if(t)for(let s=e.shift();s;s=e.shift()){const e=s.indexOf(":"),o=e>=0?s.slice(0,e):s,i=e>=0?s.slice(e+1).split(":"):[],a=o.replace(/^-+/,""),l=(o.length-a.length)%2==1;let c=t[a]||a;if(n)switch(c){case"once":case"passive":case"capture":n[c]=!l;continue}"string"==typeof c&&(c=Le[c]),"function"==typeof c&&r.push([c,i,l])}return r}function Me(e,t,n){return r=>{const s=e.all;for(const[e,t,o]of n)if(e(r,t,s)===o)return;t(r,s)}}function Ne(e){return"number"==typeof e||"bigint"==typeof e?String(e):"boolean"==typeof e?e?"":null:"string"==typeof e?e:null===(e??null)?null:String(e)}function ke(e){return null===(e??null)?"":String(e)}function Ie(e,t){if(e instanceof HTMLInputElement&&"checked"===t)switch(e.type.toLowerCase()){case"checkbox":case"radio":return Boolean}if((e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&"value"===t)return ke;if(e instanceof HTMLDetailsElement&&"open"===t)return Boolean;if(e instanceof HTMLMediaElement){if("muted"===t)return Boolean;if("paused"===t)return Boolean;if("currentTime"===t)return!0;if("playbackRate"===t)return!0;if("volume"===t)return!0}return!1}const Pe={input:{attrs:{$min:(e,t)=>{t.min=e},$max:(e,t)=>{t.max=e},$step:(e,t)=>{t.step=e},$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{switch(t.type){case"checkbox":case"radio":t.checked=Boolean(e)}t.value=ke(e)}},events:{$value:["input",(e,t)=>{switch(t.type){case"checkbox":case"radio":return t.checked;case"number":return Number(t.value)}return t.value}]}},textarea:{attrs:{$placeholder:(e,t)=>{t.placeholder=e},$disabled:(e,t)=>{t.disabled=e},$readonly:(e,t)=>{t.readOnly=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["input",(e,t)=>t.value]}},select:{attrs:{$disabled:(e,t)=>{t.disabled=e},$required:(e,t)=>{t.required=e},$value:(e,t)=>{t.value=ke(e)}},events:{$value:["change",(e,t)=>t.value]}}};function Ue(e,t,n){const r=document.createElement(t,{is:n||void 0}),{watch:s,props:o}=e;return["input","textarea","select"].includes(t.toLowerCase())&&e.relate(r),e.listen("init",(({events:n})=>{const i=Pe[t.toLowerCase()],a=i?.attrs||{},l=i?.events||{};for(const[e,t,s]of n)if("$"!==e[0])r.addEventListener(e,t,s);else{const n=l[e];if(n){const[e,o]=n;r.addEventListener(e,(e=>t(o(e,r))),s)}}if(o)for(const[t,n]of Object.entries(e.attrs))if(s(t,(e=>{if(o.has(t))r[t]=e;else{const n=Ne(e);null==n?r.removeAttribute(t):r.setAttribute(t,n)}})),o.has(t))r[t]=n;else{const e=Ne(n);null!==e&&r.setAttribute(t,e)}else for(const[t,n]of Object.entries(e.attrs)){if(r instanceof HTMLInputElement&&"type"===t.toLocaleLowerCase()){const e=Ne(n);null!==e&&r.setAttribute(t,e);continue}if("$hidden"===t){n&&(r.hidden=n),s(t,(e=>{r.hidden=e}));continue}if("$"===t[0]){const e=a[t];e&&(e(n,r),s(t,(t=>e(t,r))));continue}const e=Ie(r,t);if("function"==typeof e){r[t]=e(n),s(t,(n=>{r[t]=e(n)}));continue}if(e){r[t]=n,s(t,(e=>{r[t]=e}));continue}let o=Ne(n);null!==o&&r.setAttribute(t,o),s(t,(e=>{const n=Ne(e);null===n?r.removeAttribute(t):r.setAttribute(t,n)}))}})),r}function Be(e){return null===(e??null)?"":String(e)}function Re(e,t,n,r,s){if(!s){const s=e.insertBefore(document.createTextNode(""),t),o=n.watch(r,(e=>s.textContent=Be(e)));return()=>{s.remove(),o()}}const o=e.insertBefore(document.createComment(""),t),i=e.insertBefore(document.createComment(""),t),a=document.createElement("div");function l(){for(let e=o.nextSibling;e&&e!==i;e=o.nextSibling)e.remove()}const c=n.watch(r,(t=>{l(),function(t){a.innerHTML=t;for(let t=a.firstChild;t;t=o.firstChild)e.insertBefore(t,i)}(Be(t))}));return()=>{c(),l(),o.remove(),i.remove()}}function qe(e,t){if("bigint"==typeof e&&"bigint"==typeof t)return Number(e-t);if(!("number"!=typeof e&&"bigint"!=typeof e||"number"!=typeof t&&"bigint"!=typeof t))return Number(e)-Number(t);const n=String(e),r=String(t);return n>r?1:n<r?-1:0}const _e=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function Ve(e,t,n,r,s){const o=e.children;if(!o.length)return()=>{};const i=t.insertBefore(document.createComment(""),n);let a=null,l=()=>{};const c=be((()=>o.find((([,e])=>!e||r.exec(e)))||null),(e=>{if(e===a)return;a=e,l(),l=()=>{};const t=e?.[0];t&&(l=s(t.children,t.vars,t.templates))}),!0);let u=!1;return()=>{u||(u=!0,c(),l(),l=()=>{},i.remove())}}function De(e,t,n,r,s,o,i,a,l){const c=e.bind,u=[...o,e.name],f=l?.(u);if(l&&!f)return()=>{};const{context:d,handler:h}=function(e,t,n,r){const s="string"==typeof e?e:e.tag,{attrs:o,events:i}="string"!=typeof e&&e||{attrs:null,events:null};let a=!1;const l=new M.State(!1);let c=!1;const u=new M.State(!1),f=Object.create(null),d=Object.create(null),h=new Set,p=[],g=new je;return{context:{events:p,props:o?new Set(Object.entries(o).filter((([,e])=>e.isProp)).map((([e])=>e))):null,attrs:d,watch(e,t){if(a)return()=>{};const n=f[e];if(!n)return()=>{};let r=n.get();const s=be((()=>n.get()),(n=>{const s=r;r=n,t(n,s,e)}),!0);return h.add(s),()=>{h.delete(s),s()}},relate(e){if(!n||!r||a)return()=>{};try{const t=r(n,e);return"function"!=typeof t?()=>{}:(h.add(t),()=>{h.delete(t),t()})}catch{return()=>{}}},get destroyed(){return l.get()},get init(){return u.get()},listen:(e,t)=>g.listen(e,t)},handler:{tag:s,set(e,t){if(o&&!(e in o))return;let n=f[e];if(n)return void n.set(t);const r=new M.State(t);f[e]=r,Object.defineProperty(d,e,{configurable:!0,enumerable:!0,get:r.get.bind(r)})},addEvent(e,n){if("function"!=typeof n)return;const[r,...s]=e.split(".").filter(Boolean),o=i?i[r].filters:{};if(!o)return;const a={},l=Te(s,o,a);p.push([r,Me(t,n,l),a])},destroy(){if(!a){a=!0,l.set(!0);for(const e of h)e();g.emit("destroy")}},mount(){c||(c=!0,u.set(!0),g.emit("init",{events:p}))}}}}(f||e.name,r,r.getStore(c),a),p=f?.attrs,g=p?function(e,t,n,r,s){let o=new Set;for(const[i,a]of Object.entries(r)){if("class"===i||"style"===i)continue;if(i in n){const r=n[i],{name:s,calc:l,value:c}=n[i];if(!s&&!l){e.set(i,c);continue}a.immutable&&e.set(i,t.exec(r)),o.add(t.watch(r,(t=>e.set(i,t))));continue}const r=a.bind;if(!s||!r){e.set(i,a.default);continue}if("string"==typeof r){const n=t.bind(s,r,(t=>e.set(i,t)));n?o.add(n):e.set(i,a.default);continue}if(!Array.isArray(r)){e.set(i,a.default);continue}const[l,c,u]=r;if(!l||"function"!=typeof c)continue;if(!u){const n=!0===s?"":s;o.add(t.watch({name:n},(t=>e.set(i,t)))),e.addEvent(l,((...e)=>{t.all[n]=c(...e)}));continue}const f=t.bind(s,"state",(t=>e.set(i,t)));if(!f)continue;o.add(f);const d=t.bindSet(s,"state");d&&e.addEvent(l,((...e)=>{d(c(...e))}))}return()=>{const e=o;o=new Set;for(const t of e)t()}}(h,r,e.attrs,p,c):function(e,t,n){const r=e.tag;let s=new Set;for(const[o,i]of Object.entries(n)){if("class"===o||"style"===o)continue;const{name:n,calc:a,value:l}=i;if(n||a)if("string"!=typeof r||"input"!==r.toLocaleLowerCase()||"type"!==o.toLocaleLowerCase())s.add(t.watch(i,(t=>e.set(o,t))));else{const n=t.exec(i);e.set(o,n)}else e.set(o,l)}return()=>{const e=s;s=new Set;for(const t of e)t()}}(h,r,e.attrs);for(const[t,n]of Object.entries(e.events)){const e=r.getEvent(n);e&&h.addEvent(t,e)}const m=function(e,t,n){if(!n)return()=>{};let r=new Set;for(const[s,o]of Object.entries(t.bindAll(n)||{}))"function"==typeof o&&r.add(o((t=>e.set(s,t))));for(const[r,s]of Object.entries(t.bindEvents(n)||{}))e.addEvent(r,(e=>s(e)));return()=>{const e=r;r=new Set;for(const t of e)t()}}(h,r,c),b=f?"function"==typeof f.tag?f.tag(d):Ue(d,f.tag,f.is):Ue(d,e.name,e.is),v=Array.isArray(b)?b[0]:b,y=Array.isArray(b)?b[1]:v;t.insertBefore(v,n);const w=y?ze(e.children||[],y,null,r,s,o,i,a,l):()=>{},x=function(e,t,n,r){if(!(e instanceof Element))return()=>{};r&&(e.className+=" "+t.exec(r));let s=new Set;for(const[r,o]of Object.entries(n))o.value?e.classList.add(r):s.add(be((()=>Boolean(t.exec(o))),(t=>{t?e.classList.add(r):e.classList.remove(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(v,r,e.classes,e.attrs.class),O=function(e,t,n,r){if(!(e instanceof HTMLElement||e instanceof SVGElement))return()=>{};if(r){const n=[e.getAttribute("style")||"",t.exec(r)||""].filter(Boolean).join(";");n&&e.setAttribute("style",n)}let s=new Set;for(const[r,o]of Object.entries(n))s.add(be((()=>Ae(r,t.exec(o))),(t=>{t?e.style.setProperty(r,...t):e.style.removeProperty(r)}),!0));return()=>{if(!s)return;const e=s;s=null;for(const t of e)t()}}(v,r,e.styles,e.attrs.style);h.mount();const S=function(e,t,n,r,s,o){let i=new Set;for(const[a,{attrs:l,value:c,events:u,bind:f}]of Object.entries(t)){if(!_e(r,a))continue;const d=r[a];if("function"!=typeof d)continue;let h=!1;const p=new M.State(!1),g=d?.events,m=[],b=Object.create(null),v=new Set,y=new je;function w(e,t){if("function"!=typeof t)return;const[r,...s]=e.split(".").filter(Boolean),o=g?g[r].filters:{};if(!o)return;const i={},a=Te(s,o,i);m.push([r,Me(n,t,a),i])}function x(){if(!h){h=!0,p.set(!0);for(const e of v)e();y.emit("destroy")}}i.add(x);for(const[S,E]of Object.entries(l)){const C=n.get(E);C&&Object.defineProperty(b,S,{...C,configurable:!0,enumerable:!0})}for(const[$,A]of Object.entries(u)){const j=n.getEvent(A);j&&w($,j)}if(f){for(const[L,T]of Object.entries(n.getBindAll(f)||{}))Object.defineProperty(b,L,{...T,configurable:!0,enumerable:!0});for(const[N,k]of Object.entries(n.bindEvents(f)||{}))w(N,(e=>k(e)))}const O={get value(){return null},events:m,attrs:b,watch(e,t){if(h)return()=>{};let n=b[e];const r=be((()=>b[e]),(r=>{const s=n;n=r,t(r,s,e)}),!0);return v.add(r),()=>{v.delete(r),r()}},get destroyed(){return p.get()},listen:(e,t)=>y.listen(e,t),root:s,slot:o,tag:e};if(c){const I=n.get(c);I&&Object.defineProperty(O,"value",{...I,configurable:!0,enumerable:!0})}d(O)}return()=>{const e=i;i=new Set;for(const t of e)t()}}(h.tag,e.enhancements,r,i,v,y);return()=>{S(),h.destroy(),v.remove(),g(),w(),m(),x(),O()}}function We(e,t,n){if(!n)return t;const r=Object.entries(n);if(!r.length)return t;const s=Object.create(t);for(const[t,n]of r)s[t]=[n,e];return s}function Ke(e,t,n,r,s,o,i,a,l){if("string"==typeof e){const r=document.createTextNode(e);return t.insertBefore(r,n),()=>r.remove()}const c=r.set(e.vars),u=We(c,s,e.templates);if("divergent"===e.type)return Ve(e,t,n,c,((e,r,u)=>{const f=c.set(r),d=We(f,s,u);return ze(e,t,n,f,d,o,i,a,l)}));if("value"===e.type){const r=c.child(e.name);return r?ze(e.children,t,n,r,u,o,i,a,l):()=>{}}if("enum"===e.type){const r=c.enum(e.value),s=(n,r)=>ze(e.children,t,n,r,u,o,i,a,l);return r instanceof Q?function(e,t,n,r,s){const o=e.insertBefore(document.createComment(""),t);let i=new Map;function a(e){for(const[t,n,r]of e.values())r(),t.remove(),n.remove()}const l=new M.State(0),c=be((()=>n.children),(function(t){if(!o.parentNode)return;let c=o.nextSibling;const u=i;i=new Map,l.set(t.length);for(let o of t){const t=u.get(o);if(!t){const t=e.insertBefore(document.createComment(""),c),a=e.insertBefore(document.createComment(""),c),u=s(a,r.setStore(o,n,{get count(){return l.get()},get key(){return o.index},get index(){return o.index},get item(){return o.value}}));i.set(o,[t,a,u]);continue}if(u.delete(o),i.set(o,t),c===t[0]){c=t[1].nextSibling;continue}let a=t[0];for(;a&&a!==t[1];){const t=a;a=a.nextSibling,e.insertBefore(t,c)}e.insertBefore(t[1],c)}a(u)}),!0);return()=>{o.remove(),a(i),c()}}(t,n,r,c,s,e.sort):r instanceof G?function(e,t,n,r,s,o){const i=[],a=[...n],l=a.length,c=o?a.map((([e,t])=>[e,t,r.setStore(t,n).exec(o)])).sort((([,,e],[,,t])=>qe(e,t))).map((([e,t],n)=>[e,t,n])):a.map((([e,t],n)=>[e,t,n]));for(const[e,o,a]of c)i.push(s(t,r.setStore(o,n,{get count(){return l},get key(){return e},get index(){return a},get item(){return o.value}})));return()=>{for(const e of i)e()}}(0,n,r,c,s,e.sort):"function"==typeof r?function(e,t,n,r,s,o){const i=new M.Computed((()=>{const e=n();if("number"==typeof e){const t=Math.floor(e);return t?Array(t).fill(0).map(((e,t)=>[t+1,t])):[]}return e&&"object"==typeof e?Array.isArray(e)?e.map(((e,t)=>[e,t])):Object.entries(e).map((([e,t])=>[t,e])):[]})),a=o?new M.Computed((()=>{const e=i.get();return e.map((([t,n],s)=>[n,t,r.setObject({get count(){return e.length},get key(){return t},get item(){return n},get index(){return s}}).exec(o)])).sort((([,,e],[,,t])=>qe(e,t))).map((([e,t],n)=>[t,n,e]))})):new M.Computed((()=>i.get().map((([e,t],n)=>[t,n,e])))),l=e.insertBefore(document.createComment(""),t);let c=[];function u(e){for(const[t,n,r]of e)r(),t.remove(),n.remove()}const f=new M.State(0),d=be((()=>a.get()),(function(t){if(!l.parentNode)return;let n=l.nextSibling;const o=c;c=[],f.set(t.length);for(const[i,a,l]of t){const t=o.findIndex((e=>e[3]===l)),[u]=t>=0?o.splice(t,1):[];if(!u){const t=e.insertBefore(document.createComment(""),n),o=e.insertBefore(document.createComment(""),n),u=new M.State(i),d=new M.State(a),h=s(o,r.setObject({get count(){return f.get()},get key(){return l},get item(){return u.get()},get index(){return d.get()}}));c.push([t,o,h,l,u,d]);continue}if(c.push(u),u[4].set(i),u[5].set(a),n===u[0]){n=u[1].nextSibling;continue}let d=u[0];for(;d&&d!==u[1];){const t=d;d=d.nextSibling,e.insertBefore(t,n)}e.insertBefore(u[1],n)}u(o)}),!0);return()=>{l.remove(),u(c),d()}}(t,n,r,c,s,e.sort):()=>{}}if("content"===e.type)return Re(t,n,c,e.value,e.html);if("template"===e.type){const r=u[e.template];if(!r)return()=>{};const[f,d]=r,h=d.params(f.params,e.attrs,c,e.bind),p=We(h,s,f.templates);return ze(f.children,t,n,h,p,o,i,a,l)}return"fragment"===e.type?ze(e.children,t,n,c,u,o,i,a,l):De(e,t,n,c,u,o,i,a,l)}function ze(e,t,n,r,s,o,i,a,l){const c=e.map((e=>Ke(e,t,n,r,s,o,i,a,l)));let u=!1;return()=>{if(!u){u=!0;for(const e of c)e()}}}function He(e,t,n,{component:r,global:s,relate:o,enhancements:i}={}){return ze(t,n,null,new Ce(e,s),Object.create(null),[],i||{},"function"==typeof o?o:null,r)}export{Q as ArrayStore,ge as Layout,G as ObjectStore,M as Signal,Y as Store,me as effect,He as render,be as watch};
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @neeloong/form v0.
|
|
2
|
+
* @neeloong/form v0.14.0
|
|
3
3
|
* (c) 2024-2025 Fierflame
|
|
4
4
|
* @license Apache-2.0
|
|
5
5
|
*/
|
|
@@ -400,8 +400,12 @@ class Store {
|
|
|
400
400
|
if (parent) {
|
|
401
401
|
this.#parent = parent;
|
|
402
402
|
this.#root = parent.#root;
|
|
403
|
+
this.#loading = parent.#loading;
|
|
403
404
|
// TODO: 事件向上冒泡
|
|
404
405
|
}
|
|
406
|
+
const loading = new Signal.State(false);
|
|
407
|
+
this.#selfLoading = loading;
|
|
408
|
+
this.#loading = loading;
|
|
405
409
|
this.#type = schema.type;
|
|
406
410
|
this.#meta = schema.meta;
|
|
407
411
|
this.#component = schema.component;
|
|
@@ -517,6 +521,18 @@ class Store {
|
|
|
517
521
|
#meta;
|
|
518
522
|
/** @readonly @type {any} */
|
|
519
523
|
#component;
|
|
524
|
+
/** @type {Signal.State<boolean>?} */
|
|
525
|
+
#selfLoading = null
|
|
526
|
+
/** @type {Signal.State<boolean>} */
|
|
527
|
+
#loading;
|
|
528
|
+
get loading() {
|
|
529
|
+
return this.#loading.get();
|
|
530
|
+
}
|
|
531
|
+
set loading(loading) {
|
|
532
|
+
const s = this.#selfLoading;
|
|
533
|
+
if (!s) { return }
|
|
534
|
+
s.set(Boolean(loading));
|
|
535
|
+
}
|
|
520
536
|
/** 存储对象自身 */
|
|
521
537
|
get store() { return this; }
|
|
522
538
|
/** 父级存储对象 */
|
|
@@ -2412,6 +2428,7 @@ const bindable = {
|
|
|
2412
2428
|
immutable: true,
|
|
2413
2429
|
changed: true,
|
|
2414
2430
|
|
|
2431
|
+
loading: true,
|
|
2415
2432
|
required: true,
|
|
2416
2433
|
clearable: true,
|
|
2417
2434
|
hidden: true,
|
|
@@ -2581,7 +2598,7 @@ function testKey(key) {
|
|
|
2581
2598
|
return '_$'.includes(key[1]);
|
|
2582
2599
|
}
|
|
2583
2600
|
/**
|
|
2584
|
-
* @param {Record<string, Store | {get?(): any; set?(v: any): void; exec
|
|
2601
|
+
* @param {Record<string, Store | {get?(): any; set?(v: any): void; exec?: any; calc?: any }>?} [global]
|
|
2585
2602
|
*/
|
|
2586
2603
|
function toGlobal(global) {
|
|
2587
2604
|
/** @type {Record<string, ValueDefine | ExecDefine | CalcDefine>} */
|
|
@@ -2601,11 +2618,11 @@ function toGlobal(global) {
|
|
|
2601
2618
|
items[key] = typeof set === 'function' ? {get,set} : {get};
|
|
2602
2619
|
continue;
|
|
2603
2620
|
}
|
|
2604
|
-
if (typeof calc === 'function') {
|
|
2621
|
+
if (typeof calc === 'function' || calc && typeof calc === 'object') {
|
|
2605
2622
|
items[key] = {calc};
|
|
2606
2623
|
continue;
|
|
2607
2624
|
}
|
|
2608
|
-
if (typeof exec === 'function') {
|
|
2625
|
+
if (typeof exec === 'function' || calc && typeof calc === 'object') {
|
|
2609
2626
|
items[key] = {exec};
|
|
2610
2627
|
continue;
|
|
2611
2628
|
}
|
|
@@ -2638,8 +2655,8 @@ function addStore(store, env) {
|
|
|
2638
2655
|
|
|
2639
2656
|
|
|
2640
2657
|
/** @typedef {{get(): any; set?(v: any): void; exec?: null; store?: Store; calc?: null; }} ValueDefine */
|
|
2641
|
-
/** @typedef {{get?: null; exec(...
|
|
2642
|
-
/** @typedef {{get?: null; calc(...
|
|
2658
|
+
/** @typedef {{get?: null; exec: ((...v: any[]) => void) | Record<string, any>; calc?: null}} ExecDefine */
|
|
2659
|
+
/** @typedef {{get?: null; calc: ((...v: any[]) => void) | Record<string, any>; exec?: null;}} CalcDefine */
|
|
2643
2660
|
|
|
2644
2661
|
/**
|
|
2645
2662
|
* @template {Store} [T=Store]
|
|
@@ -2818,7 +2835,9 @@ class Environment {
|
|
|
2818
2835
|
const item = this.#items[name];
|
|
2819
2836
|
if (!item) { return null }
|
|
2820
2837
|
const {exec, calc} = item;
|
|
2838
|
+
// @ts-ignore
|
|
2821
2839
|
if (typeof exec === 'function') { return exec }
|
|
2840
|
+
// @ts-ignore
|
|
2822
2841
|
if (typeof calc === 'function') { return calc }
|
|
2823
2842
|
return null
|
|
2824
2843
|
|
|
@@ -4687,4 +4706,4 @@ function render(store, layouts, parent, { component, global, relate, enhancement
|
|
|
4687
4706
|
return renderChildren(layouts, parent, null, env, templates, [], allEnhancements, relateFn, component);
|
|
4688
4707
|
}
|
|
4689
4708
|
|
|
4690
|
-
export { index as Layout, Store, effect, render, watch };
|
|
4709
|
+
export { ArrayStore, index as Layout, ObjectStore, Store, effect, render, watch };
|