/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/domeleon@0.5.2/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
import{Renderer,isVElement}from"./chunk-KCVQ624I.js";import{debounce,equalsIgnoreCase,freezeProps,fuzzyEquals,getPropertyKey,humanizeIdentifier,isAttrEvent,isNullOrEmpty,kebab,key,nativiseAttrName,parseFloatDeNaN,takeWhile}from"./chunk-REJLVLZH.js";import{__publicField}from"./chunk-V6TY7KAL.js";import*as preact3 from"preact";import*as preactHooks2 from"preact/hooks";import*as preact from"preact";import{h as preactH}from"preact";import*as preactHooks from"preact/hooks";var OnMountAdapter=({onMounted:e,preactElement:t})=>{const r=preactHooks.useRef(null);return preactHooks.useLayoutEffect((()=>e(r.current)),[]),preact.cloneElement(t,{ref:r})};function isRef(e){return!(!e||"object"!=typeof e||!("current"in e))}var HookAdapter=({hookConfig:e,tag:t,elementProps:r,elementChildren:n})=>{const{hook:i,options:o}=e,s=i(o??{}),a=isRef(s?.[0])?s[0]:isRef(s)?s:null,u=a?{...r,ref:a}:r;return preactH(t,u,n)},ComponentAdapter=({componentConfig:e,elementProps:t,elementChildren:r})=>{const{component:n,componentProps:i={}}=e,o={...i,...t};return preactH(n,o,r)};import*as preact2 from"preact";var transformer=()=>({transformElement:(e,t,r)=>preact2.h(e,t,r),transformHook:(e,t,r,n)=>preact2.h(HookAdapter,{elementProps:r,elementChildren:n,hookConfig:e,tag:t}),tranformComponent:(e,t,r,n)=>preact2.h(ComponentAdapter,{elementProps:r,elementChildren:n,componentConfig:e}),transformAttributeName:(e,t)=>isAttrEvent(e)?e:nativiseAttrName(e,t),transformOnMounted:(e,t,r)=>preact2.h(OnMountAdapter,{onMounted:t,preactElement:e})}),PreactRenderer=class extends Renderer{constructor(e){super(transformer()),__publicField(this,"_dependencies"),__publicField(this,"_PreactLib"),this._dependencies={...e,mountCallback:e.mountCallback??((e,t)=>{this._PreactLib.render(e,t)})},this._PreactLib=this._dependencies.PreactLib}get rendererName(){return"Preact"}patch(e,t){let r=this.renderVNode(e);return this._dependencies.mountCallback(r,t),t}unmount(e){this._PreactLib.render(null,e)}},createDefaultRenderer=()=>new PreactRenderer({PreactLib:preact3,PreactHooksLib:preactHooks2}),LocalStorageSerializer=class{constructor(e){__publicField(this,"_host"),this._host=e}load(){supported()&&this._host.deserialize(window.localStorage.getItem(this._host.key))}save(){if(supported()){const e=this._host.serialize();window.localStorage.setItem(this._host.key,e)}}clear(){supported()&&window.localStorage.removeItem(this._host.key)}};function supported(){return null!=window.localStorage}var AppSerializer=class{constructor(e){__publicField(this,"_host"),__publicField(this,"_localStorage"),this._host=e,this._localStorage=this.createStorage(),this._host.autoPersist&&this._localStorage.load()}serialize(){return this._host.root.serializer.serialize()}deserialize(e){this._host.root.serializer.deserialize(e),this._host.refresh()}load(){this._localStorage.load()}save(){this._localStorage.save()}clear(){this._localStorage.clear()}createStorage(){return new LocalStorageSerializer({key:this._host.id,serialize:()=>JSON.stringify(this.serialize()),deserialize:e=>this.deserialize(JSON.parse(e))})}},selectorSpacePrefix=/\[&\s+/,selectorSpaceInfix=/\s+(?=[^\]]*\]:)/g,bracketVariantRegex=/\[[^\]]+\]:\S+/g,normalizeUtilityClass=e=>e.startsWith("[& ")?e.trim().replace(selectorSpacePrefix,"[&_").replace(selectorSpaceInfix,"_"):e.trim(),normalizeUtilityString=e=>e.replace(bracketVariantRegex,(e=>normalizeUtilityClass(e))),ClassProcessor=class{constructor(){__publicField(this,"_elementClasses",new Set)}addClass(e){const t=("string"==typeof e?[e]:Array.isArray(e)?e:[]).flatMap((e=>{if(!e)return[];return[...Array.from(e.matchAll(bracketVariantRegex),(e=>e[0])),...e.replace(bracketVariantRegex," ").trim().split(/\s+/g).filter(Boolean)]})).filter(Boolean);for(const e of t){const t=cssManager.addClass(e,!1);this._elementClasses.add(t)}}getClassString(){return[...this._elementClasses].join(" ")}},CssManager=class{constructor(){__publicField(this,"_classes",new Set),__publicField(this,"_stickyClasses",new Set)}addClass(e,t){const r=normalizeUtilityClass(e);return t?this._stickyClasses.add(r):this._classes.add(r),r}async flushClasses(e){e&&(await e.generate(this._classes,this._stickyClasses),this._classes.clear(),this._stickyClasses.clear())}},cssManager=new CssManager;function stickyClass(e){return cssManager.addClass(e,!0)}var StyleProcessor=class{constructor(){__publicField(this,"styles")}addStyle(e){isStyleObject(e)&&(this.styles??(this.styles={}),Object.assign(this.styles,e))}},isStyleObject=e=>!("object"!=typeof e||null===e||Array.isArray(e)||e instanceof Date),isAttribute=e=>!("object"!=typeof e||null===e||Array.isArray(e)||e instanceof Date||"nodeName"in e!=!1||"view"in e!=!1),squash=e=>e.flatMap((e=>Array.isArray(e)?squash(e):null==e||isAttribute(e)?[]:[e]));function mergeAttrs(...e){const t=new ClassProcessor,r=new StyleProcessor,n={};for(const i of e)if(i)for(const e in i){const o=i[e];"class"===e?t.addClass(o):"style"===e?r.addStyle(o):"key"===e?null!=o&&(n.key=o):null!=o&&(n[e]=o)}n.style=r.styles;const i=t.getClassString();return i&&(n.class=i),n}function h2(e,...t){const r=t.findIndex((e=>null!=e&&!isAttribute(e)&&"boolean"!=typeof e)),n=r<0?t.length:r,i=mergeAttrs(...t.slice(0,n).filter(isAttribute));return{nodeName:e,attributes:i,children:squash(t.slice(n)),key:i.key}}function a(...e){return h2("a",...e)}function abbr(...e){return h2("abbr",...e)}function address(...e){return h2("address",...e)}function area(...e){return h2("area",...e)}function article(...e){return h2("article",...e)}function aside(...e){return h2("aside",...e)}function audio(...e){return h2("audio",...e)}function b(...e){return h2("b",...e)}function base(...e){return h2("base",...e)}function bdi(...e){return h2("bdi",...e)}function bdo(...e){return h2("bdo",...e)}function blockquote(...e){return h2("blockquote",...e)}function body(...e){return h2("body",...e)}function br(...e){return h2("br",...e)}function button(...e){return h2("button",...e)}function canvas(...e){return h2("canvas",...e)}function caption(...e){return h2("caption",...e)}function cite(...e){return h2("cite",...e)}function code(...e){return h2("code",...e)}function col(...e){return h2("col",...e)}function colgroup(...e){return h2("colgroup",...e)}function data(...e){return h2("data",...e)}function datalist(...e){return h2("datalist",...e)}function dd(...e){return h2("dd",...e)}function del(...e){return h2("del",...e)}function details(...e){return h2("details",...e)}function dfn(...e){return h2("dfn",...e)}function dialog(...e){return h2("dialog",...e)}function div(...e){return h2("div",...e)}function dl(...e){return h2("dl",...e)}function dt(...e){return h2("dt",...e)}function em(...e){return h2("em",...e)}function embed(...e){return h2("embed",...e)}function fieldset(...e){return h2("fieldset",...e)}function figcaption(...e){return h2("figcaption",...e)}function figure(...e){return h2("figure",...e)}function footer(...e){return h2("footer",...e)}function form(...e){return h2("form",...e)}function h1(...e){return h2("h1",...e)}function h22(...e){return h2("h2",...e)}function h3(...e){return h2("h3",...e)}function h4(...e){return h2("h4",...e)}function h5(...e){return h2("h5",...e)}function h6(...e){return h2("h6",...e)}function head(...e){return h2("head",...e)}function header(...e){return h2("header",...e)}function hgroup(...e){return h2("hgroup",...e)}function hr(...e){return h2("hr",...e)}function html(...e){return h2("html",...e)}function i(...e){return h2("i",...e)}function iframe(...e){return h2("iframe",...e)}function img(...e){return h2("img",...e)}function input(...e){return h2("input",...e)}function ins(...e){return h2("ins",...e)}function kbd(...e){return h2("kbd",...e)}function label(...e){return h2("label",...e)}function legend(...e){return h2("legend",...e)}function li(...e){return h2("li",...e)}function link(...e){return h2("link",...e)}function main(...e){return h2("main",...e)}function map(...e){return h2("map",...e)}function mark(...e){return h2("mark",...e)}function menu(...e){return h2("menu",...e)}function meta(...e){return h2("meta",...e)}function meter(...e){return h2("meter",...e)}function nav(...e){return h2("nav",...e)}function noscript(...e){return h2("noscript",...e)}function object(...e){return h2("object",...e)}function ol(...e){return h2("ol",...e)}function optgroup(...e){return h2("optgroup",...e)}function option(...e){return h2("option",...e)}function output(...e){return h2("output",...e)}function p(...e){return h2("p",...e)}function picture(...e){return h2("picture",...e)}function pre(...e){return h2("pre",...e)}function progress(...e){return h2("progress",...e)}function q(...e){return h2("q",...e)}function rp(...e){return h2("rp",...e)}function rt(...e){return h2("rt",...e)}function ruby(...e){return h2("ruby",...e)}function s(...e){return h2("s",...e)}function samp(...e){return h2("samp",...e)}function script(...e){return h2("script",...e)}function search(...e){return h2("search",...e)}function section(...e){return h2("section",...e)}function select(...e){return h2("select",...e)}function slot(...e){return h2("slot",...e)}function small(...e){return h2("small",...e)}function source(...e){return h2("source",...e)}function span(...e){return h2("span",...e)}function strong(...e){return h2("strong",...e)}function style(...e){return h2("style",...e)}function sub(...e){return h2("sub",...e)}function summary(...e){return h2("summary",...e)}function sup(...e){return h2("sup",...e)}function table(...e){return h2("table",...e)}function tbody(...e){return h2("tbody",...e)}function td(...e){return h2("td",...e)}function template(...e){return h2("template",...e)}function textarea(...e){return h2("textarea",...e)}function tfoot(...e){return h2("tfoot",...e)}function th(...e){return h2("th",...e)}function thead(...e){return h2("thead",...e)}function time(...e){return h2("time",...e)}function title(...e){return h2("title",...e)}function tr(...e){return h2("tr",...e)}function track(...e){return h2("track",...e)}function u(...e){return h2("u",...e)}function ul(...e){return h2("ul",...e)}function video(...e){return h2("video",...e)}function wbr(...e){return h2("wbr",...e)}async function matchRoute(e,t,r,n){if(n())return{cancel:!0,updates:[]};const i=t.firstSegment,o=i?t.remainder:t;if(!1===await e.component.onNavigate(t,r)||n())return{cancel:!0,updates:[]};const s=[];if(i){let a=e.children.find((e=>e.routeSegment===i))?.router;if(!a)return{cancel:!0,updates:[]};for(const e of contiguousTransparentParents(a).reverse()){if(!1===await e.component.onNavigate(t,r)||n())return{cancel:!0,updates:[]};s.push({router:e,segment:i})}const u=await matchRoute(a,o,r,n);if(u.cancel)return{cancel:!0,updates:[]};s.push(...u.updates)}return n()?{cancel:!0,updates:[]}:(s.push({router:e,segment:i}),{cancel:!1,updates:s})}var contiguousTransparentParents=e=>takeWhile(e.rootToHereRouters.reverse().slice(1),(e=>e.isTransparent)),Route=class e{constructor(e,t=""){if(__publicField(this,"segments"),__publicField(this,"query"),Array.isArray(e))return this.segments=e.filter(Boolean),void(this.query=t);const[r,n]=e.split("?"),i=r.replace(/^\/+/g,"").replace(/\/+$/g,"");this.segments=i?i.split("/"):[],this.query=t||n||""}get pathOnly(){return new e(this.segments)}get firstSegment(){return this.segments[0]}get remainder(){return new e(this.segments.slice(1),this.query)}withQuery(t){const r=t.replace(/^\?/,"");return new e(this.segments,r)}concat(t){const r=t instanceof e?t:new e(t);return new e([...this.segments,...r.segments],r.query||this.query)}toString(){return"/"+this.segments.join("/")+(this.query?`?${this.query}`:"")}equals(e){return this.query===e.query&&(this.segments.length===e.segments.length&&this.segments.every(((t,r)=>t===e.segments[r])))}relativeTo(t){if(0===t.segments.length)return this;return t.segments.every(((e,t)=>this.segments[t]===e))?new e(this.segments.slice(t.segments.length),this.query):this}},Router=class{constructor(e){__publicField(this,"_component"),__publicField(this,"_activeSegment",""),__publicField(this,"_navigationVersion",0),__publicField(this,"_inFlight"),__publicField(this,"routeService"),this._component=e}navigate(e,t="PUSH"){const r=e instanceof Route?e:new Route(e),n=this.root,i=n.activeLeaf.rootToHereRouters,o=r.pathOnly,s=r.query,a=this.rootToHereRoute.concat(o).withQuery(s),u=this.getInFlight(a);if(u)return u;const c=this.bumpNavigationVersion();if(this.shouldShortCircuit(a,t))return Promise.resolve(!0);const l=(async()=>{const e=await matchRoute(this.root,a,t,c);if(e.cancel)return!1;for(const{router:t,segment:r}of e.updates)t._activeSegment=r;return this.root.routeService.currentRoute=a,this.root.routeService?.syncHistory(t),this.clearActiveSegments(i),this.fireRouterUpdateEvent(),this.fireNavigated(),!0})();return n._inFlight={route:a,promise:l},l.finally((()=>{n._inFlight?.promise===l&&(n._inFlight=void 0)})),l}get component(){return this._component}fireRouterUpdateEvent(){const e=this.root.routeService?.currentRoute;e&&this.component.update({cause:"router",key:"route",value:e.toString()})}bumpNavigationVersion(){this.root._navigationVersion++;const e=this.root._navigationVersion;return()=>e!==this.root._navigationVersion}getInFlight(e){return this.root._inFlight?.route.equals(e)?this.root._inFlight.promise:void 0}shouldShortCircuit(e,t){const r=this.root.routeService?.currentRoute;return!("POP"===t||!r)&&e.equals(r)}fireNavigated(){this.root.activeLeaf.rootToHereRouters.forEach((e=>e.component.onNavigated()))}clearActiveSegments(e){const t=this.root.activeLeaf.rootToHereRouters;e.filter((e=>!t.includes(e))).forEach((e=>e._activeSegment=""))}get activeSegment(){return this._activeSegment}get activeLeaf(){if(this.isActive)return this.activeChild?.router.activeLeaf??this}get isActive(){return!this.parent||this.parent.activeChild?.router===this}get parent(){let e=this.component.ctx.parent;for(;e&&!isRouted(e);)e=e.ctx.parent;return e?e.router:void 0}get rootToHereRouters(){const e=[];for(let t=this;t;t=t.parent)e.unshift(t);return e}get rootToHereRoute(){const e=this.rootToHereRouters.filter((e=>!e.isTransparent)).map((e=>e.component.routeSegment));return new Route(e)}get root(){return this.parent?this.parent.root:this}get children(){return this.component.ctx.children.flatMap((e=>isRouted(e)?e.router.isTransparent?e.router.children:[e]:[]))}child(e){return this.children.find((t=>t.routeSegment===e))}get activeChild(){return this.child(this.activeSegment)}get isTransparent(){return""===this.component.routeSegment}link(e,...t){const r=e instanceof Route?e:new Route(e),n=this.root.routeService?.basePath.concat(this.rootToHereRoute).concat(r).toString();return a({href:n,onClick:e=>{e.preventDefault(),this.navigate(r)}},...t)}};function isRouted(e){return"object"==typeof e&&null!==e&&"router"in e&&e.router instanceof Router}var browserHistory={push(e){window.history.pushState({},"",e.toString()),window.dispatchEvent(new PopStateEvent("popstate",{state:{}}))},replace(e){window.history.replaceState({},"",e.toString()),window.dispatchEvent(new PopStateEvent("popstate",{state:{}}))},back(){window.history.back()},listen(e){window.addEventListener("popstate",(()=>{e(new Route(window.location.pathname+window.location.search),"POP")}))},get location(){return new Route(window.location.pathname+window.location.search)}},HistorySync=class{constructor(e){this.service=e,__publicField(this,"_registered",!1)}ensureListener(){this.service.root.parent||this._registered||(this._registered=!0,browserHistory.listen(((e,t)=>{"POP"===t&&this.service.navigateAbsolute(e,"POP")})))}sync(e){if("POP"===e)return;const t=this.service.basePath.concat(this.service.currentRoute);t.equals(browserHistory.location)?browserHistory.replace(t):browserHistory.push(t)}},RouteService=class{constructor(e={}){__publicField(this,"_basePath"),__publicField(this,"_history"),__publicField(this,"_root"),__publicField(this,"currentRoute",new Route("")),this._basePath=new Route(e.basePath??"")}get basePath(){return this._basePath}get root(){return this._root}syncHistory(e){this._history?.sync(e)}init(e){const t=e.root;if(!isRouted(t))return;t.router.routeService=this,this._root=t.router,this._history=new HistorySync(this),this._history.ensureListener();const r=window.location;this.navigateAbsolute(new Route(r.pathname+r.search),"POP")}navigateAbsolute(e,t){const r=e.relativeTo(this._basePath);return this.root.navigate(r,t)}},AppPlugins=class{constructor(e,t=[]){this.app=e,__publicField(this,"_pluginData",[]),__publicField(this,"_rendered",!1);for(const r of t){const t=r.create?.(e);this._pluginData.push({plugin:r,instance:t})}}onRendered(){if(!this._rendered){this._rendered=!0;for(const{plugin:e,instance:t}of this._pluginData)e.onRendered?.(t)}}onUpdated(e){for(const{plugin:t,instance:r}of this._pluginData)t.onUpdated?.(r,e)}},App=class{constructor(e){__publicField(this,"_lock",!1),__publicField(this,"_pending",!1),__publicField(this,"serializer"),__publicField(this,"renderer"),__publicField(this,"routeService"),__publicField(this,"_root"),__publicField(this,"_props"),__publicField(this,"_rootElement",null),__publicField(this,"_id"),__publicField(this,"_saveDebounce"),__publicField(this,"_plugins"),this._id=e.id,this._root=e.root,this._props=e,this.renderer=e.renderer??createDefaultRenderer(),this._rootElement=document.getElementById(e.id),this._saveDebounce=debounce((()=>this.save()),200),this.serializer=new AppSerializer({id:e.id,root:this._root,refresh:()=>this.render(),autoPersist:e.autoPersist??!1}),this.routeService=e.routeService??new RouteService,this.routeService.init(this),this._root.ctx.attach(this),this._plugins=new AppPlugins(this,e.plugins??[]),this.render()}get containerId(){return this._id}get root(){return this._root}render(){this._lock?this._pending=!0:(this._lock=!0,this._pending=!1,requestAnimationFrame((async()=>{try{const e=this._root.view();await cssManager.flushClasses(this._props.cssAdapter),this.renderer.patch(e,this._rootElement),this.root.ctx.markRendered(),this._plugins.onRendered()}finally{this._lock=!1,this._pending&&(this._pending=!1,this.render())}})))}update(e){this.serializer&&this._plugins&&(this._plugins.onUpdated(e),this._saveDebounce(),this.render())}save(){this._props.autoPersist&&this.serializer.save()}},componentSkipProps=["ctx","serializer","serializerMap","validator","router"],isFunctionValue=(e,t)=>{try{return"function"==typeof e[t]}catch{return!0}},isWritable=(e,t)=>{for(let r=e;r;r=Object.getPrototypeOf(r)){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return!!e.set||!!e.writable}return!0},keysOfComponent=e=>{const t=new Set;for(const r of Object.keys(e))componentSkipProps.includes(r)||!isWritable(e,r)||r.startsWith("_")||isFunctionValue(e,r)||t.add(r);for(let r=Object.getPrototypeOf(e);r&&r!==Object.prototype;r=Object.getPrototypeOf(r))for(const n of Object.getOwnPropertyNames(r)){if(t.has(n)||componentSkipProps.includes(n))continue;const i=Object.getOwnPropertyDescriptor(r,n);i.get&&i.set&&!isFunctionValue(e,n)&&t.add(n)}return[...t]},_ComponentContext=class e{constructor(t){__publicField(this,"_app"),__publicField(this,"_parent"),__publicField(this,"_state","detached"),__publicField(this,"_component"),__publicField(this,"_componentId"),this._component=t,this._componentId=e._globalComponentId++}get component(){return this._component}get state(){return this._state}get componentId(){return this._componentId}get parent(){return this._parent}get app(){return this._app}attach(e){this.attachInternal(e,this.parent)}attachInternal(e,t,r=!1){this.attachTraverse(e,t),r&&this.traversePostOrder((e=>e.onDeserialized())),e&&this.traversePreOrder((e=>{"detached"===e.ctx.state&&(e.ctx._state="updating",e.onAttached())}))}attachTraverse(e,t){this._app=e,this._parent=t;for(const t of this.children)t.ctx.attachTraverse(e,this.component)}update(e){this.attachInternal(this.app,this.parent,"serializer"===e?.cause),"rendered"===this.state&&(this._state="updating");const t={...e,component:this.component};for(const e of this.rootToHere.reverse())e.onUpdated(t);this._app?.update(t)}traversePreOrder(e,t=new Set){this.throwOnDupe(t),e(this.component);for(const r of this.children)r.ctx.traversePreOrder(e,t)}traversePostOrder(e,t=new Set){this.throwOnDupe(t);for(const r of this.children)r.ctx.traversePostOrder(e,t);e(this.component)}markRendered(){this.traversePreOrder((e=>{e.ctx._state="rendered",e.onRendered()}))}get root(){let e=this.component;for(;e?.ctx?.parent;)e=e.ctx.parent;return e}get rootToHere(){const e=[];let t=this.component;for(;t;)e.unshift(t),t=t.ctx.parent;return e}get children(){return keysOfComponent(this.component).flatMap((e=>{const t=this.component[e];return t instanceof Component?[t]:Array.isArray(t)?t.filter((e=>e instanceof Component)):[]}))}get keys(){return keysOfComponent(this.component)}throwOnDupe(e){if(e.has(this.component)){const e=this.rootToHere.map((e=>`${e.constructor.name}-${e.ctx.componentId}`)).join(" -> ");throw new Error(`Component graph invariant violated: duplicate reference or cycle at Path: ${e}\nHint: use a get-only property or a private field (_ or #) for back references.`)}e.add(this.component)}childrenKeys(){return this.keys.filter((e=>this.component[e]instanceof Component))}childByKey(e){if(!this.keys.includes(e))return;const t=this.component[e];return t instanceof Component?t:void 0}childKey(e){return this.keys.find((t=>this.component[t]===e))}qualify(e){return`${getPropertyKey(e)}-${this._componentId}`}};__publicField(_ComponentContext,"_globalComponentId",1);var ComponentContext=_ComponentContext,registry=new Map([[Date,{toJSON:e=>e instanceof Date?e.toISOString():e,fromJSON:e=>{if(null==e)return e;const t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?void 0:t}}]]),getCustomSerializer=e=>registry.get(e),ComponentSerializer=class{constructor(e){this.component=e,__publicField(this,"fromJSON",((e,t)=>{if(!e)return t;const r=getCustomSerializer(e);if(r?.fromJSON)return r.fromJSON(t);const n=new e;return n instanceof Component&&n.serializer.deserializeInternal(t),n}))}get keys(){const e=this.component.serializerMap;return this.component.ctx.keys.filter((t=>null!==e[t]))}serialize(){const e={},t=this.component.serializerMap;for(const r of this.keys){const n=this.component[r];if(n instanceof Component)e[r]=n.serializer.serialize();else if(Array.isArray(n))e[r]=n.map((e=>{if(e instanceof Component)return e.serializer.serialize();const t=e?.constructor?getCustomSerializer(e.constructor):void 0;return t?.toJSON?t.toJSON(e):clone(e)}));else if(isPrimitive(n)||isPlain(n))e[r]=n;else if(r in t){const i=getCustomSerializer(t[r]);e[r]=i?.toJSON?i.toJSON(n):clone(n)}}return e}deserialize(e){this.deserializeInternal(e),this.component.update({cause:"serializer"})}deserializeInternal(e){if(!e)return;const t=this.component.serializerMap,r=new Set([...this.component.ctx.keys,...Object.keys(t)]),n=this.component;for(const[i,o]of Object.entries(e)){if(null===t[i])continue;if(!r.has(i))continue;const e=t[i],s=n[i];if(e){if(Array.isArray(e)&&Array.isArray(o)){const t=e[0];n[i]=o.map(((e,r)=>{const n=s?.[r];return n instanceof Component?(n.serializer.deserializeInternal(e),n):this.fromJSON(t,e)}));continue}if(!Array.isArray(e)&&!Array.isArray(o)){s instanceof Component?(s.serializer.deserializeInternal(o),n[i]=s):n[i]=this.fromJSON(e,o);continue}n[i]=o}else if(s instanceof Component)s.serializer.deserializeInternal(o);else if(Array.isArray(s)&&Array.isArray(o)){if(!e){n[i]=o;continue}const t=Math.min(s.length,o.length);for(let e=0;e<t;e++){const t=s[e],r=o[e];t instanceof Component?t.serializer.deserializeInternal(r):isPlain(t)&&isPlain(r)?Object.assign(t,r):s[e]=r}}else(isPrimitive(o)||isPlain(o)||Array.isArray(o))&&(n[i]=o)}}},isPrimitive=e=>null==e||"object"!=typeof e&&"function"!=typeof e,isPlain=e=>{const t=e&&"object"==typeof e?Object.getPrototypeOf(e):null;return t===Object.prototype||null===t},clone=e=>JSON.parse(JSON.stringify(e)),Component=class{constructor(){__publicField(this,"ctx",new ComponentContext(this)),__publicField(this,"serializer",new ComponentSerializer(this)),__publicField(this,"serializerMap",{}),freezeProps(this,["ctx","serializer"])}view(...e){return div(this.constructor.name)}update(e){this.ctx.update(e)}onAttached(){}onUpdated(e){}onRendered(){}async onValidate(){return[]}async onNavigate(e,t){}onNavigated(){}onDeserialized(){}},getPropertyValue=(e,t)=>e[getPropertyKey(t)],setPropertyValue=(e,t,r)=>{const n=getPropertyKey(t);r!=getPropertyValue(e,t)&&(e[n]=r,e.update({cause:"input",key:n,value:r}))},getLabel=(e,t)=>{const r=getPropertyKey(t),n=e.getLabels?.(),i=n?.[r];return"string"==typeof i?i:i?.label??humanizeIdentifier(r)},getDescription=(e,t)=>{const r=getPropertyKey(t),n=e.getLabels?.(),i=n?.[r];if("object"==typeof i&&null!==i)return i.description};function typeify(e,t){return"number"==typeof e?parseFloatDeNaN(t):"boolean"==typeof e?"true"==t:"string"==typeof e?t:null}function bindValue(e,t){return{value:String(getPropertyValue(e,t)??""),onInput:r=>setPropertyValue(e,t,r.target.value)}}function bindRangeValue(e,t){return{value:getPropertyValue(e,t),onInput:r=>{setPropertyValue(e,t,r.target.valueAsNumber)}}}function bindChoice(e,t,r){const n=getPropertyValue(e,t);return{value:String("radio"===r.mode?r.elementValue??"":n??""),checked:"radio"===r.mode&&fuzzyEquals(n,r.elementValue),onChange:i=>{const o=i.target;if("select"===r.mode||o.checked){const i="radio"===r.mode?r.elementValue??"":r.guideValue??n??"";setPropertyValue(e,t,typeify(i,o.value))}}}}function bindChecked(e,t){return{checked:getPropertyValue(e,t)??!1,onChange:r=>setPropertyValue(e,t,r.target.checked)}}function bindCheckedFlag(e,t,r){return{checked:getPropertyValue(e,t).find((e=>e.key===r)).value,onChange:n=>{const i=n.target;setPropertyValue(e,t,getPropertyValue(e,t).map((e=>e.key===r?{...e,value:i.checked}:e)))}}}function inputText(e){const{id:t,target:r,prop:n,attrs:i}=e;return input({type:"text",id:t,...i,...bindValue(r,n)})}function inputTextArea(e){const{id:t,target:r,prop:n,attrs:i}=e;return textarea({id:t,...i,...bindValue(r,n)})}function inputRange(e){const{id:t,target:r,prop:n,attrs:i}=e;return input({type:"range",id:t,...i,...bindRangeValue(r,n)})}function inputSelect(e){const{id:t,target:r,prop:n,attrs:i,options:o,emptyOption:s,selectedClass:a}=e,u=getPropertyValue(r,n),c=u??o?.[0]?.value??s?.value,l=[s,...o??[]].filter((e=>void 0!==e));return select({id:t,...i,...bindChoice(r,n,{mode:"select",guideValue:c})},l.map((e=>option(mergeAttrs({value:String(e.value??""),class:fuzzyEquals(e.value,u)?a:void 0},e.attrs),e.label))))}function inputRadioGroup(e){const{id:t,target:r,prop:n,attrs:i,options:o=[],selectedClass:s}=e;return div(i,o.map((e=>{const i=String(e.value),o=`${t}-${i}`,a=fuzzyEquals(getPropertyValue(r,n),e.value),u={id:o,name:t,...e.attrs};return label(e.labelAttrs,input({class:a?s:void 0,type:"radio",...u,...bindChoice(r,n,{mode:"radio",elementValue:e.value})}),e.label)})))}function inputCheckbox(e){const{id:t,target:r,prop:n,attrs:i}=e;return input({type:"checkbox",id:t,...i,...bindChecked(r,n)})}function inputCheckboxGroup(e){const{id:t,target:r,prop:n,attrs:i,options:o}=e;return div({id:t,...i},o.map(((e,i)=>{const o=bindCheckedFlag(r,n,e.key),s=`${t}-${e.key}-${i}`;return label(e.labelAttrs,input({type:"checkbox",id:s,...e.attrs,...o}),e.label)})))}function isValidated(e){return e instanceof Component&&e.validator instanceof Validator}var Validator=class{constructor(e){__publicField(this,"_form"),__publicField(this,"_errors"),__publicField(this,"_runToken",0),__publicField(this,"_asyncInProgress",!1),__publicField(this,"_syncErrors",[]),__publicField(this,"_asyncErrors",[]),this._form=e}validateSyncWrapper(){this._syncErrors=this.validateSync(this._form),this.mergeErrors();for(const e of this.children())e.validator.validateSyncWrapper();return this.isValid}async validate(){const e=++this._runToken;this._asyncInProgress=!0;this.validateSyncWrapper();return this.fireUpdate(!1),await this.validateAsync(e),e===this._runToken&&(this._asyncInProgress=!1,this.fireUpdate(!0)),this.isValid}fireUpdate(e){this._form.update({cause:"validator",async:e,validationState:this.state})}revalidate(e){return"validator"!==e.cause&&this.wasValidated?this.validate():Promise.resolve(!1)}async validateAsync(e){const t=[];t.push(this._form.onValidate().then((t=>{e===this._runToken&&(this._asyncErrors=t,this.mergeErrors())})));for(const e of this.children())t.push(e.validator.validate());await Promise.all(t)}mergeErrors(){const e=new Map,t=t=>{const r=e.get(t.property);r?(r.messages=Array.from(new Set([...r.messages,...t.messages])),void 0!==t.value&&(r.value=t.value)):e.set(t.property,{...t,messages:[...t.messages]})};this._syncErrors.forEach(t),this._asyncErrors.forEach(t),this._errors=Array.from(e.values())}children(){return this._form.ctx.children.filter(isValidated)}getError(e){return this._errors?.find((t=>t.property===getPropertyKey(e)))}get isValid(){return!this._errors?.length&&this.children().every((e=>e.validator.isValid))}get isSettled(){return!this._asyncInProgress&&this.children().every((e=>e.validator.isSettled))}get wasValidated(){return null!=this._errors&&this.children().every((e=>e.validator.wasValidated))}get state(){return this.wasValidated?this.isValid?this.isSettled?"valid":"validating":"invalid":"unvalidated"}clearErrors(){this._syncErrors=[],this._asyncErrors=[],this._errors=void 0,this.children().forEach((e=>e.validator.clearErrors()))}},validationMessage=(e,t,r)=>e?.length?div({...r,id:t,role:"alert"},...e.map((e=>p(e)))):void 0,dataValidationAttrs=(e,t)=>({"data-validated":e?"true":void 0,"data-validation-state":t?.messages.length?"invalid":"valid"}),ariaValidationAttrs=(e,t)=>({ariaInvalid:e?.messages.length?"true":void 0,ariaDescribedBy:t}),hasBeenValidated=e=>isValidated(e)&&"unvalidated"!==e.validator.state,getInputMetadata=(e,t,r,n,i,o=!0,s)=>{const a=`${r}-messages`,u=n??getDescription(e,t),c=u?`${r}-description`:void 0,l=u&&div({...i,id:c},u),h=isValidated(e)?e.validator.getError(t):void 0,p=dataValidationAttrs(hasBeenValidated(e),h),d=ariaValidationAttrs(h,a);return{validationFieldAttrs:p,validationInputAttrs:{...d,ariaDescribedBy:[d.ariaDescribedBy,c].filter(Boolean).join(" ")||void 0},explanation:(o&&h?.messages.length?validationMessage(h.messages,a,s):void 0)||l}};function formField(e){const{target:t,prop:r,inputFn:n,inputProps:i,label:o,description:s,showLabel:a=!0,showValidation:u=!0,fieldAttrs:c,labelAttrs:l,validationAttrs:h,descriptionAttrs:p,controlAttrs:d,coreAttrs:f,inputPrefix:g,inputSuffix:m,selectWrapperAttrs:y}=e,_=o??getLabel(t,r),b=t.ctx.qualify(r),{validationFieldAttrs:v,validationInputAttrs:S,explanation:P}=getInputMetadata(t,r,b,s,p,u,h),k={...v,...c},C=n({target:t,prop:r,id:b,...i});if("div"===C.nodeName)return div(k,fieldset({...d,...S},a?legend(l,_):void 0,C),P);const w={...C,attributes:{...a?void 0:{ariaLabel:getLabel(t,r)},...S,...C.attributes}},A="input"===w.nodeName&&"checkbox"===w.attributes?.type,F=[g,"select"===w.nodeName?div(y,w):w,m],z={for:b,...l},V=A?label(z,...F,a?_:void 0):F;return div(k,div(f,A?void 0:a?label(z,_):void 0,div(d,V)),P)}function animate(...e){return h2("animate",...e)}function animateMotion(...e){return h2("animateMotion",...e)}function animateTransform(...e){return h2("animateTransform",...e)}function circle(...e){return h2("circle",...e)}function clipPath(...e){return h2("clipPath",...e)}function defs(...e){return h2("defs",...e)}function ellipse(...e){return h2("ellipse",...e)}function feBlend(...e){return h2("feBlend",...e)}function feColorMatrix(...e){return h2("feColorMatrix",...e)}function feComponentTransfer(...e){return h2("feComponentTransfer",...e)}function feComposite(...e){return h2("feComposite",...e)}function feConvolveMatrix(...e){return h2("feConvolveMatrix",...e)}function feDiffuseLighting(...e){return h2("feDiffuseLighting",...e)}function feDisplacementMap(...e){return h2("feDisplacementMap",...e)}function feDistantLight(...e){return h2("feDistantLight",...e)}function feDropShadow(...e){return h2("feDropShadow",...e)}function feFlood(...e){return h2("feFlood",...e)}function feFuncA(...e){return h2("feFuncA",...e)}function feFuncB(...e){return h2("feFuncB",...e)}function feFuncG(...e){return h2("feFuncG",...e)}function feFuncR(...e){return h2("feFuncR",...e)}function feGaussianBlur(...e){return h2("feGaussianBlur",...e)}function feImage(...e){return h2("feImage",...e)}function feMerge(...e){return h2("feMerge",...e)}function feMergeNode(...e){return h2("feMergeNode",...e)}function feMorphology(...e){return h2("feMorphology",...e)}function feOffset(...e){return h2("feOffset",...e)}function fePointLight(...e){return h2("fePointLight",...e)}function feSpecularLighting(...e){return h2("feSpecularLighting",...e)}function feSpotLight(...e){return h2("feSpotLight",...e)}function feTile(...e){return h2("feTile",...e)}function feTurbulence(...e){return h2("feTurbulence",...e)}function filter(...e){return h2("filter",...e)}function foreignObject(...e){return h2("foreignObject",...e)}function g(...e){return h2("g",...e)}function image(...e){return h2("image",...e)}function line(...e){return h2("line",...e)}function linearGradient(...e){return h2("linearGradient",...e)}function marker(...e){return h2("marker",...e)}function mask(...e){return h2("mask",...e)}function metadata(...e){return h2("metadata",...e)}function mpath(...e){return h2("mpath",...e)}function path(...e){return h2("path",...e)}function pattern(...e){return h2("pattern",...e)}function polygon(...e){return h2("polygon",...e)}function polyline(...e){return h2("polyline",...e)}function radialGradient(...e){return h2("radialGradient",...e)}function rect(...e){return h2("rect",...e)}function set(...e){return h2("set",...e)}function stop(...e){return h2("stop",...e)}function svg(...e){return h2("svg",...e)}function symbol(...e){return h2("symbol",...e)}function text(...e){return h2("text",...e)}function textPath(...e){return h2("textPath",...e)}function tspan(...e){return h2("tspan",...e)}function use(...e){return h2("use",...e)}function view(...e){return h2("view",...e)}export{App,AppSerializer,Component,ComponentSerializer,Renderer,Route,RouteService,Router,Validator,a,abbr,address,animate,animateMotion,animateTransform,area,article,aside,audio,b,base,bdi,bdo,bindChecked,bindChoice,bindRangeValue,bindValue,blockquote,body,br,button,canvas,caption,circle,cite,clipPath,code,col,colgroup,componentSkipProps,data,datalist,dd,defs,del,details,dfn,dialog,div,dl,dt,ellipse,em,embed,equalsIgnoreCase,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,fieldset,figcaption,figure,filter,footer,foreignObject,form,formField,fuzzyEquals,g,getDescription,getLabel,getPropertyKey,getPropertyValue,h2 as h,h1,h22 as h2,h3,h4,h5,h6,head,header,hgroup,hr,html,humanizeIdentifier,i,iframe,image,img,input,inputCheckbox,inputCheckboxGroup,inputRadioGroup,inputRange,inputSelect,inputText,inputTextArea,ins,isNullOrEmpty,isRouted,isVElement,isValidated,kbd,kebab,key,label,legend,li,line,linearGradient,link,main,map,mark,marker,mask,menu,mergeAttrs,meta,metadata,meter,mpath,nav,normalizeUtilityString,noscript,object,ol,optgroup,option,output,p,parseFloatDeNaN,path,pattern,picture,polygon,polyline,pre,progress,q,radialGradient,rect,rp,rt,ruby,s,samp,script,search,section,select,set,setPropertyValue,slot,small,source,span,stickyClass,stop,strong,style,sub,summary,sup,svg,symbol,table,tbody,td,template,text,textPath,textarea,tfoot,th,thead,time,title,tr,track,tspan,u,ul,use,video,view,wbr};
//# sourceMappingURL=/sm/956cd482f06a9772cb3511f012e1eb22a7b13d822e870f3b4df79924c1c6aa34.map