dothtml 6.0.9 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +5 -5
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var bt=Object.defineProperty;var a=(i,e)=>bt(i,"name",{value:e,configurable:!0});var W="_dotVDom",U=typeof process<"u"?process.env.NODE_ENV!=="production":(()=>{try{return new Function("return import.meta.env?.DEV")()}catch{return!1}})()??!1;var u=class{static{a(this,"Binding")}_isBinding=!0;_vtype="binding";_source;_transform;get isWritable(){return this._source.isWritable&&(!this._transform||!!this._transform.read)}get value(){return this._get()}_get(){return this._transform?.display?this._transform.display(this._source.value):this._source.value}_set(e){let t=this._transform?.read?this._transform.read(e):e;this._source.value=t}_subscribe(e,t=!1){return this._source._subscribe(this,e,t)}subscribe(e,t=!1){return this._subscribe(e,t)}_unsubscribe(e){this._source.unsubscribe(e)}unsubscribe(e){this._source.unsubscribe(e)}constructor(e){this._source=e}};var Y=class{static{a(this,"VMetaNode")}};function fe(i,e){if(i.parentNode!==e.parentNode)throw new Error("Start and end nodes must have the same parent.");let t=i.nextSibling;for(;t&&t!==e;){let n=t.nextSibling;t[W]?t[W]._unrender():t.parentNode?.removeChild(t),t=n}}a(fe,"removeNodesBetween");function Le(i,e,t=new Map){if(i===e)return!0;if(i==null||e==null||typeof i!="object"||typeof e!="object")return!1;if(t.has(i))return t.get(i)===e;if(t.set(i,e),Array.isArray(i)&&Array.isArray(e)&&i.length!==e.length)return!1;for(let n in i)if(!e.hasOwnProperty(n)||!Le(i[n],e[n],t))return!1;for(let n in e)if(!i.hasOwnProperty(n))return!1;return!0}a(Le,"deepEqual");function l(i,e){if(!i||typeof i!="object")return!1;let t=i._vtype;return t?Array.isArray(e)?e.indexOf(t)!==-1:t===e:!1}a(l,"isVType");var _e=new RegExp("[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?","g");var f=class{static{a(this,"Vdom")}_dot;_onEnterHook;_onLeaveHook;_vtype="vdom";constructor(e){this._dot=e}_unrenderAsync(){let t=this._getNodes().find(n=>n instanceof HTMLElement);if(this._onLeaveHook&&t){let n=this._onLeaveHook(t);if(n instanceof Promise)return n.then(()=>this._unrender())}this._unrender()}_moveBefore(e,t){let n=this._getNodes();if(n.length===0)return;let s=e?.parentElement||t;if(!s)throw new Error("Internal Error: Cannot move nodes without a parent.");for(let o=0;o<n.length;o++)if(n[o]===e)return;let r=(e?.ownerDocument||s.ownerDocument||document).createDocumentFragment();for(let o=0;o<n.length;o++)r.appendChild(n[o]);s.insertBefore(r,e)}__isRendered=!1;get _isRendered(){return this.__isRendered}set _isRendered(e){this.__isRendered=e}toString(){let e=document.createElement("div");return this._render(e),e.innerHTML}_renderBefore(e){let t=e.ownerDocument.createElement("div");for(this._render(t);t.childNodes.length>0;){let n=t.childNodes[0];n.parentElement.removeChild(n),e.parentElement.insertBefore(n,e)}}_renderAfter(e){if(e.nextSibling)this._renderBefore(e.nextSibling);else{let t=e.ownerDocument.createTextNode("");e.parentElement.appendChild(t),this._renderBefore(t),t.parentElement.removeChild(t)}}_moveTo(e){let t=this._getNodes();for(let n=0;n<t.length;n++)e.appendChild(t[n])}text(e){return null}html(e){return null}md(e){return null}mount(e,t){return null}append(e){return null}prepend(e){return null}when(e,t){return null}each(e,t){return null}otherwiseWhen(e,t,n){return null}otherwise(e){return null}attr(e,t){return null}style(e){return null}on(e,t){return null}onEnter(e){return null}onLeave(e){return null}empty(){return null}remove(){}};var T=class extends f{static{a(this,"TextVdom")}_text;textNode=null;observerId=0;_vtype="text";constructor(e){super(),this._text=e}_render(e){this._text instanceof u?(this.textNode=e.ownerDocument.createTextNode(this._text._get()??""),this.observerId=this._text._subscribe(this)):this.textNode=e.ownerDocument.createTextNode(`${this._text??""}`),e.appendChild(this.textNode)}_unrender(){this.textNode&&(this.textNode.parentElement&&this.textNode.parentElement.removeChild(this.textNode),this.textNode=null),this.observerId&&this._text instanceof u&&(this._text._unsubscribe(this.observerId),this.observerId=0)}_getNodes(){return this.textNode?[this.textNode]:[]}_getLastChild(){return this}toString(){let e=document.createTextNode((this._text instanceof u?this._text._get():this._text)??""),t=document.createElement("div");return t.appendChild(e),t.innerHTML}};var R=class extends f{static{a(this,"FragmentVdom")}_children=[];_vtype="fragment";constructor(e){super(e)}_render(e){this._isRendered=!0;for(let t=0;t<this._children.length;t++)this._children[t]._render(e)}_unrender(){if(this._isRendered){this._isRendered=!1;for(let e=0;e<this._children.length;e++)this._children[e]._unrender()}}_getNodes(){let e=[];for(let t=0;t<this._children.length;t++)e.push(...this._children[t]._getNodes());return e}_getLastChild(){return this._children[this._children.length-1]||null}};var S=(function(i){return i[i.Immediate=0]="Immediate",i[i.UserBlocking=1]="UserBlocking",i[i.Normal=2]="Normal",i[i.Background=3]="Background",i})({});var _t=class{static{a(this,"Scheduler")}queues=[new Set,new Set,new Set,new Set];isPending=!1;startTime=0;frameYieldMs=5;isSync=!1;isSyncing=!1;onError;channel=typeof MessageChannel<"u"?new MessageChannel:null;constructor(){this.channel&&(this.channel.port1.onmessage=()=>this.workLoop())}enqueue(e,t=S.Normal){e.isQueued||(e.isQueued=!0,this.queues[t].add(e)),t===S.Immediate||this.isSync?this.flushSync():this.scheduleFlush()}scheduleFlush(){this.isPending||(this.isPending=!0,this.channel?this.channel.port2.postMessage(null):setTimeout(()=>this.workLoop(),0))}shouldYield(){return performance.now()-this.startTime>=this.frameYieldMs}workLoop(){for(this.startTime=performance.now(),this.isPending=!1;this.flushQueues();)if(this.shouldYield()){this.scheduleFlush();break}}flushQueues(){for(let e=S.Immediate;e<=S.Background;e++){let t=this.queues[e];if(t.size===0)continue;let n=Array.from(t);t.clear();for(let s=0;s<n.length;s++){let r=n[s];if(r.isQueued=!1,r.active)try{r.update()&&(r.isQueued=!0,t.add(r))}catch(o){this.onError?this.onError(o):console.error("Scheduler error:",o)}if(this.shouldYield()){for(let o=s+1;o<n.length;o++)t.add(n[o]);return!0}}}for(let e=S.Immediate;e<=S.Background;e++)if(this.queues[e].size>0)return!0;return!1}flushSync(){if(this.isSyncing)return;this.isSyncing=!0,this.isPending=!0;let e=this.shouldYield;this.shouldYield=()=>!1;try{let t=!0;for(;t;){t=!1;for(let n=S.Immediate;n<=S.Background;n++){let s=this.queues[n];if(s.size===0)continue;let r=Array.from(s);s.clear();for(let o of r)if(o.isQueued=!1,o.active)try{o.update()&&(o.isQueued=!0,s.add(o),t=!0)}catch(d){throw this.onError&&this.onError(d),d}s.size>0&&(t=!0)}}}finally{this.shouldYield=e,this.isPending=!1,this.isSyncing=!1}}setSync(e){this.isSync=e}clear(){for(let e of this.queues)e.clear();this.isPending=!1}},I=new _t;var ie=class i extends f{static{a(this,"CollectionVdom")}static MAX_BATCH_SIZE=128;value;renderCallback;startNode;endNode;observerId=0;_vtype="collection";mappedItems=[];updateState=null;constructor(e,t,n){super(e),this.value=t,this.renderCallback=n}_render(e){this.value instanceof u&&(this.observerId=this.value._subscribe(this)),this.startNode=e.ownerDocument.createTextNode(""),this.endNode=e.ownerDocument.createTextNode(""),e.appendChild(this.startNode),e.appendChild(this.endNode);let t=I.shouldYield;I.shouldYield=()=>!1;try{this.updateList()}finally{I.shouldYield=t}}_unrender(){this.observerId&&this.value instanceof u&&(this.value._unsubscribe(this.observerId),this.observerId=null);for(let e=0;e<this.mappedItems.length;e++){let t=this.mappedItems[e];t.vdom._unrender(),t.afterNode.parentElement.removeChild(t.afterNode)}this.mappedItems.length=0,this.startNode.parentElement.removeChild(this.startNode),this.endNode.parentElement.removeChild(this.endNode),this.startNode=null,this.endNode=null}_getNodes(){if(!this.startNode)return[];let e=[this.startNode];for(let t=0;t<this.mappedItems.length;t++)e.push(...this.mappedItems[t].vdom._getNodes()),e.push(this.mappedItems[t].afterNode);return e.push(this.endNode),e}_getLastChild(){return this}getTailAppendPrefixLength(e){let t=this.mappedItems;if(t.length===0||e.length<=t.length)return 0;for(let n=0;n<t.length;n++)if(e[n]!==t[n].keyValue)return 0;return t.length}isItemPositionedAfter(e,t){let n=e.vdom._getNodes();if(!n.length||!t.parentElement||n[0]!==t.nextSibling)return!1;let s=n[n.length-1];return e.afterNode===s.nextSibling}reuseExistingItem(e,t,n){if(e.value!==t&&!Le(e.value,t)){e.vdom._unrender(),e.value=t;let s=this.renderCallback(t,this.value instanceof u?e.observableIndex:n,e.keyValue),r;s instanceof f?r=s:typeof s=="object"&&s?.build?(r=new R(this._dot),r.mount(s)):r=new T(s),r._root&&(r=r._root),e.vdom=r}else e.observableIndex._set(n)}getInsertBeforeAnchor(e,t){for(let n=e;n<t.length;n++)if(t[n].vdom._isRendered){let s=t[n].vdom._getNodes();if(s.length)return s[0]}return this.endNode}countConsecutiveUnrendered(e,t){let n=0;for(;e+n<t.length&&!t[e+n].vdom._isRendered&&n<i.MAX_BATCH_SIZE;)n++;return n}batchRenderNewItems(e,t,n){let s=t.ownerDocument.createDocumentFragment();for(let r of e)r.vdom._render(s),s.appendChild(r.afterNode);t.insertBefore(s,n)}removeItem(e){let t=e.vdom._unrenderAsync();if(t instanceof Promise)return t.then(()=>{e.afterNode.parentElement&&e.afterNode.parentElement.removeChild(e.afterNode)});e.afterNode.parentElement&&e.afterNode.parentElement.removeChild(e.afterNode)}updateList(){let e=null;this.value instanceof u?e=this.value._get():e=this.value;let t=Array.isArray(e)?e:Object.values(e);if(this.updateState&&(Le(this.updateState.newItems,t)||(this.updateState=null)),!this.updateState){let s=null;this.value instanceof u&&(s=this.value._source.key??null);let r=t,o=Array.isArray(e)?r.map((c,p)=>s?c[s]:p):Object.keys(e).map((c,p)=>s?e[c][s]:c),d=this.getTailAppendPrefixLength(o),h=new Map;for(let c=0;c<this.mappedItems.length;c++){let p=this.mappedItems[c];c>=d&&h.set(p.keyValue,p)}this.updateState={newItems:r,newKeys:o,oldMap:h,nextMappedItems:[],currentIndex:0,lastNode:this.startNode,tailAppendPrefix:d,step:"diff"}}let n=this.updateState;if(n.step==="diff"){for(;n.currentIndex<n.newItems.length;){let s=n.newItems[n.currentIndex],r=n.newKeys[n.currentIndex];if(n.currentIndex<n.tailAppendPrefix){let o=this.mappedItems[n.currentIndex];this.reuseExistingItem(o,s,n.currentIndex),n.nextMappedItems.push(o)}else{let o=n.oldMap.get(r);if(o)n.oldMap.delete(r),this.reuseExistingItem(o,s,n.currentIndex),n.nextMappedItems.push(o);else{let h=new m().bind();h._set(n.currentIndex);let c=this.renderCallback(s,this.value instanceof u?h:n.currentIndex,r),p;c instanceof f?p=c:typeof c=="object"&&c?.build?(p=new R(this._dot),p.mount(c)):p=new T(c),p._root&&(p=p._root);let b=this.startNode.ownerDocument.createTextNode("");n.nextMappedItems.push({vdom:p,value:s,keyValue:r,afterNode:b,observableIndex:h})}}if(n.currentIndex++,I.shouldYield())return!0}n.step="cleanup"}if(n.step==="cleanup"){let s=Array.from(n.oldMap.values());for(let r of s)this.removeItem(r);n.step="reorder",n.currentIndex=0,this.mappedItems=[]}if(n.step==="reorder")for(;n.currentIndex<n.nextMappedItems.length;){let s=n.nextMappedItems[n.currentIndex];if(s.vdom._isRendered)this.isItemPositionedAfter(s,n.lastNode)?(n.lastNode=s.afterNode,this.mappedItems.push(s),n.currentIndex++):(s.vdom._moveBefore(n.lastNode.nextSibling,n.lastNode.parentElement),n.lastNode.parentElement.insertBefore(s.afterNode,s.vdom._getNodes().slice(-1)[0].nextSibling),n.lastNode=s.afterNode,this.mappedItems.push(s),n.currentIndex++);else{let r=this.countConsecutiveUnrendered(n.currentIndex,n.nextMappedItems);if(r>=2){let o=n.nextMappedItems.slice(n.currentIndex,n.currentIndex+r),d=n.lastNode.parentElement,h=this.getInsertBeforeAnchor(n.currentIndex+r,n.nextMappedItems);this.batchRenderNewItems(o,d,h);for(let c of o)n.lastNode=c.afterNode,this.mappedItems.push(c);n.currentIndex+=r}else s.vdom._renderAfter(n.lastNode),n.lastNode.parentElement.insertBefore(s.afterNode,s.vdom._getNodes().slice(-1)[0].nextSibling),n.lastNode=s.afterNode,this.mappedItems.push(s),n.currentIndex++}if(I.shouldYield())return!0}return this.updateState=null,!1}};var se=class extends f{static{a(this,"ConditionalVdom")}conditions=[];sealed=!1;renderedIndex=-1;currentUpdatePromise=null;nextIndex=null;_vtype="conditional";constructor(e){super(e)}addCondition(e,t,n=!1){if(this.sealed)throw new Error("Cannot add additional conditions to a sealed block.");this.sealed=n;let s={condition:e,vNode:t,startAnchor:null,endAnchor:null,observerId:0};this.conditions.push(s),this._isRendered&&(this.renderClause(s,this.conditions[0].startAnchor.parentElement),this.renderedIndex==-1&&this.updateConditions())}renderClause(e,t){if(e.startAnchor)throw new Error("Item is already rendered.");e.startAnchor=t.ownerDocument.createTextNode(""),e.endAnchor=t.ownerDocument.createTextNode(""),t.appendChild(e.startAnchor),t.appendChild(e.endAnchor),e.condition instanceof u&&(e.observerId=e.condition._subscribe(this))}_render(e){this._isRendered=!0;for(let t=0;t<this.conditions.length;t++)this.renderClause(this.conditions[t],e);this.updateConditions()}removeCNode(e){e.condition instanceof u&&(e.condition._unsubscribe(e.observerId),e.observerId=0);let t=e.startAnchor,n=e.endAnchor;t.parentElement.removeChild(t),n.parentElement.removeChild(n),e.startAnchor=null,e.endAnchor=null,e.vNode._unrender()}_unrender(){if(this._isRendered){this._isRendered=!1,this.renderedIndex=-1,this.nextIndex=null,this.currentUpdatePromise=null;for(let e=0;e<this.conditions.length;e++){let t=this.conditions[e];this.removeCNode(t)}}}_getNodes(){if(!this._isRendered)return[];let e=[];for(let t=0;t<this.conditions.length;t++){let n=this.conditions[t];e.push(n.startAnchor),t==this.renderedIndex&&e.push(...n.vNode._getNodes()),e.push(n.endAnchor)}return e}_getLastChild(){return this}updateConditions(){let e=-1;for(let t=0;t<this.conditions.length;t++){let n=this.conditions[t];if(n.condition instanceof u?n.condition._get():n.condition){e=t;break}}if(this.currentUpdatePromise){this.nextIndex=e;return}e!=this.renderedIndex&&this.performUpdate(e)}performUpdate(e){let t=this.renderedIndex;if(t!=-1){let s=this.conditions[t].vNode._unrenderAsync();if(s instanceof Promise){this.currentUpdatePromise=s,s.then(()=>{this.currentUpdatePromise=null,this.renderedIndex=-1,this.finishUpdate(e)});return}}this.renderedIndex=-1,this.finishUpdate(e)}finishUpdate(e){if(this.nextIndex!==null){let t=this.nextIndex;if(this.nextIndex=null,t!==e){this.performUpdate(t);return}}if(this.renderedIndex=e,this.renderedIndex!=-1){let t=this.conditions[this.renderedIndex];t.vNode._renderBefore(t.endAnchor)}if(this.nextIndex!==null){let t=this.nextIndex;this.nextIndex=null,t!==this.renderedIndex&&this.performUpdate(t)}}};var pe=class extends f{static{a(this,"HtmlVdom")}beforeNode;afterNode;_vtype="html";_content;currentVdom=null;observerId=0;constructor(e,t){super(t),this._content=e}_toVdom(e){return e==null?null:e instanceof f||e?._root?e?._root||e:this._dot&&(typeof e=="object"&&e.build||Array.isArray(e))?this._dot.mount(e)._root:null}updateHtml(e){if(this.beforeNode){this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null),fe(this.beforeNode,this.afterNode);let t=this._toVdom(e);if(t)this.currentVdom=t,this.currentVdom._renderBefore(this.afterNode);else if(e!=null){let n=this.beforeNode.ownerDocument.createElement("div");for(n.innerHTML=e;n.firstChild;)this.afterNode.parentElement.insertBefore(n.firstChild,this.afterNode)}}}_render(e){let t="";this._content instanceof u?(t=this._content._get(),this.observerId=this._content._subscribe(this)):t=this._content,this.beforeNode=e.ownerDocument.createTextNode(""),this.afterNode=e.ownerDocument.createTextNode(""),e.appendChild(this.beforeNode),e.appendChild(this.afterNode),this.updateHtml(t)}_unrender(){if(this.beforeNode){this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null);let e=this.beforeNode.parentElement;fe(this.beforeNode,this.afterNode),e.removeChild(this.beforeNode),e.removeChild(this.afterNode),this.beforeNode=null,this.afterNode=null}this.observerId&&this._content instanceof u&&(this._content._unsubscribe(this.observerId),this.observerId=0)}update(e){this.updateHtml(e)}_getNodes(){if(!this.beforeNode)return[];let e=[this.beforeNode],t=this.beforeNode.nextSibling;for(;t&&t!==this.afterNode;)e.push(t),t=t.nextSibling;return e.push(this.afterNode),e}_getLastChild(){return this}toString(){return this.currentVdom?this.currentVdom.toString():this._content instanceof u?this._content._get():this._content}};var re=class{static{a(this,"ReactiveAttr")}elementVdom;attribute;constructor(e,t){this.elementVdom=e,this.attribute=t}};var ye=class{static{a(this,"Subscription")}boundReactive;item;active=!0;isQueued=!1;constructor(e,t){this.boundReactive=e,this.item=t}update(){if(!this.active)return;let e=this.boundReactive._get();if(this.item instanceof T||l(this.item,"text"))this.item.textNode.textContent=e??"";else if(this.item._isReactiveVdom||l(this.item,"reactive"))this.item.update(e);else if(this.item instanceof pe||l(this.item,"html"))this.item.updateHtml(e);else if(this.item instanceof re)this.item.elementVdom.updateReactiveAttr(this.item.attribute,e);else if(this.item instanceof Y||l(this.item,["style-v-node","attribute-v-node"]))this.item.update();else{if(this.item instanceof ie||l(this.item,"collection"))return this.item.updateList();this.item instanceof se||l(this.item,"conditional")?this.item.updateConditions():this.item instanceof Function&&this.item(e)}}};var X=[];var yt=7,Dn=yt+1,m=class{static{a(this,"Signal")}_isSignal=!0;_isRef=!1;_vtype="signal";bindAs(e){let t=new u(this);return e.call&&e.apply?t._transform={display:e}:t._transform=e,t}bind(){return new u(this)}_value;key;subscribers=new Map;get isWritable(){return!0}constructor(){}get value(){let e=X[X.length-1];return e&&e.addDependency&&e.addDependency(this),this._value}set value(e){this.setValue(e)}getValue(){return this.value}setValue(e,t=S.Normal){this._value!==e&&(this._value=e,this.updater(this._value,t))}updater(e,t=S.Normal){for(let n of this.subscribers.values())n.sync?n.update():(!n.isQueued||t===S.Immediate)&&I.enqueue(n,t)}nextId=1;subscribe(e,t=!1){return new u(this)._subscribe(e,t)}_subscribe(e,t,n=!1){let s=this.nextId++,r=new ye(e,t);return r.sync=n,this.subscribers.set(s,r),s}unsubscribe(e){this.subscribers.has(e)&&(this.subscribers.get(e).active=!1,this.subscribers.delete(e))}_detachBinding(e){this.unsubscribe(e)}refresh(e=S.Normal){let t=this.value;this.updater(t,e)}updateObservers(e=S.Normal){this.refresh(e)}};var oe=class extends Y{static{a(this,"AttributeVNode")}attr;value;target;_vtype="attribute-v-node";observables={};constructor(e,t){super(),this.attr=e,this.value=t}render(e){this.target=e;for(let t in this.value){let n=this.value[t];if((n instanceof m||l(n,"signal"))&&(n=n.bind()),n&&(n instanceof u||l(n,"binding"))){let s=n._subscribe(this);this.observables[s]=n}}this.update()}update(){if(!this.target)return;let e=[];for(let t in this.value){let n=this.value[t];n&&((n instanceof m||l(n,"signal"))&&(n=n.bind()),(!(n instanceof u||l(n,"binding"))||n._get())&&e.push(t))}e.length>0?this.target.setAttribute(this.attr,e.join(" ")):this.target.removeAttribute(this.attr)}unrender(){this.target=null;for(let e in this.observables)this.observables[e]._unsubscribe(Number(e));this.observables={}}};var je={color:"color|background-Color|border-Bottom-Color|border-Color|border-Left-Color|border-Right-Color|border-Top-Color|text-Decoration-Color|outline-Color|column-Rule-Color",length:"background-Size|block-Size|border-Bottom-Left-Radius|border-Bottom-Right-Radius|border-Bottom-Width|border-Left-Width|border-Radius|border-Right-Width|border-Top-Left-Radius|border-Top-Right-Radius|border-Top-Width|border-Width|bottom|gap|height|left|margin|margin-Bottom|margin-Left|margin-Right|margin-Top|max-Height|max-Width|min-Height|min-Width|padding|padding-Bottom|padding-Left|padding-Right|padding-Top|right|top|width|flex-Basis|font-Size|text-Indent|letter-Spacing|word-Spacing|border-Spacing|outline-Offset|outline-Width|column-Gap|column-Rule-Width|grid-Column-Gap|grid-Gap|grid-Row-Gap|column-Width|perspective|row-Gap",hybrid:"line-Height|border-Image-Width|border-Image-Outset|tab-Size|flex",url:"background-Image|border-Image|list-Style-Image|content|image-Orientation",transformation:"transform",filter:"filter|backdrop-Filter",time:"animation-Delay|animation-Direction|animation-Duration|transition-Duration|transition-Delay",misc:"appearance|aspect-Ratio|opacity|background|background-Attachment|background-Blend-Mode|background-Position|background-Repeat|background-Clip|background-Origin|border|border-Bottom|border-Bottom-Style|border-Image-Repeat|border-Image-Slice|border-Image-Source|border-Left|border-Left-Style|border-Right|border-Right-Style|border-Style|border-Top|border-Top-Style|box-Decoration-Break|box-Shadow|clear|clip|display|float|overflow|box|overflow-X|overflow-Y|position|visibility|vertical-Align|z-Index|align-Content|align-Items|align-Self|flex-Direction|flex-Flow|flex-Grow|flex-Shrink|flex-Wrap|grid|grid-Area|grid-Auto-Columns|grid-auto-Rows|grid-Column|grid-Column-End|grid-Column-Start|grid-Row|grid-Row-End|grid-Row-Start|grid-Template|grid-Template-Areas|grid-Template-Columns|grid-Template-Rows|justify-Content|order|hanging-Punctuation|hyphens|line-Break|overflow-Wrap|text-Align|text-Align-Last|text-Combine-Upright|text-Justify|text-Transform|white-Space|word-Break|word-Wrap|text-Decoration|text-Decoration-Line|text-Decoration-Style|text-Shadow|text-Underline-Position|font|font-Family|font-Feature-Settings|font-Kerning|font-Language-Override|font-Size-Adjust|font-Stretch|font-Style|font-Synthesis|font-Variant|font-Variant-Alternates|font-Variant-Caps|font-Variant-East-Asian|font-Variant-Ligatures|font-Variant-Numeric|font-Variant-Position|font-Weight|direction|text-Orientation|text-Combine-Upright|unicode-Bidi|user-Select|writing-Mode|border-Collapse|caption-Side|empty-Cells|table-Layout|counter-Increment|counter-Reset|list-Style|list-Style-Position|list-Style-Type|animation|animation-Fill-Mode|animation-Iteration-Count|animation-Name|animation-Play-State|animation-Timing-Function|animation-Timeline|container-Type|container-Name|backface-Visibility|perspective2d|perspective-Origin|transform-Origin|transform-Style|transition|transition-Property|transition-Timing-Function|box-Sizing|cursor|ime-Mode|nav-Down|nav-Index|nav-Left|nav-Right|nav-Up|outline|outline-Style|resize|text-Overflow|break-After|break-Before|break-Inside|column-Count|column-Fill|column-Rule|column-Rule-Style|column-Span|columns|widows|orphans|page-Break-After|page-Break-Before|page-Break-Inside|marks|quotes|image-Rendering|image-Resolution|object-Fit|object-Position|mask|mask-Type|mark|mark-After|mark-Before|phonemes|rest|rest-After|rest-Before|voice-Balance|voice-Duration|voice-Pitch|voice-Pitch-Range|voice-Rate|voice-Stress|voice-Volume|marquee-Direction|marquee-Play-Count|marquee-Speed|marquee-Style|pointer-Events"},wt="Cm|Mm|In|Px|Pt|Pc|Ch|Em|Ex|Lh|Rem|Vh|Vw|Vmin|Vmax|Cqw|Cqh|Cqi|Cqb|Cqmin|Cqmax|P".split("|"),vt="Ms|S".split("|"),St="Deg|Grad|Rad|Turn".split("|"),Ct="Hz|Khz".split("|"),me={};for(let i in je){let e=je[i].split("|");for(let t of e){let n=t.split("-").join("");switch(i){case"hybrid":case"length":{for(let s of wt)me[`${n}${s}`]={dotName:n,cssName:t.toLowerCase(),type:i,unit:s=="P"?"%":s.toLowerCase()};break}case"time":{for(let s of vt)me[`${n}${s}`]={dotName:n,cssName:t.toLowerCase(),type:i,unit:s.toLowerCase()};break}case"angle":{for(let s of St)me[`${n}${s}`]={dotName:n,cssName:t.toLowerCase(),type:i,unit:s.toLowerCase()};break}case"frequency":{for(let s of Ct)me[`${n}${s}`]={dotName:n,cssName:t.toLowerCase(),type:i,unit:s.toLowerCase()};break}default:break}me[n]={dotName:n,cssName:t.toLowerCase(),type:i,unit:void 0}}}var ae=me;var P=class{static{a(this,"CssFunctionBuilderVStyle")}funcs=[];propName;constructor(e){this.propName=e}toString(){let e="";for(let t of this.funcs){let n=Array.from(t.args).map(s=>{let r=s.v!==void 0?s.v:s,o=s.f||(d=>`${d}`);return r instanceof u?o(r._get()):r instanceof m?o(r.value):o(r).toString().split(" ").join(", ")}).join(", ");e+=`${t.func}(${n}) `}return e.trim()}appendFunction(e,t){return this.funcs.push({func:e,args:t}),this}};function w(i,e="px"){if(i=i||"0px",i instanceof u&&(i=i._get()),i instanceof m&&(i=i.value),i instanceof Array)return i.map(n=>w(n,e)).join(" ");isNaN(i)||(i=i+e);let t=i.trim().split(" ");if(t.length>1)return t.map(n=>w(n,e)).join(" ");{let n=Number(i.match(_e)[0]),s=i.split(_e)[1]||e;return`${n}${s}`}}a(w,"formatCssLength");function Pe(i){if(i=i||"0%",i instanceof u&&(i=i._get()),i instanceof m&&(i=i.value),i instanceof Array)return i.map(t=>Pe(t)).join(" ");let e=i.trim().split(" ");return e.length>1?e.map(t=>Pe(t)).join(" "):isNaN(i)?i:`${i}%`}a(Pe,"formatCssPercentage");function Ue(i){if(typeof i=="number"){let e=0,t=0,n=0,s=1;return n=i&255,i>>=8,t=i&255,i>>=8,e=i&255,`rgb(${e} ${t} ${n})`}else if(typeof i=="string")return i}a(Ue,"formatCssColor");function B(i){if(i=i||"0deg",i instanceof u&&(i=i._get()),i instanceof m&&(i=i.value),i instanceof Array)return i.map(t=>B(t)).join(" ");isNaN(i)||(i=`${i}deg`);let e=i.trim().split(" ");if(e.length>1)return e.map(t=>B(t)).join(" ");{let t=Number(i.match(_e)[0]),n=i.split(_e)[1]||"deg";return`${t}${n}`}}a(B,"formatCssAngle");var H=class extends P{static{a(this,"FilterVStyle")}blur(e){return this.appendFunction("blur",[{v:e,f:w}])}brightness(e){return this.appendFunction("brightness",[{v:e,f:Pe}])}contrast(e){return this.appendFunction("contrast",[{v:e,f:w}])}dropShadow(e,t,n,s){return this.appendFunction("drop-shadow",[{v:e,f:w},{v:t,f:w},{v:n,f:w},{v:s,f:Ue}])}grayscale(e){return this.appendFunction("grayscale",[{v:e,f:w}])}hueRotate(e){return this.appendFunction("hue-rotate",[{v:e,f:w}])}invert(e){return this.appendFunction("invert",[{v:e,f:w}])}opacity(e){return this.appendFunction("opacity",[{v:e,f:w}])}sepia(e){return this.appendFunction("sepia",[{v:e,f:w}])}saturate(e){return this.appendFunction("saturate",[{v:e,f:w}])}};var q=class extends P{static{a(this,"TransformVStyle")}matrix3d(e,t,n,s,r,o,d,h,c,p,b,x,g,_,N,z){return this.appendFunction("matrix3d",arguments)}matrix(e,t,n,s,r,o){return this.appendFunction("matrix",arguments)}translate(e,t){return arguments.length==1?this.appendFunction("translate",[{f:w,v:e}]):this.appendFunction("translate",[{f:w,v:e},{f:w,v:t}])}translate3d(e,t,n){return this.appendFunction("translate3d",[{f:w,v:e},{f:w,v:t},{f:w,v:n}])}translateX(e){return this.appendFunction("translateX",[{f:w,v:e}])}translateY(e){return this.appendFunction("translateY",[{f:w,v:e}])}translateZ(e){return this.appendFunction("translateZ",[{f:w,v:e}])}scale(e,t){return this.appendFunction("scale",[e,t??1])}scale3d(e,t,n){return this.appendFunction("scale3d",[e,t,n])}scaleX(e){return this.appendFunction("scaleX",[e])}scaleY(e){return this.appendFunction("scaleY",[e])}scaleZ(e){return this.appendFunction("scaleZ",[e])}rotate(e){return this.appendFunction("rotate",[{f:B,v:e}])}rotate3d(e,t,n,s){return this.appendFunction("rotate3d",[e,t,n,{f:B,v:s}])}rotate3dDeg(e,t,n,s){return this.rotate3d(e,t,n,s)}rotate3dRad(e,t,n,s){return this.rotate3d(e,t,n,`${s}rad`)}rotate3dGrad(e,t,n,s){return this.rotate3d(e,t,n,`${s}grad`)}rotate3dTurn(e,t,n,s){return this.rotate3d(e,t,n,`${s}turn`)}rotateX(e){return this.appendFunction("rotateX",[{f:B,v:e}])}rotateY(e){return this.appendFunction("rotateY",[{f:B,v:e}])}rotateZ(e){return this.appendFunction("rotateZ",[{f:B,v:e}])}skew(e,t){return arguments.length==1?this.appendFunction("skew",[{f:B,v:e}]):this.appendFunction("skew",[{f:B,v:e},{f:B,v:t}])}skewX(e){return this.appendFunction("skewX",[{f:B,v:e}])}skewY(e){return this.appendFunction("skewY",[{f:B,v:e}])}perspective(e){return this.appendFunction("perspective",[{f:w,v:e}])}};var V=class i{static{a(this,"BaseVStyle")}_vtype="base-v-style";_isBase=!1;props=[];onUpdate;setProp(e,t){return this._isBase?new i().setProp(e,t):(this.props.push({prop:e,value:t}),this.onUpdate&&this.onUpdate(),this)}_setOnUpdate(e){this.onUpdate=e}variable(e,t){return e.startsWith("--")||(e="--"+e),this.setProp(e,t)}v(e){return e.startsWith("--")||(e="--"+e),`var(${e})`}getProps(){return this.props}};for(let i in ae)V.prototype[i]=function(e){return this.setProp(i,e)};var M=class extends Y{static{a(this,"StyleVNode")}target;document;shadowRoot;styleSource;_vtype="style-v-node";styleElement;observables=[];observableIds=[];isQueued=!1;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.applyStyles()},"update")};constructor(e){super(),this.styleSource=e,(this.styleSource instanceof V||l(this.styleSource,"base-v-style"))&&this.styleSource._setOnUpdate(()=>this.update()),this.extractObservables()}extractObservables(){let e=this.styleSource instanceof V||l(this.styleSource,"base-v-style")?this.styleSource.getProps():this.styleSource;if(Array.isArray(e))for(let t=0;t<e.length;t++){let n=e[t];this.processValue(n.prop,n.value,s=>n.value=s)}else for(let t in e)this.processValue(t,e[t],n=>e[t]=n)}processValue(e,t,n){if(!this.tryExtractObservable(t)&&typeof t=="object"&&t!==null&&!(t instanceof P)){let s;switch(e){case"filter":{s=new H(e);break}case"transform":{s=new q(e);break}}if(s){let r=Array.isArray(t)?t:[t];for(let o of r)for(let d in o){let h=o[d];if(this.tryExtractObservable(h),Array.isArray(h))for(let p of h)this.tryExtractObservable(p);let c=d.replace(/_\d+$/,"");typeof s[c]=="function"&&(Array.isArray(h)?s[c](...h):s[c](h))}n(s)}}}tryExtractObservable(e){if(e instanceof u||l(e,"binding")||e instanceof m||l(e,"signal")){if(this.observables.indexOf(e)===-1&&(this.observables.push(e),this.target)){let t=e.subscribe(()=>this.update());this.observableIds.push(t)}return!0}return!1}render(e,t=window.document,n){this.target=e,this.document=t,this.shadowRoot=n;for(let s of this.observables){let r=s.subscribe(()=>this.update());this.observableIds.push(r)}typeof e=="string"&&(this.styleElement=this.document.createElement("style"),this.shadowRoot?this.shadowRoot.appendChild(this.styleElement):this.document.head.appendChild(this.styleElement)),this.applyStyles()}update(){this.isQueued||(this.isQueued=!0,I.enqueue(this.updateSubscription,S.Normal))}applyStyles(){if(this.target)if(typeof this.target=="string")this.styleElement&&(this.styleElement.textContent=`${this.target} { ${this.getStyleString()} }`);else{this.extractObservables();let e=this.styleSource instanceof V||l(this.styleSource,"base-v-style")?this.styleSource.getProps():this.styleSource;if(Array.isArray(e))for(let t of e){let n=t.value instanceof u||l(t.value,"binding")?t.value._get():t.value instanceof m||l(t.value,"signal")?t.value.value:t.value;this.applySingleStyle(t.prop,n)}else for(let t in e){let n=e[t]instanceof u||l(e[t],"binding")?e[t]._get():e[t]instanceof m||l(e[t],"signal")?e[t].value:e[t];this.applySingleStyle(t,n)}}}applySingleStyle(e,t){let n;if(t instanceof P)n=t.toString();else if(typeof t=="object"&&t!==null&&(e==="transform"||e==="filter")){let d=e==="transform"?new q(e):new H(e);this.applyObjectToBuilder(d,t),n=d.toString()}else n=t;let s=e,r,o=ae[e];o&&(s=o.cssName,r=o.unit,(o.type==="length"||o.type==="hybrid")&&typeof n=="number"?o.type==="hybrid"&&r===void 0||(n=w(n,r)):o.unit&&typeof n=="number"&&(n=`${n}${o.unit}`)),this.target instanceof HTMLElement&&this.target.style.setProperty(s,`${n}`)}getStyleString(){let e="",t=this.styleSource instanceof V||l(this.styleSource,"base-v-style")?this.styleSource.getProps():this.styleSource;if(Array.isArray(t))for(let n of t)e+=this.formatSingleStyle(n.prop,n.value);else for(let n in t)e+=this.formatSingleStyle(n,t[n]);return e}applyObjectToBuilder(e,t){let n=Array.isArray(t)?t:[t];for(let s of n)for(let r in s){let o=s[r],d=r.replace(/_\d+$/,"");typeof e[d]=="function"&&(Array.isArray(o)?e[d](...o):e[d](o))}}formatSingleStyle(e,t){let n=t instanceof u||l(t,"binding")?t._get():t instanceof m||l(t,"signal")?t.value:t;if(n instanceof P)n=n.toString();else if(typeof n=="object"&&n!==null&&(e==="transform"||e==="filter")){let d=e==="transform"?new q(e):new H(e);this.applyObjectToBuilder(d,n),n=d.toString()}let s=e,r,o=ae[e];return o&&(s=o.cssName,r=o.unit,(o.type==="length"||o.type==="hybrid")&&typeof n=="number"?o.type==="hybrid"&&r===void 0||(n=w(n,r)):o.unit&&typeof n=="number"&&(n=`${n}${o.unit}`)),`${s}: ${n}; `}unrender(){for(let e=0;e<this.observableIds.length;e++){let t=this.observableIds[e],n=this.observables[e];n instanceof u||l(n,"binding")?n._unsubscribe(t):n.unsubscribe(t)}this.observableIds=[],this.observables=[],this.styleElement&&(this.styleElement.remove(),this.styleElement=null),this.target=null,this.updateSubscription.active=!1}toString(){return typeof this.target=="string"?`${this.target} { ${this.getStyleString()} }`:this.getStyleString()}};var we=class{static{a(this,"SyntheticEvent")}nativeEvent;target;currentTarget;type;timeStamp;defaultPrevented;detail;_propagationStopped=!1;_immediatePropagationStopped=!1;constructor(e){this.nativeEvent=e,this.target=e.target,this.currentTarget=e.currentTarget,this.type=e.type,this.timeStamp=e.timeStamp,this.defaultPrevented=e.defaultPrevented,this.detail=e.detail}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this._propagationStopped=!0,this.nativeEvent.stopPropagation()}stopImmediatePropagation(){this._immediatePropagationStopped=!0,this._propagationStopped=!0,this.nativeEvent.stopImmediatePropagation()}isPropagationStopped(){return this._propagationStopped}isImmediatePropagationStopped(){return this._immediatePropagationStopped}};var K=class i{static{a(this,"EventManager")}static managers=new Map;static getForDocument(e){let t=this.managers.get(e);return t||(t=new i(e),this.managers.set(e,t)),t}document;listeners=new WeakMap;activeEventTypes=new Set;constructor(e){this.document=e}addListener(e,t,n,s=[]){let r=this.listeners.get(e);r||(r=new Map,this.listeners.set(e,r));let o=r.get(t);o||(o=[],r.set(t,o)),o.push({handler:n,modifiers:s}),this.ensureGlobalListener(t)}removeListener(e,t,n){let s=this.listeners.get(e);if(!s)return;let r=s.get(t);if(!r)return;let o=r.findIndex(d=>d.handler===n);o!==-1&&r.splice(o,1),r.length===0&&s.delete(t)}ensureGlobalListener(e){if(this.activeEventTypes.has(e))return;let t=e==="focus"||e==="blur";this.document.addEventListener(e,n=>{this.dispatchEvent(e,n)},t),this.activeEventTypes.add(e)}dispatchEvent(e,t){let n=t.composedPath();if(!n||n.length===0){n=[];let r=t.target;for(;r;)n.push(r),r=r.parentNode||r.host}let s=new we(t);for(let r of n){if(r===this.document||r===window)continue;let o=this.listeners.get(r);if(!o)continue;let d=o.get(e);if(d){s.currentTarget=r;for(let{handler:h,modifiers:c}of[...d])if(!(c.includes("self")&&t.target!==r)&&(c.includes("stop")&&s.stopPropagation(),c.includes("prevent")&&s.preventDefault(),h(s),c.includes("once")&&this.removeListener(r,e,h),s.isImmediatePropagationStopped()))break;if(s.isPropagationStopped())break}}}};var C=class extends f{static{a(this,"ElementVdom")}_children=null;_vtype="element";get children(){return this._children||(this._children=new v(this._dot),this._children._parent=this),this._children}set children(e){this._children=e}element;tag=null;attributes={};events=[];attributeObserverIds=[];childBuilders=[];attrVNodes=[];styleVNodes=[];ref;inputListener;compositionStartListener;compositionEndListener;manualInputAllowed=!0;isComposing=!1;activeBindings={};lastSyncedValues={};constructor(e,t){super(e),this.tag=t}_render(e){this._isRendered=!0,this.element=e.ownerDocument.createElement(this.tag),this.element[W]=this,this.ref&&(typeof this.ref=="function"?this.ref(this.element):this.ref.value=this.element),e.appendChild(this.element),this._children&&this._children._render(this.element);for(let t=0;t<this.events.length;t++){let n=this.events[t];this.renderEvent(n.name,n.callback,n.modifiers)}this.attributes.type!==void 0&&this.renderAttr("type",this.attributes.type,this.element);for(let t in this.attributes)t!=="type"&&this.renderAttr(t,this.attributes[t],this.element);this._onEnterHook&&this._onEnterHook(this.element)}_unrender(){if(!this._isRendered||(this._isRendered=!1,this._children&&this._children._unrender(),!this.element))return;let e=K.getForDocument(this.element.ownerDocument);this.inputListener&&(e.removeListener(this.element,"input",this.inputListener),this.inputListener=null),this.compositionStartListener&&(e.removeListener(this.element,"compositionstart",this.compositionStartListener),this.compositionStartListener=null),this.compositionEndListener&&(e.removeListener(this.element,"compositionend",this.compositionEndListener),this.compositionEndListener=null);for(let t=0;t<this.events.length;t++){let n=this.events[t];e.removeListener(this.element,n.name.toLowerCase(),n.callback)}this.element.parentNode?.removeChild(this.element);for(let t=0;t<this.childBuilders.length;t++)this.childBuilders[t]._unrender();this.childBuilders.length=0;for(let t=0;t<this.attrVNodes.length;t++)this.attrVNodes[t].unrender();this.attrVNodes.length=0;for(let t=0;t<this.styleVNodes.length;t++)this.styleVNodes[t].unrender();this.styleVNodes.length=0;for(let t=0;t<this.attributeObserverIds.length;t++){let n=this.attributeObserverIds[t];n.observable._unsubscribe(n.id)}this.attributeObserverIds.length=0,this.ref&&(typeof this.ref=="function"?this.ref(null):this.ref.value=null),this.element=null}_getNodes(){return this.element?[this.element]:[]}_getLastChild(){return this}toString(){return this.element?this.element.outerHTML:super.toString()}setAttr(e,t){e=(e??"").toLowerCase();let n=e;if(e=="bind"){let r=this.attributes.type;r instanceof u||l(r,"binding")?r=r._get():(r instanceof m||l(r,"signal"))&&(r=r.value);let o=typeof r=="string"?r.toLowerCase():null;n=this.tag.toLowerCase()=="input"&&(o=="checkbox"||o=="radio")?"checked":"value"}let s=this.attributes[e];if(s instanceof M||l(s,"style-v-node")){s.unrender();let r=this.styleVNodes.indexOf(s);r!==-1&&this.styleVNodes.splice(r,1)}if(s instanceof oe||l(s,"attribute-v-node")){s.unrender();let r=this.attrVNodes.indexOf(s);r!==-1&&this.attrVNodes.splice(r,1)}for(let r=0;r<this.attributeObserverIds.length;r++){let o=this.attributeObserverIds[r];if(o.attr===e||o.attr===n){o.observable._unsubscribe(o.id),this.attributeObserverIds.splice(r,1);break}}if(t&&typeof t=="object"&&!(t instanceof Array||t instanceof u||l(t,"binding")||t?._isBinding||t instanceof m||l(t,"signal")||t?._isSignal||t instanceof V||l(t,"base-v-style")))switch(e){case"style":{t=new M(t);break}case"ref":break;default:{t=new oe(e,t);break}}if(typeof t=="function"&&e==="style"){let r=new V;t(r),t=new M(r)}(t instanceof V||l(t,"base-v-style"))&&e==="style"&&(t=new M(t)),this.attributes[e]=t,this.element&&this.renderAttr(e,t,this.element)}updateReactiveAttr(e,t){this.element&&this.renderAttr((e??"").toLowerCase(),t,this.element)}renderAttr(e,t,n,s=!1){if(e=="bind"){let r=this.attributes.type;r instanceof u||l(r,"binding")?r=r._get():(r instanceof m||l(r,"signal"))&&(r=r.value);let o=typeof r=="string"?r.toLowerCase():null;e=this.tag.toLowerCase()=="input"&&(o=="checkbox"||o=="radio")?"checked":"value",s=!0}if(e=="ref")this.ref=t,this.element&&(typeof this.ref=="function"?this.ref(this.element):this.ref.value=this.element);else if(typeof t=="string"||typeof t=="number")e=="value"&&(this.tag.toLowerCase()=="input"||this.tag.toLowerCase()=="textarea"||this.tag.toLowerCase()=="select")?(n.value=t??"",this.lastSyncedValues[e]=t??""):n.setAttribute(e,`${t}`);else if(typeof t=="boolean"||t==null||t==null)e=="checked"&&this.tag.toLowerCase()=="input"?(n.checked=!!t,this.lastSyncedValues[e]=!!t):e=="selected"&&this.tag.toLowerCase()=="option"?n.selected=!!t:e=="value"&&(this.tag.toLowerCase()=="input"||this.tag.toLowerCase()=="textarea"||this.tag.toLowerCase()=="select")&&(n.value=t??"",this.lastSyncedValues[e]=t??""),t?n.setAttribute(e,`${t}`):n.removeAttribute(e);else if(t instanceof Array)n.setAttribute(e,t.join(" "));else if(t instanceof u||l(t,"binding")||t?._isBinding){if(this.renderAttr(e,t._get(),n,s),!this.attributeObserverIds.some(r=>r.attr===e&&r.observable===t)){let r=t._subscribe(new re(this,e));this.attributeObserverIds.push({id:r,observable:t,attr:e})}if((e=="value"||e=="checked")&&t.isWritable&&s&&(this.activeBindings[e]=t,!this.inputListener)){this.inputListener=o=>{if(!this.isComposing)try{let d=o.target.type==="checkbox"||o.target.type==="radio"?"checked":"value",h=this.activeBindings[d];if(!h)return;let c=this.element[d],p=h._get(),b=this.lastSyncedValues[d];p==b&&c!=b&&h._set(c),this.lastSyncedValues[d]=h._get()}catch(d){console.error("CAUGHT ERROR: "+d.message)}},this.compositionStartListener=()=>{this.isComposing=!0},this.compositionEndListener=o=>{this.isComposing=!1,this.inputListener(o)};let r=K.getForDocument(this.element.ownerDocument);r.addListener(this.element,"input",this.inputListener),r.addListener(this.element,"compositionstart",this.compositionStartListener),r.addListener(this.element,"compositionend",this.compositionEndListener)}}else t instanceof oe||l(t,"attribute-v-node")?(t.render(n),this.attrVNodes.push(t)):(t instanceof M||l(t,"style-v-node"))&&(t.render(n),this.styleVNodes.push(t))}addEventListener(e,t,n=[]){this.events.some(s=>s.name===e&&s.callback===t)||(this.events.push({name:e,callback:t,modifiers:n}),this.element&&this.renderEvent(e,t,n))}renderEvent(e,t,n=[]){K.getForDocument(this.element.ownerDocument).addListener(this.element,e.toLowerCase(),t,n)}};var v=class extends f{static{a(this,"ContainerVdom")}_children=[];_parent=null;element=null;_vtype="container";constructor(e){super(e)}_addChild(e){return this._children.push(e),this.element?e._render(this.element):this._parent&&(this._parent instanceof C||l(this._parent,"element"))&&this._parent.element&&e._render(this._parent.element),this}_prependChild(e){return this._children.unshift(e),this.element?this.element.firstChild?e._renderBefore(this.element.firstChild):e._render(this.element):this._parent&&(this._parent instanceof C||l(this._parent,"element"))&&this._parent.element&&(this._parent.element.firstChild?e._renderBefore(this._parent.element.firstChild):e._render(this._parent.element)),this}_render(e){this._isRendered=!0,this.element=e;for(let t=0;t<this._children.length;t++)this._children[t]._render(e)}_unrender(){if(this._isRendered){this._isRendered=!1,this.element=null;for(let e=0;e<this._children.length;e++)this._children[e]._unrender()}}_getNodes(){let e=[];for(let t=0;t<this._children.length;t++)e.push(...this._children[t]._getNodes());return e}_getLastChild(){return this._children[this._children.length-1]||null}};var Ye={onAbort:1,onBlur:1,onChange:1,onInput:1,onCanPlay:1,onCantPlayThrough:1,onClick:1,onCopy:1,onContextMenu:1,onCueChange:1,onCut:1,onDblClick:1,onDrag:1,onDragEnd:1,onDragEnter:1,onDragLeave:1,onDragOver:1,onDragStart:1,onDrop:1,onDurationChange:1,onEmptied:1,onEnded:1,onError:1,onFocus:1,onHashChange:1,onInvalid:1,onKeyDown:1,onKeyPress:1,onKeyUp:1,onLoad:1,onLoadedData:1,onLoadedMetadata:1,onLoadStart:1,onMouseDown:1,onMouseEnter:1,onMouseLeave:1,onMouseMove:1,onMouseOut:1,onMouseOver:1,onMouseUp:1,onPointerCancel:1,onPointerDown:1,onPointerEnter:1,onPointerLeave:1,onPointerMove:1,onPointerOut:1,onPointerOver:1,onPointerUp:1,onTouchStart:1,onTouchEnd:1,onTouchCancel:1,onTouchMove:1,onMouseWheel:1,onOffline:1,onOnline:1,onPageHide:1,onPagePaste:1,onPageShow:1,onPause:1,onPlay:1,onPlaying:1,onPopState:1,onProgress:1,onRateChange:1,onReset:1,onResize:1,onScroll:1,onSearch:1,onSeeked:1,onSeeking:1,onSelect:1,onStalled:1,onStorage:1,onSubmit:1,onSuspend:1,onTimeUpdate:1,onToggle:1,onUnload:1,onVolumeChange:1,onWaiting:1,onWheel:1};var De=a(i=>i instanceof v||l(i,"container")||i instanceof f||l(i,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])||i?._root||l(i,"dotchain")||i?._children||typeof i=="object"&&i?.build||i instanceof m||l(i,"signal")||i?._isSignal||i instanceof u||l(i,"binding")||i?._isBinding||typeof i=="string"||typeof i=="number"||typeof i=="boolean"||Array.isArray(i),"isContent"),$=a((i,e,t)=>{let n=e instanceof C||l(e,"element")?e.children:e;if(Array.isArray(t))for(let s=0;s<t.length;s++)$(i,e,t[s]);else if(t?._root||l(t,"dotchain"))$(i,e,t._root);else if(Array.isArray(t?._children)){let s=t._children;if(s&&s.length>0)for(let r=0;r<s.length;r++)n._addChild(s[r])}else if(t instanceof f||l(t,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"]))n._addChild(t);else if(typeof t=="object"&&t?.build)n.mount(t);else if(t!=null){let s=t;(s instanceof m||l(s,"signal")||s?._isSignal)&&(s=s.bind()),s instanceof u||l(s,"binding")||s?._isBinding?n._addChild(new ge(i,s)):n._addChild(new T(s))}},"applyContent"),xt=a((i,e)=>{for(let t in e){let n=e[t];(n instanceof m||l(n,"signal")||n?._isSignal)&&!n?._isRef&&(n=n.bind());let s=t,r=[];if(t.includes(".")){let d=t.split(".");s=d[0],r=d.slice(1)}if(Ye[s]||s.startsWith("on")&&s[2]&&s[2]===s[2].toUpperCase()){if(typeof e[t]!="function")throw new Error(`Value of event attribute ${t} must be a function.`);i.addEventListener(s.substring(2).toLowerCase(),n,r)}else i.setAttr(t,n)}},"applyAttributes"),Be=a((i,e,t)=>{let n=new C(i,e);for(let s=0;s<t.length;s++){let r=t[s];De(r)?$(i,n,r):r&&typeof r=="object"&&xt(n,r)}return n},"createElement");var E=class extends m{static{a(this,"Computed")}getter;_vtype="computed";dependencies=new Map;isQueued=!1;isEvaluating=!1;active=!0;dirty=!0;error=null;get isWritable(){return!1}updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.dirty&&this._update()},"update")};constructor(e){super(),this.getter=e,this._update()}get value(){if(this.isEvaluating)throw new Error("Circular dependency detected in computed signal.");if(this.dirty&&this._update(),this.error)throw this.error;return super.value}addDependency(e){this.active&&(this.newDependencies.has(e)||this.newDependencies.add(e))}requestUpdate(){this.active&&(this.dirty=!0,this.isQueued||(this.isQueued=!0,I.enqueue(this.updateSubscription,S.Normal)))}newDependencies=new Set;_update(){if(!this.active)return;if(this.isEvaluating)throw new Error("Circular dependency detected in computed signal.");this.isEvaluating=!0,this.dirty=!1,this.error=null,this.newDependencies.clear(),X.push(this);let e,t=!1;try{e=this.getter()}catch(s){this.error=s,t=!0}finally{X.pop(),this.isEvaluating=!1}t||this.setValue(e);let n=[];for(let[s,r]of this.dependencies)this.newDependencies.has(s)||(s.unsubscribe(r),n.push(s));for(let s of n)this.dependencies.delete(s);for(let s of this.newDependencies)if(!this.dependencies.has(s)){let r=s.subscribe(()=>this.requestUpdate(),!0);this.dependencies.set(s,r)}}dispose(){this.active=!1;for(let[e,t]of this.dependencies)e.unsubscribe(t);this.dependencies.clear()}};var Ae=[],F=a(()=>Ae[Ae.length-1]||null,"getCurrentComponent"),k=a(i=>Ae.push(i),"pushComponent"),L=a(()=>Ae.pop(),"popComponent");var ve=class{static{a(this,"KeyframesBuilder")}sheet;steps=[];constructor(e){this.sheet=e}step(e,t){let n=new V;return t(n),this.steps.push({selector:e,style:n}),this}from(e){return this.step("from",e)}to(e){return this.step("to",e)}at(e,t){let n=typeof e=="number"?`${e}%`:e;return this.step(n,t)}toString(e=""){return this.steps.map(t=>`${e}${t.selector} { ${this.sheet.formatPropsForBlock(t.style)} }`).join(`
|
|
2
|
-
`)}};var Se=class i{static{a(this,"StyleSheetBuilder")}rules=[];theme=null;ghostVars=[];varCounter=0;getGhostVars(){return this.ghostVars}setTheme(e){return this.theme=e,this}clearRules(){this.rules=[],this.ghostVars=[],this.varCounter=0}template(e,...t){return new E(()=>{let n="";for(let s=0;s<e.length;s++)if(n+=e[s],s<t.length){let r=t[s];r instanceof m||r instanceof u?n+=r instanceof u?r._get():r.value:n+=r}return n})}class(e,t){return this.rule(`.${e}`,t)}rule(e,t){let n=new V;return t(n),this.rules.push({type:"rule",selector:e,style:n}),this}selector(e,t){return this.rule(e,t)}media(e,t){let n=new i;return t(n),this.rules.push({type:"media",condition:e,builder:n}),this}container(e,t){let n=new i;return t(n),this.rules.push({type:"container",condition:e,builder:n}),this}supports(e,t){let n=new i;return t(n),this.rules.push({type:"supports",condition:e,builder:n}),this}keyframes(e,t){let n=new ve(this);return t(n),this.rules.push({type:"keyframes",name:e,builder:n}),this}v(e){return e.startsWith("--")||(e="--"+e),`var(${e})`}applyObjectToBuilder(e,t){let n=Array.isArray(t)?t:[t];for(let s of n)for(let r in s){let o=s[r],d=r.replace(/_\d+$/,"");typeof e[d]=="function"&&(Array.isArray(o)?e[d](...o):e[d](o))}}formatPropsForBlock(e){return e.getProps().map(t=>{let n=
|
|
1
|
+
var bt=Object.defineProperty;var a=(i,e)=>bt(i,"name",{value:e,configurable:!0});var W="_dotVDom",U=typeof process<"u"?process.env.NODE_ENV!=="production":(()=>{try{return new Function("return import.meta.env?.DEV")()}catch{return!1}})()??!1;var u=class{static{a(this,"Binding")}_isBinding=!0;_vtype="binding";_source;_transform;get isWritable(){return this._source.isWritable&&(!this._transform||!!this._transform.read)}get value(){return this._get()}_get(){return this._transform?.display?this._transform.display(this._source.value):this._source.value}_set(e){let t=this._transform?.read?this._transform.read(e):e;this._source.value=t}_subscribe(e,t=!1){return this._source._subscribe(this,e,t)}subscribe(e,t=!1){return this._subscribe(e,t)}_unsubscribe(e){this._source.unsubscribe(e)}unsubscribe(e){this._source.unsubscribe(e)}constructor(e){this._source=e}};var Y=class{static{a(this,"VMetaNode")}};function pe(i,e){if(i.parentNode!==e.parentNode)throw new Error("Start and end nodes must have the same parent.");let t=i.nextSibling;for(;t&&t!==e;){let n=t.nextSibling;t[W]?t[W]._unrender():t.parentNode?.removeChild(t),t=n}}a(pe,"removeNodesBetween");function Le(i,e,t=new Map){if(i===e)return!0;if(i==null||e==null||typeof i!="object"||typeof e!="object")return!1;if(t.has(i))return t.get(i)===e;if(t.set(i,e),Array.isArray(i)&&Array.isArray(e)&&i.length!==e.length)return!1;for(let n in i)if(!e.hasOwnProperty(n)||!Le(i[n],e[n],t))return!1;for(let n in e)if(!i.hasOwnProperty(n))return!1;return!0}a(Le,"deepEqual");function l(i,e){if(!i||typeof i!="object")return!1;let t=i._vtype;return t?Array.isArray(e)?e.indexOf(t)!==-1:t===e:!1}a(l,"isVType");var ye=new RegExp("[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?","g");var f=class{static{a(this,"Vdom")}_dot;_onEnterHook;_onLeaveHook;_vtype="vdom";constructor(e){this._dot=e}_unrenderAsync(){let t=this._getNodes().find(n=>n instanceof HTMLElement);if(this._onLeaveHook&&t){let n=this._onLeaveHook(t);if(n instanceof Promise)return n.then(()=>this._unrender())}this._unrender()}_moveBefore(e,t){let n=this._getNodes();if(n.length===0)return;let s=e?.parentElement||t;if(!s)throw new Error("Internal Error: Cannot move nodes without a parent.");for(let o=0;o<n.length;o++)if(n[o]===e)return;let r=(e?.ownerDocument||s.ownerDocument||document).createDocumentFragment();for(let o=0;o<n.length;o++)r.appendChild(n[o]);s.insertBefore(r,e)}__isRendered=!1;get _isRendered(){return this.__isRendered}set _isRendered(e){this.__isRendered=e}toString(){let e=document.createElement("div");return this._render(e),e.innerHTML}_renderBefore(e){let t=e.ownerDocument.createElement("div");for(this._render(t);t.childNodes.length>0;){let n=t.childNodes[0];n.parentElement.removeChild(n),e.parentElement.insertBefore(n,e)}}_renderAfter(e){if(e.nextSibling)this._renderBefore(e.nextSibling);else{let t=e.ownerDocument.createTextNode("");e.parentElement.appendChild(t),this._renderBefore(t),t.parentElement.removeChild(t)}}_moveTo(e){let t=this._getNodes();for(let n=0;n<t.length;n++)e.appendChild(t[n])}text(e){return null}html(e){return null}md(e){return null}mount(e,t){return null}append(e){return null}prepend(e){return null}when(e,t){return null}each(e,t){return null}otherwiseWhen(e,t,n){return null}otherwise(e){return null}attr(e,t){return null}style(e){return null}on(e,t){return null}onEnter(e){return null}onLeave(e){return null}empty(){return null}remove(){}};var T=class extends f{static{a(this,"TextVdom")}_text;textNode=null;observerId=0;_vtype="text";constructor(e){super(),this._text=e}_render(e){this._text instanceof u?(this.textNode=e.ownerDocument.createTextNode(this._text._get()??""),this.observerId=this._text._subscribe(this)):this.textNode=e.ownerDocument.createTextNode(`${this._text??""}`),e.appendChild(this.textNode)}_unrender(){this.textNode&&(this.textNode.parentElement&&this.textNode.parentElement.removeChild(this.textNode),this.textNode=null),this.observerId&&this._text instanceof u&&(this._text._unsubscribe(this.observerId),this.observerId=0)}_getNodes(){return this.textNode?[this.textNode]:[]}_getLastChild(){return this}toString(){let e=document.createTextNode((this._text instanceof u?this._text._get():this._text)??""),t=document.createElement("div");return t.appendChild(e),t.innerHTML}};var R=class extends f{static{a(this,"FragmentVdom")}_children=[];_vtype="fragment";constructor(e){super(e)}_render(e){this._isRendered=!0;for(let t=0;t<this._children.length;t++)this._children[t]._render(e)}_unrender(){if(this._isRendered){this._isRendered=!1;for(let e=0;e<this._children.length;e++)this._children[e]._unrender()}}_getNodes(){let e=[];for(let t=0;t<this._children.length;t++)e.push(...this._children[t]._getNodes());return e}_getLastChild(){return this._children[this._children.length-1]||null}};var S=(function(i){return i[i.Immediate=0]="Immediate",i[i.UserBlocking=1]="UserBlocking",i[i.Normal=2]="Normal",i[i.Background=3]="Background",i})({});var yt=class{static{a(this,"Scheduler")}queues=[new Set,new Set,new Set,new Set];isPending=!1;startTime=0;frameYieldMs=5;isSync=!1;isSyncing=!1;onError;channel=typeof MessageChannel<"u"?new MessageChannel:null;constructor(){this.channel&&(this.channel.port1.onmessage=()=>this.workLoop())}enqueue(e,t=S.Normal){e.isQueued||(e.isQueued=!0,this.queues[t].add(e)),t===S.Immediate||this.isSync?this.flushSync():this.scheduleFlush()}scheduleFlush(){this.isPending||(this.isPending=!0,this.channel?this.channel.port2.postMessage(null):setTimeout(()=>this.workLoop(),0))}shouldYield(){return performance.now()-this.startTime>=this.frameYieldMs}workLoop(){for(this.startTime=performance.now(),this.isPending=!1;this.flushQueues();)if(this.shouldYield()){this.scheduleFlush();break}}flushQueues(){for(let e=S.Immediate;e<=S.Background;e++){let t=this.queues[e];if(t.size===0)continue;let n=Array.from(t);t.clear();for(let s=0;s<n.length;s++){let r=n[s];if(r.isQueued=!1,r.active)try{r.update()&&(r.isQueued=!0,t.add(r))}catch(o){this.onError?this.onError(o):console.error("Scheduler error:",o)}if(this.shouldYield()){for(let o=s+1;o<n.length;o++)t.add(n[o]);return!0}}}for(let e=S.Immediate;e<=S.Background;e++)if(this.queues[e].size>0)return!0;return!1}flushSync(){if(this.isSyncing)return;this.isSyncing=!0,this.isPending=!0;let e=this.shouldYield;this.shouldYield=()=>!1;try{let t=!0;for(;t;){t=!1;for(let n=S.Immediate;n<=S.Background;n++){let s=this.queues[n];if(s.size===0)continue;let r=Array.from(s);s.clear();for(let o of r)if(o.isQueued=!1,o.active)try{o.update()&&(o.isQueued=!0,s.add(o),t=!0)}catch(d){throw this.onError&&this.onError(d),d}s.size>0&&(t=!0)}}}finally{this.shouldYield=e,this.isPending=!1,this.isSyncing=!1}}setSync(e){this.isSync=e}clear(){for(let e of this.queues)e.clear();this.isPending=!1}},I=new yt;var re=class i extends f{static{a(this,"CollectionVdom")}static MAX_BATCH_SIZE=128;value;renderCallback;startNode;endNode;observerId=0;_vtype="collection";mappedItems=[];updateState=null;constructor(e,t,n){super(e),this.value=t,this.renderCallback=n}_render(e){this.value instanceof u&&(this.observerId=this.value._subscribe(this)),this.startNode=e.ownerDocument.createTextNode(""),this.endNode=e.ownerDocument.createTextNode(""),e.appendChild(this.startNode),e.appendChild(this.endNode);let t=I.shouldYield;I.shouldYield=()=>!1;try{this.updateList()}finally{I.shouldYield=t}}_unrender(){this.observerId&&this.value instanceof u&&(this.value._unsubscribe(this.observerId),this.observerId=null);for(let e=0;e<this.mappedItems.length;e++){let t=this.mappedItems[e];t.vdom._unrender(),t.afterNode.parentElement.removeChild(t.afterNode)}this.mappedItems.length=0,this.startNode.parentElement.removeChild(this.startNode),this.endNode.parentElement.removeChild(this.endNode),this.startNode=null,this.endNode=null}_getNodes(){if(!this.startNode)return[];let e=[this.startNode];for(let t=0;t<this.mappedItems.length;t++)e.push(...this.mappedItems[t].vdom._getNodes()),e.push(this.mappedItems[t].afterNode);return e.push(this.endNode),e}_getLastChild(){return this}getTailAppendPrefixLength(e){let t=this.mappedItems;if(t.length===0||e.length<=t.length)return 0;for(let n=0;n<t.length;n++)if(e[n]!==t[n].keyValue)return 0;return t.length}isItemPositionedAfter(e,t){let n=e.vdom._getNodes();if(!n.length||!t.parentElement||n[0]!==t.nextSibling)return!1;let s=n[n.length-1];return e.afterNode===s.nextSibling}reuseExistingItem(e,t,n){if(e.value!==t&&!Le(e.value,t)){e.vdom._unrender(),e.value=t;let s=this.renderCallback(t,this.value instanceof u?e.observableIndex:n,e.keyValue),r;s instanceof f?r=s:typeof s=="object"&&s?.build?(r=new R(this._dot),r.mount(s)):r=new T(s),r._root&&(r=r._root),e.vdom=r}else e.observableIndex._set(n)}getInsertBeforeAnchor(e,t){for(let n=e;n<t.length;n++)if(t[n].vdom._isRendered){let s=t[n].vdom._getNodes();if(s.length)return s[0]}return this.endNode}countConsecutiveUnrendered(e,t){let n=0;for(;e+n<t.length&&!t[e+n].vdom._isRendered&&n<i.MAX_BATCH_SIZE;)n++;return n}batchRenderNewItems(e,t,n){let s=t.ownerDocument.createDocumentFragment();for(let r of e)r.vdom._render(s),s.appendChild(r.afterNode);t.insertBefore(s,n)}removeItem(e){let t=e.vdom._unrenderAsync();if(t instanceof Promise)return t.then(()=>{e.afterNode.parentElement&&e.afterNode.parentElement.removeChild(e.afterNode)});e.afterNode.parentElement&&e.afterNode.parentElement.removeChild(e.afterNode)}updateList(){let e=null;this.value instanceof u?e=this.value._get():e=this.value;let t=Array.isArray(e)?e:Object.values(e);if(this.updateState&&(Le(this.updateState.newItems,t)||(this.updateState=null)),!this.updateState){let s=null;this.value instanceof u&&(s=this.value._source.key??null);let r=t,o=Array.isArray(e)?r.map((c,p)=>s?c[s]:p):Object.keys(e).map((c,p)=>s?e[c][s]:c),d=this.getTailAppendPrefixLength(o),h=new Map;for(let c=0;c<this.mappedItems.length;c++){let p=this.mappedItems[c];c>=d&&h.set(p.keyValue,p)}this.updateState={newItems:r,newKeys:o,oldMap:h,nextMappedItems:[],currentIndex:0,lastNode:this.startNode,tailAppendPrefix:d,step:"diff"}}let n=this.updateState;if(n.step==="diff"){for(;n.currentIndex<n.newItems.length;){let s=n.newItems[n.currentIndex],r=n.newKeys[n.currentIndex];if(n.currentIndex<n.tailAppendPrefix){let o=this.mappedItems[n.currentIndex];this.reuseExistingItem(o,s,n.currentIndex),n.nextMappedItems.push(o)}else{let o=n.oldMap.get(r);if(o)n.oldMap.delete(r),this.reuseExistingItem(o,s,n.currentIndex),n.nextMappedItems.push(o);else{let h=new m().bind();h._set(n.currentIndex);let c=this.renderCallback(s,this.value instanceof u?h:n.currentIndex,r),p;c instanceof f?p=c:typeof c=="object"&&c?.build?(p=new R(this._dot),p.mount(c)):p=new T(c),p._root&&(p=p._root);let b=this.startNode.ownerDocument.createTextNode("");n.nextMappedItems.push({vdom:p,value:s,keyValue:r,afterNode:b,observableIndex:h})}}if(n.currentIndex++,I.shouldYield())return!0}n.step="cleanup"}if(n.step==="cleanup"){let s=Array.from(n.oldMap.values());for(let r of s)this.removeItem(r);n.step="reorder",n.currentIndex=0,this.mappedItems=[]}if(n.step==="reorder")for(;n.currentIndex<n.nextMappedItems.length;){let s=n.nextMappedItems[n.currentIndex];if(s.vdom._isRendered)this.isItemPositionedAfter(s,n.lastNode)?(n.lastNode=s.afterNode,this.mappedItems.push(s),n.currentIndex++):(s.vdom._moveBefore(n.lastNode.nextSibling,n.lastNode.parentElement),n.lastNode.parentElement.insertBefore(s.afterNode,s.vdom._getNodes().slice(-1)[0].nextSibling),n.lastNode=s.afterNode,this.mappedItems.push(s),n.currentIndex++);else{let r=this.countConsecutiveUnrendered(n.currentIndex,n.nextMappedItems);if(r>=2){let o=n.nextMappedItems.slice(n.currentIndex,n.currentIndex+r),d=n.lastNode.parentElement,h=this.getInsertBeforeAnchor(n.currentIndex+r,n.nextMappedItems);this.batchRenderNewItems(o,d,h);for(let c of o)n.lastNode=c.afterNode,this.mappedItems.push(c);n.currentIndex+=r}else s.vdom._renderAfter(n.lastNode),n.lastNode.parentElement.insertBefore(s.afterNode,s.vdom._getNodes().slice(-1)[0].nextSibling),n.lastNode=s.afterNode,this.mappedItems.push(s),n.currentIndex++}if(I.shouldYield())return!0}return this.updateState=null,!1}};var oe=class extends f{static{a(this,"ConditionalVdom")}conditions=[];sealed=!1;renderedIndex=-1;currentUpdatePromise=null;nextIndex=null;_vtype="conditional";constructor(e){super(e)}addCondition(e,t,n=!1){if(this.sealed)throw new Error("Cannot add additional conditions to a sealed block.");this.sealed=n;let s={condition:e,vNode:t,startAnchor:null,endAnchor:null,observerId:0};this.conditions.push(s),this._isRendered&&(this.renderClause(s,this.conditions[0].startAnchor.parentElement),this.renderedIndex==-1&&this.updateConditions())}renderClause(e,t){if(e.startAnchor)throw new Error("Item is already rendered.");e.startAnchor=t.ownerDocument.createTextNode(""),e.endAnchor=t.ownerDocument.createTextNode(""),t.appendChild(e.startAnchor),t.appendChild(e.endAnchor),e.condition instanceof u&&(e.observerId=e.condition._subscribe(this))}_render(e){this._isRendered=!0;for(let t=0;t<this.conditions.length;t++)this.renderClause(this.conditions[t],e);this.updateConditions()}removeCNode(e){e.condition instanceof u&&(e.condition._unsubscribe(e.observerId),e.observerId=0);let t=e.startAnchor,n=e.endAnchor;t.parentElement.removeChild(t),n.parentElement.removeChild(n),e.startAnchor=null,e.endAnchor=null,e.vNode._unrender()}_unrender(){if(this._isRendered){this._isRendered=!1,this.renderedIndex=-1,this.nextIndex=null,this.currentUpdatePromise=null;for(let e=0;e<this.conditions.length;e++){let t=this.conditions[e];this.removeCNode(t)}}}_getNodes(){if(!this._isRendered)return[];let e=[];for(let t=0;t<this.conditions.length;t++){let n=this.conditions[t];e.push(n.startAnchor),t==this.renderedIndex&&e.push(...n.vNode._getNodes()),e.push(n.endAnchor)}return e}_getLastChild(){return this}updateConditions(){let e=-1;for(let t=0;t<this.conditions.length;t++){let n=this.conditions[t];if(n.condition instanceof u?n.condition._get():n.condition){e=t;break}}if(this.currentUpdatePromise){this.nextIndex=e;return}e!=this.renderedIndex&&this.performUpdate(e)}performUpdate(e){let t=this.renderedIndex;if(t!=-1){let s=this.conditions[t].vNode._unrenderAsync();if(s instanceof Promise){this.currentUpdatePromise=s,s.then(()=>{this.currentUpdatePromise=null,this.renderedIndex=-1,this.finishUpdate(e)});return}}this.renderedIndex=-1,this.finishUpdate(e)}finishUpdate(e){if(this.nextIndex!==null){let t=this.nextIndex;if(this.nextIndex=null,t!==e){this.performUpdate(t);return}}if(this.renderedIndex=e,this.renderedIndex!=-1){let t=this.conditions[this.renderedIndex];t.vNode._renderBefore(t.endAnchor)}if(this.nextIndex!==null){let t=this.nextIndex;this.nextIndex=null,t!==this.renderedIndex&&this.performUpdate(t)}}};var K=class extends f{static{a(this,"HtmlVdom")}beforeNode;afterNode;_vtype="html";_content;currentVdom=null;observerId=0;constructor(e,t){super(t),this._content=e}_toVdom(e){return e==null?null:e instanceof f||e?._root?e?._root||e:this._dot&&(typeof e=="object"&&e.build||Array.isArray(e))?this._dot.mount(e)._root:null}updateHtml(e){if(this.beforeNode){this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null),pe(this.beforeNode,this.afterNode);let t=this._toVdom(e);if(t)this.currentVdom=t,this.currentVdom._renderBefore(this.afterNode);else if(e!=null){let n=this.beforeNode.ownerDocument.createElement("div");for(n.innerHTML=e;n.firstChild;)this.afterNode.parentElement.insertBefore(n.firstChild,this.afterNode)}}}_render(e){let t="";this._content instanceof u?(t=this._content._get(),this.observerId=this._content._subscribe(this)):t=this._content,this.beforeNode=e.ownerDocument.createTextNode(""),this.afterNode=e.ownerDocument.createTextNode(""),e.appendChild(this.beforeNode),e.appendChild(this.afterNode),this.updateHtml(t)}_unrender(){if(this.beforeNode){this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null);let e=this.beforeNode.parentElement;pe(this.beforeNode,this.afterNode),e.removeChild(this.beforeNode),e.removeChild(this.afterNode),this.beforeNode=null,this.afterNode=null}this.observerId&&this._content instanceof u&&(this._content._unsubscribe(this.observerId),this.observerId=0)}update(e){this.updateHtml(e)}_getNodes(){if(!this.beforeNode)return[];let e=[this.beforeNode],t=this.beforeNode.nextSibling;for(;t&&t!==this.afterNode;)e.push(t),t=t.nextSibling;return e.push(this.afterNode),e}_getLastChild(){return this}toString(){return this.currentVdom?this.currentVdom.toString():this._content instanceof u?this._content._get():this._content}};var ae=class{static{a(this,"ReactiveAttr")}elementVdom;attribute;constructor(e,t){this.elementVdom=e,this.attribute=t}};var _e=class{static{a(this,"Subscription")}boundReactive;item;active=!0;isQueued=!1;constructor(e,t){this.boundReactive=e,this.item=t}update(){if(!this.active)return;let e=this.boundReactive._get();if(this.item instanceof T||l(this.item,"text"))this.item.textNode.textContent=e??"";else if(this.item._isReactiveVdom||l(this.item,"reactive"))this.item.update(e);else if(this.item instanceof K||l(this.item,"html"))this.item.updateHtml(e);else if(this.item instanceof ae)this.item.elementVdom.updateReactiveAttr(this.item.attribute,e);else if(this.item instanceof Y||l(this.item,["style-v-node","attribute-v-node"]))this.item.update();else{if(this.item instanceof re||l(this.item,"collection"))return this.item.updateList();this.item instanceof oe||l(this.item,"conditional")?this.item.updateConditions():this.item instanceof Function&&this.item(e)}}};var Z=[];var _t=7,Dn=_t+1,m=class i{static{a(this,"Signal")}_isSignal=!0;_isRef=!1;_vtype="signal";bindAs(e){let t=new u(this);return e.call&&e.apply?t._transform={display:e}:t._transform=e,t}bind(){return new u(this)}_value;key;subscribers=new Map;get isWritable(){return!0}constructor(){if(new.target===i)return this._proxy()}_proxy(){return new Proxy(this,{get(e,t,n){if(t in e)return Reflect.get(e,t,n);let s=e.value;return s&&typeof s[t]=="function"?(...r)=>{let o=s[t].apply(s,r),d=["push","pop","shift","unshift","splice","sort","reverse"];return Array.isArray(s)&&d.includes(t)&&e.refresh(),o}:s?s[t]:void 0},set(e,t,n,s){if(t in e||typeof t=="string"&&t.startsWith("_"))return Reflect.set(e,t,n,s);let r=e.value;if(r&&typeof r=="object"&&e.isWritable){let o=Reflect.set(r,t,n);return o&&e.refresh(),o}return Reflect.set(e,t,n,s)},defineProperty(e,t,n){return Reflect.defineProperty(e,t,n)}})}get value(){let e=Z[Z.length-1];return e&&e.addDependency&&e.addDependency(this),this._value}set value(e){this.setValue(e)}getValue(){return this.value}setValue(e,t=S.Normal){this._value!==e&&(this._value=e,this.updater(this._value,t))}updater(e,t=S.Normal){for(let n of this.subscribers.values())n.sync?n.update():(!n.isQueued||t===S.Immediate)&&I.enqueue(n,t)}nextId=1;subscribe(e,t=!1){return new u(this)._subscribe(e,t)}_subscribe(e,t,n=!1){let s=this.nextId++,r=new _e(e,t);return r.sync=n,this.subscribers.set(s,r),s}unsubscribe(e){this.subscribers.has(e)&&(this.subscribers.get(e).active=!1,this.subscribers.delete(e))}_detachBinding(e){this.unsubscribe(e)}refresh(e=S.Normal){let t=this.value;this.updater(t,e)}updateObservers(e=S.Normal){this.refresh(e)}};var le=class extends Y{static{a(this,"AttributeVNode")}attr;value;target;_vtype="attribute-v-node";observables={};constructor(e,t){super(),this.attr=e,this.value=t}render(e){this.target=e;for(let t in this.value){let n=this.value[t];if((n instanceof m||l(n,"signal"))&&(n=n.bind()),n&&(n instanceof u||l(n,"binding"))){let s=n._subscribe(this);this.observables[s]=n}}this.update()}update(){if(!this.target)return;let e=[];for(let t in this.value){let n=this.value[t];n&&((n instanceof m||l(n,"signal"))&&(n=n.bind()),(!(n instanceof u||l(n,"binding"))||n._get())&&e.push(t))}e.length>0?this.target.setAttribute(this.attr,e.join(" ")):this.target.removeAttribute(this.attr)}unrender(){this.target=null;for(let e in this.observables)this.observables[e]._unsubscribe(Number(e));this.observables={}}};var je={color:"color|background-Color|border-Bottom-Color|border-Color|border-Left-Color|border-Right-Color|border-Top-Color|text-Decoration-Color|outline-Color|column-Rule-Color",length:"background-Size|block-Size|border-Bottom-Left-Radius|border-Bottom-Right-Radius|border-Bottom-Width|border-Left-Width|border-Radius|border-Right-Width|border-Top-Left-Radius|border-Top-Right-Radius|border-Top-Width|border-Width|bottom|gap|height|left|margin|margin-Bottom|margin-Left|margin-Right|margin-Top|max-Height|max-Width|min-Height|min-Width|padding|padding-Bottom|padding-Left|padding-Right|padding-Top|right|top|width|flex-Basis|font-Size|text-Indent|letter-Spacing|word-Spacing|border-Spacing|outline-Offset|outline-Width|column-Gap|column-Rule-Width|grid-Column-Gap|grid-Gap|grid-Row-Gap|column-Width|perspective|row-Gap",hybrid:"line-Height|border-Image-Width|border-Image-Outset|tab-Size|flex",url:"background-Image|border-Image|list-Style-Image|content|image-Orientation",transformation:"transform",filter:"filter|backdrop-Filter",time:"animation-Delay|animation-Direction|animation-Duration|transition-Duration|transition-Delay",misc:"appearance|aspect-Ratio|opacity|background|background-Attachment|background-Blend-Mode|background-Position|background-Repeat|background-Clip|background-Origin|border|border-Bottom|border-Bottom-Style|border-Image-Repeat|border-Image-Slice|border-Image-Source|border-Left|border-Left-Style|border-Right|border-Right-Style|border-Style|border-Top|border-Top-Style|box-Decoration-Break|box-Shadow|clear|clip|display|float|overflow|box|overflow-X|overflow-Y|position|visibility|vertical-Align|z-Index|align-Content|align-Items|align-Self|flex-Direction|flex-Flow|flex-Grow|flex-Shrink|flex-Wrap|grid|grid-Area|grid-Auto-Columns|grid-auto-Rows|grid-Column|grid-Column-End|grid-Column-Start|grid-Row|grid-Row-End|grid-Row-Start|grid-Template|grid-Template-Areas|grid-Template-Columns|grid-Template-Rows|justify-Content|order|hanging-Punctuation|hyphens|line-Break|overflow-Wrap|text-Align|text-Align-Last|text-Combine-Upright|text-Justify|text-Transform|white-Space|word-Break|word-Wrap|text-Decoration|text-Decoration-Line|text-Decoration-Style|text-Shadow|text-Underline-Position|font|font-Family|font-Feature-Settings|font-Kerning|font-Language-Override|font-Size-Adjust|font-Stretch|font-Style|font-Synthesis|font-Variant|font-Variant-Alternates|font-Variant-Caps|font-Variant-East-Asian|font-Variant-Ligatures|font-Variant-Numeric|font-Variant-Position|font-Weight|direction|text-Orientation|text-Combine-Upright|unicode-Bidi|user-Select|writing-Mode|border-Collapse|caption-Side|empty-Cells|table-Layout|counter-Increment|counter-Reset|list-Style|list-Style-Position|list-Style-Type|animation|animation-Fill-Mode|animation-Iteration-Count|animation-Name|animation-Play-State|animation-Timing-Function|animation-Timeline|container-Type|container-Name|backface-Visibility|perspective2d|perspective-Origin|transform-Origin|transform-Style|transition|transition-Property|transition-Timing-Function|box-Sizing|cursor|ime-Mode|nav-Down|nav-Index|nav-Left|nav-Right|nav-Up|outline|outline-Style|resize|text-Overflow|break-After|break-Before|break-Inside|column-Count|column-Fill|column-Rule|column-Rule-Style|column-Span|columns|widows|orphans|page-Break-After|page-Break-Before|page-Break-Inside|marks|quotes|image-Rendering|image-Resolution|object-Fit|object-Position|mask|mask-Type|mark|mark-After|mark-Before|phonemes|rest|rest-After|rest-Before|voice-Balance|voice-Duration|voice-Pitch|voice-Pitch-Range|voice-Rate|voice-Stress|voice-Volume|marquee-Direction|marquee-Play-Count|marquee-Speed|marquee-Style|pointer-Events"},wt="Cm|Mm|In|Px|Pt|Pc|Ch|Em|Ex|Lh|Rem|Vh|Vw|Vmin|Vmax|Cqw|Cqh|Cqi|Cqb|Cqmin|Cqmax|P".split("|"),vt="Ms|S".split("|"),St="Deg|Grad|Rad|Turn".split("|"),xt="Hz|Khz".split("|"),me={};for(let i in je){let e=je[i].split("|");for(let t of e){let n=t.split("-").join("");switch(i){case"hybrid":case"length":{for(let s of wt)me[`${n}${s}`]={dotName:n,cssName:t.toLowerCase(),type:i,unit:s=="P"?"%":s.toLowerCase()};break}case"time":{for(let s of vt)me[`${n}${s}`]={dotName:n,cssName:t.toLowerCase(),type:i,unit:s.toLowerCase()};break}case"angle":{for(let s of St)me[`${n}${s}`]={dotName:n,cssName:t.toLowerCase(),type:i,unit:s.toLowerCase()};break}case"frequency":{for(let s of xt)me[`${n}${s}`]={dotName:n,cssName:t.toLowerCase(),type:i,unit:s.toLowerCase()};break}default:break}me[n]={dotName:n,cssName:t.toLowerCase(),type:i,unit:void 0}}}var de=me;var P=class{static{a(this,"CssFunctionBuilderVStyle")}funcs=[];propName;constructor(e){this.propName=e}toString(){let e="";for(let t of this.funcs){let n=Array.from(t.args).map(s=>{let r=s.v!==void 0?s.v:s,o=s.f||(d=>`${d}`);return r instanceof u?o(r._get()):r instanceof m?o(r.value):o(r).toString().split(" ").join(", ")}).join(", ");e+=`${t.func}(${n}) `}return e.trim()}appendFunction(e,t){return this.funcs.push({func:e,args:t}),this}};function w(i,e="px"){if(i=i||"0px",i instanceof u&&(i=i._get()),i instanceof m&&(i=i.value),i instanceof Array)return i.map(n=>w(n,e)).join(" ");isNaN(i)||(i=i+e);let t=i.trim().split(" ");if(t.length>1)return t.map(n=>w(n,e)).join(" ");{let n=Number(i.match(ye)[0]),s=i.split(ye)[1]||e;return`${n}${s}`}}a(w,"formatCssLength");function Pe(i){if(i=i||"0%",i instanceof u&&(i=i._get()),i instanceof m&&(i=i.value),i instanceof Array)return i.map(t=>Pe(t)).join(" ");let e=i.trim().split(" ");return e.length>1?e.map(t=>Pe(t)).join(" "):isNaN(i)?i:`${i}%`}a(Pe,"formatCssPercentage");function Ue(i){if(typeof i=="number"){let e=0,t=0,n=0,s=1;return n=i&255,i>>=8,t=i&255,i>>=8,e=i&255,`rgb(${e} ${t} ${n})`}else if(typeof i=="string")return i}a(Ue,"formatCssColor");function M(i){if(i=i||"0deg",i instanceof u&&(i=i._get()),i instanceof m&&(i=i.value),i instanceof Array)return i.map(t=>M(t)).join(" ");isNaN(i)||(i=`${i}deg`);let e=i.trim().split(" ");if(e.length>1)return e.map(t=>M(t)).join(" ");{let t=Number(i.match(ye)[0]),n=i.split(ye)[1]||"deg";return`${t}${n}`}}a(M,"formatCssAngle");var H=class extends P{static{a(this,"FilterVStyle")}blur(e){return this.appendFunction("blur",[{v:e,f:w}])}brightness(e){return this.appendFunction("brightness",[{v:e,f:Pe}])}contrast(e){return this.appendFunction("contrast",[{v:e,f:w}])}dropShadow(e,t,n,s){return this.appendFunction("drop-shadow",[{v:e,f:w},{v:t,f:w},{v:n,f:w},{v:s,f:Ue}])}grayscale(e){return this.appendFunction("grayscale",[{v:e,f:w}])}hueRotate(e){return this.appendFunction("hue-rotate",[{v:e,f:w}])}invert(e){return this.appendFunction("invert",[{v:e,f:w}])}opacity(e){return this.appendFunction("opacity",[{v:e,f:w}])}sepia(e){return this.appendFunction("sepia",[{v:e,f:w}])}saturate(e){return this.appendFunction("saturate",[{v:e,f:w}])}};var q=class extends P{static{a(this,"TransformVStyle")}matrix3d(e,t,n,s,r,o,d,h,c,p,b,C,g,y,N,G){return this.appendFunction("matrix3d",arguments)}matrix(e,t,n,s,r,o){return this.appendFunction("matrix",arguments)}translate(e,t){return arguments.length==1?this.appendFunction("translate",[{f:w,v:e}]):this.appendFunction("translate",[{f:w,v:e},{f:w,v:t}])}translate3d(e,t,n){return this.appendFunction("translate3d",[{f:w,v:e},{f:w,v:t},{f:w,v:n}])}translateX(e){return this.appendFunction("translateX",[{f:w,v:e}])}translateY(e){return this.appendFunction("translateY",[{f:w,v:e}])}translateZ(e){return this.appendFunction("translateZ",[{f:w,v:e}])}scale(e,t){return this.appendFunction("scale",[e,t??1])}scale3d(e,t,n){return this.appendFunction("scale3d",[e,t,n])}scaleX(e){return this.appendFunction("scaleX",[e])}scaleY(e){return this.appendFunction("scaleY",[e])}scaleZ(e){return this.appendFunction("scaleZ",[e])}rotate(e){return this.appendFunction("rotate",[{f:M,v:e}])}rotate3d(e,t,n,s){return this.appendFunction("rotate3d",[e,t,n,{f:M,v:s}])}rotate3dDeg(e,t,n,s){return this.rotate3d(e,t,n,s)}rotate3dRad(e,t,n,s){return this.rotate3d(e,t,n,`${s}rad`)}rotate3dGrad(e,t,n,s){return this.rotate3d(e,t,n,`${s}grad`)}rotate3dTurn(e,t,n,s){return this.rotate3d(e,t,n,`${s}turn`)}rotateX(e){return this.appendFunction("rotateX",[{f:M,v:e}])}rotateY(e){return this.appendFunction("rotateY",[{f:M,v:e}])}rotateZ(e){return this.appendFunction("rotateZ",[{f:M,v:e}])}skew(e,t){return arguments.length==1?this.appendFunction("skew",[{f:M,v:e}]):this.appendFunction("skew",[{f:M,v:e},{f:M,v:t}])}skewX(e){return this.appendFunction("skewX",[{f:M,v:e}])}skewY(e){return this.appendFunction("skewY",[{f:M,v:e}])}perspective(e){return this.appendFunction("perspective",[{f:w,v:e}])}};var V=class i{static{a(this,"BaseVStyle")}_vtype="base-v-style";_isBase=!1;props=[];onUpdate;setProp(e,t){return this._isBase?new i().setProp(e,t):(this.props.push({prop:e,value:t}),this.onUpdate&&this.onUpdate(),this)}_setOnUpdate(e){this.onUpdate=e}variable(e,t){return e.startsWith("--")||(e="--"+e),this.setProp(e,t)}v(e){return e.startsWith("--")||(e="--"+e),`var(${e})`}getProps(){return this.props}};for(let i in de)V.prototype[i]=function(e){return this.setProp(i,e)};var O=class extends Y{static{a(this,"StyleVNode")}target;document;shadowRoot;styleSource;_vtype="style-v-node";styleElement;observables=[];observableIds=[];isQueued=!1;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.applyStyles()},"update")};constructor(e){super(),this.styleSource=e,(this.styleSource instanceof V||l(this.styleSource,"base-v-style"))&&this.styleSource._setOnUpdate(()=>this.update()),this.extractObservables()}extractObservables(){let e=this.styleSource instanceof V||l(this.styleSource,"base-v-style")?this.styleSource.getProps():this.styleSource;if(Array.isArray(e))for(let t=0;t<e.length;t++){let n=e[t];this.processValue(n.prop,n.value,s=>n.value=s)}else for(let t in e)this.processValue(t,e[t],n=>e[t]=n)}processValue(e,t,n){if(!this.tryExtractObservable(t)&&typeof t=="object"&&t!==null&&!(t instanceof P)){let s;switch(e){case"filter":{s=new H(e);break}case"transform":{s=new q(e);break}}if(s){let r=Array.isArray(t)?t:[t];for(let o of r)for(let d in o){let h=o[d];if(this.tryExtractObservable(h),Array.isArray(h))for(let p of h)this.tryExtractObservable(p);let c=d.replace(/_\d+$/,"");typeof s[c]=="function"&&(Array.isArray(h)?s[c](...h):s[c](h))}n(s)}}}tryExtractObservable(e){if(e instanceof u||l(e,"binding")||e instanceof m||l(e,"signal")){if(this.observables.indexOf(e)===-1&&(this.observables.push(e),this.target)){let t=e.subscribe(()=>this.update());this.observableIds.push(t)}return!0}return!1}render(e,t=window.document,n){this.target=e,this.document=t,this.shadowRoot=n;for(let s of this.observables){let r=s.subscribe(()=>this.update());this.observableIds.push(r)}typeof e=="string"&&(this.styleElement=this.document.createElement("style"),this.shadowRoot?this.shadowRoot.appendChild(this.styleElement):this.document.head.appendChild(this.styleElement)),this.applyStyles()}update(){this.isQueued||(this.isQueued=!0,I.enqueue(this.updateSubscription,S.Normal))}applyStyles(){if(this.target)if(typeof this.target=="string")this.styleElement&&(this.styleElement.textContent=`${this.target} { ${this.getStyleString()} }`);else{this.extractObservables();let e=this.styleSource instanceof V||l(this.styleSource,"base-v-style")?this.styleSource.getProps():this.styleSource;if(Array.isArray(e))for(let t of e){let n=t.value instanceof u||l(t.value,"binding")?t.value._get():t.value instanceof m||l(t.value,"signal")?t.value.value:t.value;this.applySingleStyle(t.prop,n)}else for(let t in e){let n=e[t]instanceof u||l(e[t],"binding")?e[t]._get():e[t]instanceof m||l(e[t],"signal")?e[t].value:e[t];this.applySingleStyle(t,n)}}}applySingleStyle(e,t){let n;if(t instanceof P)n=t.toString();else if(typeof t=="object"&&t!==null&&(e==="transform"||e==="filter")){let d=e==="transform"?new q(e):new H(e);this.applyObjectToBuilder(d,t),n=d.toString()}else n=t;let s=e,r,o=de[e];o&&(s=o.cssName,r=o.unit,(o.type==="length"||o.type==="hybrid")&&typeof n=="number"?o.type==="hybrid"&&r===void 0||(n=w(n,r)):o.unit&&typeof n=="number"&&(n=`${n}${o.unit}`)),this.target instanceof HTMLElement&&this.target.style.setProperty(s,`${n}`)}getStyleString(){let e="",t=this.styleSource instanceof V||l(this.styleSource,"base-v-style")?this.styleSource.getProps():this.styleSource;if(Array.isArray(t))for(let n of t)e+=this.formatSingleStyle(n.prop,n.value);else for(let n in t)e+=this.formatSingleStyle(n,t[n]);return e}applyObjectToBuilder(e,t){let n=Array.isArray(t)?t:[t];for(let s of n)for(let r in s){let o=s[r],d=r.replace(/_\d+$/,"");typeof e[d]=="function"&&(Array.isArray(o)?e[d](...o):e[d](o))}}formatSingleStyle(e,t){let n=t instanceof u||l(t,"binding")?t._get():t instanceof m||l(t,"signal")?t.value:t;if(n instanceof P)n=n.toString();else if(typeof n=="object"&&n!==null&&(e==="transform"||e==="filter")){let d=e==="transform"?new q(e):new H(e);this.applyObjectToBuilder(d,n),n=d.toString()}let s=e,r,o=de[e];return o&&(s=o.cssName,r=o.unit,(o.type==="length"||o.type==="hybrid")&&typeof n=="number"?o.type==="hybrid"&&r===void 0||(n=w(n,r)):o.unit&&typeof n=="number"&&(n=`${n}${o.unit}`)),`${s}: ${n}; `}unrender(){for(let e=0;e<this.observableIds.length;e++){let t=this.observableIds[e],n=this.observables[e];n instanceof u||l(n,"binding")?n._unsubscribe(t):n.unsubscribe(t)}this.observableIds=[],this.observables=[],this.styleElement&&(this.styleElement.remove(),this.styleElement=null),this.target=null,this.updateSubscription.active=!1}toString(){return typeof this.target=="string"?`${this.target} { ${this.getStyleString()} }`:this.getStyleString()}};var we=class{static{a(this,"SyntheticEvent")}nativeEvent;target;currentTarget;type;timeStamp;defaultPrevented;detail;_propagationStopped=!1;_immediatePropagationStopped=!1;constructor(e){this.nativeEvent=e,this.target=e.target,this.currentTarget=e.currentTarget,this.type=e.type,this.timeStamp=e.timeStamp,this.defaultPrevented=e.defaultPrevented,this.detail=e.detail}preventDefault(){this.defaultPrevented=!0,this.nativeEvent.preventDefault()}stopPropagation(){this._propagationStopped=!0,this.nativeEvent.stopPropagation()}stopImmediatePropagation(){this._immediatePropagationStopped=!0,this._propagationStopped=!0,this.nativeEvent.stopImmediatePropagation()}isPropagationStopped(){return this._propagationStopped}isImmediatePropagationStopped(){return this._immediatePropagationStopped}};var J=class i{static{a(this,"EventManager")}static managers=new Map;static getForDocument(e){let t=this.managers.get(e);return t||(t=new i(e),this.managers.set(e,t)),t}document;listeners=new WeakMap;activeEventTypes=new Set;constructor(e){this.document=e}addListener(e,t,n,s=[]){let r=this.listeners.get(e);r||(r=new Map,this.listeners.set(e,r));let o=r.get(t);o||(o=[],r.set(t,o)),o.push({handler:n,modifiers:s}),this.ensureGlobalListener(t)}removeListener(e,t,n){let s=this.listeners.get(e);if(!s)return;let r=s.get(t);if(!r)return;let o=r.findIndex(d=>d.handler===n);o!==-1&&r.splice(o,1),r.length===0&&s.delete(t)}ensureGlobalListener(e){if(this.activeEventTypes.has(e))return;let t=e==="focus"||e==="blur";this.document.addEventListener(e,n=>{this.dispatchEvent(e,n)},t),this.activeEventTypes.add(e)}dispatchEvent(e,t){let n=t.composedPath();if(!n||n.length===0){n=[];let r=t.target;for(;r;)n.push(r),r=r.parentNode||r.host}let s=new we(t);for(let r of n){if(r===this.document||r===window)continue;let o=this.listeners.get(r);if(!o)continue;let d=o.get(e);if(d){s.currentTarget=r;for(let{handler:h,modifiers:c}of[...d])if(!(c.includes("self")&&t.target!==r)&&(c.includes("stop")&&s.stopPropagation(),c.includes("prevent")&&s.preventDefault(),h(s),c.includes("once")&&this.removeListener(r,e,h),s.isImmediatePropagationStopped()))break;if(s.isPropagationStopped())break}}}};var x=class extends f{static{a(this,"ElementVdom")}_children=null;_vtype="element";get children(){return this._children||(this._children=new v(this._dot),this._children._parent=this),this._children}set children(e){this._children=e}element;tag=null;attributes={};events=[];attributeObserverIds=[];childBuilders=[];attrVNodes=[];styleVNodes=[];ref;inputListener;compositionStartListener;compositionEndListener;manualInputAllowed=!0;isComposing=!1;activeBindings={};lastSyncedValues={};constructor(e,t){super(e),this.tag=t}_render(e){this._isRendered=!0;let t="http://www.w3.org/2000/svg",n="http://www.w3.org/1998/Math/MathML",s=e.namespaceURI;this.tag==="svg"?s=t:this.tag==="math"&&(s=n),s&&s!=="http://www.w3.org/1999/xhtml"?this.element=e.ownerDocument.createElementNS(s,this.tag):this.element=e.ownerDocument.createElement(this.tag),this.element[W]=this,this.ref&&(typeof this.ref=="function"?this.ref(this.element):this.ref.value=this.element),e.appendChild(this.element),this._children&&this._children._render(this.element);for(let r=0;r<this.events.length;r++){let o=this.events[r];this.renderEvent(o.name,o.callback,o.modifiers)}this.attributes.type!==void 0&&this.renderAttr("type",this.attributes.type,this.element);for(let r in this.attributes)r!=="type"&&this.renderAttr(r,this.attributes[r],this.element);this._onEnterHook&&this._onEnterHook(this.element)}_unrender(){if(!this._isRendered||(this._isRendered=!1,this._children&&this._children._unrender(),!this.element))return;let e=J.getForDocument(this.element.ownerDocument);this.inputListener&&(e.removeListener(this.element,"input",this.inputListener),this.inputListener=null),this.compositionStartListener&&(e.removeListener(this.element,"compositionstart",this.compositionStartListener),this.compositionStartListener=null),this.compositionEndListener&&(e.removeListener(this.element,"compositionend",this.compositionEndListener),this.compositionEndListener=null);for(let t=0;t<this.events.length;t++){let n=this.events[t];e.removeListener(this.element,n.name.toLowerCase(),n.callback)}this.element.parentNode?.removeChild(this.element);for(let t=0;t<this.childBuilders.length;t++)this.childBuilders[t]._unrender();this.childBuilders.length=0;for(let t=0;t<this.attrVNodes.length;t++)this.attrVNodes[t].unrender();this.attrVNodes.length=0;for(let t=0;t<this.styleVNodes.length;t++)this.styleVNodes[t].unrender();this.styleVNodes.length=0;for(let t=0;t<this.attributeObserverIds.length;t++){let n=this.attributeObserverIds[t];n.observable._unsubscribe(n.id)}this.attributeObserverIds.length=0,this.ref&&(typeof this.ref=="function"?this.ref(null):this.ref.value=null),this.element=null}_getNodes(){return this.element?[this.element]:[]}_getLastChild(){return this}toString(){return this.element?this.element.outerHTML:super.toString()}setAttr(e,t){e=(e??"").toLowerCase();let n=e;if(e=="bind"){let r=this.attributes.type;r instanceof u||l(r,"binding")?r=r._get():(r instanceof m||l(r,"signal"))&&(r=r.value);let o=typeof r=="string"?r.toLowerCase():null;n=this.tag.toLowerCase()=="input"&&(o=="checkbox"||o=="radio")?"checked":"value"}let s=this.attributes[e];if(s instanceof O||l(s,"style-v-node")){s.unrender();let r=this.styleVNodes.indexOf(s);r!==-1&&this.styleVNodes.splice(r,1)}if(s instanceof le||l(s,"attribute-v-node")){s.unrender();let r=this.attrVNodes.indexOf(s);r!==-1&&this.attrVNodes.splice(r,1)}for(let r=0;r<this.attributeObserverIds.length;r++){let o=this.attributeObserverIds[r];if(o.attr===e||o.attr===n){o.observable._unsubscribe(o.id),this.attributeObserverIds.splice(r,1);break}}if(t&&typeof t=="object"&&!(t instanceof Array||t instanceof u||l(t,"binding")||t?._isBinding||t instanceof m||l(t,"signal")||t?._isSignal||t instanceof V||l(t,"base-v-style")))switch(e){case"style":{t=new O(t);break}case"ref":break;default:{t=new le(e,t);break}}if(typeof t=="function"&&e==="style"){let r=new V;t(r),t=new O(r)}(t instanceof V||l(t,"base-v-style"))&&e==="style"&&(t=new O(t)),this.attributes[e]=t,this.element&&this.renderAttr(e,t,this.element)}updateReactiveAttr(e,t){this.element&&this.renderAttr((e??"").toLowerCase(),t,this.element)}renderAttr(e,t,n,s=!1){if(e=="bind"){let r=this.attributes.type;r instanceof u||l(r,"binding")?r=r._get():(r instanceof m||l(r,"signal"))&&(r=r.value);let o=typeof r=="string"?r.toLowerCase():null;e=this.tag.toLowerCase()=="input"&&(o=="checkbox"||o=="radio")?"checked":"value",s=!0}if(e=="ref")this.ref=t,this.element&&(typeof this.ref=="function"?this.ref(this.element):this.ref.value=this.element);else if(typeof t=="string"||typeof t=="number")e=="value"&&(this.tag.toLowerCase()=="input"||this.tag.toLowerCase()=="textarea"||this.tag.toLowerCase()=="select")?(n.value=t??"",this.lastSyncedValues[e]=t??""):n.setAttribute(e,`${t}`);else if(typeof t=="boolean"||t==null||t==null)e=="checked"&&this.tag.toLowerCase()=="input"?(n.checked=!!t,this.lastSyncedValues[e]=!!t):e=="selected"&&this.tag.toLowerCase()=="option"?n.selected=!!t:e=="value"&&(this.tag.toLowerCase()=="input"||this.tag.toLowerCase()=="textarea"||this.tag.toLowerCase()=="select")&&(n.value=t??"",this.lastSyncedValues[e]=t??""),t?n.setAttribute(e,`${t}`):n.removeAttribute(e);else if(t instanceof Array)n.setAttribute(e,t.join(" "));else if(t instanceof u||l(t,"binding")||t?._isBinding){if(this.renderAttr(e,t._get(),n,s),!this.attributeObserverIds.some(r=>r.attr===e&&r.observable===t)){let r=t._subscribe(new ae(this,e));this.attributeObserverIds.push({id:r,observable:t,attr:e})}if((e=="value"||e=="checked")&&t.isWritable&&s&&(this.activeBindings[e]=t,!this.inputListener)){this.inputListener=o=>{if(!this.isComposing)try{let d=o.target.type==="checkbox"||o.target.type==="radio"?"checked":"value",h=this.activeBindings[d];if(!h)return;let c=this.element[d],p=h._get(),b=this.lastSyncedValues[d];p==b&&c!=b&&h._set(c),this.lastSyncedValues[d]=h._get()}catch(d){console.error("CAUGHT ERROR: "+d.message)}},this.compositionStartListener=()=>{this.isComposing=!0},this.compositionEndListener=o=>{this.isComposing=!1,this.inputListener(o)};let r=J.getForDocument(this.element.ownerDocument);r.addListener(this.element,"input",this.inputListener),r.addListener(this.element,"compositionstart",this.compositionStartListener),r.addListener(this.element,"compositionend",this.compositionEndListener)}}else t instanceof le||l(t,"attribute-v-node")?(t.render(n),this.attrVNodes.push(t)):(t instanceof O||l(t,"style-v-node"))&&(t.render(n),this.styleVNodes.push(t))}addEventListener(e,t,n=[]){this.events.some(s=>s.name===e&&s.callback===t)||(this.events.push({name:e,callback:t,modifiers:n}),this.element&&this.renderEvent(e,t,n))}renderEvent(e,t,n=[]){J.getForDocument(this.element.ownerDocument).addListener(this.element,e.toLowerCase(),t,n)}};var v=class extends f{static{a(this,"ContainerVdom")}_children=[];_parent=null;element=null;_vtype="container";constructor(e){super(e)}_addChild(e){return this._children.push(e),this.element?e._render(this.element):this._parent&&(this._parent instanceof x||l(this._parent,"element"))&&this._parent.element&&e._render(this._parent.element),this}_prependChild(e){return this._children.unshift(e),this.element?this.element.firstChild?e._renderBefore(this.element.firstChild):e._render(this.element):this._parent&&(this._parent instanceof x||l(this._parent,"element"))&&this._parent.element&&(this._parent.element.firstChild?e._renderBefore(this._parent.element.firstChild):e._render(this._parent.element)),this}_render(e){this._isRendered=!0,this.element=e;for(let t=0;t<this._children.length;t++)this._children[t]._render(e)}_unrender(){if(this._isRendered){this._isRendered=!1,this.element=null;for(let e=0;e<this._children.length;e++)this._children[e]._unrender()}}_getNodes(){let e=[];for(let t=0;t<this._children.length;t++)e.push(...this._children[t]._getNodes());return e}_getLastChild(){return this._children[this._children.length-1]||null}};var Ye={onAbort:1,onBlur:1,onChange:1,onInput:1,onCanPlay:1,onCantPlayThrough:1,onClick:1,onCopy:1,onContextMenu:1,onCueChange:1,onCut:1,onDblClick:1,onDrag:1,onDragEnd:1,onDragEnter:1,onDragLeave:1,onDragOver:1,onDragStart:1,onDrop:1,onDurationChange:1,onEmptied:1,onEnded:1,onError:1,onFocus:1,onHashChange:1,onInvalid:1,onKeyDown:1,onKeyPress:1,onKeyUp:1,onLoad:1,onLoadedData:1,onLoadedMetadata:1,onLoadStart:1,onMouseDown:1,onMouseEnter:1,onMouseLeave:1,onMouseMove:1,onMouseOut:1,onMouseOver:1,onMouseUp:1,onPointerCancel:1,onPointerDown:1,onPointerEnter:1,onPointerLeave:1,onPointerMove:1,onPointerOut:1,onPointerOver:1,onPointerUp:1,onTouchStart:1,onTouchEnd:1,onTouchCancel:1,onTouchMove:1,onMouseWheel:1,onOffline:1,onOnline:1,onPageHide:1,onPagePaste:1,onPageShow:1,onPause:1,onPlay:1,onPlaying:1,onPopState:1,onProgress:1,onRateChange:1,onReset:1,onResize:1,onScroll:1,onSearch:1,onSeeked:1,onSeeking:1,onSelect:1,onStalled:1,onStorage:1,onSubmit:1,onSuspend:1,onTimeUpdate:1,onToggle:1,onUnload:1,onVolumeChange:1,onWaiting:1,onWheel:1};var De=a(i=>i instanceof v||l(i,"container")||i instanceof f||l(i,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])||i?._root||l(i,"dotchain")||i?._children||typeof i=="object"&&i?.build||i instanceof m||l(i,"signal")||i?._isSignal||i instanceof u||l(i,"binding")||i?._isBinding||typeof i=="string"||typeof i=="number"||typeof i=="boolean"||Array.isArray(i),"isContent"),$=a((i,e,t)=>{let n=e instanceof x||l(e,"element")?e.children:e;if(Array.isArray(t))for(let s=0;s<t.length;s++)$(i,e,t[s]);else if(t?._root||l(t,"dotchain"))$(i,e,t._root);else if(Array.isArray(t?._children)){let s=t._children;if(s&&s.length>0)for(let r=0;r<s.length;r++)n._addChild(s[r])}else if(t instanceof f||l(t,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"]))n._addChild(t);else if(typeof t=="object"&&t?.build)n.mount(t);else if(t!=null){let s=t;(s instanceof m||l(s,"signal")||s?._isSignal)&&(s=s.bind()),s instanceof u||l(s,"binding")||s?._isBinding?n._addChild(new ge(i,s)):n._addChild(new T(s))}},"applyContent"),Ct=a((i,e)=>{for(let t in e){let n=e[t];if((n instanceof m||l(n,"signal")||n?._isSignal)&&!n?._isRef&&(n=n.bind()),t==="html"||t==="innerHtml"){i.children.mount(n);continue}let s=t,r=[];if(t.includes(".")){let d=t.split(".");s=d[0],r=d.slice(1)}if(Ye[s]||s.startsWith("on")&&s[2]&&s[2]===s[2].toUpperCase()){if(typeof e[t]!="function")throw new Error(`Value of event attribute ${t} must be a function.`);i.addEventListener(s.substring(2).toLowerCase(),n,r)}else i.setAttr(t,n)}},"applyAttributes"),Me=a((i,e,t)=>{let n=new x(i,e);for(let s=0;s<t.length;s++){let r=t[s];De(r)?$(i,n,r):r&&typeof r=="object"&&Ct(n,r)}return n},"createElement");var E=class extends m{static{a(this,"Computed")}getter;_vtype="computed";dependencies=new Map;isQueued=!1;isEvaluating=!1;active=!0;dirty=!0;error=null;get isWritable(){return!1}updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.dirty&&this._update()},"update")};constructor(e){return super(),this.getter=e,this._update(),this._proxy()}get value(){if(this.isEvaluating)throw new Error("Circular dependency detected in computed signal.");if(this.dirty&&this._update(),this.error)throw this.error;return super.value}addDependency(e){this.active&&(this.newDependencies.has(e)||this.newDependencies.add(e))}requestUpdate(){this.active&&(this.dirty=!0,this.isQueued||(this.isQueued=!0,I.enqueue(this.updateSubscription,S.Normal)))}newDependencies=new Set;_update(){if(!this.active)return;if(this.isEvaluating)throw new Error("Circular dependency detected in computed signal.");this.isEvaluating=!0,this.dirty=!1,this.error=null,this.newDependencies.clear(),Z.push(this);let e,t=!1;try{e=this.getter()}catch(s){this.error=s,t=!0}finally{Z.pop(),this.isEvaluating=!1}t||this.setValue(e);let n=[];for(let[s,r]of this.dependencies)this.newDependencies.has(s)||(s.unsubscribe(r),n.push(s));for(let s of n)this.dependencies.delete(s);for(let s of this.newDependencies)if(!this.dependencies.has(s)){let r=s.subscribe(()=>this.requestUpdate(),!0);this.dependencies.set(s,r)}}dispose(){this.active=!1;for(let[e,t]of this.dependencies)e.unsubscribe(t);this.dependencies.clear()}};var Ae=[],F=a(()=>Ae[Ae.length-1]||null,"getCurrentComponent"),k=a(i=>Ae.push(i),"pushComponent"),L=a(()=>Ae.pop(),"popComponent");var ve=class{static{a(this,"KeyframesBuilder")}sheet;steps=[];constructor(e){this.sheet=e}step(e,t){let n=new V;return t(n),this.steps.push({selector:e,style:n}),this}from(e){return this.step("from",e)}to(e){return this.step("to",e)}at(e,t){let n=typeof e=="number"?`${e}%`:e;return this.step(n,t)}toString(e=""){return this.steps.map(t=>`${e}${t.selector} { ${this.sheet.formatPropsForBlock(t.style)} }`).join(`
|
|
2
|
+
`)}};var Se=class i{static{a(this,"StyleSheetBuilder")}rules=[];theme=null;ghostVars=[];varCounter=0;getGhostVars(){return this.ghostVars}setTheme(e){return this.theme=e,this}clearRules(){this.rules=[],this.ghostVars=[],this.varCounter=0}template(e,...t){return new E(()=>{let n="";for(let s=0;s<e.length;s++)if(n+=e[s],s<t.length){let r=t[s];r instanceof m||r instanceof u?n+=r instanceof u?r._get():r.value:n+=r}return n})}class(e,t){return this.rule(`.${e}`,t)}rule(e,t){let n=new V;return t(n),this.rules.push({type:"rule",selector:e,style:n}),this}selector(e,t){return this.rule(e,t)}media(e,t){let n=new i;return t(n),this.rules.push({type:"media",condition:e,builder:n}),this}container(e,t){let n=new i;return t(n),this.rules.push({type:"container",condition:e,builder:n}),this}supports(e,t){let n=new i;return t(n),this.rules.push({type:"supports",condition:e,builder:n}),this}keyframes(e,t){let n=new ve(this);return t(n),this.rules.push({type:"keyframes",name:e,builder:n}),this}v(e){return e.startsWith("--")||(e="--"+e),`var(${e})`}applyObjectToBuilder(e,t){let n=Array.isArray(t)?t:[t];for(let s of n)for(let r in s){let o=s[r],d=r.replace(/_\d+$/,"");typeof e[d]=="function"&&(Array.isArray(o)?e[d](...o):e[d](o))}}formatPropsForBlock(e){return e.getProps().map(t=>{let n=de[t.prop],s=t.prop,r=t.value;if(typeof r=="object"&&r!==null&&!(r instanceof P)&&!(r instanceof m)&&!(r instanceof u)){let o;switch(t.prop){case"filter":{o=new H(t.prop);break}case"transform":{o=new q(t.prop);break}}o&&(this.applyObjectToBuilder(o,r),r=o)}if(r instanceof m||r instanceof u||r instanceof P){let o=r instanceof m||r instanceof u;if(r instanceof P)for(let d of r.funcs){for(let h of d.args)if(h.v instanceof m||h.v instanceof u||h instanceof m||h instanceof u){o=!0;break}if(o)break}if(o){let d;t.prop.startsWith("--")?d=t.prop:d=`--dh-v${++this.varCounter}`;let h=r,c=r;(t.prop==="transform"||t.prop==="filter")&&!(h instanceof P)?c=new E(()=>{let p=h instanceof u?h._get():h.value;if(typeof p=="object"&&p!==null){let b=t.prop==="transform"?new q(t.prop):new H(t.prop);return this.applyObjectToBuilder(b,p),b.toString()}return p}):n&&n.unit&&!(h instanceof P)?c=new E(()=>{let p=h instanceof u?h._get():h.value;return typeof p=="number"?`${p}${n.unit}`:p}):n&&(n.type==="length"||n.type==="hybrid")&&!(h instanceof P)?c=new E(()=>{let p=h instanceof u?h._get():h.value;return typeof p=="number"?w(p,n.unit):p}):h instanceof P&&(c=new E(()=>h.toString())),this.ghostVars.push({name:d,value:c}),r=`var(${d})`}}return n&&(s=n.cssName,(n.type==="length"||n.type==="hybrid")&&typeof t.value=="number"?n.type==="hybrid"&&n.unit===void 0||(r=w(t.value,n.unit)):n.unit&&typeof t.value=="number"&&(r=`${t.value}${n.unit}`)),`${s}: ${r};`}).join(" ")}toString(e=""){return this.rules.map(t=>{if(t.type==="media")return`${e}@media ${t.condition} {
|
|
3
3
|
${t.builder.toString(e+" ")}
|
|
4
4
|
${e}}`;if(t.type==="container")return`${e}@container ${t.condition} {
|
|
5
5
|
${t.builder.toString(e+" ")}
|
|
@@ -8,7 +8,7 @@ ${t.builder.toString(e+" ")}
|
|
|
8
8
|
${e}}`;if(t.type==="keyframes")return`${e}@keyframes ${t.name} {
|
|
9
9
|
${t.builder.toString(e+" ")}
|
|
10
10
|
${e}}`;let n=this.formatPropsForBlock(t.style);return`${e}${t.selector} { ${n} }`}).join(`
|
|
11
|
-
`)}hasRules(){return this.rules.length>0}dispose(){for(let e of this.ghostVars)e.value instanceof E?e.value.dispose():e.value instanceof u&&e.value._source instanceof E&&e.value._source.dispose();for(let e of this.rules)(e.type==="media"||e.type==="container"||e.type==="supports")&&e.builder.dispose()}};var
|
|
11
|
+
`)}hasRules(){return this.rules.length>0}dispose(){for(let e of this.ghostVars)e.value instanceof E?e.value.dispose():e.value instanceof u&&e.value._source instanceof E&&e.value._source.dispose();for(let e of this.rules)(e.type==="media"||e.type==="container"||e.type==="supports")&&e.builder.dispose()}};var xe=new Map;function Qe(i,e){xe.has(i)||xe.set(i,new Set),xe.get(i).add(e)}a(Qe,"registerInstance");function ze(i,e){xe.get(i)?.delete(e)}a(ze,"unregisterInstance");function Ge(i){return xe.get(i)||new Set}a(Ge,"getInstances");var B=class i extends Error{static{a(this,"HandledError")}_vtype="handled-error";constructor(){super("Error handled by error boundary."),Object.setPrototypeOf(this,i.prototype)}},Et=65536;function Nt(i){return`dothtml-${i.toLowerCase().replace(/[^a-z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}`}a(Nt,"getStableTagName");var j=class extends f{static{a(this,"ComponentVdom")}component;shadowEl;childShadowVdom;_vtype="component";events=[];styleVNodes=[];isQueued=!1;isBuilding=!1;computedSignals=[];buildComputedSignals=[];effects=[];buildEffects=[];disposables=[];buildDisposables=[];ref;slots={};parentComponent=null;lastError=null;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.rebuild()},"update")};constructor(e,t){if(super(e),this.component=t,this.parentComponent=F(),this.childShadowVdom=new v(e),t._?._meta?.isRendered)throw new Error("Component has already been added to the VDOM.");if(!t.constructor._dotHtmlComponent){t.constructor._dotHtmlComponent={};let n=t.constructor.__hmrId;if(U&&n)t.constructor._dotHtmlComponent.tagName=Nt(n);else{let s=Math.floor(performance.now()*1e13).toString(16),r=(Et++).toString(16);t.constructor._dotHtmlComponent.tagName=`dothtml-${r}${e._addTimestamp?`-${s}`:""}`}}if(t._||(t._={}),t._.cvdom=this,t._.refs={},t._._meta=t._._meta||{},t._._meta.isRendered=!1,t._._meta.tagName=t.constructor._dotHtmlComponent.tagName,t.emit=(n,s)=>{this.shadowEl&&this.shadowEl.dispatchEvent(new CustomEvent(n.toLowerCase(),{detail:s,bubbles:!0,composed:!0}))},t._trackedComputeds){for(let n of t._trackedComputeds)this.registerComputed(n);delete t._trackedComputeds}if(t._trackedEffects){for(let n of t._trackedEffects)this.registerEffect(n);delete t._trackedEffects}if(t._trackedDisposables){for(let n of t._trackedDisposables)this.registerDisposable(n);delete t._trackedDisposables}if(U){let n=t.constructor.__hmrId;n&&Qe(n,this)}}registerComputed(e){this.isBuilding?this.buildComputedSignals.push(e):this.computedSignals.push(e)}registerEffect(e){this.isBuilding?this.buildEffects.push(e):this.effects.push(e)}registerDisposable(e){this.isBuilding?this.buildDisposables.push(e):this.disposables.push(e)}setRef(e){this.ref=e}addSlot(e,t){let n;if(typeof t=="function"?this.slots[e]=t:((!this.slots[e]||typeof this.slots[e]=="function")&&(this.slots[e]=new v(this._dot)),n=this.slots[e],$(this._dot,n,t)),this.shadowEl){if(typeof t!="function"&&(n._render(this.shadowEl),e!=="default")){let s=n._getNodes();for(let r of s)r&&r.setAttribute&&r.setAttribute("slot",e)}this.rebuild()}}_hmrSwap(e){let t=this.component;k(this);try{t.unmounting&&t.unmounting()}finally{L()}let n=new e;for(let s in t){if(s==="_"||s==="constructor")continue;let r=t[s],o=n[s];(r instanceof m||l(r,"signal"))&&!(r instanceof E||l(r,"computed"))?(o instanceof m||l(o,"signal"))&&!(o instanceof E||l(o,"computed"))?o.value=r.value:n[s]=r:r instanceof E||l(r,"computed")||(n[s]=r)}this.component=n,this.component._=t._,this.component._.cvdom=this,this.shadowEl&&(this.shadowEl.component=this.component);try{this.init(),this.subscribeToProps(),k(this);try{this.component.mounted&&this.component.mounted()}finally{L()}k(this);try{t.unmounted&&t.unmounted()}finally{L()}}catch(s){if(s instanceof B||l(s,"handled-error"))return;this.handleError(s)}}init(){if(this.validateProps(),this.subscribeToProps(),this.shadowEl){this.rebuild();return}k(this),this.isBuilding=!0;try{let e=this.component.build(this._dot);e?._root||l(e,"dotchain")?this.childShadowVdom=e._root:e instanceof f||l(e,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])?this.childShadowVdom=e:(this.childShadowVdom=new v(this._dot),$(this._dot,this.childShadowVdom,e))}finally{this.isBuilding=!1,L()}this.component.built&&this.component.built()}handleError(e){if(e instanceof B||l(e,"handled-error"))throw e;if(this.lastError=e,this.component.errorCaught)try{let t=this.component.errorCaught(e);if(t){if(this.lastError=null,this.childShadowVdom=new v(this._dot),$(this._dot,this.childShadowVdom,t),this.shadowEl){let n=this.shadowEl.shadowRoot;if(n){n.innerHTML="",k(this);try{this.childShadowVdom._render(n)}finally{L()}}}throw new B}}catch(t){if(t instanceof B||l(t,"handled-error"))throw t;e=t}throw this._dot.onError?(this._dot.onError(e),this.lastError=null,new B):this.parentComponent&&this.parentComponent.handleError?(this.parentComponent.handleError(e),this.lastError=null,new B):U?(this.shadowEl&&!e.isPropValidationError&&this.renderErrorBox(e),typeof globalThis.describe=="function"&&(!this.shadowEl||e.isPropValidationError)?e:new B):e}subscribeToProps(){let e=this.component.props;if(e)for(let t in e){let n=e[t];(n instanceof m||l(n,"signal")||n instanceof u||l(n,"binding"))&&n.subscribe(()=>{this.validateProps(),this.requestUpdate()})}}requestUpdate(){this.isQueued||(this.isQueued=!0,I.enqueue(this.updateSubscription,S.Normal))}rebuild(){if(this.shadowEl)try{this.childShadowVdom._unrender();for(let t of this.buildEffects)t.dispose&&t.dispose();this.buildEffects=[];for(let t of this.buildComputedSignals)t.dispose();this.buildComputedSignals=[];for(let t of this.buildDisposables)t();this.buildDisposables=[],this.validateProps(),k(this),this.isBuilding=!0;try{let t=this.component.build(this._dot);t?._root||l(t,"dotchain")?this.childShadowVdom=t._root:t instanceof f||l(t,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])?this.childShadowVdom=t:(this.childShadowVdom=new v(this._dot),$(this._dot,this.childShadowVdom,t))}finally{this.isBuilding=!1,L()}let e=this.component._._meta.shadowRoot||this.shadowEl.shadowRoot;if(e){Array.from(e.childNodes).forEach(t=>{t.nodeName!=="STYLE"&&e.removeChild(t)}),k(this);try{this.childShadowVdom._render(e)}finally{L()}}this.lastError=null,this.component.built&&this.component.built()}catch(e){if(e instanceof B)return;this.handleError(e)}}renderErrorBox(e){let t=document.createElement("div");t.style.cssText=`
|
|
12
12
|
background-color: rgba(255, 0, 0, 0.9);
|
|
13
13
|
color: white;
|
|
14
14
|
padding: 20px;
|
|
@@ -21,6 +21,6 @@ ${e}}`;let n=this.formatPropsForBlock(t.style);return`${e}${t.selector} { ${n} }
|
|
|
21
21
|
position: relative;
|
|
22
22
|
overflow: auto;
|
|
23
23
|
max-height: 90vh;
|
|
24
|
-
`;let n=document.createElement("h2");n.textContent="DOThtml HMR Error",n.style.marginTop="0px",t.appendChild(n);let s=document.createElement("div");if(s.textContent=e.message||e,s.style.cssText="font-weight: bold; font-size: 1.2em; margin-bottom: 10px;",t.appendChild(s),e.stack){let r=document.createElement("pre");r.textContent=e.stack,r.style.cssText="font-size: 0.9em; opacity: 0.8;",t.appendChild(r)}if(this.shadowEl){let r=this.shadowEl.shadowRoot;r&&(r.innerHTML="",r.appendChild(t))}}validateProps(){try{let e=this.component.constructor.props;if(!e)return;let t=this.component.constructor.name,n=this.component.props||{};for(let s in e){let r=e[s],o=n[s];if((o instanceof m||l(o,"signal"))&&(o=o.value),(o instanceof u||l(o,"binding"))&&(o=o._get()),r.required&&o===void 0)throw new Error(`[${t}] Prop "${s}" is required.`);if(o===void 0&&r.default!==void 0&&(o=typeof r.default=="function"?r.default():r.default,n[s]=o),o!==void 0){if(r.type){let d=o===null?"null":Array.isArray(o)?"array":typeof o,h="";if(r.type===String?h="string":r.type===Number?h="number":r.type===Boolean?h="boolean":r.type===Array?h="array":r.type===Object?h="object":r.type===Function&&(h="function"),h&&d!==h&&(o!==null||r.required))throw new Error(`[${t}] Prop "${s}" expected ${h}, but got ${d}.`)}if(r.validator&&!r.validator(o))throw new Error(`[${t}] Prop "${s}" failed custom validation.`)}}}catch(e){throw e.isPropValidationError=!0,e}}setupCustomElement(e){let t=this.component._._meta.tagName;if(e.defaultView.customElements.get(t)){let r=this.component.constructor._cachedStyles;r&&(this.component.constructor._cachedStyles=r);return}let n=this,s=class extends e.defaultView.HTMLElement{static{a(this,"CustomElementConstructor")}_component;_isMounted=!1;constructor(){super(),this.attachShadow({mode:"open"})}set component(o){this._component=o,this._isMounted&&this._renderComponent(o)}get component(){return this._component}connectedCallback(){this._isMounted=!0,this._component&&this._renderComponent(this._component)}_renderComponent(o){let d=this.shadowRoot;if(!d)return;let h=o._.cvdom;if(h)try{let c=new Se;h._dot._theme&&c.setTheme(h._dot._theme);let p=o.constructor.styles;p&&typeof p=="function"&&p(c);let b=o.constructor.hostStyles;b&&typeof b=="function"&&b(c),o.hostStyle&&c.rule(":host",g=>o.hostStyle(g));let x=h._dot.globalStyles||[];for(let g of x)if(typeof g=="string"){let _=e.createElement("style");_.textContent=g.replace(/\b(html|body)\b/g,":host"),d.appendChild(_)}if(o.stylize){let g=o.stylize(c);if(typeof g=="string"){let _=e.createElement("style");_.textContent=g,d.appendChild(_)}else if(g instanceof m||l(g,"signal")||g instanceof u||l(g,"binding")||g instanceof E||l(g,"computed")){let _=e.createElement("style");_.id="--dh-dynamic-style",d.appendChild(_);let N=a(()=>{c.clearRules();let A=o.stylize(c),ne="";if(typeof A=="string")ne=A;else if(A instanceof m||l(A,"signal")||A instanceof u||l(A,"binding")||A instanceof E||l(A,"computed")){let G=A instanceof u||l(A,"binding")?A._get():A.value;typeof G=="string"?ne=G:ne=c.toString()}else ne=c.toString();_.textContent=ne;let qe=c.getGhostVars();qe.length>0&&qe.forEach(G=>{let gt=G.value instanceof u||l(G.value,"binding")?G.value._get():G.value.value;this.style.setProperty(G.name,`${gt}`)}),c.hasRules()&&typeof A!="string"&&(_.textContent+=c.toString())},"update"),z=g.subscribe(N);h.registerDisposable(()=>{g instanceof u||l(g,"binding")?g._unsubscribe(z):g.unsubscribe(z)}),N()}}if(c.hasRules()){let g=e.createElement("style");g.textContent=c.toString(),d.appendChild(g),o.constructor._cachedStyles=c.toString();let _=c.getGhostVars();_.length>0&&_.forEach(N=>{let z=N.value instanceof u||l(N.value,"binding")?N.value._get():N.value.value;if(this.style.setProperty(N.name,`${z}`),N.value instanceof m||l(N.value,"signal")||N.value instanceof u||l(N.value,"binding")){let A=N.value.subscribe(ne=>{this.style.setProperty(N.name,`${ne}`)});h.registerDisposable(()=>{N.value instanceof u||l(N.value,"binding")?N.value._unsubscribe(A):N.value.unsubscribe(A)})}}),h.registerDisposable(()=>c.dispose())}if(h.childShadowVdom._isRendered)return;{o._._meta.shadowRoot=d;let g=c.getGhostVars();g.length>0&&g.forEach(_=>{let N=_.value instanceof u||l(_.value,"binding")?_.value._get():_.value.value;if(this.style.setProperty(_.name,`${N}`),_.value instanceof m||l(_.value,"signal")||_.value instanceof u||l(_.value,"binding")){let z=_.value.subscribe(A=>{this.style.setProperty(_.name,`${A}`)});h.registerDisposable(()=>{_.value instanceof u||l(_.value,"binding")?_.value._unsubscribe(z):_.value.unsubscribe(z)})}}),k(h);try{h.childShadowVdom._render(d)}finally{L()}}}catch(c){try{h.handleError(c)}catch(p){if(p instanceof O)return;throw p}}}};e.defaultView.customElements.define(t,s)}_render(e){try{if(!this.component._)throw new Error("Invalid component. Ensure components are created through the component factory or through decoration.");if(this.component._?._meta?.isRendered)throw new Error("Individual component instances cannot be rendered twice at once.");this.component._._meta||(this.component._._meta={}),this.component._._meta.isRendered=!0;let t=e.ownerDocument;if(this.setupCustomElement(t),this.shadowEl=t.createElement(this.component._._meta.tagName),this.shadowEl.cvdom=this,this.shadowEl.setAttribute("cvdom",""),this.shadowEl.component=this.component,this.init(),this.lastError){U&&this.renderErrorBox(this.lastError),e.appendChild(this.shadowEl);return}k(this);try{this.component.mounting&&this.component.mounting()}finally{L()}e.appendChild(this.shadowEl),this.ref&&(typeof this.ref=="function"?this.ref(this.component):this.ref.value=this.component);for(let n in this.slots){let s=this.slots[n];if(typeof s!="function"&&(s._render(this.shadowEl),n!=="default")){let r=s._getNodes();for(let o of r)o&&o.setAttribute&&o.setAttribute("slot",n)}}for(let n=0;n<this.events.length;n++){let s=this.events[n];this.renderEvent(s.name,s.callback,s.modifiers)}k(this);try{this.component.mounted&&this.component.mounted()}finally{L()}this._onEnterHook&&this._onEnterHook(this.shadowEl),this.component.onEnter&&this.component.onEnter()}catch(t){if(this.shadowEl&&!this.shadowEl.parentElement&&e.appendChild(this.shadowEl),t instanceof O||l(t,"handled-error"))return;this.handleError(t)}}_unrender(){k(this);try{this.component.unmounting&&this.component.unmounting()}finally{L()}this.childShadowVdom._unrender();for(let t in this.slots){let n=this.slots[t];(n instanceof f||l(n,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"]))&&n._unrender()}this.shadowEl&&(this.shadowEl.parentNode?.removeChild(this.shadowEl),delete this.shadowEl.component);for(let t of this.computedSignals)t.dispose();this.computedSignals=[];for(let t of this.buildComputedSignals)t.dispose();this.buildComputedSignals=[];for(let t of this.effects)t.dispose&&t.dispose();this.effects=[];for(let t of this.buildEffects)t.dispose&&t.dispose();this.buildEffects=[];for(let t of this.disposables)t();this.disposables=[];for(let t of this.buildDisposables)t();this.buildDisposables=[],this.ref&&(typeof this.ref=="function"?this.ref(null):this.ref.value=null);let e=this.component.constructor.__hmrId;U&&e&&ze(e,this),this.component._&&(this.component._._meta.isRendered=!1),this.shadowEl=null,this._isRendered=!1,k(this);try{this.component.unmounted&&this.component.unmounted()}finally{L()}}_unrenderAsync(){let e=null;if(this._onLeaveHook&&this.shadowEl){let t=this._onLeaveHook(this.shadowEl);t instanceof Promise&&(e=t)}if(this.component.onLeave){let t=this.component.onLeave();t instanceof Promise&&(e=e?e.then(()=>t):t)}if(e)return e.then(()=>this._unrender());this._unrender()}_getNodes(){return this.shadowEl?[this.shadowEl]:[]}_getLastChild(){return this}addEventListener(e,t,n=[]){this.events.push({name:e,callback:t,modifiers:n}),this.shadowEl&&this.renderEvent(e,t,n)}renderEvent(e,t,n=[]){K.getForDocument(this.shadowEl.ownerDocument).addListener(this.shadowEl,e.toLowerCase(),t,n)}generateStyles(e){return""}};var ge=class extends f{static{a(this,"ReactiveVdom")}binding;beforeNode=null;afterNode=null;currentVdom=null;observerId=0;_isReactiveVdom=!0;_vtype="reactive";constructor(e,t){super(e),this.binding=t}_toVdom(e){if(e==null)return new T("");if(e instanceof f)return e;if(typeof e=="object"&&e.build){let t=new j(this._dot,e);return t.init(),t}if(Array.isArray(e)){let t=new v(this._dot);for(let n of e)t._addChild(this._toVdom(n));return t}return new T(e)}_render(e){this._isRendered=!0,this.beforeNode=e.ownerDocument.createTextNode(""),this.afterNode=e.ownerDocument.createTextNode(""),e.appendChild(this.beforeNode),e.appendChild(this.afterNode);let t=this.binding._get();this.update(t),this.observerId=this.binding._subscribe(this)}update(e){this._isRendered&&(this.currentVdom&&this.currentVdom._unrender(),fe(this.beforeNode,this.afterNode),this.currentVdom=this._toVdom(e),this.currentVdom._renderBefore(this.afterNode))}_unrender(){this._isRendered&&(this._isRendered=!1,this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null),this.observerId&&(this.binding._unsubscribe(this.observerId),this.observerId=0),fe(this.beforeNode,this.afterNode),this.beforeNode.parentElement&&this.beforeNode.parentElement.removeChild(this.beforeNode),this.afterNode.parentElement&&this.afterNode.parentElement.removeChild(this.afterNode),this.beforeNode=null,this.afterNode=null)}_getNodes(){if(!this._isRendered)return[];let e=[this.beforeNode];return this.currentVdom&&e.push(...this.currentVdom._getNodes()),e.push(this.afterNode),e}_getLastChild(){return this}toString(){return this.currentVdom?this.currentVdom.toString():""}};var xe=class{static{a(this,"Effect")}callback;_vtype="effect";cleanup;dependencies=new Map;isQueued=!1;isEvaluating=!1;active=!0;dirty=!0;newDependencies=new Set;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.dirty&&this.run()},"update")};constructor(e){this.callback=e,this.run()}addDependency(e){this.active&&(this.newDependencies.has(e)||this.newDependencies.add(e))}requestUpdate(){this.active&&(this.dirty=!0,this.isQueued||(this.isQueued=!0,I.enqueue(this.updateSubscription,S.Normal)))}run(){if(!this.active)return;if(this.isEvaluating)throw new Error("Circular dependency detected in effect.");if(this.cleanup){try{this.cleanup()}catch(t){console.error("Error during effect cleanup:",t)}this.cleanup=void 0}this.isEvaluating=!0,this.dirty=!1,this.newDependencies.clear(),X.push(this);try{let t=this.callback();typeof t=="function"&&(this.cleanup=t)}catch(t){console.error("Error during effect execution:",t)}finally{X.pop(),this.isEvaluating=!1}let e=[];for(let[t,n]of this.dependencies)this.newDependencies.has(t)||(t.unsubscribe(n),e.push(t));for(let t of e)this.dependencies.delete(t);for(let t of this.newDependencies)if(!this.dependencies.has(t)){let n=t.subscribe(()=>this.requestUpdate(),!0);this.dependencies.set(t,n)}}dispose(){if(this.active){if(this.active=!1,this.cleanup){try{this.cleanup()}catch(e){console.error("Error during effect disposal cleanup:",e)}this.cleanup=void 0}for(let[e,t]of this.dependencies)e.unsubscribe(t);this.dependencies.clear()}}};function Xe(i){let e=class extends i{static{a(this,"decorated")}constructor(...t){let n={computedSignals:[],effects:[],disposables:[],registerComputed(s){this.computedSignals.push(s)},registerEffect(s){this.effects.push(s)},registerDisposable(s){this.disposables.push(s)}};k(n);try{super(...t)}finally{L()}t[0]&&typeof t[0]=="object"&&!t[0].build&&i.props&&(this.props||(this.props={}),Object.assign(this.props,t[0])),this._trackedComputeds=n.computedSignals,this._trackedEffects=n.effects,this._trackedDisposables=n.disposables}};Object.defineProperty(e,"name",{value:i.name});for(let t of Object.getOwnPropertyNames(i))t!=="prototype"&&t!=="name"&&t!=="length"&&(e[t]=i[t]);return e}a(Xe,"component");var Ke=new WeakMap;function Oe(i,e){let t="";if(i instanceof e.defaultView?.CSSStyleSheet)return i;if(typeof i=="string")t=i;else if(typeof i=="function"){let d=i(null);typeof d=="string"&&(t=d)}let n=Ke.get(e);if(n||(n=new Map,Ke.set(e,n)),n.has(t))return n.get(t);let s=e.defaultView?.CSSStyleSheet;if(s)try{let o=new s;if(o.replaceSync)return o.replaceSync(t),n.set(t,o),o}catch{}let r=e.createElement("style");return r.innerHTML=t,r}a(Oe,"renderStylesheet");var It=1,Ee=class i{static{a(this,"WindowWrapper")}window;document;title;root;_vdom;width;height;isOpen=!1;tether=!1;syncStyles=!1;position=null;static tetheredWindows=new Set;eventListeners=[];wrapperEventListeners=[];constructor(e){this.root=e.content,this.width=e.width||e.height||600,this.height=e.height||e.width||400,this.title=e.title||"Window",this.tether=e.tether||!1,this.syncStyles=e.syncStyles||!1,this.position=e.position||null}async open(){if(this.isOpen){console.warn("Window is already open.");return}let e=0,t=0,n=`width=${this.width},height=${this.height}`;if(this.position&&(typeof this.position=="object"?(e=this.position.left,t=this.position.top):this.position==="center"?(e=(window.screen.width-this.width)/2,t=(window.screen.height-this.height)/2):this.position==="parent-center"?(e=window.screenX+(window.outerWidth-this.width)/2,t=window.screenY+(window.outerHeight-this.height)/2):this.position==="beside-parent"&&(e=window.screenX+window.outerWidth,t=window.screenY),n+=`,left=${e},top=${t}`),this.window=window.open("",this.title,n),!this.window)throw new Error("Popup window could not be opened.");this.setupDocument(),this.isOpen=!0,this.tether&&(i.tetheredWindows.add(this),i.tetheredWindows.size===1&&(window.addEventListener("pagehide",i.closeAllTethered),window.addEventListener("beforeunload",i.closeAllTethered),window.addEventListener("unload",i.closeAllTethered)))}setupDocument(){this._vdom&&(this._vdom._unrender(),this._vdom=null),this.document=this.window.document,this.document._dotId=`${It++}`;let e=document.createElement("div");e.textContent=this.title;let t=e.innerHTML;this.document.open?(this.document.open(),this.document.write(`<!DOCTYPE html><html><head><title>${t}</title></head><body></body></html>`),this.document.close()):this.document.documentElement.innerHTML=`<head><title>${t}</title></head><body></body>`,this.document=this.window.document;let n=this.document.body;n.innerHTML="",delete n[W],this.syncStyles&&this.syncStylesWithParent(),this._vdom=y(n,this.window).mount(this.root);for(let{name:s,callback:r}of this.eventListeners)this.document.addEventListener(s,r);this.window.addEventListener("unload",()=>{this.isOpen&&setTimeout(()=>{this.window&&!this.window.closed?this.setupDocument():(this.isOpen=!1,this.tether&&i.tetheredWindows.delete(this),this.emit("close"))},100)})}on(e,t){return e==="close"?this.wrapperEventListeners.push({name:e,callback:t}):(this.eventListeners.push({name:e,callback:t}),this.document&&this.document.addEventListener(e,t)),this}emit(e,t){for(let{name:n,callback:s}of this.wrapperEventListeners)n===e&&s(t)}focus(){this.window&&this.window.focus()}bringToFront(){this.window&&this.window.focus()}resizeTo(e,t){this.window&&this.window.resizeTo(e,t),this.width=e,this.height=t}moveTo(e,t){this.window&&this.window.moveTo(e,t)}static closeAllTethered=a(()=>{i.tetheredWindows.forEach(e=>e.close()),i.tetheredWindows.clear()},"closeAllTethered");syncStylesWithParent(){this.document.body.className=document.body.className;let e=getComputedStyle(document.documentElement);for(let n=0;n<document.documentElement.style.length;n++){let s=document.documentElement.style[n];s.startsWith("--")&&this.document.documentElement.style.setProperty(s,e.getPropertyValue(s))}if(this.document.adoptedStyleSheets&&document.adoptedStyleSheets){let n=[];for(let s of document.adoptedStyleSheets)try{let r=new this.window.CSSStyleSheet,o="";for(let d=0;d<s.cssRules.length;d++)o+=s.cssRules[d].cssText+`
|
|
25
|
-
`;r.replaceSync(o),n.push(r)}catch(r){console.warn("Failed to clone adopted stylesheet:",r)}this.document.adoptedStyleSheets=n}document.head.querySelectorAll("style, link[rel='stylesheet']").forEach(n=>{this.document.head.appendChild(n.cloneNode(!0))})}close(){this.window&&(this._vdom&&(this._vdom._unrender(),this._vdom=null),this.window.close(),this.window=null,this.document=null,this.isOpen=!1,this.tether&&i.tetheredWindows.delete(this),this.emit("close"))}};var le=class extends m{static{a(this,"Ref")}_dot;_isRef=!0;_vtype="ref";constructor(e){return super(),this._value=null,this._dot=e,new Proxy(this,{get(t,n,s){if(n in t)return Reflect.get(t,n,s);let r=t.value;if(r&&typeof r[n]=="function")return(...o)=>r[n].apply(r,o)},set(t,n,s,r){return n in t?Reflect.set(t,n,s):Reflect.set(t,n,s,r)}})}get element(){return this.value}async ready(){return this.value?this.value:new Promise(e=>{let t=this.subscribe(n=>{n&&(this.unsubscribe(t),e(n))})})}append(e){if(this.value instanceof HTMLElement){let t=this._dot||globalThis.dot;t?t(this.value).append(e):console.warn("DOThtml: Ref.append called but dot instance is not available.")}return this}prepend(e){if(this.value instanceof HTMLElement){let t=this._dot||globalThis.dot;t?t(this.value).prepend(e):console.warn("DOThtml: Ref.prepend called but dot instance is not available.")}return this}};var Ne=class{static{a(this,"RefCollection")}_refs=new Map;_dot;_vtype="ref-collection";constructor(e){this._dot=e}get(e){return this._refs.has(e)||this._refs.set(e,new le(this._dot)),this._refs.get(e)}get elements(){let e={};return this._refs.forEach((t,n)=>{e[n]=t.value}),e}forEach(e){this._refs.forEach((t,n)=>{e(t.value,n)})}map(e){let t=[];return this._refs.forEach((n,s)=>{t.push(e(n.value,s))}),t}};var Z=new Map;function Ze(i){let{id:e,state:t,getters:n,actions:s}=i;if(e&&Z.has(e))return()=>Z.get(e);let r=a(()=>{let d={$id:e,_state:{},_getters:{},_effects:[]},h={computedSignals:[],effects:[],disposables:[],registerComputed(c){this.computedSignals.push(c)},registerEffect(c){this.effects.push(c)},registerDisposable(c){this.disposables.push(c)}};k(h);try{if(t){let c=t();for(let p in c){let b=c[p],x=b instanceof m?b:new m;x!==b&&(x.value=b),d._state[p]=x,Object.defineProperty(d,p,{get:a(()=>d._state[p],"get"),enumerable:!0,configurable:!0})}}if(n){for(let c in n)Object.defineProperty(d,c,{get:a(()=>d._getters[c],"get"),enumerable:!0,configurable:!0});for(let c in n){let p=new E(()=>n[c].call(d,d));d._getters[c]=p}}if(s)for(let c in s)d[c]=(...p)=>{k(h);try{return s[c].apply(d,p)}finally{L()}}}finally{L()}return d._getters_list=h.computedSignals,d._effects=h.effects,d._disposables=h.disposables,d.$dispose=()=>{for(let c in d._getters)d._getters[c].dispose();for(let c of d._getters_list||[])c.dispose();for(let c of d._effects||[])c.dispose();for(let c of d._disposables||[])c();e&&Z.delete(e),d._state={},d._getters={},d._effects=[]},e&&Z.set(e,d),d},"createInstance"),o;return e&&(o=r()),()=>{let d=e?o:r();if(!e){let h=F();h&&h.registerDisposable&&h.registerDisposable(()=>d.$dispose())}return d}}a(Ze,"createStore");function Je(i){return Z.get(i)}a(Je,"getStore");function et(){Z.forEach(i=>i.$dispose()),Z.clear()}a(et,"clearStores");function tt(){let i={};return Z.forEach((e,t)=>{i[t]=e}),i}a(tt,"getStores");var be=["a","aside","abbr","address","area","article","audio","b","bdi","bdo","blockQuote","body","br","button","canvas","caption","cite","code","col","colGroup","content","data","dataList","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldSet","figCaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","i","iFrame","img","input","ins","kbd","keyGen","label","legend","li","main","map","mark","menu","menuItem","meter","nav","object","ol","optGroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","svg","sub","summary","sup","table","tBody","td","textArea","tFoot","th","tHead","time","tr","track","u","ul","var","video","wbr"],nt=new Set(be),Me=["each","html","mount","text","md","when","on"];var de=class extends f{static{a(this,"SlotVdom")}name;fallbackOrScope;fallback=null;scopedContent=null;element=null;component;_vtype="slot";constructor(e,t,n){super(e),this.name=t||"default",this.fallbackOrScope=n,this.component=F()}_render(e){this._isRendered=!0;let t=e.ownerDocument,s=(this.component||F())?.slots?.[this.name];typeof s=="function"?(this.scopedContent=new v(this._dot),$(this._dot,this.scopedContent,s(this.fallbackOrScope))):this.fallbackOrScope!==void 0&&(this.fallback=new v(this._dot),$(this._dot,this.fallback,this.fallbackOrScope)),this.scopedContent?this.scopedContent._render(e):(this.element=t.createElement("slot"),this.name!=="default"&&(this.element.name=this.name),this.fallback&&this.fallback._render(this.element),e.appendChild(this.element))}_unrender(){this.scopedContent?this.scopedContent._unrender():this.element&&(this.fallback&&this.fallback._unrender(),this.element.remove(),this.element=null),this._isRendered=!1}_getNodes(){return this.scopedContent?this.scopedContent._getNodes():this.element?[this.element]:[]}_getLastChild(){return this}};var he=class i extends f{static{a(this,"DotChain")}_root;_vtype="dotchain";constructor(e,t){super(e),this._root=t}_addChild(e){if(this._root instanceof v||l(this._root,"container"))this._root._addChild(e);else if(this._root instanceof R||l(this._root,"fragment"))this._root._children.push(e);else{let t=new R(this._dot);t._children.push(this._root),t._children.push(e),this._root=t}return this}_prependChild(e){if(this._root instanceof v||l(this._root,"container"))this._root._prependChild(e);else if(this._root instanceof R||l(this._root,"fragment"))this._root._children.unshift(e);else{let t=new R(this._dot);t._children.push(e),t._children.push(this._root),this._root=t}return this}_render(e){this._root._render(e)}_unrender(){this._root._unrender()}_unrenderAsync(){return this._root._unrenderAsync()}_renderBefore(e){this._root._renderBefore(e)}_renderAfter(e){this._root._renderAfter(e)}_moveBefore(e,t){this._root._moveBefore(e,t)}get _isRendered(){return this._root._isRendered}set _isRendered(e){this._root._isRendered=e}_getNodes(){return this._root._getNodes()}_getLastChild(){return this._root._getLastChild()}get _children(){return this._root instanceof v||l(this._root,"container")?this._root._children:this._root instanceof R||l(this._root,"fragment")?this._root._children:[]}slot(e,t){let n=this._getLastChild();for(;n instanceof i||l(n,"dotchain");)n=n._root;return n instanceof j||l(n,"component")?(typeof e!="string"&&(t=e,e="default"),n.addSlot(e||"default",t)):(typeof e!="string"&&(t=e,e=void 0),this._addChild(new de(this._dot,e,t))),this}};var it="6.0.9";function ce(i){return l(i,"signal")?i.bind():i}a(ce,"reduceReactive");function ue(i){return i instanceof he||l(i,"dotchain")?i:new he(i._dot,i)}a(ue,"promote");function Q(i){let e=i;for(;e&&(e instanceof he||l(e,"dotchain"));)U&&!(e instanceof he)&&console.warn("\u26A0\uFE0F DOThtml Warning: Multiple instances of DOThtml detected. This can lead to unexpected behavior. Ensure all plugins and your main app share the same dependency instance."),e=e._root;return e}a(Q,"resolveRoot");function rt(i,e,t){let n=ce(e);if(n instanceof f||l(n,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])||n?._root)return ue(n);if(typeof n=="string"||l(n,"binding")||typeof n=="number"||typeof n=="boolean"||n===null||n===void 0||Array.isArray(n))return new pe(n,i);let s=new j(i,n);for(let r=0;r<t.length;r++){let o=t[r];if(De(o))s.addSlot("default",o);else if(o&&typeof o=="object")for(let d in o){let h=o[d];if(d==="ref")s.setRef(h);else if(d.startsWith("on")&&typeof h=="function"){let c=d,p=[];if(d.includes(".")){let b=d.split(".");c=b[0],p=b.slice(1)}s.addEventListener(c.substring(2).toLowerCase(),h,p)}else{let c=e.constructor.props;c&&c[d]?(e.props||(e.props={}),e.props[d]=h):typeof h=="function"||h instanceof f||h?._root||h?._children?s.addSlot(d,h):(e.props||(e.props={}),e.props[d]=h)}}}return s}a(rt,"createMountable");f.prototype._addChild=function(i){return ue(this)._addChild(i)};f.prototype._prependChild=function(i){return ue(this)._prependChild(i)};f.prototype.text=function(i){let e=ce(i);return e instanceof u?this._addChild(new ge(this._dot,e)):this._addChild(new T(e))};f.prototype.html=function(i){return this.mount(i)};f.prototype.md=function(i){return this.text(i)};f.prototype.slot=function(i,e){let t=Q(this._getLastChild());return t&&(t instanceof j||l(t,"component"))?(typeof i!="string"&&i!==void 0&&(e=i,i="default"),t.addSlot(i||"default",e),this):(typeof i!="string"&&i!==void 0&&(e=i,i=void 0),this._addChild(new de(this._dot,i,e)))};f.prototype.mount=function(i,...e){return this._addChild(rt(this._dot,i,e))};f.prototype.append=function(i){let e=Q(this);return e&&(e instanceof C||l(e,"element"))?(e.children.mount(i),this):this.mount(i)};f.prototype.prepend=function(i){let e=Q(this);return e&&(e instanceof C||l(e,"element"))?(e.children.prepend(i),this):this._prependChild(rt(this._dot,i,[]))};f.prototype.when=function(i,e){let t=new se(this._dot),n;return e instanceof f||l(e,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])?n=e:typeof e=="object"&&e?.build?(n=new R(this._dot),n.mount(e)):(n=new R(this._dot),n._children.push(new T(ce(e)))),t.addCondition(ce(i),n),this._addChild(t)};f.prototype.each=function(i,e){let t=new ie(this._dot,ce(i),e);return this._addChild(t)};f.prototype.otherwiseWhen=function(i,e,t=!1){let n=this._getLastChild();if(n&&(n instanceof se||l(n,"conditional"))){let s;e instanceof f||l(e,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])?s=e:typeof e=="object"&&e?.build?(s=new R(this._dot),s.mount(e)):s=new T(ce(e)),n.addCondition(ce(i),s,t)}else throw new Error("Can't branch off of a non-conditional node.");return this};f.prototype.otherwise=function(i){return this.otherwiseWhen(!0,i,!0)};f.prototype.attr=function(i,e){let t=Q(this._getLastChild()||this);if(t&&(t instanceof v||l(t,"container"))&&t._parent&&(t._parent instanceof C||l(t._parent,"element"))&&(t=t._parent),t&&(t instanceof C||l(t,"element")))t.setAttr(i,e);else throw new Error(`Invalid node to set ${i} attribute.`);return this};f.prototype.style=function(i){if(typeof i=="function"){let e=new V;i(e),this.attr("style",e)}else this.attr("style",i);return this};f.prototype.on=function(i,e){let t=Q(this._getLastChild()||this);if(t&&(t instanceof v||l(t,"container"))&&t._parent&&(t._parent instanceof C||l(t._parent,"element"))&&(t=t._parent),t&&(t instanceof C||l(t,"element")||t instanceof j||l(t,"component")))t.addEventListener(i,e);else throw new Error(`Invalid node to set ${i} listener.`);return this};f.prototype.onEnter=function(i){let e=Q(this._getLastChild()||this);if(e&&(e instanceof v||l(e,"container"))&&e._parent&&(e._parent instanceof C||l(e._parent,"element"))&&(e=e._parent),e&&(e._onEnterHook=i,e._isRendered)){let n=e._getNodes().find(s=>s instanceof HTMLElement);n&&i(n)}return this};f.prototype.onLeave=function(i){let e=Q(this._getLastChild()||this);return e&&(e instanceof v||l(e,"container"))&&e._parent&&(e._parent instanceof C||l(e._parent,"element"))&&(e=e._parent),e&&(e._onLeaveHook=i),this};f.prototype.empty=function(){let i=Q(this),e=i instanceof v||l(i,"container")?i:i instanceof C||l(i,"element")?i.children:i instanceof R||l(i,"fragment")?i:null;return e&&(e._unrender(),(e instanceof v||l(e,"container")||e instanceof R||l(e,"fragment"))&&(e._children=[]),e._isRendered=!0,e instanceof v||l(e,"container")?e.element?e.element.innerHTML="":e._parent&&(e._parent instanceof C||l(e._parent,"element"))&&e._parent.element&&(e._parent.element.innerHTML=""):(e instanceof C||l(e,"element"))&&e.element&&(e.element.innerHTML="")),this};f.prototype.remove=function(){let i=Q(this);(i instanceof v||l(i,"container"))&&i._parent&&(i._parent instanceof C||l(i._parent,"element"))?i._parent._unrender():i._unrender()};f.prototype.fade=function(i=300){return this.onEnter(e=>{e.animate([{opacity:0},{opacity:1}],{duration:i})}).onLeave(async e=>{await e.animate([{opacity:1},{opacity:0}],{duration:i}).finished})};f.prototype.slide=function(i=300){return this.onEnter(e=>{e.animate([{height:"0",opacity:0,overflow:"hidden"},{height:e.scrollHeight+"px",opacity:1,overflow:"hidden"}],{duration:i})}).onLeave(async e=>{await e.animate([{height:e.scrollHeight+"px",opacity:1,overflow:"hidden"},{height:"0",opacity:0,overflow:"hidden"}],{duration:i}).finished})};for(let i=0;i<be.length;i++){let e=be[i];f.prototype[e]=function(...t){return this._addChild(Be(this._dot,e,t))}}var st=a((i,e)=>{i[e]=function(){if(nt.has(e))return ue(Be(i,e,arguments));{let t=new v(i);return t[e](...arguments),ue(t)}}},"makeCoreWrapper"),Vt=a(()=>{let i=a(function(e,t=window){if(e?.ownerDocument?.defaultView){let n=e,s=n[W];return s||(s=new C(i,n.tagName.toLocaleLowerCase()),s.element=n,s._isRendered=!0,s.children._parent=s,s.children._isRendered=!0,n[W]=s),ue(s.children)}else{if(typeof e=="string")return i(t.document.querySelectorAll(e)[0]);throw new Error("Invalid render target.")}},"_dot");i.version=it,i.onError=null,i.state=function(e,t){let n=new m;return n.key=t,n.value=e,n},i.computed=function(e){let t=new E(e),n=F();return n&&n.registerComputed(t),t},i.effect=function(e){let t=new xe(e),n=F();return n&&(n.registerEffect?n.registerEffect(t):n.registerComputed(t)),()=>t.dispose()},i.component=Xe,i.hmr={swap(e,t){let n=Ge(e);for(let s of n)s._hmrSwap(t)}},i.slot=function(e,t){return typeof e!="string"&&e!==void 0&&(t=e,e=void 0),new de(i,e,t)},i.getCurrentComponent=F,i.store=Ze,i.getStore=Je,i.clearStores=et,Object.defineProperty(i,"stores",{get:a(()=>tt(),"get")}),i.create=function(e,...t){let n={computedSignals:[],effects:[],disposables:[],registerComputed(r){this.computedSignals.push(r)},registerEffect(r){this.effects.push(r)},registerDisposable(r){this.disposables.push(r)}};k(n);let s;try{s=new e(...t)}finally{L()}return s._trackedComputeds?s._trackedComputeds.push(...n.computedSignals):s._trackedComputeds=n.computedSignals,s._trackedEffects?s._trackedEffects.push(...n.effects):s._trackedEffects=n.effects,s._trackedDisposables?s._trackedDisposables.push(...n.disposables):s._trackedDisposables=n.disposables,s},i.ref=function(){return new le(i)},i.refCollection=function(){return new Ne(i)},i.alpha=function(e,t){return new E(()=>{let n=e instanceof u?e._get():e instanceof m?e.value:e,s=t instanceof u?t._get():t instanceof m?t.value:t,r=Math.round(Math.max(0,Math.min(100,(1-s)*100))*100)/100;return`color-mix(in srgb, ${n}, transparent ${r}%)`})},i.globalStyles=[],i.useGlobalStyles=e=>{let t=Array.isArray(e)?e:[e];for(let n of t)i.globalStyles.push(n),typeof document<"u"&&i.useStyles(document,n)},i.css=new V,i._theme=null,i.setTheme=e=>{i._theme=e},i.useStyles=(e,t)=>{e&&!t&&(typeof e=="string"||e.call&&e.apply)&&(t=e,e=document);let n=Oe(t,e);n instanceof e.defaultView?.CSSStyleSheet?e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]:n instanceof HTMLElement&&e.head.appendChild(n)},typeof document<"u"&&new M(i.css).render(document.documentElement),i.window=e=>new Ee(e),i.flushSync=()=>{I.flushSync()},i.setSync=e=>{I.setSync(e)},I.onError=e=>{i.onError?i.onError(e):console.error("DOThtml Error:",e)};for(let e=0;e<be.length;e++){let t=be[e];st(i,t)}for(let e=0;e<Me.length;e++){let t=Me[e];st(i,t)}return i},"makeDot"),ot=Vt();U&&typeof window<"u"&&(window.dot=ot);var y=ot;var $e=a(()=>{if(typeof window>"u")return{path:"/",search:"",hash:""};let i=window.location.pathname,e=window.location.search,t=window.location.hash;if(t.startsWith("#/")){let n=t.substring(1),s=n.search(/[?#]/);if(s===-1)i=n,e="",t="";else{i=n.substring(0,s);let r=n.substring(s),o=r.indexOf("#");o===-1?(e=r,t=""):(e=r.substring(0,o),t=r.substring(o))}}return{path:i,search:e,hash:t}},"getRouteInfo"),Re=$e(),D=y.state(Re.path),J=y.state(Re.path),Ie=y.state(Re.search),ee=y.state(Re.hash);function te(i,e=!1){if(typeof window>"u")return;J.value=D.value,e?window.history.replaceState({},"",i):window.history.pushState({},"",i);let t=$e();D.value=t.path,Ie.value=t.search,ee.value=t.hash}a(te,"navigate");function at(){return y.computed(()=>{let i=Ie.value,e=new URLSearchParams(i),t={};return e.forEach((n,s)=>{t[s]=n}),t})}a(at,"useQueryParams");function lt(){return y.computed(()=>{let i=ee.value;return i.startsWith("#")?i.substring(1):i})}a(lt,"useHash");if(typeof window<"u"){let i=a(()=>{let e=$e();J.value=D.value,D.value=e.path,Ie.value=e.search,ee.value=e.hash},"updateState");window.addEventListener("popstate",i),window.addEventListener("hashchange",i)}var Fe=[],Ve=[],dt=y.state([]);function kt(i){dt.value=i}a(kt,"setGlobalRoutes");function ht(){return dt.value}a(ht,"getGlobalRoutes");function Lt(i,e,t=""){let s=(e.startsWith(t)?e.slice(t.length):e).split("/").filter(r=>r!=="");for(let r of i){let o=r.path.split("/").filter(b=>b!==""),d={},h=!0,c=o.indexOf("*")!==-1,p=!!(r.children&&r.children.length>0);if(!(!c&&!p&&o.length!==s.length)&&!(o.length>s.length)){for(let b=0;b<o.length;b++){let x=o[b],g=s[b];if(x==="*"){h=!0;break}if(g===void 0){h=!1;break}if(x!=="+"){if(x.startsWith("{")&&x.endsWith("}")){let _=x.slice(1,-1);d[_]=g;continue}if(x.startsWith(":")){let _=x.slice(1);d[_]=g;continue}if(x!==g){h=!1;break}}}if(h){let b=s.slice(0,o.length),x=(t.endsWith("/")?t.slice(0,-1):t)+"/"+b.join("/");return{route:r,params:d,matchedPath:x}}}}return null}a(Lt,"matchRoute");var ke=y.component(class{static props={routes:{type:Array,required:!0},notFound:{type:Object,default:null},loading:{type:Object,default:null},basePath:{type:String,default:""}};props;resolvedComponent=y.state(null);currentMatch=null;lastPath="";subId=-1;loaderCache=new Map;mounting(){this.subId=D.subscribe(()=>{this._?.cvdom.requestUpdate()})}unmounting(){D.unsubscribe(this.subId)}build(i){kt(this.props.routes);let e=D.value,t=Lt(this.props.routes,e,this.props.basePath);this.currentMatch=t;let n=a(o=>{if(!t)return;let d=t.route.title;if(typeof d=="function"&&(d=d(t.params)),d&&(document.title=d),typeof o=="function"&&!o.prototype?.build){if(this.loaderCache.has(o)){this.resolvedComponent.value=this.loaderCache.get(o),Ve.forEach(c=>c(e,J.value));return}let h=o();if(h instanceof Promise){h.then(c=>{let p=c.default||c;this.loaderCache.set(o,p),this.resolvedComponent.value=p,this._?.cvdom.requestUpdate(),Ve.forEach(b=>b(e,J.value))}),this.resolvedComponent.value=this.props.loading||i.div("Loading...");return}}this.resolvedComponent.value=o,Ve.forEach(h=>h(e,J.value))},"proceed");if(!t)this.resolvedComponent.value=this.props.notFound||i.div("404 - Not Found");else if(t.route.redirect){let o=typeof t.route.redirect=="function"?t.route.redirect(t.params):t.route.redirect;return te(o,!0),i.div()}else{let o=[...Fe];t.route.beforeEnter&&o.push(t.route.beforeEnter);let d=a(async h=>{if(h>=o.length){n(t.route.component);return}let c=o[h],p=!1,b=a(g=>{p||(p=!0,g===!1?te(J.value,!0):typeof g=="string"?te(g,!0):d(h+1))},"handleNext"),x=c(e,J.value,b);if(x instanceof Promise){let g=await x;p||(g===!1||typeof g=="string"?b(g):b())}else x!==void 0&&!p&&b(x)},"runGuards");d(0)}let s=this.resolvedComponent.value;if(!s)return i.div();let r=this.currentMatch;return typeof s=="function"&&s.prototype?.build?i.mount(new s,{routeParams:r?.params,basePath:r?.matchedPath}):typeof s=="object"&&s.build?i.mount(s,{routeParams:r?.params,basePath:r?.matchedPath}):s instanceof f?s:i.div(s)}});ke.beforeEach=i=>{Fe.push(i)};ke.afterEach=i=>{Ve.push(i)};ke.clearHooks=()=>{Fe.length=0,Ve.length=0};function We(i,e,t={},n=""){for(let s of i){let r=(n.endsWith("/")?n.slice(0,-1):n)+(s.path.startsWith("/")?"":"/")+s.path;if(s.name===e){let o=r;for(let d in t){let h=t[d];o=o.replace(new RegExp(`\\{${d}\\}`,"g"),h),o=o.replace(new RegExp(`:${d}`,"g"),h)}return o}if(s.children){let o=We(s.children,e,t,r);if(o)return o}}return null}a(We,"generatePath");var ct=y.component(class{static props={to:{type:String,default:""},name:{type:String,default:""},params:{type:Object,default:a(()=>({}),"default")},activeClass:{type:String,default:"active"},exact:{type:Boolean,default:!1},label:{type:String,default:""}};props;slots;getResolvedPath(){return this.props.name?We(ht(),this.props.name,this.props.params)||"":this.props.to}build(){let i=y.computed(()=>this.getResolvedPath());return y.a({hRef:i,class:y.computed(()=>{let e=D.value,t=i.value;return t.startsWith("#/")?t=t.substring(1).split(/[?#]/)[0]:t=t.split(/[?#]/)[0],(this.props.exact?e===t:e.startsWith(t))?this.props.activeClass:""}),onClick:a(e=>{(e.button===0||e.button===void 0)&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(e.preventDefault(),te(i.value))},"onClick")},this.props.label||this.slots?.default)}});function He(i,e=document){let t=e.getElementById(i);if(t)return t;let n=e.querySelectorAll("*");for(let s=0;s<n.length;s++){let r=n[s].shadowRoot;if(r&&(t=He(i,r),t))return t}return null}a(He,"getElementByIdDeep");var ft=new Map,Te=null;function Pt(i,e=!1){let t=ee.value;if(t&&t.startsWith("#")){let s=t.substring(1),r=He(s);if(r){let o=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;r.scrollIntoView({behavior:e&&!o?"smooth":"auto"});return}}let n=ft.get(i);n?window.scrollTo(n.x,n.y):window.scrollTo(0,0)}a(Pt,"performScroll");function ut(i,e){Te&&clearTimeout(Te),Te=setTimeout(()=>{Pt(i,e),Te=null},0)}a(ut,"scheduleScroll");function pt(){if(typeof window>"u")return;window.addEventListener("scroll",()=>{ft.set(D.value,{x:window.pageXOffset,y:window.pageYOffset})},{passive:!0}),y.computed(()=>({path:D.value,hash:ee.value})).subscribe(e=>{ut(e.path,!0)}),ut(D.value,!1)}a(pt,"initScrollManager");var mt=class{static{a(this,"DotComponent")}props;refs={};_;constructor(e){this.props=e||{}}emit(e,t){}effect(e){y.effect(e)}};pt();y.currentPath=D;y.currentSearch=Ie;y.currentHash=ee;y.navigate=te;y.useQueryParams=at;y.useHash=lt;y.Router=ke;y.Link=ct;window.dot=y;document._dotId="default";export{mt as DotComponent,ct as Link,S as Priority,ke as Router,ee as currentHash,D as currentPath,Ie as currentSearch,y as dot,We as generatePath,ht as getGlobalRoutes,pt as initScrollManager,Lt as matchRoute,te as navigate,J as previousPath,kt as setGlobalRoutes,lt as useHash,at as useQueryParams};
|
|
24
|
+
`;let n=document.createElement("h2");n.textContent="DOThtml HMR Error",n.style.marginTop="0px",t.appendChild(n);let s=document.createElement("div");if(s.textContent=e.message||e,s.style.cssText="font-weight: bold; font-size: 1.2em; margin-bottom: 10px;",t.appendChild(s),e.stack){let r=document.createElement("pre");r.textContent=e.stack,r.style.cssText="font-size: 0.9em; opacity: 0.8;",t.appendChild(r)}if(this.shadowEl){let r=this.shadowEl.shadowRoot;r&&(r.innerHTML="",r.appendChild(t))}}validateProps(){try{let e=this.component.constructor.props;if(!e)return;let t=this.component.constructor.name,n=this.component.props||{};for(let s in e){let r=e[s],o=n[s];if((o instanceof m||l(o,"signal"))&&(o=o.value),(o instanceof u||l(o,"binding"))&&(o=o._get()),r.required&&o===void 0)throw new Error(`[${t}] Prop "${s}" is required.`);if(o===void 0&&r.default!==void 0&&(o=typeof r.default=="function"?r.default():r.default,n[s]=o),o!==void 0){if(r.type){let d=o===null?"null":Array.isArray(o)?"array":typeof o,h="";if(r.type===String?h="string":r.type===Number?h="number":r.type===Boolean?h="boolean":r.type===Array?h="array":r.type===Object?h="object":r.type===Function&&(h="function"),h&&d!==h&&(o!==null||r.required))throw new Error(`[${t}] Prop "${s}" expected ${h}, but got ${d}.`)}if(r.validator&&!r.validator(o))throw new Error(`[${t}] Prop "${s}" failed custom validation.`)}}}catch(e){throw e.isPropValidationError=!0,e}}setupCustomElement(e){let t=this.component._._meta.tagName;if(e.defaultView.customElements.get(t)){let r=this.component.constructor._cachedStyles;r&&(this.component.constructor._cachedStyles=r);return}let n=this,s=class extends e.defaultView.HTMLElement{static{a(this,"CustomElementConstructor")}_component;_isMounted=!1;constructor(){super(),this.attachShadow({mode:"open"})}set component(o){this._component=o,this._isMounted&&this._renderComponent(o)}get component(){return this._component}connectedCallback(){this._isMounted=!0,this._component&&this._renderComponent(this._component)}_renderComponent(o){let d=this.shadowRoot;if(!d)return;let h=o._.cvdom;if(h)try{let c=new Se;h._dot._theme&&c.setTheme(h._dot._theme);let p=o.constructor.styles;p&&typeof p=="function"&&p(c);let b=o.constructor.hostStyles;b&&typeof b=="function"&&b(c),o.hostStyle&&c.rule(":host",g=>o.hostStyle(g));let C=h._dot.globalStyles||[];for(let g of C)if(typeof g=="string"){let y=e.createElement("style");y.textContent=g.replace(/\b(html|body)\b/g,":host"),d.appendChild(y)}if(o.stylize){let g=o.stylize(c);if(typeof g=="string"){let y=e.createElement("style");y.textContent=g,d.appendChild(y)}else if(g instanceof m||l(g,"signal")||g instanceof u||l(g,"binding")||g instanceof E||l(g,"computed")){let y=e.createElement("style");y.id="--dh-dynamic-style",d.appendChild(y);let N=a(()=>{c.clearRules();let A=o.stylize(c),se="";if(typeof A=="string")se=A;else if(A instanceof m||l(A,"signal")||A instanceof u||l(A,"binding")||A instanceof E||l(A,"computed")){let X=A instanceof u||l(A,"binding")?A._get():A.value;typeof X=="string"?se=X:se=c.toString()}else se=c.toString();y.textContent=se;let qe=c.getGhostVars();qe.length>0&&qe.forEach(X=>{let gt=X.value instanceof u||l(X.value,"binding")?X.value._get():X.value.value;this.style.setProperty(X.name,`${gt}`)}),c.hasRules()&&typeof A!="string"&&(y.textContent+=c.toString())},"update"),G=g.subscribe(N);h.registerDisposable(()=>{g instanceof u||l(g,"binding")?g._unsubscribe(G):g.unsubscribe(G)}),N()}}if(c.hasRules()){let g=e.createElement("style");g.textContent=c.toString(),d.appendChild(g),o.constructor._cachedStyles=c.toString();let y=c.getGhostVars();y.length>0&&y.forEach(N=>{let G=N.value instanceof u||l(N.value,"binding")?N.value._get():N.value.value;if(this.style.setProperty(N.name,`${G}`),N.value instanceof m||l(N.value,"signal")||N.value instanceof u||l(N.value,"binding")){let A=N.value.subscribe(se=>{this.style.setProperty(N.name,`${se}`)});h.registerDisposable(()=>{N.value instanceof u||l(N.value,"binding")?N.value._unsubscribe(A):N.value.unsubscribe(A)})}}),h.registerDisposable(()=>c.dispose())}if(h.childShadowVdom._isRendered)return;{o._._meta.shadowRoot=d;let g=c.getGhostVars();g.length>0&&g.forEach(y=>{let N=y.value instanceof u||l(y.value,"binding")?y.value._get():y.value.value;if(this.style.setProperty(y.name,`${N}`),y.value instanceof m||l(y.value,"signal")||y.value instanceof u||l(y.value,"binding")){let G=y.value.subscribe(A=>{this.style.setProperty(y.name,`${A}`)});h.registerDisposable(()=>{y.value instanceof u||l(y.value,"binding")?y.value._unsubscribe(G):y.value.unsubscribe(G)})}}),k(h);try{h.childShadowVdom._render(d)}finally{L()}}}catch(c){try{h.handleError(c)}catch(p){if(p instanceof B)return;throw p}}}};e.defaultView.customElements.define(t,s)}_render(e){try{if(!this.component._)throw new Error("Invalid component. Ensure components are created through the component factory or through decoration.");if(this.component._?._meta?.isRendered)throw new Error("Individual component instances cannot be rendered twice at once.");this.component._._meta||(this.component._._meta={}),this.component._._meta.isRendered=!0;let t=e.ownerDocument;if(this.setupCustomElement(t),this.shadowEl=t.createElement(this.component._._meta.tagName),this.shadowEl.cvdom=this,this.shadowEl.setAttribute("cvdom",""),this.shadowEl.component=this.component,this.init(),this.lastError){U&&this.renderErrorBox(this.lastError),e.appendChild(this.shadowEl);return}k(this);try{this.component.mounting&&this.component.mounting()}finally{L()}e.appendChild(this.shadowEl),this.ref&&(typeof this.ref=="function"?this.ref(this.component):this.ref.value=this.component);for(let n in this.slots){let s=this.slots[n];if(typeof s!="function"&&(s._render(this.shadowEl),n!=="default")){let r=s._getNodes();for(let o of r)o&&o.setAttribute&&o.setAttribute("slot",n)}}for(let n=0;n<this.events.length;n++){let s=this.events[n];this.renderEvent(s.name,s.callback,s.modifiers)}k(this);try{this.component.mounted&&this.component.mounted()}finally{L()}this._onEnterHook&&this._onEnterHook(this.shadowEl),this.component.onEnter&&this.component.onEnter()}catch(t){if(this.shadowEl&&!this.shadowEl.parentElement&&e.appendChild(this.shadowEl),t instanceof B||l(t,"handled-error"))return;this.handleError(t)}}_unrender(){k(this);try{this.component.unmounting&&this.component.unmounting()}finally{L()}this.childShadowVdom._unrender();for(let t in this.slots){let n=this.slots[t];(n instanceof f||l(n,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"]))&&n._unrender()}this.shadowEl&&(this.shadowEl.parentNode?.removeChild(this.shadowEl),delete this.shadowEl.component);for(let t of this.computedSignals)t.dispose();this.computedSignals=[];for(let t of this.buildComputedSignals)t.dispose();this.buildComputedSignals=[];for(let t of this.effects)t.dispose&&t.dispose();this.effects=[];for(let t of this.buildEffects)t.dispose&&t.dispose();this.buildEffects=[];for(let t of this.disposables)t();this.disposables=[];for(let t of this.buildDisposables)t();this.buildDisposables=[],this.ref&&(typeof this.ref=="function"?this.ref(null):this.ref.value=null);let e=this.component.constructor.__hmrId;U&&e&&ze(e,this),this.component._&&(this.component._._meta.isRendered=!1),this.shadowEl=null,this._isRendered=!1,k(this);try{this.component.unmounted&&this.component.unmounted()}finally{L()}}_unrenderAsync(){let e=null;if(this._onLeaveHook&&this.shadowEl){let t=this._onLeaveHook(this.shadowEl);t instanceof Promise&&(e=t)}if(this.component.onLeave){let t=this.component.onLeave();t instanceof Promise&&(e=e?e.then(()=>t):t)}if(e)return e.then(()=>this._unrender());this._unrender()}_getNodes(){return this.shadowEl?[this.shadowEl]:[]}_getLastChild(){return this}addEventListener(e,t,n=[]){this.events.push({name:e,callback:t,modifiers:n}),this.shadowEl&&this.renderEvent(e,t,n)}renderEvent(e,t,n=[]){J.getForDocument(this.shadowEl.ownerDocument).addListener(this.shadowEl,e.toLowerCase(),t,n)}generateStyles(e){return""}};var ge=class extends f{static{a(this,"ReactiveVdom")}binding;beforeNode=null;afterNode=null;currentVdom=null;observerId=0;_isReactiveVdom=!0;_vtype="reactive";constructor(e,t){super(e),this.binding=t}_toVdom(e){if(e==null)return new T("");if(e instanceof f)return e;if(typeof e=="object"&&e.build){let t=new j(this._dot,e);return t.init(),t}if(Array.isArray(e)){let t=new v(this._dot);for(let n of e)t._addChild(this._toVdom(n));return t}return new T(e)}_render(e){this._isRendered=!0,this.beforeNode=e.ownerDocument.createTextNode(""),this.afterNode=e.ownerDocument.createTextNode(""),e.appendChild(this.beforeNode),e.appendChild(this.afterNode);let t=this.binding._get();this.update(t),this.observerId=this.binding._subscribe(this)}update(e){this._isRendered&&(this.currentVdom&&this.currentVdom._unrender(),pe(this.beforeNode,this.afterNode),this.currentVdom=this._toVdom(e),this.currentVdom._renderBefore(this.afterNode))}_unrender(){this._isRendered&&(this._isRendered=!1,this.currentVdom&&(this.currentVdom._unrender(),this.currentVdom=null),this.observerId&&(this.binding._unsubscribe(this.observerId),this.observerId=0),pe(this.beforeNode,this.afterNode),this.beforeNode.parentElement&&this.beforeNode.parentElement.removeChild(this.beforeNode),this.afterNode.parentElement&&this.afterNode.parentElement.removeChild(this.afterNode),this.beforeNode=null,this.afterNode=null)}_getNodes(){if(!this._isRendered)return[];let e=[this.beforeNode];return this.currentVdom&&e.push(...this.currentVdom._getNodes()),e.push(this.afterNode),e}_getLastChild(){return this}toString(){return this.currentVdom?this.currentVdom.toString():""}};var Ce=class{static{a(this,"Effect")}callback;_vtype="effect";cleanup;dependencies=new Map;isQueued=!1;isEvaluating=!1;active=!0;dirty=!0;newDependencies=new Set;updateSubscription={active:!0,update:a(()=>{this.isQueued=!1,this.dirty&&this.run()},"update")};constructor(e){this.callback=e,this.run()}addDependency(e){this.active&&(this.newDependencies.has(e)||this.newDependencies.add(e))}requestUpdate(){this.active&&(this.dirty=!0,this.isQueued||(this.isQueued=!0,I.enqueue(this.updateSubscription,S.Normal)))}run(){if(!this.active)return;if(this.isEvaluating)throw new Error("Circular dependency detected in effect.");if(this.cleanup){try{this.cleanup()}catch(t){console.error("Error during effect cleanup:",t)}this.cleanup=void 0}this.isEvaluating=!0,this.dirty=!1,this.newDependencies.clear(),Z.push(this);try{let t=this.callback();typeof t=="function"&&(this.cleanup=t)}catch(t){console.error("Error during effect execution:",t)}finally{Z.pop(),this.isEvaluating=!1}let e=[];for(let[t,n]of this.dependencies)this.newDependencies.has(t)||(t.unsubscribe(n),e.push(t));for(let t of e)this.dependencies.delete(t);for(let t of this.newDependencies)if(!this.dependencies.has(t)){let n=t.subscribe(()=>this.requestUpdate(),!0);this.dependencies.set(t,n)}}dispose(){if(this.active){if(this.active=!1,this.cleanup){try{this.cleanup()}catch(e){console.error("Error during effect disposal cleanup:",e)}this.cleanup=void 0}for(let[e,t]of this.dependencies)e.unsubscribe(t);this.dependencies.clear()}}};function Xe(i){let e=class extends i{static{a(this,"decorated")}constructor(...t){let n={computedSignals:[],effects:[],disposables:[],registerComputed(s){this.computedSignals.push(s)},registerEffect(s){this.effects.push(s)},registerDisposable(s){this.disposables.push(s)}};k(n);try{super(...t)}finally{L()}t[0]&&typeof t[0]=="object"&&!t[0].build&&i.props&&(this.props||(this.props={}),Object.assign(this.props,t[0])),this._trackedComputeds=n.computedSignals,this._trackedEffects=n.effects,this._trackedDisposables=n.disposables}};Object.defineProperty(e,"name",{value:i.name});for(let t of Object.getOwnPropertyNames(i))t!=="prototype"&&t!=="name"&&t!=="length"&&(e[t]=i[t]);return e}a(Xe,"component");var Ke=new WeakMap;function Be(i,e){let t="";if(i instanceof e.defaultView?.CSSStyleSheet)return i;if(typeof i=="string")t=i;else if(typeof i=="function"){let d=i(null);typeof d=="string"&&(t=d)}let n=Ke.get(e);if(n||(n=new Map,Ke.set(e,n)),n.has(t))return n.get(t);let s=e.defaultView?.CSSStyleSheet;if(s)try{let o=new s;if(o.replaceSync)return o.replaceSync(t),n.set(t,o),o}catch{}let r=e.createElement("style");return r.innerHTML=t,r}a(Be,"renderStylesheet");var It=1,Ee=class i{static{a(this,"WindowWrapper")}window;document;title;root;_vdom;width;height;isOpen=!1;tether=!1;syncStyles=!1;position=null;static tetheredWindows=new Set;eventListeners=[];wrapperEventListeners=[];constructor(e){this.root=e.content,this.width=e.width||e.height||600,this.height=e.height||e.width||400,this.title=e.title||"Window",this.tether=e.tether||!1,this.syncStyles=e.syncStyles||!1,this.position=e.position||null}async open(){if(this.isOpen){console.warn("Window is already open.");return}let e=0,t=0,n=`width=${this.width},height=${this.height}`;if(this.position&&(typeof this.position=="object"?(e=this.position.left,t=this.position.top):this.position==="center"?(e=(window.screen.width-this.width)/2,t=(window.screen.height-this.height)/2):this.position==="parent-center"?(e=window.screenX+(window.outerWidth-this.width)/2,t=window.screenY+(window.outerHeight-this.height)/2):this.position==="beside-parent"&&(e=window.screenX+window.outerWidth,t=window.screenY),n+=`,left=${e},top=${t}`),this.window=window.open("",this.title,n),!this.window)throw new Error("Popup window could not be opened.");this.setupDocument(),this.isOpen=!0,this.tether&&(i.tetheredWindows.add(this),i.tetheredWindows.size===1&&(window.addEventListener("pagehide",i.closeAllTethered),window.addEventListener("beforeunload",i.closeAllTethered),window.addEventListener("unload",i.closeAllTethered)))}setupDocument(){this._vdom&&(this._vdom._unrender(),this._vdom=null),this.document=this.window.document,this.document._dotId=`${It++}`;let e=document.createElement("div");e.textContent=this.title;let t=e.innerHTML;this.document.open?(this.document.open(),this.document.write(`<!DOCTYPE html><html><head><title>${t}</title></head><body></body></html>`),this.document.close()):this.document.documentElement.innerHTML=`<head><title>${t}</title></head><body></body>`,this.document=this.window.document;let n=this.document.body;n.innerHTML="",delete n[W],this.syncStyles&&this.syncStylesWithParent(),this._vdom=_(n,this.window).mount(this.root);for(let{name:s,callback:r}of this.eventListeners)this.document.addEventListener(s,r);this.window.addEventListener("unload",()=>{this.isOpen&&setTimeout(()=>{this.window&&!this.window.closed?this.setupDocument():(this.isOpen=!1,this.tether&&i.tetheredWindows.delete(this),this.emit("close"))},100)})}on(e,t){return e==="close"?this.wrapperEventListeners.push({name:e,callback:t}):(this.eventListeners.push({name:e,callback:t}),this.document&&this.document.addEventListener(e,t)),this}emit(e,t){for(let{name:n,callback:s}of this.wrapperEventListeners)n===e&&s(t)}focus(){this.window&&this.window.focus()}bringToFront(){this.window&&this.window.focus()}resizeTo(e,t){this.window&&this.window.resizeTo(e,t),this.width=e,this.height=t}moveTo(e,t){this.window&&this.window.moveTo(e,t)}static closeAllTethered=a(()=>{i.tetheredWindows.forEach(e=>e.close()),i.tetheredWindows.clear()},"closeAllTethered");syncStylesWithParent(){this.document.body.className=document.body.className;let e=getComputedStyle(document.documentElement);for(let n=0;n<document.documentElement.style.length;n++){let s=document.documentElement.style[n];s.startsWith("--")&&this.document.documentElement.style.setProperty(s,e.getPropertyValue(s))}if(this.document.adoptedStyleSheets&&document.adoptedStyleSheets){let n=[];for(let s of document.adoptedStyleSheets)try{let r=new this.window.CSSStyleSheet,o="";for(let d=0;d<s.cssRules.length;d++)o+=s.cssRules[d].cssText+`
|
|
25
|
+
`;r.replaceSync(o),n.push(r)}catch(r){console.warn("Failed to clone adopted stylesheet:",r)}this.document.adoptedStyleSheets=n}document.head.querySelectorAll("style, link[rel='stylesheet']").forEach(n=>{this.document.head.appendChild(n.cloneNode(!0))})}close(){this.window&&(this._vdom&&(this._vdom._unrender(),this._vdom=null),this.window.close(),this.window=null,this.document=null,this.isOpen=!1,this.tether&&i.tetheredWindows.delete(this),this.emit("close"))}};var he=class extends m{static{a(this,"Ref")}_dot;_isRef=!0;_vtype="ref";constructor(e){return super(),this._value=null,this._dot=e,this._proxy()}get element(){return this.value}async ready(){return this.value?this.value:new Promise(e=>{let t=this.subscribe(n=>{n&&(this.unsubscribe(t),e(n))})})}append(e){if(this.value instanceof HTMLElement){let t=this._dot||globalThis.dot;t?t(this.value).append(e):console.warn("DOThtml: Ref.append called but dot instance is not available.")}return this}prepend(e){if(this.value instanceof HTMLElement){let t=this._dot||globalThis.dot;t?t(this.value).prepend(e):console.warn("DOThtml: Ref.prepend called but dot instance is not available.")}return this}};var Ne=class{static{a(this,"RefCollection")}_refs=new Map;_dot;_vtype="ref-collection";constructor(e){this._dot=e}get(e){return this._refs.has(e)||this._refs.set(e,new he(this._dot)),this._refs.get(e)}get elements(){let e={};return this._refs.forEach((t,n)=>{e[n]=t.value}),e}forEach(e){this._refs.forEach((t,n)=>{e(t.value,n)})}map(e){let t=[];return this._refs.forEach((n,s)=>{t.push(e(n.value,s))}),t}};var ee=new Map;function Ze(i){let{id:e,state:t,getters:n,actions:s}=i;if(e&&ee.has(e))return()=>ee.get(e);let r=a(()=>{let d={$id:e,_state:{},_getters:{},_effects:[]},h={computedSignals:[],effects:[],disposables:[],registerComputed(c){this.computedSignals.push(c)},registerEffect(c){this.effects.push(c)},registerDisposable(c){this.disposables.push(c)}};k(h);try{if(t){let c=t();for(let p in c){let b=c[p],C=b instanceof m?b:new m;C!==b&&(C.value=b),d._state[p]=C,Object.defineProperty(d,p,{get:a(()=>d._state[p],"get"),enumerable:!0,configurable:!0})}}if(n){for(let c in n)Object.defineProperty(d,c,{get:a(()=>d._getters[c],"get"),enumerable:!0,configurable:!0});for(let c in n){let p=new E(()=>n[c].call(d,d));d._getters[c]=p}}if(s)for(let c in s)d[c]=(...p)=>{k(h);try{return s[c].apply(d,p)}finally{L()}}}finally{L()}return d._getters_list=h.computedSignals,d._effects=h.effects,d._disposables=h.disposables,d.$dispose=()=>{for(let c in d._getters)d._getters[c].dispose();for(let c of d._getters_list||[])c.dispose();for(let c of d._effects||[])c.dispose();for(let c of d._disposables||[])c();e&&ee.delete(e),d._state={},d._getters={},d._effects=[]},e&&ee.set(e,d),d},"createInstance"),o;return e&&(o=r()),()=>{let d=e?o:r();if(!e){let h=F();h&&h.registerDisposable&&h.registerDisposable(()=>d.$dispose())}return d}}a(Ze,"createStore");function Je(i){return ee.get(i)}a(Je,"getStore");function et(){ee.forEach(i=>i.$dispose()),ee.clear()}a(et,"clearStores");function tt(){let i={};return ee.forEach((e,t)=>{i[t]=e}),i}a(tt,"getStores");var be=["a","aside","abbr","address","area","article","audio","b","bdi","bdo","blockQuote","body","br","button","canvas","caption","cite","code","col","colGroup","content","data","dataList","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldSet","figCaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","i","iFrame","img","input","ins","kbd","keyGen","label","legend","li","main","map","mark","menu","menuItem","meter","nav","object","ol","optGroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","source","span","strong","svg","sub","summary","sup","table","tBody","td","textArea","tFoot","th","tHead","time","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polyline","polygon","ellipse","g","defs","symbol","use","linearGradient","radialGradient","stop","clipPath","mask","pattern","filter","feGaussianBlur","feOffset","feMerge","feMergeNode","math","mi","mo","mn","ms","mtext","mspace","mglyph","mrow","mfrac","msqrt","mroot","mstyle","merror","mpadded","mphantom","menclose","msub","msup","msubsup","munder","mover","munderover","mmultiscripts","mtable","mtr","mtd","maction","semantics","annotation","annotation-xml"],nt=new Set(be),Oe=["each","html","h","mount","text","md","when","on"];var ce=class extends f{static{a(this,"SlotVdom")}name;fallbackOrScope;fallback=null;scopedContent=null;element=null;component;_vtype="slot";constructor(e,t,n){super(e),this.name=t||"default",this.fallbackOrScope=n,this.component=F()}_render(e){this._isRendered=!0;let t=e.ownerDocument,s=(this.component||F())?.slots?.[this.name];typeof s=="function"?(this.scopedContent=new v(this._dot),$(this._dot,this.scopedContent,s(this.fallbackOrScope))):this.fallbackOrScope!==void 0&&(this.fallback=new v(this._dot),$(this._dot,this.fallback,this.fallbackOrScope)),this.scopedContent?this.scopedContent._render(e):(this.element=t.createElement("slot"),this.name!=="default"&&(this.element.name=this.name),this.fallback&&this.fallback._render(this.element),e.appendChild(this.element))}_unrender(){this.scopedContent?this.scopedContent._unrender():this.element&&(this.fallback&&this.fallback._unrender(),this.element.remove(),this.element=null),this._isRendered=!1}_getNodes(){return this.scopedContent?this.scopedContent._getNodes():this.element?[this.element]:[]}_getLastChild(){return this}};var ue=class i extends f{static{a(this,"DotChain")}_root;_vtype="dotchain";constructor(e,t){super(e),this._root=t}_addChild(e){if(this._root instanceof v||l(this._root,"container"))this._root._addChild(e);else if(this._root instanceof R||l(this._root,"fragment"))this._root._children.push(e);else{let t=new R(this._dot);t._children.push(this._root),t._children.push(e),this._root=t}return this}_prependChild(e){if(this._root instanceof v||l(this._root,"container"))this._root._prependChild(e);else if(this._root instanceof R||l(this._root,"fragment"))this._root._children.unshift(e);else{let t=new R(this._dot);t._children.push(e),t._children.push(this._root),this._root=t}return this}_render(e){this._root._render(e)}_unrender(){this._root._unrender()}_unrenderAsync(){return this._root._unrenderAsync()}_renderBefore(e){this._root._renderBefore(e)}_renderAfter(e){this._root._renderAfter(e)}_moveBefore(e,t){this._root._moveBefore(e,t)}get _isRendered(){return this._root._isRendered}set _isRendered(e){this._root._isRendered=e}_getNodes(){return this._root._getNodes()}_getLastChild(){return this._root._getLastChild()}get _children(){return this._root instanceof v||l(this._root,"container")?this._root._children:this._root instanceof R||l(this._root,"fragment")?this._root._children:[]}slot(e,t){let n=this._getLastChild();for(;n instanceof i||l(n,"dotchain");)n=n._root;return n instanceof j||l(n,"component")?(typeof e!="string"&&(t=e,e="default"),n.addSlot(e||"default",t)):(typeof e!="string"&&(t=e,e=void 0),this._addChild(new ce(this._dot,e,t))),this}};var it="6.2.0";function fe(i){return l(i,"signal")?i.bind():i}a(fe,"reduceReactive");function Q(i){return i instanceof ue||l(i,"dotchain")?i:new ue(i._dot,i)}a(Q,"promote");function z(i){let e=i;for(;e&&(e instanceof ue||l(e,"dotchain"));)U&&!(e instanceof ue)&&console.warn("\u26A0\uFE0F DOThtml Warning: Multiple instances of DOThtml detected. This can lead to unexpected behavior. Ensure all plugins and your main app share the same dependency instance."),e=e._root;return e}a(z,"resolveRoot");function rt(i,e,t){let n=fe(e);if(n instanceof f||l(n,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])||n?._root)return Q(n);if(typeof n=="string"||l(n,"binding")||typeof n=="number"||typeof n=="boolean"||n===null||n===void 0||Array.isArray(n))return new K(n,i);let s=new j(i,n);for(let r=0;r<t.length;r++){let o=t[r];if(De(o))s.addSlot("default",o);else if(o&&typeof o=="object")for(let d in o){let h=o[d];if(d==="ref")s.setRef(h);else if(d.startsWith("on")&&typeof h=="function"){let c=d,p=[];if(d.includes(".")){let b=d.split(".");c=b[0],p=b.slice(1)}s.addEventListener(c.substring(2).toLowerCase(),h,p)}else{let c=e.constructor.props;c&&c[d]?(e.props||(e.props={}),e.props[d]=h):typeof h=="function"||h instanceof f||h?._root||h?._children?s.addSlot(d,h):(e.props||(e.props={}),e.props[d]=h)}}}return s}a(rt,"createMountable");f.prototype._addChild=function(i){return Q(this)._addChild(i)};f.prototype._prependChild=function(i){return Q(this)._prependChild(i)};f.prototype.text=function(i){let e=fe(i);return e instanceof u?this._addChild(new ge(this._dot,e)):this._addChild(new T(e))};f.prototype.html=function(i){return this.append(i)};f.prototype.h=function(i){return this.append(i)};f.prototype.md=function(i){return this.text(i)};f.prototype.slot=function(i,e){let t=z(this._getLastChild());return t&&(t instanceof j||l(t,"component"))?(typeof i!="string"&&i!==void 0&&(e=i,i="default"),t.addSlot(i||"default",e),this):(typeof i!="string"&&i!==void 0&&(e=i,i=void 0),this._addChild(new ce(this._dot,i,e)))};f.prototype.mount=function(i,...e){return this._addChild(rt(this._dot,i,e))};f.prototype.append=function(i){let e=z(this);return e&&(e instanceof x||l(e,"element"))?(e.children.mount(i),this):this.mount(i)};f.prototype.prepend=function(i){let e=z(this);return e&&(e instanceof x||l(e,"element"))?(e.children.prepend(i),this):this._prependChild(rt(this._dot,i,[]))};f.prototype.when=function(i,e){let t=new oe(this._dot),n;return e instanceof f||l(e,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])?n=e:typeof e=="object"&&e?.build?(n=new R(this._dot),n.mount(e)):(n=new R(this._dot),n._children.push(new T(fe(e)))),t.addCondition(fe(i),n),this._addChild(t)};f.prototype.each=function(i,e){let t=new re(this._dot,fe(i),e);return this._addChild(t)};f.prototype.otherwiseWhen=function(i,e,t=!1){let n=this._getLastChild();if(n&&(n instanceof oe||l(n,"conditional"))){let s;e instanceof f||l(e,["vdom","container","element","fragment","component","html","text","reactive","conditional","collection","slot"])?s=e:typeof e=="object"&&e?.build?(s=new R(this._dot),s.mount(e)):s=new T(fe(e)),n.addCondition(fe(i),s,t)}else throw new Error("Can't branch off of a non-conditional node.");return this};f.prototype.otherwise=function(i){return this.otherwiseWhen(!0,i,!0)};f.prototype.attr=function(i,e){let t=z(this._getLastChild()||this);if(t&&(t instanceof v||l(t,"container"))&&t._parent&&(t._parent instanceof x||l(t._parent,"element"))&&(t=t._parent),t&&(t instanceof x||l(t,"element")))t.setAttr(i,e);else throw new Error(`Invalid node to set ${i} attribute.`);return this};f.prototype.style=function(i){if(typeof i=="function"){let e=new V;i(e),this.attr("style",e)}else this.attr("style",i);return this};f.prototype.on=function(i,e){let t=z(this._getLastChild()||this);if(t&&(t instanceof v||l(t,"container"))&&t._parent&&(t._parent instanceof x||l(t._parent,"element"))&&(t=t._parent),t&&(t instanceof x||l(t,"element")||t instanceof j||l(t,"component")))t.addEventListener(i,e);else throw new Error(`Invalid node to set ${i} listener.`);return this};f.prototype.onEnter=function(i){let e=z(this._getLastChild()||this);if(e&&(e instanceof v||l(e,"container"))&&e._parent&&(e._parent instanceof x||l(e._parent,"element"))&&(e=e._parent),e&&(e._onEnterHook=i,e._isRendered)){let n=e._getNodes().find(s=>s instanceof HTMLElement);n&&i(n)}return this};f.prototype.onLeave=function(i){let e=z(this._getLastChild()||this);return e&&(e instanceof v||l(e,"container"))&&e._parent&&(e._parent instanceof x||l(e._parent,"element"))&&(e=e._parent),e&&(e._onLeaveHook=i),this};f.prototype.empty=function(){let i=z(this),e=i instanceof v||l(i,"container")?i:i instanceof x||l(i,"element")?i.children:i instanceof R||l(i,"fragment")?i:null;return e&&(e._unrender(),(e instanceof v||l(e,"container")||e instanceof R||l(e,"fragment"))&&(e._children=[]),e._isRendered=!0,e instanceof v||l(e,"container")?e.element?e.element.innerHTML="":e._parent&&(e._parent instanceof x||l(e._parent,"element"))&&e._parent.element&&(e._parent.element.innerHTML=""):(e instanceof x||l(e,"element"))&&e.element&&(e.element.innerHTML="")),this};f.prototype.remove=function(){let i=z(this);(i instanceof v||l(i,"container"))&&i._parent&&(i._parent instanceof x||l(i._parent,"element"))?i._parent._unrender():i._unrender()};f.prototype.fade=function(i=300){return this.onEnter(e=>{e.animate([{opacity:0},{opacity:1}],{duration:i})}).onLeave(async e=>{await e.animate([{opacity:1},{opacity:0}],{duration:i}).finished})};f.prototype.slide=function(i=300){return this.onEnter(e=>{e.animate([{height:"0",opacity:0,overflow:"hidden"},{height:e.scrollHeight+"px",opacity:1,overflow:"hidden"}],{duration:i})}).onLeave(async e=>{await e.animate([{height:e.scrollHeight+"px",opacity:1,overflow:"hidden"},{height:"0",opacity:0,overflow:"hidden"}],{duration:i}).finished})};for(let i=0;i<be.length;i++){let e=be[i];f.prototype[e]=function(...t){if(e==="svg"||e==="math")for(let s=0;s<t.length;s++)typeof t[s]=="string"&&(t[s]=new K(t[s],this._dot));let n=Me(this._dot,e,t);return this._addChild(n),e==="svg"||e==="math"?Q(n.children):this}}var st=a((i,e)=>{i[e]=function(){let t=Array.from(arguments);if(e==="svg"||e==="math")for(let n=0;n<t.length;n++)typeof t[n]=="string"&&(t[n]=new K(t[n],i));if(nt.has(e)){let n=Me(i,e,t);return Q(e==="svg"||e==="math"?n.children:n)}else{let n=new v(i);return n[e](...t),Q(n)}}},"makeCoreWrapper"),Vt=a(()=>{let i=a(function(e,t=window){if(e?.ownerDocument?.defaultView){let n=e,s=n[W];return s||(s=new x(i,n.tagName.toLocaleLowerCase()),s.element=n,s._isRendered=!0,s.children._parent=s,s.children._isRendered=!0,n[W]=s),Q(s.children)}else{if(typeof e=="string")return i(t.document.querySelectorAll(e)[0]);throw new Error("Invalid render target.")}},"_dot");i.version=it,i.onError=null,i.state=function(e,t){let n=new m;return n.key=t,n.value=e,n},i.computed=function(e){let t=new E(e),n=F();return n&&n.registerComputed(t),t},i.effect=function(e){let t=new Ce(e),n=F();return n&&(n.registerEffect?n.registerEffect(t):n.registerComputed(t)),()=>t.dispose()},i.component=Xe,i.hmr={swap(e,t){let n=Ge(e);for(let s of n)s._hmrSwap(t)}},i.slot=function(e,t){return typeof e!="string"&&e!==void 0&&(t=e,e=void 0),new ce(i,e,t)},i.getCurrentComponent=F,i.store=Ze,i.getStore=Je,i.clearStores=et,Object.defineProperty(i,"stores",{get:a(()=>tt(),"get")}),i.create=function(e,...t){let n={computedSignals:[],effects:[],disposables:[],registerComputed(r){this.computedSignals.push(r)},registerEffect(r){this.effects.push(r)},registerDisposable(r){this.disposables.push(r)}};k(n);let s;try{s=new e(...t)}finally{L()}return s._trackedComputeds?s._trackedComputeds.push(...n.computedSignals):s._trackedComputeds=n.computedSignals,s._trackedEffects?s._trackedEffects.push(...n.effects):s._trackedEffects=n.effects,s._trackedDisposables?s._trackedDisposables.push(...n.disposables):s._trackedDisposables=n.disposables,s},i.ref=function(){return new he(i)},i.refCollection=function(){return new Ne(i)},i.alpha=function(e,t){return new E(()=>{let n=e instanceof u?e._get():e instanceof m?e.value:e,s=t instanceof u?t._get():t instanceof m?t.value:t,r=Math.round(Math.max(0,Math.min(100,(1-s)*100))*100)/100;return`color-mix(in srgb, ${n}, transparent ${r}%)`})},i.globalStyles=[],i.useGlobalStyles=e=>{let t=Array.isArray(e)?e:[e];for(let n of t)i.globalStyles.push(n),typeof document<"u"&&i.useStyles(document,n)},i.css=new V,i._theme=null,i.setTheme=e=>{i._theme=e},i.useStyles=(e,t)=>{e&&!t&&(typeof e=="string"||e.call&&e.apply)&&(t=e,e=document);let n=Be(t,e);n instanceof e.defaultView?.CSSStyleSheet?e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]:n instanceof HTMLElement&&e.head.appendChild(n)},typeof document<"u"&&new O(i.css).render(document.documentElement),i.window=e=>new Ee(e),i.flushSync=()=>{I.flushSync()},i.setSync=e=>{I.setSync(e)},I.onError=e=>{i.onError?i.onError(e):console.error("DOThtml Error:",e)};for(let e=0;e<be.length;e++){let t=be[e];st(i,t)}for(let e=0;e<Oe.length;e++){let t=Oe[e];st(i,t)}return i},"makeDot"),ot=Vt();U&&typeof window<"u"&&(window.dot=ot);var _=ot;var $e=a(()=>{if(typeof window>"u")return{path:"/",search:"",hash:""};let i=window.location.pathname,e=window.location.search,t=window.location.hash;if(t.startsWith("#/")){let n=t.substring(1),s=n.search(/[?#]/);if(s===-1)i=n,e="",t="";else{i=n.substring(0,s);let r=n.substring(s),o=r.indexOf("#");o===-1?(e=r,t=""):(e=r.substring(0,o),t=r.substring(o))}}return{path:i,search:e,hash:t}},"getRouteInfo"),Re=$e(),D=_.state(Re.path),te=_.state(Re.path),Ie=_.state(Re.search),ne=_.state(Re.hash);function ie(i,e=!1){if(typeof window>"u")return;te.value=D.value,e?window.history.replaceState({},"",i):window.history.pushState({},"",i);let t=$e();D.value=t.path,Ie.value=t.search,ne.value=t.hash}a(ie,"navigate");function at(){return _.computed(()=>{let i=Ie.value,e=new URLSearchParams(i),t={};return e.forEach((n,s)=>{t[s]=n}),t})}a(at,"useQueryParams");function lt(){return _.computed(()=>{let i=ne.value;return i.startsWith("#")?i.substring(1):i})}a(lt,"useHash");if(typeof window<"u"){let i=a(()=>{let e=$e();te.value=D.value,D.value=e.path,Ie.value=e.search,ne.value=e.hash},"updateState");window.addEventListener("popstate",i),window.addEventListener("hashchange",i)}var Fe=[],Ve=[],dt=_.state([]);function kt(i){dt.value=i}a(kt,"setGlobalRoutes");function ht(){return dt.value}a(ht,"getGlobalRoutes");function Lt(i,e,t=""){let s=(e.startsWith(t)?e.slice(t.length):e).split("/").filter(r=>r!=="");for(let r of i){let o=r.path.split("/").filter(b=>b!==""),d={},h=!0,c=o.indexOf("*")!==-1,p=!!(r.children&&r.children.length>0);if(!(!c&&!p&&o.length!==s.length)&&!(o.length>s.length)){for(let b=0;b<o.length;b++){let C=o[b],g=s[b];if(C==="*"){h=!0;break}if(g===void 0){h=!1;break}if(C!=="+"){if(C.startsWith("{")&&C.endsWith("}")){let y=C.slice(1,-1);d[y]=g;continue}if(C.startsWith(":")){let y=C.slice(1);d[y]=g;continue}if(C!==g){h=!1;break}}}if(h){let b=s.slice(0,o.length),C=(t.endsWith("/")?t.slice(0,-1):t)+"/"+b.join("/");return{route:r,params:d,matchedPath:C}}}}return null}a(Lt,"matchRoute");var ke=_.component(class{static props={routes:{type:Array,required:!0},notFound:{type:Object,default:null},loading:{type:Object,default:null},basePath:{type:String,default:""}};props;resolvedComponent=_.state(null);currentMatch=null;lastPath="";subId=-1;loaderCache=new Map;mounting(){this.subId=D.subscribe(()=>{this._?.cvdom.requestUpdate()})}unmounting(){D.unsubscribe(this.subId)}build(i){kt(this.props.routes);let e=D.value,t=Lt(this.props.routes,e,this.props.basePath);this.currentMatch=t;let n=a(o=>{if(!t)return;let d=t.route.title;if(typeof d=="function"&&(d=d(t.params)),d&&(document.title=d),typeof o=="function"&&!o.prototype?.build){if(this.loaderCache.has(o)){this.resolvedComponent.value=this.loaderCache.get(o),Ve.forEach(c=>c(e,te.value));return}let h=o();if(h instanceof Promise){h.then(c=>{let p=c.default||c;this.loaderCache.set(o,p),this.resolvedComponent.value=p,this._?.cvdom.requestUpdate(),Ve.forEach(b=>b(e,te.value))}),this.resolvedComponent.value=this.props.loading||i.div("Loading...");return}}this.resolvedComponent.value=o,Ve.forEach(h=>h(e,te.value))},"proceed");if(!t)this.resolvedComponent.value=this.props.notFound||i.div("404 - Not Found");else if(t.route.redirect){let o=typeof t.route.redirect=="function"?t.route.redirect(t.params):t.route.redirect;return ie(o,!0),i.div()}else{let o=[...Fe];t.route.beforeEnter&&o.push(t.route.beforeEnter);let d=a(async h=>{if(h>=o.length){n(t.route.component);return}let c=o[h],p=!1,b=a(g=>{p||(p=!0,g===!1?ie(te.value,!0):typeof g=="string"?ie(g,!0):d(h+1))},"handleNext"),C=c(e,te.value,b);if(C instanceof Promise){let g=await C;p||(g===!1||typeof g=="string"?b(g):b())}else C!==void 0&&!p&&b(C)},"runGuards");d(0)}let s=this.resolvedComponent.value;if(!s)return i.div();let r=this.currentMatch;return typeof s=="function"&&s.prototype?.build?i.mount(new s,{routeParams:r?.params,basePath:r?.matchedPath}):typeof s=="object"&&s.build?i.mount(s,{routeParams:r?.params,basePath:r?.matchedPath}):s instanceof f?s:i.div(s)}});ke.beforeEach=i=>{Fe.push(i)};ke.afterEach=i=>{Ve.push(i)};ke.clearHooks=()=>{Fe.length=0,Ve.length=0};function We(i,e,t={},n=""){for(let s of i){let r=(n.endsWith("/")?n.slice(0,-1):n)+(s.path.startsWith("/")?"":"/")+s.path;if(s.name===e){let o=r;for(let d in t){let h=t[d];o=o.replace(new RegExp(`\\{${d}\\}`,"g"),h),o=o.replace(new RegExp(`:${d}`,"g"),h)}return o}if(s.children){let o=We(s.children,e,t,r);if(o)return o}}return null}a(We,"generatePath");var ct=_.component(class{static props={to:{type:String,default:""},name:{type:String,default:""},params:{type:Object,default:a(()=>({}),"default")},activeClass:{type:String,default:"active"},exact:{type:Boolean,default:!1},label:{type:String,default:""}};props;slots;getResolvedPath(){return this.props.name?We(ht(),this.props.name,this.props.params)||"":this.props.to}build(){let i=_.computed(()=>this.getResolvedPath());return _.a({hRef:i,class:_.computed(()=>{let e=D.value,t=i.value;return t.startsWith("#/")?t=t.substring(1).split(/[?#]/)[0]:t=t.split(/[?#]/)[0],(this.props.exact?e===t:e.startsWith(t))?this.props.activeClass:""}),onClick:a(e=>{(e.button===0||e.button===void 0)&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(e.preventDefault(),ie(i.value))},"onClick")},this.props.label||this.slots?.default)}});function He(i,e=document){let t=e.getElementById(i);if(t)return t;let n=e.querySelectorAll("*");for(let s=0;s<n.length;s++){let r=n[s].shadowRoot;if(r&&(t=He(i,r),t))return t}return null}a(He,"getElementByIdDeep");var ft=new Map,Te=null;function Pt(i,e=!1){let t=ne.value;if(t&&t.startsWith("#")){let s=t.substring(1),r=He(s);if(r){let o=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;r.scrollIntoView({behavior:e&&!o?"smooth":"auto"});return}}let n=ft.get(i);n?window.scrollTo(n.x,n.y):window.scrollTo(0,0)}a(Pt,"performScroll");function ut(i,e){Te&&clearTimeout(Te),Te=setTimeout(()=>{Pt(i,e),Te=null},0)}a(ut,"scheduleScroll");function pt(){if(typeof window>"u")return;window.addEventListener("scroll",()=>{ft.set(D.value,{x:window.pageXOffset,y:window.pageYOffset})},{passive:!0}),_.computed(()=>({path:D.value,hash:ne.value})).subscribe(e=>{ut(e.path,!0)}),ut(D.value,!1)}a(pt,"initScrollManager");var mt=class{static{a(this,"DotComponent")}props;refs={};_;constructor(e){this.props=e||{}}emit(e,t){}effect(e){_.effect(e)}};pt();_.currentPath=D;_.currentSearch=Ie;_.currentHash=ne;_.navigate=ie;_.useQueryParams=at;_.useHash=lt;_.Router=ke;_.Link=ct;window.dot=_;document._dotId="default";export{mt as DotComponent,ct as Link,S as Priority,ke as Router,ne as currentHash,D as currentPath,Ie as currentSearch,_ as dot,We as generatePath,ht as getGlobalRoutes,pt as initScrollManager,Lt as matchRoute,ie as navigate,te as previousPath,kt as setGlobalRoutes,lt as useHash,at as useQueryParams};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|