@base-framework/base 3.9.20 → 3.9.21

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/base.js CHANGED
@@ -1,2 +1,2 @@
1
- var at=class{static toArray(t){return Array.from(t)}static inArray(t,e,s){return Array.isArray(t)?t.indexOf(e,s):-1}};var qs=Object.prototype.toString,xt=Object.prototype.hasOwnProperty,S={create(r){return Object.create(r||null)},extendObject(r,t){if(!r||typeof r!="object"||!t||typeof t!="object")return!1;for(let e in r)xt.call(r,e)&&!xt.call(t,e)&&(t[e]=r[e]);return t},clone(r){if(!r||typeof r!="object")return{};try{return structuredClone(r)}catch{return JSON.parse(JSON.stringify(r))}},getClassObject(r){return typeof r=="function"?r.prototype:r},extendClass(r,t){let e=this.getClassObject(r),s=this.getClassObject(t);if(typeof e!="object"||typeof s!="object")return!1;let n=Object.create(e);for(let i in s)n[i]=s[i];return n},hasOwnProp(r,t){return xt.call(r,t)},isPlainObject(r){return!!r&&qs.call(r)==="[object Object]"},isEmpty(r){if(!r||typeof r!="object"||Array.isArray(r))return!0;if(r instanceof Map||r instanceof Set)return r.size===0;for(let t in r)if(xt.call(r,t))return!1;return!0}};var k=class{static getType(t){let e=typeof t;return e!=="object"?e:Array.isArray(t)?"array":"object"}static isUndefined(t){return typeof t>"u"}static isObject(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}static isFunction(t){return typeof t=="function"}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}};var ct={types:{},add(r,t){this.types[r]=t},get(r){return this.types[r]||!1},remove(r){delete this.types[r]}};var St=class{constructor(){this.types=new Map}add(t,e){let s=this.types.get(t);s||(s=[],this.types.set(t,s)),s.push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeType(t){let e=this.types.get(t);if(!e)return;if(!e.length){this.types.delete(t);return}let s,n=ct.get(t);if(n){for(let i=0,o=e.length;i<o;i++)s=e[i],s&&(e[i]=null,typeof n=="function"&&n(s));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}let e=this.types.keys();for(let s of e)s&&this.removeType(s);this.types.clear()}};var $=new WeakMap,p=class{static trackers=new Map;static trackingCount=0;static addType(t,e){ct.add(t,e)}static removeType(t){ct.remove(t)}static getTrackingId(t){if(!t||typeof t!="object")return"";let e=$.get(t);return e||(e="dt"+this.trackingCount++,$.set(t,e)),e}static add(t,e,s){let n=this.getTrackingId(t);this.find(n).add(e,s)}static get(t,e){let s=$.get(t),n=this.trackers.get(s);return n?e?n.get(e):n:!1}static has(t,e){let s=this.getTrackingId(t);if(!s)return!1;let n=this.trackers.get(s);return n&&e?n.has(e):!1}static find(t){let e=this.trackers.get(t);return e||(e=new St,this.trackers.set(t,e)),e}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let s=$.get(t);if(!s)return;let n=this.trackers.get(s);if(n){if(!e){n.remove(),this.trackers.delete(s),$.delete(t);return}n.remove(e),this.isEmpty(n.types)&&(this.trackers.delete(s),$.delete(t))}}};var d={getEvents(r){return typeof r!="object"||r===null?[]:p.get(r,"events")},create(r,t,e,s=!1,n=!1,i=null){return{event:r,obj:t,fn:e,capture:s,swapped:n,originalFn:i}},on(r,t,e,s){if(Array.isArray(r))for(let n=0,i=r.length;n<i;n++)this.add(r[n],t,e,s);else this.add(r,t,e,s);return this},off(r,t,e,s){if(Array.isArray(r))for(let n=0,i=r.length;n<i;n++)this.remove(r[n],t,e,s);else this.remove(r,t,e,s);return this},add(r,t,e,s=!1,n=!1,i=null){if(typeof t!="object"||t===null)return this;let o=this.create(r,t,e,s,n,i);return p.add(t,"events",o),t.addEventListener(r,e,s),this},remove(r,t,e,s=!1){let n=this.getEvent(r,t,e,s);if(n===!1)return this;if(typeof n=="object"){this.removeEvent(n);let i=this.getEvents(t);if(i){let o=i.indexOf(n);o>-1&&i.splice(o,1),i.length===0&&p.remove(t,"events")}}return this},removeEvent(r){return typeof r=="object"&&r.obj.removeEventListener(r.event,r.fn,r.capture),this},getEvent(r,t,e,s){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(r,t,e,s);return this.search(i,n)},search(r,t){let e,s=this.isSwappable(r.event);for(let n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==r.event||e.obj!==r.obj)&&(e.fn===r.fn||s===!0&&e.originalFn===r.fn))return e;return!1},removeEvents(r){return typeof r!="object"||r===null?this:(p.remove(r,"events"),this)},swap:new Set(["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"]),addSwapped(r){this.swap.add(r)},isSwappable(r){return this.swap.has(r)}};p.addType("events",r=>{d.removeEvent(r)});var Ae={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},Ce=Object.keys(Ae),zs={events:d,addListener(r,t,e,s){return this.events.add(r,t,e,s),this},on(r,t,e,s){let n=this.events;if(Array.isArray(r))for(let i=0,o=r.length;i<o;i++)n.add(r[i],t,e,s);else n.add(r,t,e,s);return this},off(r,t,e,s){let n=this.events;if(Array.isArray(r))for(let i=0,o=r.length;i<o;i++)n.remove(r[i],t,e,s);else n.remove(r,t,e,s);return this},removeListener(r,t,e,s){return this.events.remove(r,t,e,s),this},_createEvent(r,t,e,s){let n;switch(t){case"HTMLEvents":n=new Event(r,e);break;case"MouseEvents":n=new MouseEvent(r,e);break;default:n=new CustomEvent(r,s);break}return n},createEvent(r,t,e,s){if(typeof t!="object"||t===null)return!1;let n={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0,relatedTarget:null};typeof e=="object"&&e!==null&&(n=Object.assign(n,e));let i=this._getEventType(r);return this._createEvent(r,i,n,s)},_getEventType(r){for(let t=0,e=Ce.length;t<e;t++){let s=Ce[t];if(Ae[s].test(r))return s}return"CustomEvent"},trigger(r,t,e){if(typeof t!="object"||t===null)return this;let s=typeof r=="string"?this.createEvent(r,t,null,e):r;return t.dispatchEvent(s),this},mouseWheelEventType:null,getWheelEventType(){let r=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=r())},onMouseWheel(r,t,e,s=!1){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof r=="function"&&r(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,s,!0,r),this},offMouseWheel(r,t,e=!1){typeof t>"u"&&(t=window);let s=this.getWheelEventType();return this.off(s,t,r,e),this},preventDefault(r){return typeof r.preventDefault=="function"?r.preventDefault():r.returnValue=!1,this},stopPropagation(r){return typeof r.stopPropagation=="function"?r.stopPropagation():r.cancelBubble=!0,this}};var lt=class{constructor(){this.errors=[],this.dataTracker=p}augment(t){if(!k.isObject(t))return this;let e=this.constructor.prototype;for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return this}override(t,e,s,n){return(t[e]=s).apply(t,at.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,s){if(k.isObject(t)===!1)return"";let n=t[e];return typeof n<"u"?n:typeof s<"u"?s:""}createCallBack(t,e,s=[],n=!1){return typeof e!="function"?!1:(...i)=>(n===!0&&(s=s.concat(i)),e.apply(t,s))}bind(t,e){return e.bind(t)}};lt.prototype.extend=(function(){return lt.prototype})();var N=new lt;var ut={url:"",responseType:"json",method:"POST",fixedParams:"",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},beforeSend:[],async:!0,crossDomain:!1,withCredentials:!1,completed:null,failed:null,aborted:null,progress:null};var Te=()=>{N.augment({xhrSettings:ut,addFixedParams(r){this.xhrSettings.fixedParams=r},beforeSend(r){this.xhrSettings.beforeSend.push(r)},ajaxSettings(r){typeof r=="object"&&(this.xhrSettings=S.extendClass(N.xhrSettings,r))},resetAjaxSettings(){this.xhrSettings=ut}})};var w=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,s=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let n={},i=/([^?=&]+)(=([^&]*))?/g;return t.replace(i,function(o,a,c,l){let u=l===void 0?"":l;if(e!==!1)try{n[a]=decodeURIComponent(u)}catch{n[a]=u}else n[a]=u}),n}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,s=>s[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let s=/([A-Z]{1,})/g;return t.replace(s,n=>e+n.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())}};var kt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:s,url:n,async:i}=this.settings;e.open(s,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=ut.beforeSend;if(t.length<1)return;let e=this.xhr,s=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];o&&o(e,s)}}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e.join("&")}setupParams(t,e=null){let s=typeof t;if(!e)return!(t instanceof FormData)&&s==="object"&&(t=this.objectToString(t)),t;let n=typeof e;if(s==="string")return n!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(n==="string"&&(e=w.parseQueryString(e,!1)),t instanceof FormData)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.append(i,e[i]);else s==="object"&&(t=Object.assign({},e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,s=t.params;return s?s=this.setupParams(s,e):e&&(s=this.setupParams(e)),s}getXhrSettings(t){let e=this.settings={...N.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var s=0,n=t.length;s<n;s++){var i=t[s];switch(s){case 0:e.url=i;break;case 1:e.params=i;break;case 2:e.completed=i,e.failed=i;break;case 3:e.responseType=i||"json";break;case 4:e.method=i?i.toUpperCase():"POST";break;case 5:e.async=typeof i<"u"?i:!0;break}}else e=this.settings=S.extendClass(this.settings,t[0]),typeof e.completed=="function"&&(typeof e.failed!="function"&&(e.failed=e.completed),typeof e.aborted!="function"&&(e.aborted=e.failed))}createXHR(){let t=this.settings,e=new XMLHttpRequest;return e.responseType=t.responseType,t.withCredentials===!0&&(e.withCredentials=!0),e}setupHeaders(){let t=this.settings;if(!t||typeof t.headers!="object")return;let e=t.headers;for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.xhr?.setRequestHeader(s,e[s])}update(t,e){let s=this.xhr,n=()=>{d.removeEvents(s?.upload),d.removeEvents(s)},i=this.settings;if(!i)return!1;switch(e||t.type){case"load":{if((s?.status??0)>=400){typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break}if(typeof i.completed=="function"){let c=this.getResponseData();i.completed(c,this.xhr)}n();break}case"error":typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break;case"progress":typeof i.progress=="function"&&i.progress(t);break;case"abort":typeof i.aborted=="function"&&i.aborted(!1,this.xhr),n();break}}getResponseData(){let t=this.xhr;if(!t)return null;let e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let e=this.xhr;if(!e)return;let s=this.update.bind(this);d.on(["load","error","abort"],e,s),d.on("progress",e.upload,s)}};Te();var ht=(...r)=>new kt(r).xhr;var Ks=(r,t)=>{if(r===t)return!1;try{return JSON.stringify(r)!==JSON.stringify(t)}catch{return!0}},te=class{constructor({max:t=100,ttl:e=3e4}={}){this.entries=new Map,this.max=t,this.defaultTtl=e}get size(){return this.entries.size}setMax(t){this.max=Math.max(1,Number(t)||1),this.evict()}getEntry(t){let e=this.entries.get(t);return e?(this.entries.delete(t),this.entries.set(t,e),e):null}createEntry(t){let e={value:void 0,meta:null,time:0,ttl:this.defaultTtl,hasValue:!1,promise:null};return this.entries.delete(t),this.entries.set(t,e),this.evict(),e}evict(){let t=Math.max(1,this.max);for(;this.entries.size>t;){let e=this.entries.keys().next().value;this.entries.delete(e)}}isFresh(t){return!!t&&t.hasValue&&Date.now()-t.time<t.ttl}has(t){return this.isFresh(this.entries.get(t)||null)}get(t){let e=this.getEntry(t);return this.isFresh(e)?e.value:void 0}set(t,e,s,n=null){let i=this.getEntry(t)||this.createEntry(t);i.value=e,i.meta=n,i.time=Date.now(),i.ttl=typeof s=="number"?s:this.defaultTtl,i.hasValue=!0}invalidate(t){if(Array.isArray(t))return t.reduce((n,i)=>n+this.invalidate(i),0);let e=null;if(typeof t=="string"?e=n=>n.startsWith(t):t instanceof RegExp?e=n=>t.test(n):typeof t=="function"&&(e=t),!e)return 0;let s=0;for(let[n,i]of Array.from(this.entries))e(n,i)&&(this.entries.delete(n),s++);return s}clear(){this.entries.clear()}fetch(t,e,s,n){let i,o=e.promise=new Promise(l=>i=l),a=!1,c=(l,u,h)=>{a||(a=!0,i({ok:l===!0,value:u,meta:h}))};o.then(l=>{if(e.promise===o&&(e.promise=null),this.entries.get(t)===e){if(l.ok){e.value=l.value,e.meta=l.meta,e.time=Date.now(),e.ttl=n,e.hasValue=!0;return}e.hasValue||this.entries.delete(t)}});try{return s(c)}catch(l){return c(!1,void 0,l),null}}resolve(t,e,s,n){s=s||{};let i=typeof s.ttl=="number"?s.ttl:this.defaultTtl,o=this.getEntry(t);if(o&&o.hasValue){if(this.isFresh(o)){let{value:c,meta:l}=o;return queueMicrotask(()=>n(c,l,!0)),null}if(s.swr===!0){let{value:c,meta:l}=o;queueMicrotask(()=>n(c,l,!0));let u=o.promise?null:this.fetch(t,o,e,i);return o.promise.then(h=>{h.ok&&Ks(c,h.value)&&n(h.value,h.meta,!0)}),u}}if(o&&o.promise)return o.promise.then(c=>n(c.value,c.meta,c.ok)),null;o=o||this.createEntry(t);let a=this.fetch(t,o,e,i);return o.promise.then(c=>n(c.value,c.meta,c.ok)),a}load(t,e,s={}){return new Promise((n,i)=>{let o=!0,a=c=>{Promise.resolve().then(e).then(l=>c(!0,l,null),l=>c(!1,void 0,l))};this.resolve(t,a,s,(c,l,u)=>{if(o)return o=!1,u?n(c):i(l);typeof s.onUpdate=="function"&&s.onUpdate(c)})})}},wt=new te;var Vs=r=>{let t=typeof r;return t!=="string"&&t!=="number"?r:Ee(r)},Ee=r=>[{tag:"text",textContent:r}],Pe=()=>({props:{},children:[]}),De=r=>({props:{},children:Ee(r)}),Me=r=>({props:{},children:r}),Ie=r=>({props:r[0]||{},children:Vs(r[1])});var v=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t,this.evictCount=t>=8?t>>3:1}get(t){let e=this.cache.get(t);if(e!==void 0)return e.used=!0,e.value}has(t){return this.cache.has(t)}set(t,e){let s=this.cache,n=s.get(t);if(n!==void 0){n.value=e,n.used=!0;return}s.set(t,{value:e,used:!1}),s.size>this.maxSize&&this.evict()}evict(){let t=this.cache,e=this.maxSize-this.evictCount+1;for(let s=0;s<2&&t.size>e;s++){let n=t.keys(),i=t.size;for(;i-- >0&&t.size>e;){let o=n.next().value,a=t.get(o);if(a!==void 0&&a.used){a.used=!1;continue}t.delete(o)}}}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}};var vt=class{constructor(){this.connections=new Map}add(t,e,s){let n=this.getOrCreate(t),i=n.get(e);return i?Array.isArray(i)?i.push(s):n.set(e,[i,s]):n.set(e,s),s}get(t,e){let s=this.connections.get(t)?.get(e);return s?Array.isArray(s)?s[s.length-1]||!1:s:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let s=this.connections.get(t);if(s)if(e)this.unsubscribe(s.get(e)),s.delete(e),s.size===0&&this.connections.delete(t);else{for(let n of s.values())this.unsubscribe(n);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,s=t.length;e<s;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var Y=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var Ct=class extends Y{constructor(t){super(),this.data=t}subscribe(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribe - data source is null or does not have an "on" method. Make sure your component has data, state, or context.data initialized.',t,this.data);return}this.msg=t,this.token=this.data.on(t,e)}subscribeMany(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribeMany - data source is null or does not have an "on" method.',t,this.data);return}let s=t.length,n=new Array(s);for(let i=0;i<s;i++){let o=t[i];n[i]={msg:o,token:this.data.on(o,e)}}this.subscriptions=n}unsubscribe(){if(this.data){let t=this.subscriptions;if(t){for(let e=0,s=t.length;e<s;e++)this.data.off(t[e].msg,t[e].token);this.subscriptions=null}else this.msg&&this.token&&this.data.off(this.msg,this.token)}this.data=null,this.msg=null,this.token=null}};var j=class{unsubscribe(){}};var ft=class extends j{constructor(){super(),this.source=null}addSource(t){return this.source=new Ct(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var J=class extends Y{constructor(t){super(),this.pubSub=t}subscribe(t){this.msg=t;let e=this.callBack.bind(this);this.token=this.pubSub.on(t,e)}unsubscribe(){this.pubSub&&this.msg&&this.token&&this.pubSub.off(this.msg,this.token),this.pubSub=null,this.msg=null,this.token=null}callBack(){}};var At=class extends J{constructor(t,e,s){super(s),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}unsubscribe(){super.unsubscribe(),this.data=null,this.prop=null}};var X=class{static getById(t){return typeof t!="string"?!1:document.getElementById(t)||!1}static getByName(t){if(typeof t!="string")return!1;let e=document.getElementsByName(t);return e?Array.from(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let s=document.querySelectorAll(t);return s?s.length===1?s[0]:Array.from(s):!1}static html(t,e){return!t||typeof t!="object"?!1:typeof e<"u"?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return!t||typeof t!="object"||typeof e>"u"?this:(e=w.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=w.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let n=null,i=t.currentStyle;if(i&&(n=i[e]))return n;let o=window.getComputedStyle(t,null);return o?o[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return typeof t=="object"&&t!==null&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=w.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,s){e=this.removeDataPrefix(e),e=w.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=w.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(!t||typeof t!="object")return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(!t||typeof t!="object")return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return!t||typeof t!="object"?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return!t||typeof t!="object"?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return typeof t=="object"&&t!==null?t.offsetWidth:!1}static getHeight(t){return typeof t=="object"&&t!==null?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return!t||typeof t!="object"?!1:{left:e-(t.clientLeft||0),top:s-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,s=e.documentElement,n=e.getElementsByTagName("body")[0],i=t.innerWidth||s.clientWidth||n.clientWidth,o=t.innerHeight||s.clientHeight||n.clientHeight;return{width:i,height:o}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(!t||typeof t!="object")return s;let n=0;for(;t&&(e===0||n<e);)n++,s.x+=t.offsetLeft+t.clientLeft,s.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return s}static addClass(t,e){if(!t||typeof t!="object"||e==="")return this;if(typeof e=="string"){let s=e.split(" ");for(let n=0,i=s.length;n<i;n++)t.classList.add(s[n])}return this}static removeClass(t,e){return!t||typeof t!="object"||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return!t||typeof t!="object"||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return!t||typeof t!="object"?this:(t.classList.toggle(e),this)}};var Tt=r=>{let t="textContent";if(!r||typeof r!="object")return t;let e=r.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let s=r.type;if(!s)return t="value",t;switch(s){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var Gs=(r,t,e)=>{X.setAttr(r,t,e)},Qs=(r,t,e)=>{r.checked=r.value==e},$s=(r,t,e)=>{e=e==1,_e(r,t,e)},_e=(r,t,e)=>{r[t]=e},Ys=(r,t)=>X.getAttr(r,t),js=(r,t)=>r[t],Et=class extends J{constructor(t,e,s,n){super(n),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=Gs,this.getValue=Ys,this;this.getValue=js;let s=t.type;if(s)switch(s){case"checkbox":return this.setValue=$s,this;case"radio":return this.setValue=Qs,this}return this.setValue=_e,this}getAttrBind(t){return t||Tt(this.element)}setupFilter(t){let e=/\[\[[^\]]+\]\]/;return s=>t.replace(e,()=>s)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}unsubscribe(){super.unsubscribe(),this.element={},this.attr="",this.filter=null,this.setValue=null,this.getValue=null}};var Pt=class extends j{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new Et(t,e,s,this.pubSub)}addData(t,e){return this.data=new At(t,e,this.pubSub)}unsubscribeSource(t){return t&&t.unsubscribe(),this}unsubscribe(){return this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null,this}};var Js=0,Z=class{constructor(t=!1){this.callBacks=new Map,this.prefixIndex=t?new Map:null,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=2e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[],this.deliveringMessage=null,this.reentrantMessages=null,this.suppressQueue=!1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.prefixIndex?.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.reentrantMessages=null}on(t,e){let s=++Js,n=this.callBacks.get(t);return n||(n=new Map,this.callBacks.set(t,n),this.prefixIndex&&this._indexMessage(t)),n.set(s,e),s}_indexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),n=this.prefixIndex.get(s);n||(n=new Set,this.prefixIndex.set(s,n)),n.add(t)}_unindexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),n=this.prefixIndex.get(s);n&&(n.delete(t),n.size===0&&this.prefixIndex.delete(s))}getPrefixMessages(t){return this.prefixIndex&&this.prefixIndex.get(t)||null}getMessages(){return this.callBacks.keys()}off(t,e){let s=this.callBacks.get(t);s&&(s.delete(e),s.size===0&&(this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t)))}remove(t){this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t)}publish(t,e,s){if(!this.batchingEnabled){this.publishImmediate(t,e,s);return}this.suppressQueue||(t===this.deliveringMessage&&(this.reentrantMessages??=new Set).add(t),this.callBacks.has(t)&&(this.updateQueue.set(t,[e,s]),this.debugMode&&console.log("[DataPubSub] Queued update:",t,e),this.scheduleFlush()))}scheduleFlush(){this.isFlushing||this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){if(this.updateQueue.size===0){this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete();return}if(this.isFlushing||(this.flushIterations=0,this.reentrantMessages=null),this.isFlushing=!0,this.flushScheduled=!1,this.flushIterations++,this.flushIterations>this.maxFlushIterations){console.error("[DataPubSub] Infinite loop detected! Flush iterations exceeded",this.maxFlushIterations,"- Breaking to prevent memory exhaustion."),console.error("[DataPubSub] Queue size:",this.updateQueue.size),console.error("[DataPubSub] Queued messages:",Array.from(this.updateQueue.keys())),this._breakCascade(),this.flushScheduled=!1,this.isFlushing=!1,this._resolveFlushComplete(),this.flushIterations=0;return}this.debugMode&&console.log("[DataPubSub] Flushing",this.updateQueue.size,"updates (iteration",this.flushIterations+")");let t=this.updateQueue;this.updateQueue=new Map;try{for(let[e,s]of t)this.publishImmediate(e,s[0],s[1])}finally{this.debugMode&&console.log("[DataPubSub] Flush complete (iteration",this.flushIterations+")"),this.updateQueue.size>0?(this.debugMode&&console.log("[DataPubSub] New updates queued during flush, re-flushing..."),this.flush()):(this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete())}}_breakCascade(){let t=this.updateQueue;this.updateQueue=new Map;let e=this.reentrantMessages;this.suppressQueue=!0;try{for(let[s,n]of t)e&&e.has(s)||this.publishImmediate(s,n[0],n[1])}finally{this.suppressQueue=!1,this.reentrantMessages=null,this.updateQueue.clear()}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}}nextFlush(){return new Promise(t=>{this.flushCompleteResolvers.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>t())})}onFlush(t){if(typeof t!="function"){console.warn("[DataPubSub] onFlush requires a function callback");return}this.flushCallbacks.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>{if(this.flushCallbacks.length>0){let e=this.flushCallbacks;this.flushCallbacks=[];let s=e.length;for(let n=0;n<s;n++)e[n]()}})}flushSync(){this.flush()}publishImmediate(t,e,s){let n=this.callBacks.get(t);if(!n)return;let i=this.deliveringMessage;this.deliveringMessage=t;for(let o of n.values())if(o)try{o(e,s)}catch(a){console.error('[DataPubSub] Subscriber error for "'+t+'":',a)}this.deliveringMessage=i}};var ee=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new vt,this.pubSub=new Z(!0),this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,n){let i=s,o=null,a=s.indexOf(":");a!==-1&&(o=s.substring(0,a),i=s.substring(a+1));let c=o??"",l=this.setupConnection(t,e,i,c,n),u=l.element,h=e.get(i);return typeof h<"u"?u.set(h):(h=u.get(),h!==""&&l.data.set(h)),this}setupConnection(t,e,s,n,i){let o=this.getBindId(t),a=new Pt(this.pubSub);a.addData(e,s).subscribe(o);let u=`${e.getDataId()}:${s}`;return a.addElement(t,n,i).subscribe(u),this.addConnection(o,"bind",a),a}addConnection(t,e,s){return this.connections.add(t,e,s),this}setBindId(t){let e="db-"+this.idCount++;return t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){let e=t[this.attr];return e&&this.connections.remove(e),this}watch(t,e,s,n){if(k.isObject(t)===!1)return this;let i=new ft,o=e.get(s),a=!0,c=f=>{a&&(a=!1,f===o&&(f===null||typeof f!="object"))||n(f)};i.addSource(e).subscribe(s,c);let u=this.getBindId(t),h=e.getDataId()+":"+s;return this.addConnection(u,h,i),n(o),this}watchMany(t,e,s,n){if(k.isObject(t)===!1)return this;let i=s?s.length:0;if(i===0)return this;if(i===1)return this.watch(t,e,s[0],n);let o=new ft,a=o.addSource(e),c=new Array(i),l=new Array(i);for(let m=0;m<i;m++)c[m]=e.get(s[m]),l[m]=!0;let u=new Array(i);for(let m=0;m<i;m++){let x=m,_=c[m];u[m]=Q=>{l[x]&&(l[x]=!1,Q===_&&(Q===null||typeof Q!="object"))||n(Q)}}if(typeof e.on!="function")return console.warn('DataBinder.watchMany: data source has no "on" method.',e),this;let h=new Array(i);for(let m=0;m<i;m++)h[m]={msg:s[m],token:e.on(s[m],u[m])};a.subscriptions=h;let f=this.getBindId(t),g=e.getDataId()+":"+s.join(",");return this.addConnection(f,g,o),n(c[0]),this}unwatch(t,e,s){if(k.isObject(t)===!1)return this;let n=t[this.attr];if(n){let i=e.getDataId()+":"+s;this.connections.remove(n,i)}return this}publish(t,e,s){return this.pubSub.publish(t,e,s),this}getPrefixMessages(t){return this.pubSub.getPrefixMessages(t)}isDataBound(t){if(!t)return null;let e=t[this.attr];return e||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.has(t.keyCode)}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,s=this.isDataBound(e);if(s!==null){let n=this.connections.get(s,"bind");if(n){let i=n.element.get();this.pubSub.publish(s,i,e)}}}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&d.on(["change","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&d.off(["change","input"],document,this.changeHandler,!1)}},b=new ee;var Xs=new Map([["class","className"],["text","textContent"],["for","htmlFor"],["readonly","readOnly"],["maxlength","maxLength"],["cellspacing","cellSpacing"],["rowspan","rowSpan"],["colspan","colSpan"],["tabindex","tabIndex"],["celpadding","cellPadding"],["useMap","useMap"],["frameborder","frameBorder"],["contenteditable","contentEditable"]]),W=r=>Xs.get(r)||r,se=r=>typeof r=="string"&&r.charCodeAt(0)===111&&r.charCodeAt(1)===110?r.substring(2):r,Zs=/(?:<[a-z][\s\S]*>)/i,D=class{static create(t,e,s,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(s,i):this.append(s,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return;let s=e.type;s!==void 0&&t.setAttribute("type",s);let n=Object.keys(e);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=e[a];a==="innerHTML"?t.innerHTML=c:a.indexOf("-")!==-1?t.setAttribute(a,c):this.addAttr(t,a,c)}}static addHtml(t,e){return typeof e>"u"||e===""?this:(Zs.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(s===""||!e)return;if(typeof s==="function")e=se(e),s.originalCallback?d.add(e,t,s,!1,!0,s.originalCallback):d.add(e,t,s);else{let i=W(e);t[i]=s}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let s=document.createTextNode(t);return e&&this.append(e,s),s}static createComment(t,e){let s=document.createComment(t);return e&&this.append(e,s),s}static setupSelectOptions(t,e,s){if(!t||typeof t!="object"||!Array.isArray(e))return!1;e.forEach(n=>{let i=new Option(n.label,n.value);t.options.add(i),s!==null&&i.value==s&&(i.selected=!0)})}static removeElementData(t){let e=[t];for(;e.length>0;){let s=e.pop(),n=s.childNodes;if(n&&n.length>0)for(let i=n.length-1;i>=0;i--){let o=n[i];(o.nodeType!==3||o.bindId)&&e.push(o)}p.remove(s),s.bindId&&b.unbind(s)}}static removeElement(t){if(!t)return this;let e=p.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!t||typeof t!="object")return this;let e;for(;e=t.firstChild;)this.removeElementData(e),t.removeChild(e);return this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,s){let n=s||t.firstChild;return t.insertBefore(e,n),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var M=r=>r?r.data?r.data:r.context&&r.context.data?r.context.data:r.state?r.state:null:null;var C=class extends D{static create(t,e,s,n){let i=document.createElement(t);return this.addAttributes(i,e,n),s.appendChild(i),i}static addAttributes(t,e,s){if(!(!e||e.length<1))for(let n=0,i=e.length;n<i;n++){let o=e[n];this.addAttr(t,o.key,o.value,s)}}static addAttr(t,e,s,n){if(s===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=s;return}if(typeof s==="function"){if(e=se(e),s.originalCallback)d.add(e,t,s,!1,!0,s.originalCallback);else{let a=s,c=function(l){a.call(this,l,n)};d.add(e,t,c,!1,!0,a)}return}if(e.charCodeAt(4)===45){t.setAttribute(e,s);return}let o=W(e);t[o]=s}static addContent(t,e){e&&(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var Re=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,Oe=new v(1e3),tr=new Set(["disabled","checked","required","selected","hidden","readonly","readOnly","multiple","open","autofocus","inert"]),er=r=>typeof r=="string"?r!==""&&r!=="false":!!r,sr=(r,t)=>{if(t.charCodeAt(4)===45){r.removeAttribute(t);return}let e=W(t);if(e in r){r[e]="";return}r.removeAttribute(t)},T={isWatching(r){if(Array.isArray(r)){let t=r[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(r)},hasParams(r){return typeof r=="string"&&r.includes("[[")},_getWatcherProps(r){let t=Oe.get(r);if(t!==void 0)return t;let e=r.match(Re),s=e?e.map(n=>n.slice(2,-2)):null;return Oe.set(r,s),s},updateAttr(r,t,e){switch(t){case"text":case"textContent":r.textContent=e;break;case"disabled":case"checked":case"required":case"selected":case"hidden":case"readonly":case"readOnly":case"multiple":case"open":case"autofocus":case"inert":r[t==="readonly"?"readOnly":t]=er(e);break;case"src":if(r.tagName==="IMG"){r.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}r.src=e;break;default:if(e===""&&t){sr(r,t);break}C.addAttr(r,t,e);break}},replaceParams(r,t,e=!1){let s=0;return r.replace(Re,function(n,i,o){let a=e?t[s]:t;s++;let c=a.get(o);return c??""})},_getWatcherCallBack(r,t,e,s,n){let i=this._getWatcherProps(e);if(i&&i.length===1&&e.length===i[0].length+4){let o=i[0],a=n?t[0]:t;return tr.has(s)?()=>{this.updateAttr(r,s,a.get(o))}:()=>{let c=a.get(o);this.updateAttr(r,s,c!=null?String(c):"")}}return()=>{let o=this.replaceParams(e,t,n);this.updateAttr(r,s,o)}},getValue(r,t){let e=r.value;return Array.isArray(e)===!1?[e,M(t)]:e.length<2?[e[0],M(t)]:e},getPropValues(r,t,e){let s=[];for(let n=0,i=t.length;n<i;n++){let a=(e?r[n]:r).get(t[n])??"";s.push(a)}return s},getCallBack(r,t,e,s,n,i){let o=r.attr||"textContent",a=r.callBack;if(typeof a=="function"){let c=i||this._getWatcherProps(s)||[],l=c.length>1;return(u,h)=>{u=l!==!0?u:this.getPropValues(e,c,n);let f=a(u,t,h);typeof f<"u"&&this.updateAttr(t,o,f)}}return this._getWatcherCallBack(t,e,s,o,n)},addDataWatcher(r,t,e){let s=this.getValue(t,e),n=s[1]??e?.data??e?.context?.data??e?.state??null;if(!n)return;let i=s[0],o=Array.isArray(n),a=this._getWatcherProps(i);if(!a)return;let c=this.getCallBack(t,r,n,i,o,a);if(!o)a.length>1?b.watchMany(r,n,a,c):this.addWatcher(r,n,a[0],c);else for(let l=0,u=a.length;l<u;l++)this.addWatcher(r,n[l],a[l],c)},getWatcherSettings(r,t=null){if(typeof r=="string")return{attr:t,value:r};if(Array.isArray(r)){let e=r[r.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let s=r[1]&&typeof r[1]=="object"?[r[0],r[1]]:[r[0]];return typeof e=="function"?{attr:t,value:s,callBack:e}:{attr:e||"textContent",value:s}}return r},setup(r,t,e){t&&this.addDataWatcher(r,this.getWatcherSettings(t),e)},addWatcher(r,t,e,s){b.watch(r,t,e,s)}};var rr=r=>({props:{watch:r},children:[]}),nr=r=>{if(r.length===0)return Pe();let t=r[0],e=typeof t;if(e==="string"||e==="number")return De(t);if(Array.isArray(t))return T.isWatching(t)?rr(t):Me(t);let s=r[1]??r[0]??[];if(s&&Array.isArray(s)&&T.isWatching(s)){let n=r[0]&&!Array.isArray(r[0])?r[0]:{};r[0]={...n,watch:s},r[1]=[]}return Ie(r)},ir=r=>(...t)=>{let{props:e,children:s}=nr(t);return r(e,s)};var re=new WeakMap,ne=new WeakMap;function Ne(r){if(!r||typeof r!="object")return r;let t=ne.get(r);return t!==void 0?t:r}var Le=new WeakMap;function or(r,t,e,s){let n=re.get(r);n||(n=new Map,re.set(r,n));let i=n.get(e);if(i)return i;let o=new Proxy(r,He(t,e,s));return n.set(e,o),ne.set(o,r),o}function ar(r){r&&typeof r=="object"&&re.delete(r)}function Be(r,t){let e=t.charCodeAt(0),s=e>=48&&e<=57;return r===""?s?"["+t+"]":t:s?r+"["+t+"]":r+"."+t}function He(r,t="",e=""){return{get(s,n,i){let o=s[n];if(t===""&&n in s){if(typeof o=="function"){let c=Le.get(s);c||(c=new Map,Le.set(s,c));let l=c.get(n);if(l)return l;let u=o.bind(s);return c.set(n,u),u}return o}if(o=(s[e]||s)[n],o!==null&&typeof o=="object"){let c=Be(t,n);return or(o,r,c,e)}return o},set(s,n,i,o){if(t===""&&n in s)return s[n]=i,!0;let c=(s[e]||s)[n],l=Be(t,n);return r.set(l,i),c!==i&&c!==null&&typeof c=="object"&&ar(c),!0}}}var Dt=(r,t="stage")=>{let e=new Proxy(r,He(r,"",t));return ne.set(e,r),e};var dt=class{static resume(t,e){if(!t)return null;let s=localStorage.getItem(t);if(s===null)return e!==void 0?e:void 0;try{let n=JSON.parse(s);return n===null&&e!==void 0?e:n}catch(n){return console.warn('[LocalData] Failed to parse stored value for key "'+t+'". Removing corrupted entry.',n),localStorage.removeItem(t),e!==void 0?e:void 0}}static store(t,e){if(!t||!e)return!1;try{let s=JSON.stringify(e);return localStorage.setItem(t,s),!0}catch(s){return console.error('[LocalData] Failed to store data for key "'+t+'".',s),!1}}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Mt=(r={})=>{let t={};if(!k.isObject(r))return t;let e=Object.keys(r);for(let s=0,n=e.length;s<n;s++){let i=e[s],o=r[i];typeof o!="function"&&(t[i]=o)}return t};var cr=0,Ue=new v(2e3),H={CHANGE:"change",DELETE:"delete"},ie=(r,t)=>{let e=Ue.get(r);return e||(e={change:`${r}:change`,delete:`${r}:delete`},Ue.set(r,e)),t==="change"?e.change:e.delete},R=class{constructor(t={}){this.dirty=!1,this._retainState=!1,this._refreshState=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new Z;let e=Mt(t);this.set(e);let s=Dt(this);return this._proxy=s,s}retainState(){return this._retainState=!0,this._proxy||this}refreshState(){return this._refreshState=!0,this._proxy||this}setup(){this.stage={}}_init(){let t=++cr;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}flushPending(){this.eventSub.flush()}getDataId(){return String(this._id)}remove(){this.unlink(),this.eventSub.reset()}on(t,e){let s=ie(t,H.CHANGE);return this.eventSub.on(s,e)}off(t,e){let s=ie(t,H.CHANGE);this.eventSub.off(s,e)}_setAttr(t,e,s=this,n=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,s,H.CHANGE))}publishLocalEvent(t,e,s,n){let i=ie(t,n);this.eventSub.publish(i,e,s)}_publish(t,e,s,n){this.publishLocalEvent(t,e,s,n),s=s||this,b.publish(this._dataId+t,e,s)}set(t,e,s){if(typeof t!="object")return this._setAttr(t,e,s),this;let n=Object.keys(t);for(let i=0;i<n.length;i++){let o=n[i],a=t[o];typeof a!="function"&&this._setAttr(o,a,e,s)}return this}_silentSet(t){let e=this.stage,s=Object.keys(t);for(let n=0,i=s.length;n<i;n++){let o=s[n];e[o]=t[o]}}getModelData(){return this.stage}_deleteAttr(t,e,s=this){delete t[e],this.publishLocalEvent(e,null,s,H.DELETE)}toggle(t){return typeof t>"u"?this:(this.set(t,!this.get(t)),this)}increment(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s+e),this}decrement(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s-e),this}concat(t,e){if(typeof t>"u")return this;let s=this.get(t);return this.set(t,s+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t,e){return this.key=e!=null?t+":v"+e:t,this}resume(t){let e=dt.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return dt.store(String(this.key),t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,s){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,s);let n=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,s){let n=s||e,i=t.get(e);typeof i<"u"&&this.get(n)!==i&&this.set(n,i);let o=t.on(e,(c,l)=>{if(l===this)return!1;this.set(n,c,t)}),a=this.on(n,(c,l)=>{if(l===t)return!1;t.set(e,c,this)});return this.addLink(o,t,e,a),t.addLink(a,this,n,o),o}addLink(t,e,s,n){this.links.set(t,{data:e,attr:s,pair:n})}unlink(t){if(t){this.removeLink(t);return}let e=this.links;e.size!==0&&(e.forEach((s,n)=>{this.removeLink(n,!1)}),e.clear())}removeLink(t,e=!0){let s=this.links.get(t);if(s){let n=s.data;s.attr&&n.off(s.attr,t);let i=s.pair,o=i&&n.links;if(o){let a=o.get(i);a&&(o.delete(i),a.attr&&this.off(a.attr,i))}}e!==!1&&this.links.delete(t)}};R.prototype.isData=!0;var Fe=new Set(["__proto__","prototype","constructor"]),lr=r=>{let t=[],e=r.length,s=0;for(let n=0;n<e;n++){let i=r.charCodeAt(n);i!==46&&i!==91&&i!==93||(n>s&&t.push(r.substring(s,n)),s=n+1)}return e>s&&t.push(r.substring(s)),t.length>0?t:null},E={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new v(1e3),hasDeepData(r){return r.indexOf(".")!==-1||r.indexOf("[")!==-1},isSafeAttr(r){return!Fe.has(r)},getSegments(r){let t=this.segmentCache.get(r);if(t!==void 0)return t;if(t=lr(r),t){for(let e=0,s=t.length;e<s;e++)if(Fe.has(t[e])){console.warn("[Data] Blocked unsafe path segment in: "+r),t=null;break}}return this.segmentCache.set(r,t),t}};var q=class{static set(t,e,s){if(!E.hasDeepData(e)){if(!E.isSafeAttr(e))return;t[e]=s;return}let n,i=E.getSegments(e);if(!i)return;let o=i.length,a=o-1;for(let c=0;c<o;c++){let l=i[c];if(c===a){t[l]=s;break}if(t[l]===void 0){let u=l.charCodeAt(0);t[l]=u<48||u>57?{}:[]}t=t[l]}}static delete(t,e){if(!E.hasDeepData(e)){if(!E.isSafeAttr(e))return;delete t[e];return}let s=E.getSegments(e);if(!s)return;let n=s.length,i=n-1;for(let o=0;o<n;o++){let a=s[o],c=t[a];if(c===void 0)break;if(o===i){if(Array.isArray(t)){let l=Number(a);Number.isInteger(l)&&l>=0&&l<t.length&&t.splice(l,1);break}delete t[a];break}t=c}}static get(t,e){if(!E.hasDeepData(e))return t[e]??void 0;let s=E.getSegments(e);if(!s)return;let n=s.length,i=n-1;for(let o=0;o<n;o++){let a=s[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===i)return t}}};var We=new Set,It=class{static MAX_DEPTH=50;static publishDeep(t,e,s,n){if(!E.hasDeepData(e)){this.publish(e,s,n);return}let i,o=E.getSegments(e);if(!o)return;let a=o.length,c=a-1,l="";for(let u=0;u<a;u++){let h=o[u];t=t[h];let f=h.charCodeAt(0);u>0?(f<48||f>57)&&(l+="."+h):l=h;let g;if(u===c)g=s;else{let m=o[u+1],x=m.charCodeAt(0);if(x>=48&&x<=57){l+="["+m+"]";continue}let _={};_[m]=t[m],g=_}this.publish(l,g,n)}}static publish(t,e,s,n=null,i=0){if(t=t||"",s(t,e),!(!e||typeof e!="object"||(e=Ne(e),n===null&&(We.clear(),n=We),!n))){if(n.has(e)){console.warn("[Publisher] Circular reference detected at path:",t);return}if(i>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion");return}n.add(e),Array.isArray(e)?this.publishArray(t,e,s,n,i):this.publishObject(t,e,s,n,i)}}static publishArray(t,e,s,n,i){let o=e.length;for(let a=0;a<o;a++){let c=e[a],l=t+"["+a+"]";this._checkPublish(l,c,s,n,i)}}static publishObject(t,e,s,n,i){let o=Object.keys(e);for(let a=0,c=o.length;a<c;a++){let l=o[a],u=e[l],h=t+"."+l;this._checkPublish(h,u,s,n,i)}}static _checkPublish(t,e,s,n,i){if(!e||typeof e!="object"){s(t,e);return}this.publish(t,e,s,n,i+1)}};var U=class extends R{setup(){this.attributes={},this.stage={}}_setAttr(t,e,s,n){typeof e!="object"&&e===this.get(t)||(!s&&n!==!0?q.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),q.set(this.stage,t,e),s=s||this,this._publish(t,e,s,H.CHANGE))}_silentSet(t){let e=this.stage,s=this.attributes,n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];e[a]=c,s[a]=c}}linkAttr(t,e){let s=t.get(e);if(!s)return;let n=Object.keys(s);for(let i=0,o=n.length;i<o;i++){let a=n[i];this.link(t,e+"."+a,a)}}scope(t,e){let s=this.get(t);if(!s)return!1;e=e||this.constructor;let n=new e(s);return n.linkAttr(this,t),n}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.push(e),this.set(t,s),this}concat(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s=s.concat(e),this.set(t,s),this}unshift(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.unshift(e),this.set(t,s),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.shift();return this.set(t,e),s}getIndex(t,e,s){let n=this.get(t);return Array.isArray(n)===!1?-1:typeof n[0]!="object"?n.indexOf(e):n.findIndex(o=>o[e]===s)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.pop();return this.set(t,e),s}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,s,n){if(this._publishAttr(t,e,s,n),!e||typeof e!="object")return;let i=t.length,o=n===H.CHANGE?":change":":"+n,a=o.length,c=i+a;for(let u of this.eventSub.getMessages()){if(u.length<=c||!u.endsWith(o)||!u.startsWith(t))continue;let h=u.charCodeAt(i);if(h!==46&&h!==91)continue;let f=u.slice(0,u.length-a);this._publishAttr(f,this.get(f),s,n)}let l=b.getPrefixMessages(this._dataId);if(l){let u=this._dataId.length;for(let h of l){if(h.length-u<=i||!h.startsWith(t,u))continue;let g=h.charCodeAt(u+i);if(g!==46&&g!==91)continue;let m=h.slice(u);b.publish(h,this.get(m),s)}}}_publishAttr(t,e,s,n){let i=this._dataId+t;b.publish(i,e,s),this.publishLocalEvent(t,e,s,n)}mergeStage(){this.attributes=S.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,s=this){q.delete(t,e),this._delCommitter=s;let n=this._deleteCb||(this._deleteCb=i=>this._publishAttr(i,null,this._delCommitter,H.DELETE));It.publish(e,null,n)}_getAttr(t,e){return q.get(t,e)}};var ur={"\n":"\\n","\r":"\\n"," ":"\\t"},hr=(r,t)=>{typeof r!="string"&&(r=String(r));let e=t?/[\n\r\t]/g:/\t/g;return r.replace(e,s=>ur[s])},qe=(r,t)=>{if(typeof r!="string")return r;r=hr(r,t),r=encodeURIComponent(r);let e=/%22/g;return r.replace(e,'"')},oe=(r,t)=>{let e=typeof r;if(e==="undefined")return r;if(e!=="object")return r=qe(r),r;let s=Array.isArray(r)?[...r]:{...r};return Object.keys(s).forEach(n=>{let i=s[n];i!==null&&(s[n]=typeof i=="string"?oe(i,t):qe(i,t))}),s};function ze(r){if(typeof r>"u"||r.length<1)return!1;try{return JSON.parse(r)}catch(t){return console.warn("[Encode] Failed to parse JSON.",t),!1}}function ae(r){return typeof r<"u"?JSON.stringify(r):null}var pt=class{static prepareJsonUrl(t,e=!1){let s=typeof t=="object"?S.clone(t):t,n=oe(s,e);return ae(n)}static json={encode:ae,decode:ze};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var _t=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=null,this.requestOptions=null,this.init()}init(){let t=this.model;t&&t.url&&(this.url=t.url)}isValid(){let t=this.validate();if(t!==!1){let e=this.validateCallBack;typeof e=="function"&&e(t)}return t}validate(){return!0}getDefaultParams(){return""}setupParams(t){let e=this.getDefaultParams();return t=this.addParams(t,e),t}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+t[s]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=w.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=w.parseQueryString(e,!1)),this._isFormData(t))for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let s=this.model.get("id"),n="id="+s,i=s?`/${s}`:"",o=this.model;return this._get(i,n,t,e,a=>{if(a){let c=this.getObject(a);c&&o.set(c)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+pt.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let s=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._put(i,s,t,e)}add(t,e){if(!this.isValid())return;let s=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._post(i,s,t,e)}update(t,e){if(!this.isValid())return;let s=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._patch(i,s,t,e)}delete(t,e){let s=this.model.get("id"),n=typeof s<"u"?"id="+s:this.setupObjectData(),i=s!=null?`/${s}`:"";return this._delete(i,n,t,e)}getAllParams(t,e,s,n){let i=this.model.get();t=isNaN(Number(t))?0:t,e=isNaN(Number(e))?50:e;let o=i.search||"",a=f=>{try{return JSON.stringify(f)}catch(g){return console.error("[ModelService] Failed to serialize request param.",g),""}},c=i.filter||"";typeof c=="object"&&(c=a(c));let l=i.dates||"";typeof l=="object"&&(l=a(l));let u=i.orderBy||"";typeof u=="object"&&(u=a(u));let h=i.groupBy||"";return Array.isArray(h)&&(h=a(h)),"&filter="+encodeURIComponent(c)+"&offset="+t+"&limit="+e+"&dates="+encodeURIComponent(l)+"&orderBy="+encodeURIComponent(u)+"&groupBy="+encodeURIComponent(h)+"&search="+encodeURIComponent(o)+"&lastCursor="+(typeof s<"u"&&s!==null?encodeURIComponent(s):"")+"&since="+(typeof n<"u"&&n!==null?encodeURIComponent(n):"")}all(t,e,s,n,i=null,o=null){let a=this.getAllParams(s,n,i,o);return this._get("",a,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let s=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(s)}withOptions(t){return Object.create(this,{requestOptions:{value:t||null,writable:!0}})}withCache(t=!0){return this.withOptions({...this.requestOptions,cache:t})}setupRequest(t,e,s,n,i,o){o=o||this.requestOptions||null;let a=(h,f)=>{typeof i=="function"&&i(h),this.getResponse(h,n,f)},c={url:this.getUrl(t),method:e,params:s,completed:a},l=this._isFormData(s);if(l&&(c.headers={}),!o)return ht(c);o.invalidate&&(c.completed=(h,f)=>{h!==!1&&h!=null&&wt.invalidate(o.invalidate),a(h,f)});let u=o.cache;return!u||!this.isCacheableMethod(e)||l?ht(c):this.cachedRequest(c,u===!0?{}:u)}isCacheableMethod(t){let e=String(t||"").toUpperCase();return e==="GET"||e==="HEAD"}getCacheKey(t){let e=t.params||"";if(typeof e=="object")try{e=JSON.stringify(e)}catch{e=""}return t.method.toUpperCase()+" "+t.url+(e?" "+e:"")}cachedRequest(t,e){let s=e.key||this.getCacheKey(t),n=t.completed,i=o=>ht({...t,completed:(a,c)=>o(a!=null,a,c),failed:(a,c)=>o(!1,!1,c),aborted:(a,c)=>o(!1,!1,c)});return wt.resolve(s,i,{ttl:e.ttl,swr:e.swr},(o,a)=>n(o,a))}setupEventSource(t,e,s,n,i=!0){let o=null,a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0)},h=()=>{if(c||!i||l)return;u(),a=setTimeout(()=>{a=void 0,f()},3e3)},f=()=>{if(c||l)return;if(o){try{o.close()}catch{}o=null}l=!0;let g=this.getUrl(t),m=e?"?"+e:"";o=new EventSource(g+m,{withCredentials:!0}),o.onopen=()=>{l=!1,u(),n&&n()},o.onerror=()=>{l=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,h())},o.onmessage=x=>{try{let _=JSON.parse(x.data);s&&s(_)}catch{}}};return f(),{get source(){return o},close:()=>{if(c=!0,l=!1,u(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return T.isWatching(t)&&(t=T.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,s,n,i){return this._request("","POST",t,e,s,n,i)}_get(t,e,s,n,i,o){return e=this.setupParams(e),e=this.addParams(e,s),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",n,i,o)}_post(t,e,s,n,i,o){return this._request(t,"POST",e,s,n,i,o)}_put(t,e,s,n,i,o){return this._request(t,"PUT",e,s,n,i,o)}_patch(t,e,s,n,i,o){return this._request(t,"PATCH",e,s,n,i,o)}_delete(t,e,s,n,i,o){return this._request(t,"DELETE",e,s,n,i,o)}_request(t,e,s,n,i,o,a){return s=this.setupParams(s),s=this.addParams(s,n),this.setupRequest(t,e,s,i,o,a)}getResponse(t,e,s){typeof e=="function"&&e(t,s)}static extend(t){if(!t)return{};let e=this;class s extends e{constructor(i){super(i)}}return Object.assign(s.prototype,t),s}};var fr=r=>{let t={};if(!k.isObject(r)||!r.defaults)return t;let{defaults:e}=r;return Object.keys(e).forEach(s=>{let n=e[s];typeof n!="function"&&(t[s]=n)}),delete r.defaults,t},dr=r=>{if(!r||typeof r.xhr!="object")return{};let t={...r.xhr};return delete r.xhr,t},pr=0,mt=class extends U{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,s=dr(t),n=e.prototype.service.extend(s),i=fr(t);class o extends e{constructor(c){let l={...i,...Mt(c)};super(l),this.xhr=new n(this)}dataTypeId=`bm${pr++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};mt.prototype.service=_t;var tt=class extends R{};var gt=class extends tt{setup(){this.stage={}}addAction(t,e){return typeof e<"u"&&this.set(t,e),this}getState(t){return this.get(t)}removeAction(t,e){if(e)return this.off(t,e),this;let s=this.stage;return typeof s[t]<"u"&&delete s[t],this}};var Rt=class extends gt{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var I=class{static targets=new Map;static ownerCounts=new Map;static restore(t,e){this.targets.set(t,e),this.addOwner(t)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new Rt(t)),this.targets.get(t)}static attach(t){let e=this.getTarget(t);return this.addOwner(t),e}static addOwner(t){this.ownerCounts.set(t,(this.ownerCounts.get(t)||0)+1)}static detach(t){let e=this.ownerCounts.get(t);if(e===void 0)return;if(e>1){this.ownerCounts.set(t,e-1);return}this.ownerCounts.delete(t);let s=this.targets.get(t);s&&(s.remove(),this.targets.delete(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,s){let n=this.getTarget(t);return e&&n.addAction(e,s),n}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){if(s){this.off(t,e,s);return}let n=this.getTarget(t);n&&e&&n.removeAction(e)}static on(t,e,s){let n=this.getTarget(t);return e?n.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let n=this.targets,i=n.get(t);if(i){if(e){i.off(e,s);return}this.targets.delete(t),this.ownerCounts.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};var et=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static _releaseLinks(t,e){!t||t===e||typeof t.unlink!="function"||t.unlink()}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let s=t.getParentContext();if(!s||!s.data)return;let n=s.data.stage,i=e.data.stage,o=null;for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let c=n[a];c!==i[a]&&(o===null&&(o={}),o[a]=c)}o!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(o):e.data.set(o))}static _resumeExternal(t,e){let s=t.setData();if(!s){t.data=e;return}if(this._releaseLinks(e,s),e&&e.stage){let n=e._retainState||s._retainState,i=!n&&(e._refreshState||s._refreshState),o=this._buildExternalUpdates(e.stage,s.stage,n,i);S.isEmpty(o)||s._silentSet(o)}typeof s.flushPending=="function"&&s.flushPending(),t.data=s}static _buildExternalUpdates(t,e,s,n){let i={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(n){Object.prototype.hasOwnProperty.call(e,o)||(i[o]=t[o]);continue}let a=t[o];!s&&a==null||a!==e[o]&&(i[o]=a)}return i}static _resumeOwned(t,e){let s=t.data;if(!s){this._releaseLinks(e),t.data=e;return}if(e&&e._retainState){this._releaseLinks(s,e),this._releaseLinks(e),t.data=e;return}if(this._releaseLinks(e,s),e&&e.stage){let n=e._refreshState||t.data._refreshState,i=this._buildOwnedUpdates(e.stage,t.data.stage,n);S.isEmpty(i)||t.data._silentSet(i)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,s){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(s){Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);continue}let o=t[i];o!=null&&o!==e[i]&&(n[i]=o)}return n}};var Ot=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let s=0;s<e;s++){let n=t[s];this.on(n[0],n[1],n[2],n[3])}}on(t,e,s,n){d.on(t,e,s,n),this.events.push({event:t,obj:e,callBack:s,capture:n})}off(t,e,s,n){d.off(t,e,s,n);let i,o=this.events;for(let a=0,c=o.length;a<c;a++)if(i=o[a],i.event===t&&i.obj===e&&i.callBack===s&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,s=t.length;e<s;e++){let n=t[e];d.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,s=t.length;e<s;e++){let n=t[e];d.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var Lt=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let s=this.convertStates(e);this.addStatesToTarget(t,s)}addStates(t,e){let s=this.convertStates(e);this.addStatesToTarget(t,s)}createState(t,e,s,n){return{action:t,state:e,callBack:s,targetId:n,token:null,callBackToken:null}}convertStates(t){let e=[];for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;if(s==="remotes"){this.setupRemoteStates(t[s],e);continue}let n=null,i=null,o=t[s];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(s,o,i,n))}return e}setupRemoteStates(t,e){for(let s=0,n=t.length;s<n;s++){let i=t[s];if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o)||o==="id")continue;let a=null,c=i[o],l=c!==null?c:void 0;l&&typeof l=="object"&&(a=l.callBack,l=l.state),e.push(this.createState(o,l,a,i.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let s=0,n=e.length;s<n;s++){let i=e[s];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let s=0,n=e.length;s<n;s++){let i=e[s];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&I.remove(i.targetId,i.action,i.token)}}restore(t){I.restore(t.id,t);let e=this.callBackStates;if(e)for(let n=0,i=e.length;n<i;n++){let o=e[n];o.callBackToken=t.on(o.action,o.callBack)}let s=this.remoteStates;if(s)for(let n=0,i=s.length;n<i;n++){let o=s[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,s){let n=I.getTarget(s);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let s=this.remoteStates;for(let n=0,i=e.length;n<i;n++){let o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,s.push(o))}}addAction(t,e){let s,n=e.action,i=e.targetId;i&&(s=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&(e.callBackToken=t.on(n,o),this.callBackStates.push(e)),s||null}};var P=[],Bt=0,ce=!1,mr=typeof queueMicrotask=="function"?queueMicrotask:r=>Promise.resolve().then(r),gr=r=>{let t=r.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||r.container||null},yr=r=>{r._mountPending=!1;try{r.afterMount()}catch(t){console.error("Error in afterMount:",t)}},Ke=()=>{ce=!1;let r=P;if(r.length===0)return;P=[];let t=[];for(let e=0,s=r.length;e<s;e++){let n=r[e];if(n.rendered!==!0||n._mountPending!==!0){n._mountPending=!1;continue}let i=gr(n);if(i&&i.isConnected===!0){yr(n);continue}t.push(n)}t.length&&(P=P.length?t.concat(P):t),P.length&&Bt===0&&P.length!==t.length&&le()},le=()=>{ce||(ce=!0,mr(Ke))},O={add(r){r._mountPending!==!0&&(r._mountPending=!0,P.push(r))},enter(){Bt++},leave(){--Bt>0||(Bt=0,P.length&&le())},schedule(){P.length&&le()},flush(){Ke()},get size(){return P.length}};p.addType("components",r=>{if(!r)return;let t=r.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken,t),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var br=0,yt=class{constructor(t,e,s){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let n,i;if(t==null)n={},i=[];else{let o=typeof t;o==="string"||o==="number"?(n={},i=[{tag:"text",textContent:t}]):Array.isArray(t)?(n={},i=t):(n=t||{},i=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(n),this.children=i||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+br++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,s=t.cache,n;s!=null&&e!=null?n="pk:"+s+":"+e:s!=null?n="pk:"+s:e!=null?n="pk:"+e:n="pc"+this.persistedCount++;let i=this.persistedChildren[n];return i&&t.unitType===i.unitType&&t.resumeScope(i),t.persistToken=n,this.persistedChildren[n]=t,n}removePersistedChild(t,e){if(!this.rendered)return;let s=t?this.persistedChildren[t]:null;s&&(e&&s!==e||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let s=e[0];s&&(this.addingContext=!0,this.contextBranchName=s,this.addContextBranch(s,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){p.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout(),typeof this.afterMount=="function"&&O.add(this)}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let s=[];if(!t||t.length<1)return s;for(let n=0,i=t.length;n<i;n++){let o=e(t[n],n);s.push(o)}return s}removeAll(t){return D.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy();let t=this.panel;t&&D.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,s=t.length;e<s;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var A=class extends yt{constructor(t,e,s){super(t,e,s),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._externalData=this._externalData??!1,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){if(this._resumeData(t.data),this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,t.context){let e=t.context.data;e&&e._refreshState===!0&&e._retainState!==!0||(this.context=t.context,this._contextResumed=!0)}this.id=t.id,this._refreshContextData()}_resumeData(t){et.resume(this,t)}_refreshData(){et.refresh(this)}_refreshContextData(){et.refreshContext(this)}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=I.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();S.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Lt(this.state??{},t))}addState(t){!this.stateHelper||this.stateResumed===!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;if(!t)return;let e=this.stateHelper;e&&(e.removeRemoteStates(t),e.removeLocalStates(t)),I.detach(String(t.id)),this.stateResumed=!1}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new Ot)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}};var Nt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},Ht=(r,t)=>typeof r!="function"&&t==="setupStates"?()=>r:r;var ue=(r,t)=>{if(!r)return t;let e=Object.keys(r);for(let s=0,n=e.length;s<n;s++){let i=e[s],o=r[i],a=Nt[i]||i;t[a]=Ht(o,a)}return t},xr=r=>ue(r,{}),Sr=0,Ve=(r,t)=>{class e extends r{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Sr++,e},z=(r,t=A)=>{r||(r={});let e,s=typeof r;return s==="object"&&r.render?(e=xr(r),Ve(t,e)):(e={render:s==="function"?r:()=>r},Ve(t,e))};var kr=(r,t)=>{let e=Object.keys(r);for(let s=0,n=e.length;s<n;s++){let i=e[s],o=r[i],a=Nt[i]||i;t.prototype[a]=Ht(o,a)}return t},wr=0,vr=r=>{let t=class extends r{};return t.prototype._classId="pod"+wr++,t},Cr=(r,t=A)=>{if(!r)return null;let e=vr(t),s={},n=r(s);return kr(s,e),e.prototype.render=n,e};var Ar={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(r=new Date().getDay(),t=!1){if(typeof Intl<"u"){let n=new Date(2004,0,4+r);return new Intl.DateTimeFormat(void 0,{weekday:t?"short":"long"}).format(n)}let e=this.dayNames;if(r>e.length)return null;let s=e[r];return t?s.substring(0,3):s},convertJsMonth(r){return this.padNumber(r+1)},convertDate(r,t=!1){r=r?r.replace(/\s/,"T"):"";let e=new Date(r);if(typeof Intl<"u"){let n={weekday:"long",month:"short",day:"2-digit"};return t&&(n.year="numeric"),new Intl.DateTimeFormat(void 0,n).format(e)}let s=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+s},padNumber(r){return r<=9?"0"+r:String(r)},createDate(r){return r?(typeof r=="string"&&r.indexOf("-")>-1&&(r=r.replace(/\s/,"T"),r=r.indexOf(":")>-1?r:r+"T00:00:00"),new Date(r)):new Date},format(r,t){let e=this.createDate(t);return r!=="sql"&&typeof Intl<"u"?new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}).format(e):this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),r)},formatTime(r,t){let e=this.createDate(r);if(t!==24&&typeof Intl<"u")return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",hour12:!0}).format(e);let s=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),s)},getMeridian(r){return r=Number(r),r>=12?"PM":"AM"},convert24To12(r){return r=Number(r),r>12&&(r=r-12),r},convert12To24(r,t){return r=Number(r),t.toLowerCase()==="pm"&&(r=r+12),r},renderDate(r,t,e,s="sql"){return t=Number(t),e=Number(e),s==="sql"?`${r}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${r}`},renderTime(r,t,e=0,s="sql"){if(s==="sql")return`${this.padNumber(r)}:${this.padNumber(t)}:${this.padNumber(e)}`;let n=this.getMeridian(r);return r=this.convert24To12(r),`${r}:${this.padNumber(t)} ${n}`},leapYear(r){return r%400===0||r%100!==0&&r%4===0},getMonthName(r=new Date().getMonth(),t=!1){if(typeof Intl<"u"){let n=new Date(2e3,r,1);return new Intl.DateTimeFormat(void 0,{month:t?"short":"long"}).format(n)}let e=this.monthNames;if(r>e.length)return"";let s=e[r];return s?t?s.substring(0,3):s:""},getMonthLength(r,t){let e=new Date;return r=typeof r<"u"?r:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[r]},getMonthsLength(r=new Date().getFullYear()){return this.leapYear(r)===!0?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31]},getLocalDate(r,t="America/Denver"){let e=new Date(r);if(Number.isNaN(e.getMonth())===!0){let i=/[- :]/,o=r.split(i);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let s=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),n=e.getTime()-s.getTime();return new Date(e.getTime()+n)},getLocalTime(r,t=!1,e=!1,s="America/Denver"){if(!r)return"";let n=this.getLocalDate(r,s);if(!t&&typeof Intl<"u"){let c={hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0};return e===!1&&(c.year="numeric",c.month="2-digit",c.day="2-digit"),new Intl.DateTimeFormat(void 0,c).format(n)}let i=n.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(n.getFullYear(),i,n.getDate(),o)+" "),a+this.renderTime(n.getHours(),n.getMinutes(),n.getSeconds(),o)},getDiffFromNow(r,t=!1){r=r.replace(/\s/,"T");let e=new Date(r),s=new Date;return t===!0&&s.setHours(0,0,0,0),s.getTime()-e.getTime()},getAge(r){let t=this.getDiffFromNow(r),e,s;switch(!0){case t<864e5:e="1 day";break;case t<6048e5:s=this.toDays(t),e=s+" days";break;case t<12096e5:e="1 week";break;case t<2592e6:s=this.toDays(t);var n=Math.floor(s/7);e=n+" weeks";break;case t<5184e6:e="1 month";break;case t<31104e6:var i=this.toMonths(t);e=i+" months";break;default:var o=this.toYears(t);e=o}return String(e)},getTimeFrame(r){let t=this.getDiffFromNow(r);return this.convertToEstimate(t)},convertToEstimate(r){let t="",e,s,n,i,o,a,c;if(r<=0)switch(!0){case r<-63072e6:n=this.toYears(Math.abs(r)),t="in "+n+" y";break;case r<-31536e6:t="in 1y";break;case r<-5184e6:i=this.toMonths(Math.abs(r)),t="in "+i+"mo";break;case r<-2592e6:t="in 1mo";break;case r<-12096e5:e=this.toDays(Math.abs(r)),s=Math.floor(e/7),t="in "+s+"w";break;case r<-6048e5:t="in 1w";break;case r<-1728e5:e=this.toDays(Math.abs(r)),t="in "+e+"d";break;case r<-864e5:t="tomorrow";break;case r<-72e5:o=this.toHours(Math.abs(r)),t="in "+o+" h";break;case r<=-36e5:t="in 1h";break;case r<-12e4:a=this.toMinutes(Math.abs(r)),t="in "+a+"m";break;case r<-6e4:t="in 1m";break;case r<-2e3:c=this.toSeconds(Math.abs(r)),t="in "+c+"s";break;case r<-1:t="in 1s";break;default:t="now"}else switch(!0){case r<1e3:t="1s ago";break;case r<6e4:c=this.toSeconds(r),t=c+"s ago";break;case r<12e4:t="1m ago";break;case r<36e5:a=this.toMinutes(r),t=a+"m ago";break;case r<72e5:t="1h ago";break;case r<864e5:o=this.toHours(r),t=o+"h ago";break;case r<1728e5:t="yesterday";break;case r<6048e5:e=this.toDays(r),t=e+"d ago";break;case r<12096e5:t="1w ago";break;case r<2592e6:e=this.toDays(r),s=Math.floor(e/7),t=s+"w ago";break;case r<5184e6:t="1mo ago";break;case r<31536e6:i=this.toMonths(r),t=i+"mo ago";break;case r<63072e6:t="1y ago";break;default:n=this.toYears(r),t=n+"y ago"}return t},toYears(r){return typeof r!="number"?0:Math.floor(r/31558464e3)},toMonths(r){return typeof r=="number"?Math.floor(r/2592e6):0},toDays(r){return typeof r!="number"?0:Math.floor(r/864e5*1)},toHours(r){return typeof r!="number"?0:Math.floor(r%864e5/36e5*1)},toMinutes(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5/6e4*1)},toSeconds(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5%6e4/1e3*1)},getDifference(r,t){let e=new Date(r),s=new Date(t),n=s.getTime()-e.getTime();return{years:this.toYears(n),days:this.toDays(n),hours:this.toHours(n),minutes:this.toMinutes(n),seconds:this.toSeconds(n)}}};var st={items:new Map,add(r,t){return this.items.set(r,t),this},get(r){return this.items.get(r)??null}};var he=(r,t)=>({attr:r,directive:t});var L=(r,t)=>({key:r,value:t});var Ge=(r,t,e,s)=>({tag:r,attr:t,directives:e,children:s});var Qe=null,Tr=()=>Qe||(Qe=st.get("watch")),F=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,s,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(s.push(L("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,s){t.push(he(L(e,T.getWatcherSettings(s,W(e))),Tr()))}static setButtonType(t,e,s){if(t==="button"){let n=e.type||"button";s.push(L("type",n))}}static parse(t,e){let s=[],n=[],i=t.tag||"div";i==="button"&&s.push(L("type",t.type||"button"));let o=[],a,c;for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l)||l==="tag"||(a=t[l],a==null))continue;if(l==="children"||l==="nest"){if(Array.isArray(a))for(let h=0;h<a.length;h++)o.push(a[h]);else o.push(a);continue}if((c=st.get(l))!==null){n.push(he(L(l,a),c));continue}let u=typeof a;if(u==="object"){if(T.isWatching(a)){this.setTextAsWatcher(n,l,a);continue}o.push(a);continue}if(u==="function"){let h=a,f=function(g){h.call(this,g,e)};f.originalCallback=h,s.push(L(l,f));continue}if(u==="string"&&a.includes("[[")){this.setTextAsWatcher(n,l,a);continue}if(l==="text"){o.push({tag:"text",textContent:a});continue}if(l==="html"||l==="innerHTML"){s.push(L("innerHTML",a));continue}s.push(L(l,a))}return Ge(i,s,n,o)}};var rt=class{build(t,e,s){}setupComponent(t,e,s){let n=s?.getChildScope();t.parent=n,n&&n.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&n&&(n[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),s=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),s}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t),t}setDirectives(t,e,s){}removeNode(t){}removeAll(t){}};var Er=r=>{for(let e in r)if(e!=="tag"&&e!=="textContent")return!1;let t=r.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},Ut=class extends rt{build(t,e,s){let n=C.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,s);else this.buildElement(t,n,s);return e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,s){if(t){if(t.isUnit===!0){this.createComponent(t,e,s);return}this.createElement(t,e,s)}}createElement(t,e,s){if(t.tag==="text"&&Er(t)){let l=t.textContent;C.createText(l??"",e);return}let n=s?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=F.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,s);let a=i.children;for(let l=0,u=a.length;l<u;l++){let h=a[l];h!==null&&this.buildElement(h,o,s)}let c=i.directives;c.length&&this.setDirectives(o,c,n)}createTempComponent(t,e,s){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...ue(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(n.setupStateTarget=function(o){this.state=t.state});let i=new A(n);this.createComponent(i,e,s)}setDirectives(t,e,s){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],s)}handleDirective(t,e,s){e.directive(t,e.attr.value,s)}cache(t,e,s){s&&e&&s.cacheEle(t,e)}createNode(t,e,s){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return C.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return C.createComment(o,e)}return C.create(n,t.attr,e,s)}removeNode(t){C.removeElement(t)}removeAll(t){C.removeAll(t)}};var Pr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),Dr=/[&<>"]/,fe=r=>{let t=typeof r=="string"?r:String(r);return Dr.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t},nt=class{static create(t,e=[],s=""){let n="",i="";for(let o=0,a=e.length;o<a;o++){let c=e[o],l=c.key,u=c.value;if(l==="text"||l==="textContent"){n+=fe(u);continue}if(l==="html"||l==="innerHTML"){n+=u;continue}if(typeof u=="function")continue;let h=l+'="'+fe(u)+'"';i?i+=" "+h:i=h}return Pr.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+s+"</"+t+">"}static createText(t){return fe(t)}static createComment(t){return"<!-- "+t+" -->"}};var Ft=class extends rt{build(t,e,s){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],s);return n}return this.buildElement(t,s)}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let s=F.parse(t,e),n=s.children,i="";for(let o=0,a=n.length;o<a;o++){let c=n[o];c!==null&&(i+=this.buildElement(c,e))}return this.createNode(s,i)}createNode(t,e){let s=t.tag;if(s==="text"){let n=t.attr[0],i=n?n.value:"";return nt.createText(i)}else if(s==="comment"){let n=t.attr[0],i=n?n.value:"";return nt.createComment(i)}return nt.create(s,t.attr,e)}removeAll(t){}};var Wt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Ut:new Ft}};var K=Wt.setup(),Mr=r=>typeof r=="object"&&r.isUnit===!0,$e=new WeakMap,Ir=r=>{let t=$e.get(r);if(!t){if(t=z(r),!t)return null;$e.set(r,t)}return new t},y=class{static render(t,e,s){if(!t||(Mr(t)||(t=Ir(t)),!t))return null;O.enter();try{return K.createComponent(t,e,s)}finally{O.leave()}}static build(t,e,s){O.enter();try{return K.build(t,e,s)}finally{O.leave()}}static rebuild(t,e,s){return K.removeAll(e),this.build(t,e,s)}static setDirectives(t,e,s){K.setDirectives(t,e,s)}static createNode(t,e,s){return K.createNode(t,e,s)}static removeNode(t){K.removeNode(t)}static removeAll(t){K.removeAll(t)}};N.augment({buildLayout(r,t,e){y.build(r,t,e)}});var de=[],_r=r=>de.indexOf(r)!==-1,Rr=r=>({tag:"script",src:r.src,async:!1,load(t){de.push(r.src);let e=r.load;e&&e()}}),Or=r=>({tag:"link",rel:"stylesheet",type:"text/css",href:r.src,load(t){de.push(r.src);let e=r.load;e&&e()}}),qt=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,s=this.update.bind(this);t.indexOf(".css")!==-1?e=Or({load:s,src:t}):e=Rr({load:s,src:t}),y.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{_r(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var Lr=r=>r?typeof r?.prototype?.constructor=="function":!1,V=class{static process(t,e){let s=t.default;return s?e.callback?e.callback(s):(Lr(s)?s=new s:s=s(),s.isUnit===!0&&(s.route=e.route,e.persist&&(s.persist=!0)),s):null}static render(t,e,s){return this.renderNodes(t,e,s)[0]||null}static renderNodes(t,e,s){let n=y.build(t,null,s),i=Array.from(n.childNodes);return i.length===0&&t?.panel&&i.push(t.panel),e.after(n),i}};var zt=class{static load(t,e,s){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),s&&s(n)})}};var Br=r=>({tag:"comment",textContent:"import placeholder",onCreated:r.onCreated}),G=new v(100),Nr=r=>{if(G.has(r)){let s=G.get(r);return s&&typeof s.then!="function"?Promise.resolve(s):s}let t=typeof r,e;if(t==="string")e=import(r);else if(t==="function")e=r();else return r;return e.then(s=>{G.set(r,s)}).catch(()=>{G.delete(r)}),G.set(r,e),e},Hr=r=>{if(!G.has(r))return null;let t=G.get(r);return t&&typeof t.then=="function"?null:t||null},Ye=r=>{for(let t=0,e=r.length;t<e;t++){let s=r[t];s&&y.removeNode(s)}},je=z({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return Br({onCreated:r=>{if(this.src){if(this.layout){this.setLayoutRoots(V.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){new qt(()=>{this.loadAndRender(r)}).addFiles(this.depends);return}this.loadAndRender(r)}}})},loadAndRender(r){let t=this.generation,e=Hr(this.src);if(e){this.renderModule(r,e);return}zt.load(Nr(this.src),s=>{t===this.generation&&this.renderModule(r,s)},s=>{t===this.generation&&(this.loaded=!1,this.renderError(r,s))})},renderError(r,t){let e=()=>this.retry(r),s=this.fallback,n=typeof s=="function"?s(t,e):s||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};if(!n)return;let i=V.renderNodes(n,r,this.parent);this.errorRoots=i,this.errorRoot=i[0]||null},setLayoutRoots(r){this.layoutRoots=r,this.layoutRoot=r[0]||null},retry(r){this.removeErrorLayout(),this.loadAndRender(r)},removeErrorLayout(){this.errorRoot&&(Ye(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(r,t){this.loaded=!0;let e=this.layout||V.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(V.renderNodes(e,r,this.parent)),typeof this.onModuleRender=="function"&&this.onModuleRender(e)},shouldUpdate(r){return this.updateLayout===!0?!0:this.updateLayout=r&&r.isUnit&&typeof r.update=="function"},updateModuleLayout(r){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(r)},update(r){this.loaded===!0&&this.updateModuleLayout(r)},destroy(){this.generation++,this.removeErrorLayout(),this.layoutRoot&&(Ye(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var pe=r=>{let t=typeof r;return(t==="string"||t==="function"||r instanceof Promise)&&(r={src:r}),new je(r)};var Je=(r,t,e=null)=>{if(!r)return;let s=null,n=!1,i=()=>{n||(n=!0,s&&(clearTimeout(s),s=null),d.off("animationend",r,o),r&&r.classList.remove(t),e&&e())},o=c=>{c.target===r&&i()};d.on("animationend",r,o),r.classList.add(t);let a=()=>{if(!n)try{let c=window.getComputedStyle(r),l=parseFloat(c.animationDuration)*1e3||1e3,u=parseFloat(c.animationDelay)*1e3||0;s=setTimeout(i,l+u+100)}catch{s=setTimeout(i,1e3)}};if(typeof requestAnimationFrame>"u"){s=setTimeout(i,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(a))},Xe=(r,t,e)=>{Je(r,t)},Ze=(r,t,e)=>{let s=()=>{r&&r.remove&&r.remove()};Ur(r,()=>Je(r,t,s),e)};p.addType("manual-destroy",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var Ur=(r,t,e)=>{p.add(r,"manual-destroy",{ele:r,callBack:t,parent:e})};var bt=(r,t,e,s)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&bt(r,t,n,s)});return}Fr(r,t,e,s)},Fr=(r,t,e,s)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',r,t);return}let o=Wr(r,n,i,s);b.watch(r,t,n,o)},Wr=(r,t,e,s)=>typeof e=="object"?n=>{Kr(r,e,n)}:n=>{zr(r,e,t,n,s)},ts=new WeakSet,qr=(r,t,e)=>{!r||!r.isUnit&&!r.isComponent||ts.has(e)||ts.add(e)},zr=(r,t,e,s,n)=>{let i=t(s,r,n);switch(typeof i){case"object":if(i===null)break;qr(i,e,r),y.rebuild(i,r,n);break;case"string":let o=Tt(r);if(o!=="textContent"){r.setAttribute(o,i);break}D.addHtml(r,i);break}},Kr=(r,t,e)=>{let s=Object.keys(t);for(let n=0,i=s.length;n<i;n++){let o=s[n];o&&(t[o]===e?r.classList.add(o):r.classList.remove(o))}};var it=(r,t,e)=>{let s=M(e);bt(r,s,t,e)};var es=(r,t,e)=>{t&&r.setAttribute("role",t)},Vr=r=>(t,e)=>{let s=t?"true":"false";e.setAttribute(r,s)},ss=(r,t,e)=>{if(!t)return;let s=t.role;s&&(r.setAttribute("role",s),t.role=null);let n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];if(c===null)continue;let l="aria-"+a;if(Array.isArray(c)){let u=c.slice();u.push(Vr(l)),it(r,u,e)}else r.setAttribute(l,c)}};var rs=(r,t,e)=>{if(!t)return;let s=F.parse(t,e);C.addAttributes(r,s.attr,e),y.setDirectives(r,s.directives,e)};p.addType("context",r=>{if(!r)return!1;r.parent.removeContextBranch(r.branch)});var me=r=>r?r.getContext():null,ns=(r,t,e)=>{if(typeof t!="function")return;let s=me(e),n=t(s);rs(r,n,e)},is=(r,t,e)=>{if(typeof t!="function")return;let s=me(e);t(s)},os=(r,t,e)=>{if(typeof t!="function"||!e)return;let s=me(e),n=t(s);if(!n)return;let i=n[0];i&&(e.addContextBranch(i,n[1]),Gr(r,i,e))},Gr=(r,t,e)=>{p.add(r,"context",{branch:t,parent:e})};var as=(r,t,e)=>{};var cs=(r,t,e)=>{if(!e)return;let s=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",r),console.log("Data: ",t),console.log("Layout: ",s),console.log("parent: ",e)};var ls=(r,t,e)=>{},us=(r,t,e)=>{if(!t||!e)return;let s=t(e,r);s&&y.build(s,r,e)},hs=(r,t,e)=>{if(!t||!e)return;let s=e.getId(t);r.id=s},fs=(r,t,e)=>{if(!t||!e)return;let s=t(e.data,r);s&&y.build(s,r,e)},ds=(r,t,e)=>{if(!t||!e)return;let s=t(e.state,r);s&&y.build(s,r,e)},ps=(r,t,e)=>{if(!t||!e)return;let s=e.state,n=t(s);if(!e.state){e.setStateHelper(n);return}e.addState(n)},ms=(r,t,e)=>{if(!t||!e)return;e.events||e.setEventHelper();let s=t[2];if(s){let n=s;s=i=>{n(i,e)}}e.events.on(t[0],t[1],s,t[3])};var gs=(r,t,e)=>{let s,n,i;if(typeof t=="string"){if(s=M(e),!s)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=M(e);if(!o)return;s=o,n=t[0],i=t[1]}else[s,n,i]=t;b.bind(r,s,n,i)};var Kt=(r,t,e)=>{bt(r,e.state,t,e)};var ys=r=>(t,e)=>{let[s,n,i="active"]=r,o=t===n?i:"";e.dataset[s]=o},bs=(r,t,e)=>{if(!t)return;let s=t.length-1,n=t[s],i=t.slice(0,s);i.push(ys(n)),it(r,i,e)},xs=(r,t,e)=>{if(!t)return;let s=t.length-1,n=t[s],i=t.slice(0,s);i.push(ys(n)),Kt(r,i,e)};var Ss=r=>{for(let t=0,e=r.length;t<e;t++){let s=r[t];s&&s.remove()}r.length=0};p.addType("forScopes",r=>{if(!r)return!1;Ss(r.scopes)});var ks=(r,t,e)=>{let s,n,i,o;if(typeof t[0]=="string"||t.length<3){let u=M(e);if(!u)return;s=u,[n,i,o]=t}else[s,n,i,o]=t;let a=o!==!1,c=n+"[",l=a?{scopes:[]}:null;l&&p.add(r,"forScopes",l),b.watch(r,s,n,u=>{if(y.removeAll(r),l&&Ss(l.scopes),!u||u.length<1)return;let h=[];for(let f=0,g=u.length;f<g;f++){let m=a?s.scope(c+f+"]"):null;m&&l&&l.scopes.push(m);let x=i(u[f],f,m,h);x!==null&&h.push(x)}return y.build(h,r,e)})};var ws=(r,t,e)=>{let s=t[0];if(!s||s.length<1)return;let n=t[1],i=[];for(let o=0,a=s.length;o<a;o++){let c=s[o];if(!c)continue;let l=n(c,o);l!==null&&i.push(l)}y.build(i,r,e)};var vs=(r,t,e)=>{t(r,e)};p.addType("destroyed",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var Cs=(r,t,e)=>{Qr(r,t,e)},Qr=(r,t,e)=>{p.add(r,"destroyed",{ele:r,callBack:t,parent:e})};var As=(r,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let s=0,n=t.length;s<n;s++)T.setup(r,t[s],e);else T.setup(r,t,e)};var $r=0,ot=class{constructor(t){this.router=t,this.locationId="base-app-router-"+$r++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var Yr=0,jr=()=>Date.now().toString(36)+"-"+(Yr++).toString(36)+"-"+Math.random().toString(36).substring(2,8),Es=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Ts=()=>{Es&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let r=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(r,t)}))},Vt=class extends ot{constructor(t){super(t),this.currentKey=null,this.positions=new v(200)}saveCurrentPosition(){let t=this.getScrollPosition(),e=this.currentKey;return e&&this.positions.set(e,t),t}addEvent(){d.on("popstate",window,this.callBack);let t=window.history;return t&&"scrollRestoration"in t&&(this.previousScrollRestoration=t.scrollRestoration,t.scrollRestoration="manual"),Es&&(this.pageShowCallBack=this.onPageShow.bind(this),d.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){d.off("popstate",window,this.callBack);let t=window.history;return this.previousScrollRestoration&&t&&"scrollRestoration"in t&&(t.scrollRestoration=this.previousScrollRestoration,this.previousScrollRestoration=null),this.pageShowCallBack&&d.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&Ts()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.saveCurrentPosition();let s=e.key||null;this.currentKey=s;let n=s&&this.positions.get(s)||e.scrollPosition,i=this.router;i.checkActiveRoutes(e.uri,!!n),n&&(typeof i.restoreScrollPosition=="function"?i.restoreScrollPosition(n):this.scrollTo(n)),Ts()}createState(t,e={}){let s=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:jr(),scrollPosition:s,uri:t}}addState(t,e,s=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return i.key&&i.location===this.locationId&&(this.currentKey=i.key),this;!s&&i&&i.location===this.locationId&&(i.scrollPosition=this.saveCurrentPosition(),n.replaceState(i,"",window.location.href));let o=this.createState(t,e);return s||(o.scrollPosition={x:0,y:0}),n[s===!1?"pushState":"replaceState"](o,null,t),this.currentKey=o.key,this.positions.set(o.key,o.scrollPosition),this}};var Gt={removeSlashes(r){return typeof r!="string"?"":(r[0]==="/"&&(r=r.substring(1)),r[r.length-1]==="/"&&(r=r.substring(0,r.length-1)),r)},getHashUri(r){if(typeof r!="string")return"";let t=r.indexOf("#");return t===-1?"":r.substring(t+1)}};var Qt=class extends ot{addEvent(){return d.on("hashchange",window,this.callBack),this}removeEvent(){return d.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(Gt.getHashUri(t.newURL))}addState(t,e,s){return window.location.hash=t,this}};var $t=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Vt(t).setup():new Qt(t).setup()}};var ge=5,Jr=200,Yt=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new v(Jr),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:ge}get size(){return this.pages.size}add(t){let e=this.pages;e.delete(t),e.add(t),this.trim()}delete(t){this.pages.delete(t)}trim(){let t=this.pages,e=this.getMax();for(;t.size>e;){let s=t.values().next().value;t.delete(s),s.evict()}}clear(){let t=Array.from(this.pages);this.pages.clear();for(let e=0,s=t.length;e<s;e++)t[e].evict()}saveScroll(t,e){if(e){this.scrollMemory.set(t,e);return}this.scrollMemory.has(t)&&this.scrollMemory.delete(t)}getScroll(t){return this.scrollMemory.get(t)||null}};var ye=class extends A{getChildScope(){return this.parent}},Ps=r=>z(r,ye);var be="data-scroll-key",Xr="["+be+"]",Ds=(r,t)=>{for(let e=0,s=r.length;e<s;e++){let n=r[e];if(!n||n.nodeType!==1)continue;let i=n.getAttribute(be);i!==null&&t(n,i);let o=n.querySelectorAll(Xr);for(let a=0,c=o.length;a<c;a++){let l=o[a];t(l,l.getAttribute(be))}}},xe=r=>{let t=null;return Ds(r,(e,s)=>{let n=e.scrollTop||0,i=e.scrollLeft||0;n===0&&i===0||(t=t||{},t[s]=[n,i])}),t},Se=(r,t)=>{if(!t)return!0;let e={},s=0;for(let n in t)e[n]=!0,s++;return Ds(r,(n,i)=>{let o=t[i];if(!o)return;let a=o[0],c=o[1];n.scrollTop=a,n.scrollLeft=c,Math.abs((n.scrollTop||0)-a)<1&&Math.abs((n.scrollLeft||0)-c)<1&&e[i]&&(e[i]=!1,s--)}),s<=0};var Zr=r=>/^class[\s{]/.test(Function.prototype.toString.call(r)),tn=1500,Ms=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),en=r=>{let t=r.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},ke=(r,t,e)=>{if(!(!r||typeof r[t]!="function"))try{r[t](...e)}catch(s){console.error("Error in "+t+":",s)}},jt=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent,this.keepAlive=typeof e.keepAlive=="boolean"?e.keepAlive:null,this.pageCache=e.pageCache||null,this.detachedNodes=null,this.detachedParents=null,this.detachedPath=null,this.savedScroll=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let s=t.layout;if(s&&s.isUnit===!0&&typeof s.keepAlive=="boolean")return s.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}isDetached(){return this.detachedNodes!==null}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.detachedPath!==this.getPagePath()&&this.evict(),this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=Zr(t)?new t:t(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(Ps(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;y.render(t,this.container,this.parent)}afterCreate(t){let e=this.component;!e||this.pageCache===null||(e.loaded===!1&&e.src&&(e.onModuleRender=()=>this.onModuleRender(e)),this.isKeepAlive(e)&&this.callPageHook("onActivate",[t,{restored:!1}]),this.pageCache.historyNavigation===!0&&this.restoreHistoryScroll())}onModuleRender(t){if(this.setup!==!0||this.component!==t)return;let e=t.layout;e&&e.isUnit===!0&&this.isKeepAlive(t)&&ke(e,"onActivate",[this.params,{restored:!1}])}getScrollKey(){let t=this.route||{};return(t.routeId||"")+"|"+(t.path||"")}getPagePath(){let e=(this.route||{}).path||"",s=e.indexOf("#");return s>-1?e.substring(0,s):e}getRootNodes(t){let e=[],s=en(t);s&&e.push(s);let n=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),i=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),o=[n,i];for(let a=0;a<2;a++){let c=o[a];if(c)for(let l=0,u=c.length;l<u;l++){let h=c[l];h&&e.indexOf(h)===-1&&e.push(h)}}return e}callPageHook(t,e){let s=this.component;if(!s)return;ke(s,t,e);let n=s.layout;n&&n!==s&&n.isUnit===!0&&ke(n,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,s=this.component,n=()=>Se(this.getRootNodes(s),t);if(n()||typeof requestAnimationFrame>"u")return;let i=Ms(),o=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==s||n()||Ms()-i>tn||requestAnimationFrame(o)};requestAnimationFrame(o)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null,!(!t||!this.component)&&Se(this.getRootNodes(this.component),t)}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let s=xe(e);this.savedScroll=s,this.pageCache.saveScroll(this.getScrollKey(),s);let n=new WeakMap;for(let i=0,o=e.length;i<o;i++){let a=e[i],c=a.parentNode;c&&(n.set(a,c),c.removeChild(a))}return this.detachedNodes=e,this.detachedParents=n,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let s=this.component,n=this.container;if(!s||s.rendered!==!0||!n||typeof n.appendChild!="function")return this.savedScroll=null,this.releaseComponent(),!1;let i=this.getRootNodes(s);for(let o=0,a=i.length;o<a;o++){let c=i[o],l=e?e.get(c):null;(l&&l.isConnected?l:n).appendChild(c)}return this.setup=!0,O.schedule(),!0}evict(){if(this.detachedNodes===null)return;let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null,this.savedScroll=null,this.releaseComponent()}releaseComponent(){let t=this.component;this.component=null,t&&typeof t.destroy=="function"&&t.destroy()}remove(t){if(this.setup!==!0){t===!0&&this.evict();return}this.setup=!1,this.scrollToken++;let e=this.component;if(!e)return;let s=this.pageCache;if(t!==!0&&s!==null){if(this.isKeepAlive(e)&&this.detach(e))return;s.saveScroll(this.getScrollKey(),xe(this.getRootNodes(e)))}this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var Is=r=>{if(!r.length)return null;let t={};for(let e=0,s=r.length;e<s;e++)t[r[e]]=null;return t},_s=r=>{let t=[];if(!r)return t;let e=/[*?]/g;r=r.replace(e,"");let s=/:(.[^./?&($]+)\?*/g,n=r.match(s);if(n===null)return t;for(let i=0,o=n.length;i<o;i++){let a=n[i];a&&t.push(a.replace(":",""))}return t};var sn=/(\/):[^/(]*?\?/g,rn=/\//g,nn=/(\?\/+\*?)/g,on=/(:[^/?&($]+)/g,an=/(\*)/g,cn=r=>r.replace(sn,t=>t.replace(rn,"(?:$|/)")),ln=r=>(r=r.replace(nn,"?/*"),r.replace(on,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),un=r=>r.replace(an,".*"),hn=(r,t)=>r+=t[t.length-1]==="*"?"":"$",Rs=r=>{if(!r)return"";let t=r;return t=cn(t),t=ln(t),t=un(t),t=hn(t,r),t};var fn=0,Os=(r,t="")=>{let e=r||"",s=typeof t=="string"&&t?t:e,n=null,i=[],o=s.match(/#\{([^}]+)\}/);o&&o[1]&&(n=o[1].trim(),s=s.replace(o[0],""),e=e.replace(o[0],""));let a=s.indexOf("?");if(a>-1){let u=s.substring(a+1);if(u.indexOf("=")>-1){let h=u.split("&");for(let g=0,m=h.length;g<m;g++){let x=h[g];if(!x)continue;let[_,Q=""]=x.split("="),ve=(_||"").trim();ve&&i.push({key:ve,value:(Q||"").trim()})}s=s.substring(0,a);let f=e.indexOf("?");f>-1&&(e=e.substring(0,f))}}let c=n!==null||i.length>0;return c&&!s&&(e="*"),{uriPath:e,requiredHash:n,requiredQuery:i,hasConditions:c}},dn=r=>{if(!r)return"";let t=r.indexOf("?"),e=r.indexOf("#"),s=r.length;return t>-1&&(s=t),e>-1&&e<s&&(s=e),r.substring(0,s).replace(/\/\.(?:\/|$)/g,"/")},pn=r=>{if(!r)return"";let t=r.indexOf("#");return t===-1?"":r.substring(t+1)},mn=r=>{if(!r)return"";let t=r.indexOf("?");if(t===-1)return"";let e=r.indexOf("#",t);return e===-1?r.substring(t+1):r.substring(t+1,e)},Jt=class extends R{constructor(t,e,s=null){let n=t.baseUri,o=Os(n,t.rawUri).uriPath,a=_s(o),c=Is(a),l=super(c);return this.uri=n,this.matchUri=o,this.paramKeys=a,this.titleCallBack=e,this.pageCache=s,this.setupRoute(t),this.set("active",!1),l}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null,this.pageCache=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+fn++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=Os(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let s=Rs(this.matchUri);this.uriQuery=new RegExp("^"+s),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1,this.scrollTo=t.scrollTo||null}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(t){this.set("active",!1);let e=this.controller;e&&e.remove(t===!0)}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return!!e&&e.isConnected===!1}getLayout(t){if(t.component)return t.component;let e=t.import;return e?pe(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:s,persist:n,parent:i,keepAlive:o}=t,a={component:e,container:s,persist:n,parent:i,keepAlive:o,pageCache:this.pageCache},c=Dt(this);this.controller=new jt(c,a)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let s=this.controller;s&&s.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];i&&this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,s=dn(t),n=this.uriQuery||/$^/,i=s.match(n);return i===null?(this.resetParams(),e):Array.isArray(i)?this.matchConditions(t)?(this.setParams(i,1),e=i,e):(this.resetParams(),!1):e}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&pn(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let s=mn(t);if(!s)return!1;let n=new URLSearchParams(s);for(let i=0,o=e.length;i<o;i++){let a=e[i];if(!n.has(a.key)||n.get(a.key)!==a.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let s=this.paramKeys;if(!s)return;let n={};for(let i=0,o=s.length;i<o;i++){let a=s[i];typeof a<"u"&&(n[a]=t[i+e])}this.set(n)}getParams(){return this.stage}};var gn=r=>{let t=/\w\S*/;return r.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},yn=r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),bn=(r,t)=>{if(r.indexOf(":")===-1)return r;let e=t.stage;for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)){let n=new RegExp(":"+yn(s),"gi");r=r.replace(n,()=>e[s])}return r},xn=(r,t)=>t&&(typeof t=="function"&&(t=t(r.stage)),t=bn(t,r),gn(t)),Sn=(r,t)=>(t!==""&&(r+=" - "+t),r),Ls=(r,t,e)=>t&&(t=xn(r,t),Sn(t,e));var Bs=(r,t)=>({attr:r,value:t}),kn=(r,t)=>{if(!t.startsWith(r))return!1;let e=t[r.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},Xt=class extends A{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,s=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:s}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let s=this.exact===!0,n=B.data,i=[];t&&typeof t=="object"&&i.push(Bs("href",t)),e&&typeof e=="object"&&i.push(Bs("text",e));let o=null,a="",c="";return i.push({value:["[[path]]",n],callBack:(l,u)=>{if(typeof u.pathname>"u")return;let h=u.getAttribute("href");if(h!==o){o=h;let g=u.pathname+u.search+u.hash;a=g,c=u.hash||u.search?g:u.pathname}let f=s?l===a:kn(c,l);this.update(f)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var wn=()=>typeof window<"u"?window.location:{},vn=r=>{if(!r)return"";let t=r.indexOf("#");return t>-1?r.substring(t+1):""},Cn=1500,Zt=["wheel","touchstart","keydown","pointerdown"],Ns=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),we=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=ge,this.pageCache=new Yt(this),this.history=null,this.callBackLink=null,this.location=wn(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new U({path:""})}setupHistory(){this.history=$t.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new Jt(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let s=e?e.max:void 0;return typeof s=="number"&&s>=0&&(this.keepAliveMax=s),this.pageCache.trim(),this}add(t){if(typeof t!="object"){let s=arguments;t={uri:s[0],component:s[1],callBack:s[2],title:s[3],id:s[4],container:s[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resumeRoute(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){let e=this.getBasePath(),s=Gt.removeSlashes(t);return s=s.replace(/^(?:\.\/)+/,""),s==="."&&(s=""),e+s}getRoute(t){let e=this.routes,s=e.length;if(s>0)for(let n=0;n<s;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,s=e.length;if(s>0)for(let n=0;n<s;n++){let i=e[n];if(i.routeId===t)return i}return!1}removeRoute(t){let e=this.routes,s=e.indexOf(t);s>-1&&e.splice(s,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate(!0)}addSwitch(t){let e=this.switchCount++,s=this.getSwitchGroup(e);for(let n=0,i=t.length;n<i;n++){let o=t[n];if(!o)continue;let a=this.createRoute(o);s.push(a)}return this.checkGroupForRegistration(e,s),e}resumeSwitch(t,e){let s=this.switchCount++,n=this.getSwitchGroup(s);for(let i=0,o=t.length;i<o;i++){let c=t[i].component.route;c.resumeRoute(e),n.push(c)}return this.checkGroupForRegistration(s,n),s}checkGroupForRegistration(t,e){let s=this.scrollIntent,n=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=n;let i=this.scrollIntent;i&&i.type==="target"&&i.groupId!==null&&i.groupId!==void 0&&(this.lastScrollGroup=i.groupId),this.scrollIntent=s}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let s=[];return this.switches.set(t,s),s}removeSwitch(t){let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let s=0,n=e.length;s<n;s++){let i=e[s];i&&typeof i.deactivate=="function"&&i.deactivate(!0)}}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),d.on("click",document,this.callBackLink);let s=this.getEndPoint();return this.navigate(s,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.defaultPrevented===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0||t.altKey===!0||typeof t.button=="number"&&t.button!==0)return!0;let e=t.target&&t.target.closest?t.target.closest("a"):null;if(!e||e.dataset.cancelRoute||e.hasAttribute("download"))return!0;let s=e.getAttribute("target");if(s&&s!=="_self")return!0;let n=e.getAttribute("href");if(n===null)return!0;let i=this.getLinkPath(n);if(i===null)return!0;let o=e.dataset.replace==="true";return this.navigate(i,null,o),t.preventDefault(),t.stopPropagation(),!1}getLinkPath(t){let e=t;if(e.substring(0,2)==="//"||/^[a-z][a-z0-9+.-]*:/i.test(e)){let n=this.location;if(!n||!n.origin||typeof URL>"u")return null;let i;try{i=new URL(e,n.href)}catch{return null}if(i.origin!==n.origin)return null;e=i.pathname+i.search+i.hash}let s=this.baseURI;return s!=="/"&&e.indexOf(s)===0&&(e=e.substring(s.length)),e}reset(){let t=this.routes;for(let e=0,s=t.length;e<s;e++){let n=t[e];n&&typeof n.deactivate=="function"&&n.deactivate(!0)}return this.pageCache.clear(),this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,s){return t=this.createURI(t),this.history.addState(t,e,s),this.updatePath(),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=Ls(t,e,this.title),this}checkActiveRoutes(t,e){t=t||this.getPath(),t!==this.path&&(this.lastPath=this.path),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollWaitToken++;let s=this.pageCache;s.historyNavigation=e===!0;let n=this.routes;for(let i=0,o=n.length;i<o;i++){let a=n[i];typeof a>"u"||s.size>0&&a.isDormant()||this.checkRoute(a,t)}if(this.checkSwitches(t,!0),s.historyNavigation=!1,e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}checkSwitches(t,e){let s=this.switches;for(let[n,i]of s.entries())e===!0&&this.pageCache.size>0&&i.length&&i[0].isDormant()||(this.currentGroupId=n,this.checkGroup(i,t));this.currentGroupId=null}checkGroup(t,e){let s=t.length;if(!s)return;let n=null;for(let a=0;a<s;a++)if(t[a].get("active")){n=t[a];break}let i=!1;n&&(i=n.match(e)!==!1);let o;for(let a=0;a<s;a++){let c=t[a];if(typeof c>"u")continue;(c===n?i:c.match(e))!==!1&&o===void 0&&c.controller&&(o=c)}if(!o){n&&n!==t[0]&&n.deactivate(),this.select(t[0],!0);return}this.select(o),n&&n!==o&&n.deactivate();for(let a=0;a<s;a++){let c=t[a];c&&c!==o&&c!==n&&c.deactivate()}}checkRoute(t,e){let s=this.check(t,e);return s!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),s}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t,e){if(!t||(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e===!0))return;let s=this.scrollIntent;if(s&&s.type==="hash")return;let n=vn(this.path);if(n){this.scrollIntent={type:"hash",hash:n};return}t.scrollTo?this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId}:t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,s=e&&this.lastScrollGroup===t.groupId;s||(typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()),this.lastScrollGroup=e?t.groupId:null,s&&this.scrollToTarget(t.selector)}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let s=t.x||0,n=t.y||0;if(typeof requestAnimationFrame>"u"||this.canReachScroll(s,n)){window.scrollTo(s,n);return}let i=()=>{e===this.scrollWaitToken&&this.scrollWaitToken++,this.clearScrollWait()},o={capture:!0,passive:!0};for(let l=0,u=Zt.length;l<u;l++)window.addEventListener(Zt[l],i,o);this.cancelScrollWait=()=>{for(let l=0,u=Zt.length;l<u;l++)window.removeEventListener(Zt[l],i,o)};let a=Ns(),c=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(s,n)||Ns()-a>=Cn){this.clearScrollWait(),window.scrollTo(s,n);return}requestAnimationFrame(c)};requestAnimationFrame(c)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){let s=document.documentElement;if(!s)return!0;let n=(s.scrollHeight||0)-(window.innerHeight||0),i=(s.scrollWidth||0)-(window.innerWidth||0);return(e<=0||e<=n+1)&&(t<=0||t<=i+1)}scrollToHash(t){if(!t||typeof document>"u")return;let e=()=>{let c=document.getElementById(t);if(c)return c;try{return document.getElementById(decodeURIComponent(t))}catch{return null}},s=e();if(s){s.scrollIntoView(!0);return}if(typeof requestAnimationFrame>"u")return;let n=++this.scrollWaitToken,i=30,o=0,a=()=>{if(n!==this.scrollWaitToken)return;let c=e();if(c){c.scrollIntoView(!0);return}++o<i&&requestAnimationFrame(a)};requestAnimationFrame(a)}scrollToTarget(t){if(typeof t!="string"||typeof document>"u")return;let e=a=>{let c=window.getComputedStyle(a),l=c.position==="sticky",u;if(l){let g=a.style.position;a.style.position="static",u=a.getBoundingClientRect().top+window.scrollY,a.style.position=g}else u=a.getBoundingClientRect().top+window.scrollY;let h=l&&parseFloat(c.top)||0,f=u-h;window.scrollY>f&&window.scrollTo(0,f)};if(typeof requestAnimationFrame>"u"){let a=document.querySelector(t);a&&e(a);return}let s=++this.scrollWaitToken,n=30,i=0,o=()=>{if(s!==this.scrollWaitToken)return;let a=document.querySelector(t);if(a){e(a);return}++i<n&&requestAnimationFrame(o)};requestAnimationFrame(o)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),s=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(s.length!==n.length)return!0;let i=s[s.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&d.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent(),this.clearScrollWait(),this.pageCache.clear()}getPath(){let t=this.location,e=this.history;return e&&e.type==="hash"?t.hash.replace("#",""):t.pathname+t.search+t.hash}},B=new we;p.addType("routes",r=>{if(!r)return!1;let t=r.route;t&&B.removeRoute(t)});var Us=(r,t,e)=>{if(t)if(Array.isArray(t))for(let s=0,n=t.length;s<n;s++){let i=t[s];i&&Hs(r,i,e)}else Hs(r,t,e)},Hs=(r,t,e)=>{t.container=r,t.parent=e;let s=B.add(t);An(r,s)},An=(r,t)=>{p.add(r,"routes",{route:t})};var Fs=(r,t,e)=>{};p.addType("switch",r=>{if(!r)return!1;let t=r.id;B.removeSwitch(t)});var Ws=(r,t,e)=>{let s=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=r,a.parent=e)}let n=B.addSwitch(t);Tn(r,n)},Tn=(r,t)=>{p.add(r,"switch",{id:t})};st.add("cache",ls).add("onCreated",vs).add("onDestroyed",Cs).add("bind",gs).add("data",as).add("state",Fs).add("onSet",it).add("onState",Kt).add("animateIn",Xe).add("animateOut",Ze).add("watch",As).add("useParent",us).add("useData",fs).add("useState",ds).add("getId",hs).add("addState",ps).add("addEvent",ms).add("map",ws).add("for",ks).add("useContext",is).add("addContext",os).add("context",ns).add("role",es).add("aria",ss).add("route",Us).add("debug",cs).add("dataSet",bs).add("dataStateSet",xs).add("switch",Ws);export{ht as Ajax,at as Arrays,ir as Atom,y as Builder,A as Component,U as Data,p as DataTracker,Ar as DateTime,st as Directives,X as Dom,pt as Encode,zs as Events,D as Html,pe as Import,z as Jot,mt as Model,Xt as NavLink,S as Objects,Cr as Pod,wt as ResourceCache,tt as SimpleData,gt as State,I as Store,w as Strings,k as Types,yt as Unit,N as base,b as dataBinder,B as router};
1
+ var at=class{static toArray(t){return Array.from(t)}static inArray(t,e,s){return Array.isArray(t)?t.indexOf(e,s):-1}};var qs=Object.prototype.toString,xt=Object.prototype.hasOwnProperty,S={create(r){return Object.create(r||null)},extendObject(r,t){if(!r||typeof r!="object"||!t||typeof t!="object")return!1;for(let e in r)xt.call(r,e)&&!xt.call(t,e)&&(t[e]=r[e]);return t},clone(r){if(!r||typeof r!="object")return{};try{return structuredClone(r)}catch{return JSON.parse(JSON.stringify(r))}},getClassObject(r){return typeof r=="function"?r.prototype:r},extendClass(r,t){let e=this.getClassObject(r),s=this.getClassObject(t);if(typeof e!="object"||typeof s!="object")return!1;let n=Object.create(e);for(let i in s)n[i]=s[i];return n},hasOwnProp(r,t){return xt.call(r,t)},isPlainObject(r){return!!r&&qs.call(r)==="[object Object]"},isEmpty(r){if(!r||typeof r!="object"||Array.isArray(r))return!0;if(r instanceof Map||r instanceof Set)return r.size===0;for(let t in r)if(xt.call(r,t))return!1;return!0}};var k=class{static getType(t){let e=typeof t;return e!=="object"?e:Array.isArray(t)?"array":"object"}static isUndefined(t){return typeof t>"u"}static isObject(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}static isFunction(t){return typeof t=="function"}static isString(t){return typeof t=="string"}static isArray(t){return Array.isArray(t)}};var ct={types:{},add(r,t){this.types[r]=t},get(r){return this.types[r]||!1},remove(r){delete this.types[r]}};var St=class{constructor(){this.types=new Map}add(t,e){let s=this.types.get(t);s||(s=[],this.types.set(t,s)),s.push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeType(t){let e=this.types.get(t);if(!e)return;if(!e.length){this.types.delete(t);return}let s,n=ct.get(t);if(n){for(let i=0,o=e.length;i<o;i++)s=e[i],s&&(e[i]=null,typeof n=="function"&&n(s));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}let e=this.types.keys();for(let s of e)s&&this.removeType(s);this.types.clear()}};var $=new WeakMap,p=class{static trackers=new Map;static trackingCount=0;static addType(t,e){ct.add(t,e)}static removeType(t){ct.remove(t)}static getTrackingId(t){if(!t||typeof t!="object")return"";let e=$.get(t);return e||(e="dt"+this.trackingCount++,$.set(t,e)),e}static add(t,e,s){let n=this.getTrackingId(t);this.find(n).add(e,s)}static get(t,e){let s=$.get(t),n=this.trackers.get(s);return n?e?n.get(e):n:!1}static has(t,e){let s=this.getTrackingId(t);if(!s)return!1;let n=this.trackers.get(s);return n&&e?n.has(e):!1}static find(t){let e=this.trackers.get(t);return e||(e=new St,this.trackers.set(t,e)),e}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let s=$.get(t);if(!s)return;let n=this.trackers.get(s);if(n){if(!e){n.remove(),this.trackers.delete(s),$.delete(t);return}n.remove(e),this.isEmpty(n.types)&&(this.trackers.delete(s),$.delete(t))}}};var d={getEvents(r){return typeof r!="object"||r===null?[]:p.get(r,"events")},create(r,t,e,s=!1,n=!1,i=null){return{event:r,obj:t,fn:e,capture:s,swapped:n,originalFn:i}},on(r,t,e,s){if(Array.isArray(r))for(let n=0,i=r.length;n<i;n++)this.add(r[n],t,e,s);else this.add(r,t,e,s);return this},off(r,t,e,s){if(Array.isArray(r))for(let n=0,i=r.length;n<i;n++)this.remove(r[n],t,e,s);else this.remove(r,t,e,s);return this},add(r,t,e,s=!1,n=!1,i=null){if(typeof t!="object"||t===null)return this;let o=this.create(r,t,e,s,n,i);return p.add(t,"events",o),t.addEventListener(r,e,s),this},remove(r,t,e,s=!1){let n=this.getEvent(r,t,e,s);if(n===!1)return this;if(typeof n=="object"){this.removeEvent(n);let i=this.getEvents(t);if(i){let o=i.indexOf(n);o>-1&&i.splice(o,1),i.length===0&&p.remove(t,"events")}}return this},removeEvent(r){return typeof r=="object"&&r.obj.removeEventListener(r.event,r.fn,r.capture),this},getEvent(r,t,e,s){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(r,t,e,s);return this.search(i,n)},search(r,t){let e,s=this.isSwappable(r.event);for(let n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==r.event||e.obj!==r.obj)&&(e.fn===r.fn||s===!0&&e.originalFn===r.fn))return e;return!1},removeEvents(r){return typeof r!="object"||r===null?this:(p.remove(r,"events"),this)},swap:new Set(["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"]),addSwapped(r){this.swap.add(r)},isSwappable(r){return this.swap.has(r)}};p.addType("events",r=>{d.removeEvent(r)});var Ae={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},Ce=Object.keys(Ae),zs={events:d,addListener(r,t,e,s){return this.events.add(r,t,e,s),this},on(r,t,e,s){let n=this.events;if(Array.isArray(r))for(let i=0,o=r.length;i<o;i++)n.add(r[i],t,e,s);else n.add(r,t,e,s);return this},off(r,t,e,s){let n=this.events;if(Array.isArray(r))for(let i=0,o=r.length;i<o;i++)n.remove(r[i],t,e,s);else n.remove(r,t,e,s);return this},removeListener(r,t,e,s){return this.events.remove(r,t,e,s),this},_createEvent(r,t,e,s){let n;switch(t){case"HTMLEvents":n=new Event(r,e);break;case"MouseEvents":n=new MouseEvent(r,e);break;default:n=new CustomEvent(r,s);break}return n},createEvent(r,t,e,s){if(typeof t!="object"||t===null)return!1;let n={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0,relatedTarget:null};typeof e=="object"&&e!==null&&(n=Object.assign(n,e));let i=this._getEventType(r);return this._createEvent(r,i,n,s)},_getEventType(r){for(let t=0,e=Ce.length;t<e;t++){let s=Ce[t];if(Ae[s].test(r))return s}return"CustomEvent"},trigger(r,t,e){if(typeof t!="object"||t===null)return this;let s=typeof r=="string"?this.createEvent(r,t,null,e):r;return t.dispatchEvent(s),this},mouseWheelEventType:null,getWheelEventType(){let r=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=r())},onMouseWheel(r,t,e,s=!1){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof r=="function"&&r(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,s,!0,r),this},offMouseWheel(r,t,e=!1){typeof t>"u"&&(t=window);let s=this.getWheelEventType();return this.off(s,t,r,e),this},preventDefault(r){return typeof r.preventDefault=="function"?r.preventDefault():r.returnValue=!1,this},stopPropagation(r){return typeof r.stopPropagation=="function"?r.stopPropagation():r.cancelBubble=!0,this}};var lt=class{constructor(){this.errors=[],this.dataTracker=p}augment(t){if(!k.isObject(t))return this;let e=this.constructor.prototype;for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return this}override(t,e,s,n){return(t[e]=s).apply(t,at.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,s){if(k.isObject(t)===!1)return"";let n=t[e];return typeof n<"u"?n:typeof s<"u"?s:""}createCallBack(t,e,s=[],n=!1){return typeof e!="function"?!1:(...i)=>(n===!0&&(s=s.concat(i)),e.apply(t,s))}bind(t,e){return e.bind(t)}};lt.prototype.extend=(function(){return lt.prototype})();var B=new lt;var ut={url:"",responseType:"json",method:"POST",fixedParams:"",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},beforeSend:[],async:!0,crossDomain:!1,withCredentials:!1,completed:null,failed:null,aborted:null,progress:null};var Te=()=>{B.augment({xhrSettings:ut,addFixedParams(r){this.xhrSettings.fixedParams=r},beforeSend(r){this.xhrSettings.beforeSend.push(r)},ajaxSettings(r){typeof r=="object"&&(this.xhrSettings=S.extendClass(B.xhrSettings,r))},resetAjaxSettings(){this.xhrSettings=ut}})};var w=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,s=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let n={},i=/([^?=&]+)(=([^&]*))?/g;return t.replace(i,function(o,a,c,l){let u=l===void 0?"":l;if(e!==!1)try{n[a]=decodeURIComponent(u)}catch{n[a]=u}else n[a]=u}),n}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,s=>s[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let s=/([A-Z]{1,})/g;return t.replace(s,n=>e+n.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())}};var kt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:s,url:n,async:i}=this.settings;e.open(s,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=ut.beforeSend;if(t.length<1)return;let e=this.xhr,s=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];o&&o(e,s)}}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e.join("&")}setupParams(t,e=null){let s=typeof t;if(!e)return!(t instanceof FormData)&&s==="object"&&(t=this.objectToString(t)),t;let n=typeof e;if(s==="string")return n!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(n==="string"&&(e=w.parseQueryString(e,!1)),t instanceof FormData)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.append(i,e[i]);else s==="object"&&(t=Object.assign({},e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,s=t.params;return s?s=this.setupParams(s,e):e&&(s=this.setupParams(e)),s}getXhrSettings(t){let e=this.settings={...B.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var s=0,n=t.length;s<n;s++){var i=t[s];switch(s){case 0:e.url=i;break;case 1:e.params=i;break;case 2:e.completed=i,e.failed=i;break;case 3:e.responseType=i||"json";break;case 4:e.method=i?i.toUpperCase():"POST";break;case 5:e.async=typeof i<"u"?i:!0;break}}else e=this.settings=S.extendClass(this.settings,t[0]),typeof e.completed=="function"&&(typeof e.failed!="function"&&(e.failed=e.completed),typeof e.aborted!="function"&&(e.aborted=e.failed))}createXHR(){let t=this.settings,e=new XMLHttpRequest;return e.responseType=t.responseType,t.withCredentials===!0&&(e.withCredentials=!0),e}setupHeaders(){let t=this.settings;if(!t||typeof t.headers!="object")return;let e=t.headers;for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.xhr?.setRequestHeader(s,e[s])}update(t,e){let s=this.xhr,n=()=>{d.removeEvents(s?.upload),d.removeEvents(s)},i=this.settings;if(!i)return!1;switch(e||t.type){case"load":{if((s?.status??0)>=400){typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break}if(typeof i.completed=="function"){let c=this.getResponseData();i.completed(c,this.xhr)}n();break}case"error":typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break;case"progress":typeof i.progress=="function"&&i.progress(t);break;case"abort":typeof i.aborted=="function"&&i.aborted(!1,this.xhr),n();break}}getResponseData(){let t=this.xhr;if(!t)return null;let e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let e=this.xhr;if(!e)return;let s=this.update.bind(this);d.on(["load","error","abort"],e,s),d.on("progress",e.upload,s)}};Te();var ht=(...r)=>new kt(r).xhr;var Ks=(r,t)=>{if(r===t)return!1;try{return JSON.stringify(r)!==JSON.stringify(t)}catch{return!0}},te=class{constructor({max:t=100,ttl:e=3e4}={}){this.entries=new Map,this.max=t,this.defaultTtl=e}get size(){return this.entries.size}setMax(t){this.max=Math.max(1,Number(t)||1),this.evict()}getEntry(t){let e=this.entries.get(t);return e?(this.entries.delete(t),this.entries.set(t,e),e):null}createEntry(t){let e={value:void 0,meta:null,time:0,ttl:this.defaultTtl,hasValue:!1,promise:null};return this.entries.delete(t),this.entries.set(t,e),this.evict(),e}evict(){let t=Math.max(1,this.max);for(;this.entries.size>t;){let e=this.entries.keys().next().value;this.entries.delete(e)}}isFresh(t){return!!t&&t.hasValue&&Date.now()-t.time<t.ttl}has(t){return this.isFresh(this.entries.get(t)||null)}get(t){let e=this.getEntry(t);return this.isFresh(e)?e.value:void 0}set(t,e,s,n=null){let i=this.getEntry(t)||this.createEntry(t);i.value=e,i.meta=n,i.time=Date.now(),i.ttl=typeof s=="number"?s:this.defaultTtl,i.hasValue=!0}invalidate(t){if(Array.isArray(t))return t.reduce((n,i)=>n+this.invalidate(i),0);let e=null;if(typeof t=="string"?e=n=>n.startsWith(t):t instanceof RegExp?e=n=>t.test(n):typeof t=="function"&&(e=t),!e)return 0;let s=0;for(let[n,i]of Array.from(this.entries))e(n,i)&&(this.entries.delete(n),s++);return s}clear(){this.entries.clear()}fetch(t,e,s,n){let i,o=e.promise=new Promise(l=>i=l),a=!1,c=(l,u,h)=>{a||(a=!0,i({ok:l===!0,value:u,meta:h}))};o.then(l=>{if(e.promise===o&&(e.promise=null),this.entries.get(t)===e){if(l.ok){e.value=l.value,e.meta=l.meta,e.time=Date.now(),e.ttl=n,e.hasValue=!0;return}e.hasValue||this.entries.delete(t)}});try{return s(c)}catch(l){return c(!1,void 0,l),null}}resolve(t,e,s,n){s=s||{};let i=typeof s.ttl=="number"?s.ttl:this.defaultTtl,o=this.getEntry(t);if(o&&o.hasValue){if(this.isFresh(o)){let{value:c,meta:l}=o;return queueMicrotask(()=>n(c,l,!0)),null}if(s.swr===!0){let{value:c,meta:l}=o;queueMicrotask(()=>n(c,l,!0));let u=o.promise?null:this.fetch(t,o,e,i);return o.promise.then(h=>{h.ok&&Ks(c,h.value)&&n(h.value,h.meta,!0)}),u}}if(o&&o.promise)return o.promise.then(c=>n(c.value,c.meta,c.ok)),null;o=o||this.createEntry(t);let a=this.fetch(t,o,e,i);return o.promise.then(c=>n(c.value,c.meta,c.ok)),a}load(t,e,s={}){return new Promise((n,i)=>{let o=!0,a=c=>{Promise.resolve().then(e).then(l=>c(!0,l,null),l=>c(!1,void 0,l))};this.resolve(t,a,s,(c,l,u)=>{if(o)return o=!1,u?n(c):i(l);typeof s.onUpdate=="function"&&s.onUpdate(c)})})}},wt=new te;var Vs=r=>{let t=typeof r;return t!=="string"&&t!=="number"?r:Ee(r)},Ee=r=>[{tag:"text",textContent:r}],Pe=()=>({props:{},children:[]}),De=r=>({props:{},children:Ee(r)}),Me=r=>({props:{},children:r}),Ie=r=>({props:r[0]||{},children:Vs(r[1])});var v=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t,this.evictCount=t>=8?t>>3:1}get(t){let e=this.cache.get(t);if(e!==void 0)return e.used=!0,e.value}has(t){return this.cache.has(t)}set(t,e){let s=this.cache,n=s.get(t);if(n!==void 0){n.value=e,n.used=!0;return}s.set(t,{value:e,used:!1}),s.size>this.maxSize&&this.evict()}evict(){let t=this.cache,e=this.maxSize-this.evictCount+1;for(let s=0;s<2&&t.size>e;s++){let n=t.keys(),i=t.size;for(;i-- >0&&t.size>e;){let o=n.next().value,a=t.get(o);if(a!==void 0&&a.used){a.used=!1;continue}t.delete(o)}}}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}};var vt=class{constructor(){this.connections=new Map}add(t,e,s){let n=this.getOrCreate(t),i=n.get(e);return i?Array.isArray(i)?i.push(s):n.set(e,[i,s]):n.set(e,s),s}get(t,e){let s=this.connections.get(t)?.get(e);return s?Array.isArray(s)?s[s.length-1]||!1:s:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let s=this.connections.get(t);if(s)if(e)this.unsubscribe(s.get(e)),s.delete(e),s.size===0&&this.connections.delete(t);else{for(let n of s.values())this.unsubscribe(n);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,s=t.length;e<s;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var Y=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var Ct=class extends Y{constructor(t){super(),this.data=t}subscribe(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribe - data source is null or does not have an "on" method. Make sure your component has data, state, or context.data initialized.',t,this.data);return}this.msg=t,this.token=this.data.on(t,e)}subscribeMany(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribeMany - data source is null or does not have an "on" method.',t,this.data);return}let s=t.length,n=new Array(s);for(let i=0;i<s;i++){let o=t[i];n[i]={msg:o,token:this.data.on(o,e)}}this.subscriptions=n}unsubscribe(){if(this.data){let t=this.subscriptions;if(t){for(let e=0,s=t.length;e<s;e++)this.data.off(t[e].msg,t[e].token);this.subscriptions=null}else this.msg&&this.token&&this.data.off(this.msg,this.token)}this.data=null,this.msg=null,this.token=null}};var j=class{unsubscribe(){}};var ft=class extends j{constructor(){super(),this.source=null}addSource(t){return this.source=new Ct(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var J=class extends Y{constructor(t){super(),this.pubSub=t}subscribe(t){this.msg=t;let e=this.callBack.bind(this);this.token=this.pubSub.on(t,e)}unsubscribe(){this.pubSub&&this.msg&&this.token&&this.pubSub.off(this.msg,this.token),this.pubSub=null,this.msg=null,this.token=null}callBack(){}};var At=class extends J{constructor(t,e,s){super(s),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}unsubscribe(){super.unsubscribe(),this.data=null,this.prop=null}};var X=class{static getById(t){return typeof t!="string"?!1:document.getElementById(t)||!1}static getByName(t){if(typeof t!="string")return!1;let e=document.getElementsByName(t);return e?Array.from(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let s=document.querySelectorAll(t);return s?s.length===1?s[0]:Array.from(s):!1}static html(t,e){return!t||typeof t!="object"?!1:typeof e<"u"?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return!t||typeof t!="object"||typeof e>"u"?this:(e=w.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=w.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let n=null,i=t.currentStyle;if(i&&(n=i[e]))return n;let o=window.getComputedStyle(t,null);return o?o[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return typeof t=="object"&&t!==null&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=w.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,s){e=this.removeDataPrefix(e),e=w.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=w.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(!t||typeof t!="object")return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(!t||typeof t!="object")return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return!t||typeof t!="object"?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return!t||typeof t!="object"?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return typeof t=="object"&&t!==null?t.offsetWidth:!1}static getHeight(t){return typeof t=="object"&&t!==null?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return!t||typeof t!="object"?!1:{left:e-(t.clientLeft||0),top:s-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,s=e.documentElement,n=e.getElementsByTagName("body")[0],i=t.innerWidth||s.clientWidth||n.clientWidth,o=t.innerHeight||s.clientHeight||n.clientHeight;return{width:i,height:o}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(!t||typeof t!="object")return s;let n=0;for(;t&&(e===0||n<e);)n++,s.x+=t.offsetLeft+t.clientLeft,s.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return s}static addClass(t,e){if(!t||typeof t!="object"||e==="")return this;if(typeof e=="string"){let s=e.split(" ");for(let n=0,i=s.length;n<i;n++)t.classList.add(s[n])}return this}static removeClass(t,e){return!t||typeof t!="object"||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return!t||typeof t!="object"||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return!t||typeof t!="object"?this:(t.classList.toggle(e),this)}};var Tt=r=>{let t="textContent";if(!r||typeof r!="object")return t;let e=r.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let s=r.type;if(!s)return t="value",t;switch(s){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var Gs=(r,t,e)=>{X.setAttr(r,t,e)},Qs=(r,t,e)=>{r.checked=r.value==e},$s=(r,t,e)=>{e=e==1,_e(r,t,e)},_e=(r,t,e)=>{r[t]=e},Ys=(r,t)=>X.getAttr(r,t),js=(r,t)=>r[t],Et=class extends J{constructor(t,e,s,n){super(n),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=Gs,this.getValue=Ys,this;this.getValue=js;let s=t.type;if(s)switch(s){case"checkbox":return this.setValue=$s,this;case"radio":return this.setValue=Qs,this}return this.setValue=_e,this}getAttrBind(t){return t||Tt(this.element)}setupFilter(t){let e=/\[\[[^\]]+\]\]/;return s=>t.replace(e,()=>s)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}unsubscribe(){super.unsubscribe(),this.element={},this.attr="",this.filter=null,this.setValue=null,this.getValue=null}};var Pt=class extends j{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new Et(t,e,s,this.pubSub)}addData(t,e){return this.data=new At(t,e,this.pubSub)}unsubscribeSource(t){return t&&t.unsubscribe(),this}unsubscribe(){return this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null,this}};var Js=0,Z=class{constructor(t=!1){this.callBacks=new Map,this.prefixIndex=t?new Map:null,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=2e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[],this.deliveringMessage=null,this.reentrantMessages=null,this.suppressQueue=!1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.prefixIndex?.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.reentrantMessages=null}on(t,e){let s=++Js,n=this.callBacks.get(t);return n||(n=new Map,this.callBacks.set(t,n),this.prefixIndex&&this._indexMessage(t)),n.set(s,e),s}_indexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),n=this.prefixIndex.get(s);n||(n=new Set,this.prefixIndex.set(s,n)),n.add(t)}_unindexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),n=this.prefixIndex.get(s);n&&(n.delete(t),n.size===0&&this.prefixIndex.delete(s))}getPrefixMessages(t){return this.prefixIndex&&this.prefixIndex.get(t)||null}getMessages(){return this.callBacks.keys()}off(t,e){let s=this.callBacks.get(t);s&&(s.delete(e),s.size===0&&(this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t)))}remove(t){this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t)}publish(t,e,s){if(!this.batchingEnabled){this.publishImmediate(t,e,s);return}this.suppressQueue||(t===this.deliveringMessage&&(this.reentrantMessages??=new Set).add(t),this.callBacks.has(t)&&(this.updateQueue.set(t,[e,s]),this.debugMode&&console.log("[DataPubSub] Queued update:",t,e),this.scheduleFlush()))}scheduleFlush(){this.isFlushing||this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){if(this.updateQueue.size===0){this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete();return}if(this.isFlushing||(this.flushIterations=0,this.reentrantMessages=null),this.isFlushing=!0,this.flushScheduled=!1,this.flushIterations++,this.flushIterations>this.maxFlushIterations){console.error("[DataPubSub] Infinite loop detected! Flush iterations exceeded",this.maxFlushIterations,"- Breaking to prevent memory exhaustion."),console.error("[DataPubSub] Queue size:",this.updateQueue.size),console.error("[DataPubSub] Queued messages:",Array.from(this.updateQueue.keys())),this._breakCascade(),this.flushScheduled=!1,this.isFlushing=!1,this._resolveFlushComplete(),this.flushIterations=0;return}this.debugMode&&console.log("[DataPubSub] Flushing",this.updateQueue.size,"updates (iteration",this.flushIterations+")");let t=this.updateQueue;this.updateQueue=new Map;try{for(let[e,s]of t)this.publishImmediate(e,s[0],s[1])}finally{this.debugMode&&console.log("[DataPubSub] Flush complete (iteration",this.flushIterations+")"),this.updateQueue.size>0?(this.debugMode&&console.log("[DataPubSub] New updates queued during flush, re-flushing..."),this.flush()):(this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete())}}_breakCascade(){let t=this.updateQueue;this.updateQueue=new Map;let e=this.reentrantMessages;this.suppressQueue=!0;try{for(let[s,n]of t)e&&e.has(s)||this.publishImmediate(s,n[0],n[1])}finally{this.suppressQueue=!1,this.reentrantMessages=null,this.updateQueue.clear()}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}}nextFlush(){return new Promise(t=>{this.flushCompleteResolvers.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>t())})}onFlush(t){if(typeof t!="function"){console.warn("[DataPubSub] onFlush requires a function callback");return}this.flushCallbacks.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>{if(this.flushCallbacks.length>0){let e=this.flushCallbacks;this.flushCallbacks=[];let s=e.length;for(let n=0;n<s;n++)e[n]()}})}flushSync(){this.flush()}publishImmediate(t,e,s){let n=this.callBacks.get(t);if(!n)return;let i=this.deliveringMessage;this.deliveringMessage=t;for(let o of n.values())if(o)try{o(e,s)}catch(a){console.error('[DataPubSub] Subscriber error for "'+t+'":',a)}this.deliveringMessage=i}};var ee=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new vt,this.pubSub=new Z(!0),this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,n){let i=s,o=null,a=s.indexOf(":");a!==-1&&(o=s.substring(0,a),i=s.substring(a+1));let c=o??"",l=this.setupConnection(t,e,i,c,n),u=l.element,h=e.get(i);return typeof h<"u"?u.set(h):(h=u.get(),h!==""&&l.data.set(h)),this}setupConnection(t,e,s,n,i){let o=this.getBindId(t),a=new Pt(this.pubSub);a.addData(e,s).subscribe(o);let u=`${e.getDataId()}:${s}`;return a.addElement(t,n,i).subscribe(u),this.addConnection(o,"bind",a),a}addConnection(t,e,s){return this.connections.add(t,e,s),this}setBindId(t){let e="db-"+this.idCount++;return t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){let e=t[this.attr];return e&&this.connections.remove(e),this}watch(t,e,s,n){if(k.isObject(t)===!1)return this;let i=new ft,o=e.get(s),a=!0,c=f=>{a&&(a=!1,f===o&&(f===null||typeof f!="object"))||n(f)};i.addSource(e).subscribe(s,c);let u=this.getBindId(t),h=e.getDataId()+":"+s;return this.addConnection(u,h,i),n(o),this}watchMany(t,e,s,n){if(k.isObject(t)===!1)return this;let i=s?s.length:0;if(i===0)return this;if(i===1)return this.watch(t,e,s[0],n);let o=new ft,a=o.addSource(e),c=new Array(i),l=new Array(i);for(let m=0;m<i;m++)c[m]=e.get(s[m]),l[m]=!0;let u=new Array(i);for(let m=0;m<i;m++){let x=m,_=c[m];u[m]=Q=>{l[x]&&(l[x]=!1,Q===_&&(Q===null||typeof Q!="object"))||n(Q)}}if(typeof e.on!="function")return console.warn('DataBinder.watchMany: data source has no "on" method.',e),this;let h=new Array(i);for(let m=0;m<i;m++)h[m]={msg:s[m],token:e.on(s[m],u[m])};a.subscriptions=h;let f=this.getBindId(t),g=e.getDataId()+":"+s.join(",");return this.addConnection(f,g,o),n(c[0]),this}unwatch(t,e,s){if(k.isObject(t)===!1)return this;let n=t[this.attr];if(n){let i=e.getDataId()+":"+s;this.connections.remove(n,i)}return this}publish(t,e,s){return this.pubSub.publish(t,e,s),this}getPrefixMessages(t){return this.pubSub.getPrefixMessages(t)}isDataBound(t){if(!t)return null;let e=t[this.attr];return e||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.has(t.keyCode)}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,s=this.isDataBound(e);if(s!==null){let n=this.connections.get(s,"bind");if(n){let i=n.element.get();this.pubSub.publish(s,i,e)}}}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&d.on(["change","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&d.off(["change","input"],document,this.changeHandler,!1)}},b=new ee;var Xs=new Map([["class","className"],["text","textContent"],["for","htmlFor"],["readonly","readOnly"],["maxlength","maxLength"],["cellspacing","cellSpacing"],["rowspan","rowSpan"],["colspan","colSpan"],["tabindex","tabIndex"],["celpadding","cellPadding"],["useMap","useMap"],["frameborder","frameBorder"],["contenteditable","contentEditable"]]),W=r=>Xs.get(r)||r,se=r=>typeof r=="string"&&r.charCodeAt(0)===111&&r.charCodeAt(1)===110?r.substring(2):r,Zs=/(?:<[a-z][\s\S]*>)/i,D=class{static create(t,e,s,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(s,i):this.append(s,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return;let s=e.type;s!==void 0&&t.setAttribute("type",s);let n=Object.keys(e);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=e[a];a==="innerHTML"?t.innerHTML=c:a.indexOf("-")!==-1?t.setAttribute(a,c):this.addAttr(t,a,c)}}static addHtml(t,e){return typeof e>"u"||e===""?this:(Zs.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(s===""||!e)return;if(typeof s==="function")e=se(e),s.originalCallback?d.add(e,t,s,!1,!0,s.originalCallback):d.add(e,t,s);else{let i=W(e);t[i]=s}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let s=document.createTextNode(t);return e&&this.append(e,s),s}static createComment(t,e){let s=document.createComment(t);return e&&this.append(e,s),s}static setupSelectOptions(t,e,s){if(!t||typeof t!="object"||!Array.isArray(e))return!1;e.forEach(n=>{let i=new Option(n.label,n.value);t.options.add(i),s!==null&&i.value==s&&(i.selected=!0)})}static removeElementData(t){let e=[t];for(;e.length>0;){let s=e.pop(),n=s.childNodes;if(n&&n.length>0)for(let i=n.length-1;i>=0;i--){let o=n[i];(o.nodeType!==3||o.bindId)&&e.push(o)}p.remove(s),s.bindId&&b.unbind(s)}}static removeElement(t){if(!t)return this;let e=p.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!t||typeof t!="object")return this;let e;for(;e=t.firstChild;)this.removeElementData(e),t.removeChild(e);return this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,s){let n=s||t.firstChild;return t.insertBefore(e,n),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var M=r=>r?r.data?r.data:r.context&&r.context.data?r.context.data:r.state?r.state:null:null;var C=class extends D{static create(t,e,s,n){let i=document.createElement(t);return this.addAttributes(i,e,n),s.appendChild(i),i}static addAttributes(t,e,s){if(!(!e||e.length<1))for(let n=0,i=e.length;n<i;n++){let o=e[n];this.addAttr(t,o.key,o.value,s)}}static addAttr(t,e,s,n){if(s===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=s;return}if(typeof s==="function"){if(e=se(e),s.originalCallback)d.add(e,t,s,!1,!0,s.originalCallback);else{let a=s,c=function(l){a.call(this,l,n)};d.add(e,t,c,!1,!0,a)}return}if(e.charCodeAt(4)===45){t.setAttribute(e,s);return}let o=W(e);t[o]=s}static addContent(t,e){e&&(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var Re=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,Oe=new v(1e3),tr=new Set(["disabled","checked","required","selected","hidden","readonly","readOnly","multiple","open","autofocus","inert"]),er=r=>typeof r=="string"?r!==""&&r!=="false":!!r,sr=(r,t)=>{if(t.charCodeAt(4)===45){r.removeAttribute(t);return}let e=W(t);if(e in r){r[e]="";return}r.removeAttribute(t)},T={isWatching(r){if(Array.isArray(r)){let t=r[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(r)},hasParams(r){return typeof r=="string"&&r.includes("[[")},_getWatcherProps(r){let t=Oe.get(r);if(t!==void 0)return t;let e=r.match(Re),s=e?e.map(n=>n.slice(2,-2)):null;return Oe.set(r,s),s},updateAttr(r,t,e){switch(t){case"text":case"textContent":r.textContent=e;break;case"disabled":case"checked":case"required":case"selected":case"hidden":case"readonly":case"readOnly":case"multiple":case"open":case"autofocus":case"inert":r[t==="readonly"?"readOnly":t]=er(e);break;case"src":if(r.tagName==="IMG"){r.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}r.src=e;break;default:if(e===""&&t){sr(r,t);break}C.addAttr(r,t,e);break}},replaceParams(r,t,e=!1){let s=0;return r.replace(Re,function(n,i,o){let a=e?t[s]:t;s++;let c=a.get(o);return c??""})},_getWatcherCallBack(r,t,e,s,n){let i=this._getWatcherProps(e);if(i&&i.length===1&&e.length===i[0].length+4){let o=i[0],a=n?t[0]:t;return tr.has(s)?()=>{this.updateAttr(r,s,a.get(o))}:()=>{let c=a.get(o);this.updateAttr(r,s,c!=null?String(c):"")}}return()=>{let o=this.replaceParams(e,t,n);this.updateAttr(r,s,o)}},getValue(r,t){let e=r.value;return Array.isArray(e)===!1?[e,M(t)]:e.length<2?[e[0],M(t)]:e},getPropValues(r,t,e){let s=[];for(let n=0,i=t.length;n<i;n++){let a=(e?r[n]:r).get(t[n])??"";s.push(a)}return s},getCallBack(r,t,e,s,n,i){let o=r.attr||"textContent",a=r.callBack;if(typeof a=="function"){let c=i||this._getWatcherProps(s)||[],l=c.length>1;return(u,h)=>{u=l!==!0?u:this.getPropValues(e,c,n);let f=a(u,t,h);typeof f<"u"&&this.updateAttr(t,o,f)}}return this._getWatcherCallBack(t,e,s,o,n)},addDataWatcher(r,t,e){let s=this.getValue(t,e),n=s[1]??e?.data??e?.context?.data??e?.state??null;if(!n)return;let i=s[0],o=Array.isArray(n),a=this._getWatcherProps(i);if(!a)return;let c=this.getCallBack(t,r,n,i,o,a);if(!o)a.length>1?b.watchMany(r,n,a,c):this.addWatcher(r,n,a[0],c);else for(let l=0,u=a.length;l<u;l++)this.addWatcher(r,n[l],a[l],c)},getWatcherSettings(r,t=null){if(typeof r=="string")return{attr:t,value:r};if(Array.isArray(r)){let e=r[r.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let s=r[1]&&typeof r[1]=="object"?[r[0],r[1]]:[r[0]];return typeof e=="function"?{attr:t,value:s,callBack:e}:{attr:e||"textContent",value:s}}return r},setup(r,t,e){t&&this.addDataWatcher(r,this.getWatcherSettings(t),e)},addWatcher(r,t,e,s){b.watch(r,t,e,s)}};var rr=r=>({props:{watch:r},children:[]}),nr=r=>{if(r.length===0)return Pe();let t=r[0],e=typeof t;if(e==="string"||e==="number")return De(t);if(Array.isArray(t))return T.isWatching(t)?rr(t):Me(t);let s=r[1]??r[0]??[];if(s&&Array.isArray(s)&&T.isWatching(s)){let n=r[0]&&!Array.isArray(r[0])?r[0]:{};r[0]={...n,watch:s},r[1]=[]}return Ie(r)},ir=r=>(...t)=>{let{props:e,children:s}=nr(t);return r(e,s)};var re=new WeakMap,ne=new WeakMap;function Be(r){if(!r||typeof r!="object")return r;let t=ne.get(r);return t!==void 0?t:r}var Le=new WeakMap;function or(r,t,e,s){let n=re.get(r);n||(n=new Map,re.set(r,n));let i=n.get(e);if(i)return i;let o=new Proxy(r,He(t,e,s));return n.set(e,o),ne.set(o,r),o}function ar(r){r&&typeof r=="object"&&re.delete(r)}function Ne(r,t){let e=t.charCodeAt(0),s=e>=48&&e<=57;return r===""?s?"["+t+"]":t:s?r+"["+t+"]":r+"."+t}function He(r,t="",e=""){return{get(s,n,i){let o=s[n];if(t===""&&n in s){if(typeof o=="function"){let c=Le.get(s);c||(c=new Map,Le.set(s,c));let l=c.get(n);if(l)return l;let u=o.bind(s);return c.set(n,u),u}return o}if(o=(s[e]||s)[n],o!==null&&typeof o=="object"){let c=Ne(t,n);return or(o,r,c,e)}return o},set(s,n,i,o){if(t===""&&n in s)return s[n]=i,!0;let c=(s[e]||s)[n],l=Ne(t,n);return r.set(l,i),c!==i&&c!==null&&typeof c=="object"&&ar(c),!0}}}var Dt=(r,t="stage")=>{let e=new Proxy(r,He(r,"",t));return ne.set(e,r),e};var dt=class{static resume(t,e){if(!t)return null;let s=localStorage.getItem(t);if(s===null)return e!==void 0?e:void 0;try{let n=JSON.parse(s);return n===null&&e!==void 0?e:n}catch(n){return console.warn('[LocalData] Failed to parse stored value for key "'+t+'". Removing corrupted entry.',n),localStorage.removeItem(t),e!==void 0?e:void 0}}static store(t,e){if(!t||!e)return!1;try{let s=JSON.stringify(e);return localStorage.setItem(t,s),!0}catch(s){return console.error('[LocalData] Failed to store data for key "'+t+'".',s),!1}}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Mt=(r={})=>{let t={};if(!k.isObject(r))return t;let e=Object.keys(r);for(let s=0,n=e.length;s<n;s++){let i=e[s],o=r[i];typeof o!="function"&&(t[i]=o)}return t};var cr=0,Ue=new v(2e3),H={CHANGE:"change",DELETE:"delete"},ie=(r,t)=>{let e=Ue.get(r);return e||(e={change:`${r}:change`,delete:`${r}:delete`},Ue.set(r,e)),t==="change"?e.change:e.delete},R=class{constructor(t={}){this.dirty=!1,this._retainState=!1,this._refreshState=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new Z;let e=Mt(t);this.set(e);let s=Dt(this);return this._proxy=s,s}retainState(){return this._retainState=!0,this._proxy||this}refreshState(){return this._refreshState=!0,this._proxy||this}setup(){this.stage={}}_init(){let t=++cr;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}flushPending(){this.eventSub.flush()}getDataId(){return String(this._id)}remove(){this.unlink(),this.eventSub.reset()}on(t,e){let s=ie(t,H.CHANGE);return this.eventSub.on(s,e)}off(t,e){let s=ie(t,H.CHANGE);this.eventSub.off(s,e)}_setAttr(t,e,s=this,n=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,s,H.CHANGE))}publishLocalEvent(t,e,s,n){let i=ie(t,n);this.eventSub.publish(i,e,s)}_publish(t,e,s,n){this.publishLocalEvent(t,e,s,n),s=s||this,b.publish(this._dataId+t,e,s)}set(t,e,s){if(typeof t!="object")return this._setAttr(t,e,s),this;let n=Object.keys(t);for(let i=0;i<n.length;i++){let o=n[i],a=t[o];typeof a!="function"&&this._setAttr(o,a,e,s)}return this}_silentSet(t){let e=this.stage,s=Object.keys(t);for(let n=0,i=s.length;n<i;n++){let o=s[n];e[o]=t[o]}}getModelData(){return this.stage}_deleteAttr(t,e,s=this){delete t[e],this.publishLocalEvent(e,null,s,H.DELETE)}toggle(t){return typeof t>"u"?this:(this.set(t,!this.get(t)),this)}increment(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s+e),this}decrement(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s-e),this}concat(t,e){if(typeof t>"u")return this;let s=this.get(t);return this.set(t,s+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t,e){return this.key=e!=null?t+":v"+e:t,this}resume(t){let e=dt.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return dt.store(String(this.key),t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,s){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,s);let n=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,s){let n=s||e,i=t.get(e);typeof i<"u"&&this.get(n)!==i&&this.set(n,i);let o=t.on(e,(c,l)=>{if(l===this)return!1;this.set(n,c,t)}),a=this.on(n,(c,l)=>{if(l===t)return!1;t.set(e,c,this)});return this.addLink(o,t,e,a),t.addLink(a,this,n,o),o}addLink(t,e,s,n){this.links.set(t,{data:e,attr:s,pair:n})}unlink(t){if(t){this.removeLink(t);return}let e=this.links;e.size!==0&&(e.forEach((s,n)=>{this.removeLink(n,!1)}),e.clear())}removeLink(t,e=!0){let s=this.links.get(t);if(s){let n=s.data;s.attr&&n.off(s.attr,t);let i=s.pair,o=i&&n.links;if(o){let a=o.get(i);a&&(o.delete(i),a.attr&&this.off(a.attr,i))}}e!==!1&&this.links.delete(t)}};R.prototype.isData=!0;var Fe=new Set(["__proto__","prototype","constructor"]),lr=r=>{let t=[],e=r.length,s=0;for(let n=0;n<e;n++){let i=r.charCodeAt(n);i!==46&&i!==91&&i!==93||(n>s&&t.push(r.substring(s,n)),s=n+1)}return e>s&&t.push(r.substring(s)),t.length>0?t:null},E={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new v(1e3),hasDeepData(r){return r.indexOf(".")!==-1||r.indexOf("[")!==-1},isSafeAttr(r){return!Fe.has(r)},getSegments(r){let t=this.segmentCache.get(r);if(t!==void 0)return t;if(t=lr(r),t){for(let e=0,s=t.length;e<s;e++)if(Fe.has(t[e])){console.warn("[Data] Blocked unsafe path segment in: "+r),t=null;break}}return this.segmentCache.set(r,t),t}};var q=class{static set(t,e,s){if(!E.hasDeepData(e)){if(!E.isSafeAttr(e))return;t[e]=s;return}let n,i=E.getSegments(e);if(!i)return;let o=i.length,a=o-1;for(let c=0;c<o;c++){let l=i[c];if(c===a){t[l]=s;break}if(t[l]===void 0){let u=l.charCodeAt(0);t[l]=u<48||u>57?{}:[]}t=t[l]}}static delete(t,e){if(!E.hasDeepData(e)){if(!E.isSafeAttr(e))return;delete t[e];return}let s=E.getSegments(e);if(!s)return;let n=s.length,i=n-1;for(let o=0;o<n;o++){let a=s[o],c=t[a];if(c===void 0)break;if(o===i){if(Array.isArray(t)){let l=Number(a);Number.isInteger(l)&&l>=0&&l<t.length&&t.splice(l,1);break}delete t[a];break}t=c}}static get(t,e){if(!E.hasDeepData(e))return t[e]??void 0;let s=E.getSegments(e);if(!s)return;let n=s.length,i=n-1;for(let o=0;o<n;o++){let a=s[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===i)return t}}};var We=new Set,It=class{static MAX_DEPTH=50;static publishDeep(t,e,s,n){if(!E.hasDeepData(e)){this.publish(e,s,n);return}let i,o=E.getSegments(e);if(!o)return;let a=o.length,c=a-1,l="";for(let u=0;u<a;u++){let h=o[u];t=t[h];let f=h.charCodeAt(0);u>0?(f<48||f>57)&&(l+="."+h):l=h;let g;if(u===c)g=s;else{let m=o[u+1],x=m.charCodeAt(0);if(x>=48&&x<=57){l+="["+m+"]";continue}let _={};_[m]=t[m],g=_}this.publish(l,g,n)}}static publish(t,e,s,n=null,i=0){if(t=t||"",s(t,e),!(!e||typeof e!="object"||(e=Be(e),n===null&&(We.clear(),n=We),!n))){if(n.has(e)){console.warn("[Publisher] Circular reference detected at path:",t);return}if(i>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion");return}n.add(e),Array.isArray(e)?this.publishArray(t,e,s,n,i):this.publishObject(t,e,s,n,i)}}static publishArray(t,e,s,n,i){let o=e.length;for(let a=0;a<o;a++){let c=e[a],l=t+"["+a+"]";this._checkPublish(l,c,s,n,i)}}static publishObject(t,e,s,n,i){let o=Object.keys(e);for(let a=0,c=o.length;a<c;a++){let l=o[a],u=e[l],h=t+"."+l;this._checkPublish(h,u,s,n,i)}}static _checkPublish(t,e,s,n,i){if(!e||typeof e!="object"){s(t,e);return}this.publish(t,e,s,n,i+1)}};var U=class extends R{setup(){this.attributes={},this.stage={}}_setAttr(t,e,s,n){typeof e!="object"&&e===this.get(t)||(!s&&n!==!0?q.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),q.set(this.stage,t,e),s=s||this,this._publish(t,e,s,H.CHANGE))}_silentSet(t){let e=this.stage,s=this.attributes,n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];e[a]=c,s[a]=c}}linkAttr(t,e){let s=t.get(e);if(!s)return;let n=Object.keys(s);for(let i=0,o=n.length;i<o;i++){let a=n[i];this.link(t,e+"."+a,a)}}scope(t,e){let s=this.get(t);if(!s)return!1;e=e||this.constructor;let n=new e(s);return n.linkAttr(this,t),n}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.push(e),this.set(t,s),this}concat(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s=s.concat(e),this.set(t,s),this}unshift(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.unshift(e),this.set(t,s),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.shift();return this.set(t,e),s}getIndex(t,e,s){let n=this.get(t);return Array.isArray(n)===!1?-1:typeof n[0]!="object"?n.indexOf(e):n.findIndex(o=>o[e]===s)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.pop();return this.set(t,e),s}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,s,n){if(this._publishAttr(t,e,s,n),!e||typeof e!="object")return;let i=t.length,o=n===H.CHANGE?":change":":"+n,a=o.length,c=i+a;for(let u of this.eventSub.getMessages()){if(u.length<=c||!u.endsWith(o)||!u.startsWith(t))continue;let h=u.charCodeAt(i);if(h!==46&&h!==91)continue;let f=u.slice(0,u.length-a);this._publishAttr(f,this.get(f),s,n)}let l=b.getPrefixMessages(this._dataId);if(l){let u=this._dataId.length;for(let h of l){if(h.length-u<=i||!h.startsWith(t,u))continue;let g=h.charCodeAt(u+i);if(g!==46&&g!==91)continue;let m=h.slice(u);b.publish(h,this.get(m),s)}}}_publishAttr(t,e,s,n){let i=this._dataId+t;b.publish(i,e,s),this.publishLocalEvent(t,e,s,n)}mergeStage(){this.attributes=S.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,s=this){q.delete(t,e),this._delCommitter=s;let n=this._deleteCb||(this._deleteCb=i=>this._publishAttr(i,null,this._delCommitter,H.DELETE));It.publish(e,null,n)}_getAttr(t,e){return q.get(t,e)}};var ur={"\n":"\\n","\r":"\\n"," ":"\\t"},hr=(r,t)=>{typeof r!="string"&&(r=String(r));let e=t?/[\n\r\t]/g:/\t/g;return r.replace(e,s=>ur[s])},qe=(r,t)=>{if(typeof r!="string")return r;r=hr(r,t),r=encodeURIComponent(r);let e=/%22/g;return r.replace(e,'"')},oe=(r,t)=>{let e=typeof r;if(e==="undefined")return r;if(e!=="object")return r=qe(r),r;let s=Array.isArray(r)?[...r]:{...r};return Object.keys(s).forEach(n=>{let i=s[n];i!==null&&(s[n]=typeof i=="string"?oe(i,t):qe(i,t))}),s};function ze(r){if(typeof r>"u"||r.length<1)return!1;try{return JSON.parse(r)}catch(t){return console.warn("[Encode] Failed to parse JSON.",t),!1}}function ae(r){return typeof r<"u"?JSON.stringify(r):null}var pt=class{static prepareJsonUrl(t,e=!1){let s=typeof t=="object"?S.clone(t):t,n=oe(s,e);return ae(n)}static json={encode:ae,decode:ze};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var _t=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=null,this.requestOptions=null,this.init()}init(){let t=this.model;t&&t.url&&(this.url=t.url)}isValid(){let t=this.validate();if(t!==!1){let e=this.validateCallBack;typeof e=="function"&&e(t)}return t}validate(){return!0}getDefaultParams(){return""}setupParams(t){let e=this.getDefaultParams();return t=this.addParams(t,e),t}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+t[s]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=w.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=w.parseQueryString(e,!1)),this._isFormData(t))for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let s=this.model.get("id"),n="id="+s,i=s?`/${s}`:"",o=this.model;return this._get(i,n,t,e,a=>{if(a){let c=this.getObject(a);c&&o.set(c)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+pt.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let s=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._put(i,s,t,e)}add(t,e){if(!this.isValid())return;let s=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._post(i,s,t,e)}update(t,e){if(!this.isValid())return;let s=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._patch(i,s,t,e)}delete(t,e){let s=this.model.get("id"),n=typeof s<"u"?"id="+s:this.setupObjectData(),i=s!=null?`/${s}`:"";return this._delete(i,n,t,e)}getAllParams(t,e,s,n){let i=this.model.get();t=isNaN(Number(t))?0:t,e=isNaN(Number(e))?50:e;let o=i.search||"",a=f=>{try{return JSON.stringify(f)}catch(g){return console.error("[ModelService] Failed to serialize request param.",g),""}},c=i.filter||"";typeof c=="object"&&(c=a(c));let l=i.dates||"";typeof l=="object"&&(l=a(l));let u=i.orderBy||"";typeof u=="object"&&(u=a(u));let h=i.groupBy||"";return Array.isArray(h)&&(h=a(h)),"&filter="+encodeURIComponent(c)+"&offset="+t+"&limit="+e+"&dates="+encodeURIComponent(l)+"&orderBy="+encodeURIComponent(u)+"&groupBy="+encodeURIComponent(h)+"&search="+encodeURIComponent(o)+"&lastCursor="+(typeof s<"u"&&s!==null?encodeURIComponent(s):"")+"&since="+(typeof n<"u"&&n!==null?encodeURIComponent(n):"")}all(t,e,s,n,i=null,o=null){let a=this.getAllParams(s,n,i,o);return this._get("",a,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let s=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(s)}withOptions(t){return Object.create(this,{requestOptions:{value:t||null,writable:!0}})}withCache(t=!0){return this.withOptions({...this.requestOptions,cache:t})}setupRequest(t,e,s,n,i,o){o=o||this.requestOptions||null;let a=(h,f)=>{typeof i=="function"&&i(h),this.getResponse(h,n,f)},c={url:this.getUrl(t),method:e,params:s,completed:a},l=this._isFormData(s);if(l&&(c.headers={}),!o)return ht(c);o.invalidate&&(c.completed=(h,f)=>{h!==!1&&h!=null&&wt.invalidate(o.invalidate),a(h,f)});let u=o.cache;return!u||!this.isCacheableMethod(e)||l?ht(c):this.cachedRequest(c,u===!0?{}:u)}isCacheableMethod(t){let e=String(t||"").toUpperCase();return e==="GET"||e==="HEAD"}getCacheKey(t){let e=t.params||"";if(typeof e=="object")try{e=JSON.stringify(e)}catch{e=""}return t.method.toUpperCase()+" "+t.url+(e?" "+e:"")}cachedRequest(t,e){let s=e.key||this.getCacheKey(t),n=t.completed,i=o=>ht({...t,completed:(a,c)=>o(a!=null,a,c),failed:(a,c)=>o(!1,!1,c),aborted:(a,c)=>o(!1,!1,c)});return wt.resolve(s,i,{ttl:e.ttl,swr:e.swr},(o,a)=>n(o,a))}setupEventSource(t,e,s,n,i=!0){let o=null,a,c=!1,l=!1,u=()=>{a&&(clearTimeout(a),a=void 0)},h=()=>{if(c||!i||l)return;u(),a=setTimeout(()=>{a=void 0,f()},3e3)},f=()=>{if(c||l)return;if(o){try{o.close()}catch{}o=null}l=!0;let g=this.getUrl(t),m=e?"?"+e:"";o=new EventSource(g+m,{withCredentials:!0}),o.onopen=()=>{l=!1,u(),n&&n()},o.onerror=()=>{l=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,h())},o.onmessage=x=>{try{let _=JSON.parse(x.data);s&&s(_)}catch{}}};return f(),{get source(){return o},close:()=>{if(c=!0,l=!1,u(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return T.isWatching(t)&&(t=T.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,s,n,i){return this._request("","POST",t,e,s,n,i)}_get(t,e,s,n,i,o){return e=this.setupParams(e),e=this.addParams(e,s),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",n,i,o)}_post(t,e,s,n,i,o){return this._request(t,"POST",e,s,n,i,o)}_put(t,e,s,n,i,o){return this._request(t,"PUT",e,s,n,i,o)}_patch(t,e,s,n,i,o){return this._request(t,"PATCH",e,s,n,i,o)}_delete(t,e,s,n,i,o){return this._request(t,"DELETE",e,s,n,i,o)}_request(t,e,s,n,i,o,a){return s=this.setupParams(s),s=this.addParams(s,n),this.setupRequest(t,e,s,i,o,a)}getResponse(t,e,s){typeof e=="function"&&e(t,s)}static extend(t){if(!t)return{};let e=this;class s extends e{constructor(i){super(i)}}return Object.assign(s.prototype,t),s}};var fr=r=>{let t={};if(!k.isObject(r)||!r.defaults)return t;let{defaults:e}=r;return Object.keys(e).forEach(s=>{let n=e[s];typeof n!="function"&&(t[s]=n)}),delete r.defaults,t},dr=r=>{if(!r||typeof r.xhr!="object")return{};let t={...r.xhr};return delete r.xhr,t},pr=0,mt=class extends U{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,s=dr(t),n=e.prototype.service.extend(s),i=fr(t);class o extends e{constructor(c){let l={...i,...Mt(c)};super(l),this.xhr=new n(this)}dataTypeId=`bm${pr++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};mt.prototype.service=_t;var tt=class extends R{};var gt=class extends tt{setup(){this.stage={}}addAction(t,e){return typeof e<"u"&&this.set(t,e),this}getState(t){return this.get(t)}removeAction(t,e){if(e)return this.off(t,e),this;let s=this.stage;return typeof s[t]<"u"&&delete s[t],this}};var Rt=class extends gt{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var I=class{static targets=new Map;static ownerCounts=new Map;static restore(t,e){this.targets.set(t,e),this.addOwner(t)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new Rt(t)),this.targets.get(t)}static attach(t){let e=this.getTarget(t);return this.addOwner(t),e}static addOwner(t){this.ownerCounts.set(t,(this.ownerCounts.get(t)||0)+1)}static detach(t){let e=this.ownerCounts.get(t);if(e===void 0)return;if(e>1){this.ownerCounts.set(t,e-1);return}this.ownerCounts.delete(t);let s=this.targets.get(t);s&&(s.remove(),this.targets.delete(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,s){let n=this.getTarget(t);return e&&n.addAction(e,s),n}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){if(s){this.off(t,e,s);return}let n=this.getTarget(t);n&&e&&n.removeAction(e)}static on(t,e,s){let n=this.getTarget(t);return e?n.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let n=this.targets,i=n.get(t);if(i){if(e){i.off(e,s);return}this.targets.delete(t),this.ownerCounts.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};var et=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static _releaseLinks(t,e){!t||t===e||typeof t.unlink!="function"||t.unlink()}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let s=t.getParentContext();if(!s||!s.data)return;let n=s.data.stage,i=e.data.stage,o=null;for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let c=n[a];c!==i[a]&&(o===null&&(o={}),o[a]=c)}o!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(o):e.data.set(o))}static _resumeExternal(t,e){let s=t.setData();if(!s){t.data=e;return}if(this._releaseLinks(e,s),e&&e.stage){let n=e._retainState||s._retainState,i=!n&&(e._refreshState||s._refreshState),o=this._buildExternalUpdates(e.stage,s.stage,n,i);S.isEmpty(o)||s._silentSet(o)}typeof s.flushPending=="function"&&s.flushPending(),t.data=s}static _buildExternalUpdates(t,e,s,n){let i={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(n){Object.prototype.hasOwnProperty.call(e,o)||(i[o]=t[o]);continue}let a=t[o];!s&&a==null||a!==e[o]&&(i[o]=a)}return i}static _resumeOwned(t,e){let s=t.data;if(!s){this._releaseLinks(e),t.data=e;return}if(e&&e._retainState){this._releaseLinks(s,e),this._releaseLinks(e),t.data=e;return}if(this._releaseLinks(e,s),e&&e.stage){let n=e._refreshState||t.data._refreshState,i=this._buildOwnedUpdates(e.stage,t.data.stage,n);S.isEmpty(i)||t.data._silentSet(i)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,s){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(s){Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);continue}let o=t[i];o!=null&&o!==e[i]&&(n[i]=o)}return n}};var Ot=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let s=0;s<e;s++){let n=t[s];this.on(n[0],n[1],n[2],n[3])}}on(t,e,s,n){d.on(t,e,s,n),this.events.push({event:t,obj:e,callBack:s,capture:n})}off(t,e,s,n){d.off(t,e,s,n);let i,o=this.events;for(let a=0,c=o.length;a<c;a++)if(i=o[a],i.event===t&&i.obj===e&&i.callBack===s&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,s=t.length;e<s;e++){let n=t[e];d.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,s=t.length;e<s;e++){let n=t[e];d.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var Lt=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let s=this.convertStates(e);this.addStatesToTarget(t,s)}addStates(t,e){let s=this.convertStates(e);this.addStatesToTarget(t,s)}createState(t,e,s,n){return{action:t,state:e,callBack:s,targetId:n,token:null,callBackToken:null}}convertStates(t){let e=[];for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;if(s==="remotes"){this.setupRemoteStates(t[s],e);continue}let n=null,i=null,o=t[s];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(s,o,i,n))}return e}setupRemoteStates(t,e){for(let s=0,n=t.length;s<n;s++){let i=t[s];if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o)||o==="id")continue;let a=null,c=i[o],l=c!==null?c:void 0;l&&typeof l=="object"&&(a=l.callBack,l=l.state),e.push(this.createState(o,l,a,i.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let s=0,n=e.length;s<n;s++){let i=e[s];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let s=0,n=e.length;s<n;s++){let i=e[s];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&I.remove(i.targetId,i.action,i.token)}}restore(t){I.restore(t.id,t);let e=this.callBackStates;if(e)for(let n=0,i=e.length;n<i;n++){let o=e[n];o.callBackToken=t.on(o.action,o.callBack)}let s=this.remoteStates;if(s)for(let n=0,i=s.length;n<i;n++){let o=s[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,s){let n=I.getTarget(s);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let s=this.remoteStates;for(let n=0,i=e.length;n<i;n++){let o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,s.push(o))}}addAction(t,e){let s,n=e.action,i=e.targetId;i&&(s=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&(e.callBackToken=t.on(n,o),this.callBackStates.push(e)),s||null}};var P=[],Nt=0,ce=!1,mr=typeof queueMicrotask=="function"?queueMicrotask:r=>Promise.resolve().then(r),gr=r=>{let t=r.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||r.container||null},yr=r=>{r._mountPending=!1;try{r.afterMount()}catch(t){console.error("Error in afterMount:",t)}},Ke=()=>{ce=!1;let r=P;if(r.length===0)return;P=[];let t=[];for(let e=0,s=r.length;e<s;e++){let n=r[e];if(n.rendered!==!0||n._mountPending!==!0){n._mountPending=!1;continue}let i=gr(n);if(i&&i.isConnected===!0){yr(n);continue}t.push(n)}t.length&&(P=P.length?t.concat(P):t),P.length&&Nt===0&&P.length!==t.length&&le()},le=()=>{ce||(ce=!0,mr(Ke))},O={add(r){r._mountPending!==!0&&(r._mountPending=!0,P.push(r))},enter(){Nt++},leave(){--Nt>0||(Nt=0,P.length&&le())},schedule(){P.length&&le()},flush(){Ke()},get size(){return P.length}};p.addType("components",r=>{if(!r)return;let t=r.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken,t),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var br=0,yt=class{constructor(t,e,s){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let n,i;if(t==null)n={},i=[];else{let o=typeof t;o==="string"||o==="number"?(n={},i=[{tag:"text",textContent:t}]):Array.isArray(t)?(n={},i=t):(n=t||{},i=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(n),this.children=i||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+br++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,s=t.cache,n;s!=null&&e!=null?n="pk:"+s+":"+e:s!=null?n="pk:"+s:e!=null?n="pk:"+e:n="pc"+this.persistedCount++;let i=this.persistedChildren[n];return i&&t.unitType===i.unitType&&t.resumeScope(i),t.persistToken=n,this.persistedChildren[n]=t,n}removePersistedChild(t,e){if(!this.rendered)return;let s=t?this.persistedChildren[t]:null;s&&(e&&s!==e||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let s=e[0];s&&(this.addingContext=!0,this.contextBranchName=s,this.addContextBranch(s,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){p.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout(),typeof this.afterMount=="function"&&O.add(this)}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let s=[];if(!t||t.length<1)return s;for(let n=0,i=t.length;n<i;n++){let o=e(t[n],n);s.push(o)}return s}removeAll(t){return D.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy();let t=this.panel;t&&D.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,s=t.length;e<s;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var A=class extends yt{constructor(t,e,s){super(t,e,s),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._externalData=this._externalData??!1,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){if(this._resumeData(t.data),this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,t.context){let e=t.context.data;e&&e._refreshState===!0&&e._retainState!==!0||(this.context=t.context,this._contextResumed=!0)}this.id=t.id,this._refreshContextData()}_resumeData(t){et.resume(this,t)}_refreshData(){et.refresh(this)}_refreshContextData(){et.refreshContext(this)}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=I.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();S.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Lt(this.state??{},t))}addState(t){!this.stateHelper||this.stateResumed===!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;if(!t)return;let e=this.stateHelper;e&&(e.removeRemoteStates(t),e.removeLocalStates(t)),I.detach(String(t.id)),this.stateResumed=!1}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new Ot)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}};var Bt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},Ht=(r,t)=>typeof r!="function"&&t==="setupStates"?()=>r:r;var ue=(r,t)=>{if(!r)return t;let e=Object.keys(r);for(let s=0,n=e.length;s<n;s++){let i=e[s],o=r[i],a=Bt[i]||i;t[a]=Ht(o,a)}return t},xr=r=>ue(r,{}),Sr=0,Ve=(r,t)=>{class e extends r{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Sr++,e},z=(r,t=A)=>{r||(r={});let e,s=typeof r;return s==="object"&&r.render?(e=xr(r),Ve(t,e)):(e={render:s==="function"?r:()=>r},Ve(t,e))};var kr=(r,t)=>{let e=Object.keys(r);for(let s=0,n=e.length;s<n;s++){let i=e[s],o=r[i],a=Bt[i]||i;t.prototype[a]=Ht(o,a)}return t},wr=0,vr=r=>{let t=class extends r{};return t.prototype._classId="pod"+wr++,t},Cr=(r,t=A)=>{if(!r)return null;let e=vr(t),s={},n=r(s);return kr(s,e),e.prototype.render=n,e};var Ar={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(r=new Date().getDay(),t=!1){if(typeof Intl<"u"){let n=new Date(2004,0,4+r);return new Intl.DateTimeFormat(void 0,{weekday:t?"short":"long"}).format(n)}let e=this.dayNames;if(r>e.length)return null;let s=e[r];return t?s.substring(0,3):s},convertJsMonth(r){return this.padNumber(r+1)},convertDate(r,t=!1){r=r?r.replace(/\s/,"T"):"";let e=new Date(r);if(typeof Intl<"u"){let n={weekday:"long",month:"short",day:"2-digit"};return t&&(n.year="numeric"),new Intl.DateTimeFormat(void 0,n).format(e)}let s=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+s},padNumber(r){return r<=9?"0"+r:String(r)},createDate(r){return r?(typeof r=="string"&&r.indexOf("-")>-1&&(r=r.replace(/\s/,"T"),r=r.indexOf(":")>-1?r:r+"T00:00:00"),new Date(r)):new Date},format(r,t){let e=this.createDate(t);return r!=="sql"&&typeof Intl<"u"?new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}).format(e):this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),r)},formatTime(r,t){let e=this.createDate(r);if(t!==24&&typeof Intl<"u")return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",hour12:!0}).format(e);let s=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),s)},getMeridian(r){return r=Number(r),r>=12?"PM":"AM"},convert24To12(r){return r=Number(r),r>12&&(r=r-12),r},convert12To24(r,t){return r=Number(r),t.toLowerCase()==="pm"&&(r=r+12),r},renderDate(r,t,e,s="sql"){return t=Number(t),e=Number(e),s==="sql"?`${r}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${r}`},renderTime(r,t,e=0,s="sql"){if(s==="sql")return`${this.padNumber(r)}:${this.padNumber(t)}:${this.padNumber(e)}`;let n=this.getMeridian(r);return r=this.convert24To12(r),`${r}:${this.padNumber(t)} ${n}`},leapYear(r){return r%400===0||r%100!==0&&r%4===0},getMonthName(r=new Date().getMonth(),t=!1){if(typeof Intl<"u"){let n=new Date(2e3,r,1);return new Intl.DateTimeFormat(void 0,{month:t?"short":"long"}).format(n)}let e=this.monthNames;if(r>e.length)return"";let s=e[r];return s?t?s.substring(0,3):s:""},getMonthLength(r,t){let e=new Date;return r=typeof r<"u"?r:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[r]},getMonthsLength(r=new Date().getFullYear()){return this.leapYear(r)===!0?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31]},getLocalDate(r,t="America/Denver"){let e=new Date(r);if(Number.isNaN(e.getMonth())===!0){let i=/[- :]/,o=r.split(i);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let s=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),n=e.getTime()-s.getTime();return new Date(e.getTime()+n)},getLocalTime(r,t=!1,e=!1,s="America/Denver"){if(!r)return"";let n=this.getLocalDate(r,s);if(!t&&typeof Intl<"u"){let c={hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0};return e===!1&&(c.year="numeric",c.month="2-digit",c.day="2-digit"),new Intl.DateTimeFormat(void 0,c).format(n)}let i=n.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(n.getFullYear(),i,n.getDate(),o)+" "),a+this.renderTime(n.getHours(),n.getMinutes(),n.getSeconds(),o)},getDiffFromNow(r,t=!1){r=r.replace(/\s/,"T");let e=new Date(r),s=new Date;return t===!0&&s.setHours(0,0,0,0),s.getTime()-e.getTime()},getAge(r){let t=this.getDiffFromNow(r),e,s;switch(!0){case t<864e5:e="1 day";break;case t<6048e5:s=this.toDays(t),e=s+" days";break;case t<12096e5:e="1 week";break;case t<2592e6:s=this.toDays(t);var n=Math.floor(s/7);e=n+" weeks";break;case t<5184e6:e="1 month";break;case t<31104e6:var i=this.toMonths(t);e=i+" months";break;default:var o=this.toYears(t);e=o}return String(e)},getTimeFrame(r){let t=this.getDiffFromNow(r);return this.convertToEstimate(t)},convertToEstimate(r){let t="",e,s,n,i,o,a,c;if(r<=0)switch(!0){case r<-63072e6:n=this.toYears(Math.abs(r)),t="in "+n+" y";break;case r<-31536e6:t="in 1y";break;case r<-5184e6:i=this.toMonths(Math.abs(r)),t="in "+i+"mo";break;case r<-2592e6:t="in 1mo";break;case r<-12096e5:e=this.toDays(Math.abs(r)),s=Math.floor(e/7),t="in "+s+"w";break;case r<-6048e5:t="in 1w";break;case r<-1728e5:e=this.toDays(Math.abs(r)),t="in "+e+"d";break;case r<-864e5:t="tomorrow";break;case r<-72e5:o=this.toHours(Math.abs(r)),t="in "+o+" h";break;case r<=-36e5:t="in 1h";break;case r<-12e4:a=this.toMinutes(Math.abs(r)),t="in "+a+"m";break;case r<-6e4:t="in 1m";break;case r<-2e3:c=this.toSeconds(Math.abs(r)),t="in "+c+"s";break;case r<-1:t="in 1s";break;default:t="now"}else switch(!0){case r<1e3:t="1s ago";break;case r<6e4:c=this.toSeconds(r),t=c+"s ago";break;case r<12e4:t="1m ago";break;case r<36e5:a=this.toMinutes(r),t=a+"m ago";break;case r<72e5:t="1h ago";break;case r<864e5:o=this.toHours(r),t=o+"h ago";break;case r<1728e5:t="yesterday";break;case r<6048e5:e=this.toDays(r),t=e+"d ago";break;case r<12096e5:t="1w ago";break;case r<2592e6:e=this.toDays(r),s=Math.floor(e/7),t=s+"w ago";break;case r<5184e6:t="1mo ago";break;case r<31536e6:i=this.toMonths(r),t=i+"mo ago";break;case r<63072e6:t="1y ago";break;default:n=this.toYears(r),t=n+"y ago"}return t},toYears(r){return typeof r!="number"?0:Math.floor(r/31558464e3)},toMonths(r){return typeof r=="number"?Math.floor(r/2592e6):0},toDays(r){return typeof r!="number"?0:Math.floor(r/864e5*1)},toHours(r){return typeof r!="number"?0:Math.floor(r%864e5/36e5*1)},toMinutes(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5/6e4*1)},toSeconds(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5%6e4/1e3*1)},getDifference(r,t){let e=new Date(r),s=new Date(t),n=s.getTime()-e.getTime();return{years:this.toYears(n),days:this.toDays(n),hours:this.toHours(n),minutes:this.toMinutes(n),seconds:this.toSeconds(n)}}};var st={items:new Map,add(r,t){return this.items.set(r,t),this},get(r){return this.items.get(r)??null}};var he=(r,t)=>({attr:r,directive:t});var L=(r,t)=>({key:r,value:t});var Ge=(r,t,e,s)=>({tag:r,attr:t,directives:e,children:s});var Qe=null,Tr=()=>Qe||(Qe=st.get("watch")),F=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,s,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(s.push(L("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,s){t.push(he(L(e,T.getWatcherSettings(s,W(e))),Tr()))}static setButtonType(t,e,s){if(t==="button"){let n=e.type||"button";s.push(L("type",n))}}static parse(t,e){let s=[],n=[],i=t.tag||"div";i==="button"&&s.push(L("type",t.type||"button"));let o=[],a,c;for(let l in t){if(!Object.prototype.hasOwnProperty.call(t,l)||l==="tag"||(a=t[l],a==null))continue;if(l==="children"||l==="nest"){if(Array.isArray(a))for(let h=0;h<a.length;h++)o.push(a[h]);else o.push(a);continue}if((c=st.get(l))!==null){n.push(he(L(l,a),c));continue}let u=typeof a;if(u==="object"){if(T.isWatching(a)){this.setTextAsWatcher(n,l,a);continue}o.push(a);continue}if(u==="function"){let h=a,f=function(g){h.call(this,g,e)};f.originalCallback=h,s.push(L(l,f));continue}if(u==="string"&&a.includes("[[")){this.setTextAsWatcher(n,l,a);continue}if(l==="text"){o.push({tag:"text",textContent:a});continue}if(l==="html"||l==="innerHTML"){s.push(L("innerHTML",a));continue}s.push(L(l,a))}return Ge(i,s,n,o)}};var rt=class{build(t,e,s){}setupComponent(t,e,s){let n=s?.getChildScope();t.parent=n,n&&n.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&n&&(n[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),s=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),s}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t),t}setDirectives(t,e,s){}removeNode(t){}removeAll(t){}};var Er=r=>{for(let e in r)if(e!=="tag"&&e!=="textContent")return!1;let t=r.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},Ut=class extends rt{build(t,e,s){let n=C.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,s);else this.buildElement(t,n,s);return e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,s){if(t){if(t.isUnit===!0){this.createComponent(t,e,s);return}this.createElement(t,e,s)}}createElement(t,e,s){if(t.tag==="text"&&Er(t)){let l=t.textContent;C.createText(l??"",e);return}let n=s?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=F.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,s);let a=i.children;for(let l=0,u=a.length;l<u;l++){let h=a[l];h!==null&&this.buildElement(h,o,s)}let c=i.directives;c.length&&this.setDirectives(o,c,n)}createTempComponent(t,e,s){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...ue(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(n.setupStateTarget=function(o){this.state=t.state});let i=new A(n);this.createComponent(i,e,s)}setDirectives(t,e,s){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],s)}handleDirective(t,e,s){e.directive(t,e.attr.value,s)}cache(t,e,s){s&&e&&s.cacheEle(t,e)}createNode(t,e,s){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return C.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return C.createComment(o,e)}return C.create(n,t.attr,e,s)}removeNode(t){C.removeElement(t)}removeAll(t){C.removeAll(t)}};var Pr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),Dr=/[&<>"]/,fe=r=>{let t=typeof r=="string"?r:String(r);return Dr.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t},nt=class{static create(t,e=[],s=""){let n="",i="";for(let o=0,a=e.length;o<a;o++){let c=e[o],l=c.key,u=c.value;if(l==="text"||l==="textContent"){n+=fe(u);continue}if(l==="html"||l==="innerHTML"){n+=u;continue}if(typeof u=="function")continue;let h=l+'="'+fe(u)+'"';i?i+=" "+h:i=h}return Pr.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+s+"</"+t+">"}static createText(t){return fe(t)}static createComment(t){return"<!-- "+t+" -->"}};var Ft=class extends rt{build(t,e,s){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],s);return n}return this.buildElement(t,s)}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let s=F.parse(t,e),n=s.children,i="";for(let o=0,a=n.length;o<a;o++){let c=n[o];c!==null&&(i+=this.buildElement(c,e))}return this.createNode(s,i)}createNode(t,e){let s=t.tag;if(s==="text"){let n=t.attr[0],i=n?n.value:"";return nt.createText(i)}else if(s==="comment"){let n=t.attr[0],i=n?n.value:"";return nt.createComment(i)}return nt.create(s,t.attr,e)}removeAll(t){}};var Wt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Ut:new Ft}};var K=Wt.setup(),Mr=r=>typeof r=="object"&&r.isUnit===!0,$e=new WeakMap,Ir=r=>{let t=$e.get(r);if(!t){if(t=z(r),!t)return null;$e.set(r,t)}return new t},y=class{static render(t,e,s){if(!t||(Mr(t)||(t=Ir(t)),!t))return null;O.enter();try{return K.createComponent(t,e,s)}finally{O.leave()}}static build(t,e,s){O.enter();try{return K.build(t,e,s)}finally{O.leave()}}static rebuild(t,e,s){return K.removeAll(e),this.build(t,e,s)}static setDirectives(t,e,s){K.setDirectives(t,e,s)}static createNode(t,e,s){return K.createNode(t,e,s)}static removeNode(t){K.removeNode(t)}static removeAll(t){K.removeAll(t)}};B.augment({buildLayout(r,t,e){y.build(r,t,e)}});var de=[],_r=r=>de.indexOf(r)!==-1,Rr=r=>({tag:"script",src:r.src,async:!1,load(t){de.push(r.src);let e=r.load;e&&e()}}),Or=r=>({tag:"link",rel:"stylesheet",type:"text/css",href:r.src,load(t){de.push(r.src);let e=r.load;e&&e()}}),qt=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,s=this.update.bind(this);t.indexOf(".css")!==-1?e=Or({load:s,src:t}):e=Rr({load:s,src:t}),y.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{_r(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var Lr=r=>r?typeof r?.prototype?.constructor=="function":!1,V=class{static process(t,e){let s=t.default;return s?e.callback?e.callback(s):(Lr(s)?s=new s:s=s(),s.isUnit===!0&&(s.route=e.route,e.persist&&(s.persist=!0)),s):null}static render(t,e,s){return this.renderNodes(t,e,s)[0]||null}static renderNodes(t,e,s){let n=y.build(t,null,s),i=Array.from(n.childNodes);return i.length===0&&t?.panel&&i.push(t.panel),e.after(n),i}};var zt=class{static load(t,e,s){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),s&&s(n)})}};var Nr=r=>({tag:"comment",textContent:"import placeholder",onCreated:r.onCreated}),G=new v(100),Br=r=>{if(G.has(r)){let s=G.get(r);return s&&typeof s.then!="function"?Promise.resolve(s):s}let t=typeof r,e;if(t==="string")e=import(r);else if(t==="function")e=r();else return r;return e.then(s=>{G.set(r,s)}).catch(()=>{G.delete(r)}),G.set(r,e),e},Hr=r=>{if(!G.has(r))return null;let t=G.get(r);return t&&typeof t.then=="function"?null:t||null},Ye=r=>{for(let t=0,e=r.length;t<e;t++){let s=r[t];s&&y.removeNode(s)}},je=z({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return Nr({onCreated:r=>{if(this.src){if(this.layout){this.setLayoutRoots(V.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){new qt(()=>{this.loadAndRender(r)}).addFiles(this.depends);return}this.loadAndRender(r)}}})},loadAndRender(r){let t=this.generation,e=Hr(this.src);if(e){this.renderModule(r,e);return}zt.load(Br(this.src),s=>{t===this.generation&&this.renderModule(r,s)},s=>{t===this.generation&&(this.loaded=!1,this.renderError(r,s))})},renderError(r,t){let e=()=>this.retry(r),s=this.fallback,n=typeof s=="function"?s(t,e):s||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};if(!n)return;let i=V.renderNodes(n,r,this.parent);this.errorRoots=i,this.errorRoot=i[0]||null},setLayoutRoots(r){this.layoutRoots=r,this.layoutRoot=r[0]||null},retry(r){this.removeErrorLayout(),this.loadAndRender(r)},removeErrorLayout(){this.errorRoot&&(Ye(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(r,t){this.loaded=!0;let e=this.layout||V.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(V.renderNodes(e,r,this.parent)),typeof this.onModuleRender=="function"&&this.onModuleRender(e)},shouldUpdate(r){return this.updateLayout===!0?!0:this.updateLayout=r&&r.isUnit&&typeof r.update=="function"},updateModuleLayout(r){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(r)},update(r){this.loaded===!0&&this.updateModuleLayout(r)},destroy(){this.generation++,this.removeErrorLayout(),this.layoutRoot&&(Ye(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var pe=r=>{let t=typeof r;return(t==="string"||t==="function"||r instanceof Promise)&&(r={src:r}),new je(r)};var Je=(r,t,e=null)=>{if(!r)return;let s=null,n=!1,i=()=>{n||(n=!0,s&&(clearTimeout(s),s=null),d.off("animationend",r,o),r&&r.classList.remove(t),e&&e())},o=c=>{c.target===r&&i()};d.on("animationend",r,o),r.classList.add(t);let a=()=>{if(!n)try{let c=window.getComputedStyle(r),l=parseFloat(c.animationDuration)*1e3||1e3,u=parseFloat(c.animationDelay)*1e3||0;s=setTimeout(i,l+u+100)}catch{s=setTimeout(i,1e3)}};if(typeof requestAnimationFrame>"u"){s=setTimeout(i,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(a))},Xe=(r,t,e)=>{Je(r,t)},Ze=(r,t,e)=>{let s=()=>{r&&r.remove&&r.remove()};Ur(r,()=>Je(r,t,s),e)};p.addType("manual-destroy",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var Ur=(r,t,e)=>{p.add(r,"manual-destroy",{ele:r,callBack:t,parent:e})};var bt=(r,t,e,s)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&bt(r,t,n,s)});return}Fr(r,t,e,s)},Fr=(r,t,e,s)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',r,t);return}let o=Wr(r,n,i,s);b.watch(r,t,n,o)},Wr=(r,t,e,s)=>typeof e=="object"?n=>{Kr(r,e,n)}:n=>{zr(r,e,t,n,s)},ts=new WeakSet,qr=(r,t,e)=>{!r||!r.isUnit&&!r.isComponent||ts.has(e)||ts.add(e)},zr=(r,t,e,s,n)=>{let i=t(s,r,n);switch(typeof i){case"object":if(i===null)break;qr(i,e,r),y.rebuild(i,r,n);break;case"string":let o=Tt(r);if(o!=="textContent"){r.setAttribute(o,i);break}D.addHtml(r,i);break}},Kr=(r,t,e)=>{let s=Object.keys(t);for(let n=0,i=s.length;n<i;n++){let o=s[n];o&&(t[o]===e?r.classList.add(o):r.classList.remove(o))}};var it=(r,t,e)=>{let s=M(e);bt(r,s,t,e)};var es=(r,t,e)=>{t&&r.setAttribute("role",t)},Vr=r=>(t,e)=>{let s=t?"true":"false";e.setAttribute(r,s)},ss=(r,t,e)=>{if(!t)return;let s=t.role;s&&(r.setAttribute("role",s),t.role=null);let n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];if(c===null)continue;let l="aria-"+a;if(Array.isArray(c)){let u=c.slice();u.push(Vr(l)),it(r,u,e)}else r.setAttribute(l,c)}};var rs=(r,t,e)=>{if(!t)return;let s=F.parse(t,e);C.addAttributes(r,s.attr,e),y.setDirectives(r,s.directives,e)};p.addType("context",r=>{if(!r)return!1;r.parent.removeContextBranch(r.branch)});var me=r=>r?r.getContext():null,ns=(r,t,e)=>{if(typeof t!="function")return;let s=me(e),n=t(s);rs(r,n,e)},is=(r,t,e)=>{if(typeof t!="function")return;let s=me(e);t(s)},os=(r,t,e)=>{if(typeof t!="function"||!e)return;let s=me(e),n=t(s);if(!n)return;let i=n[0];i&&(e.addContextBranch(i,n[1]),Gr(r,i,e))},Gr=(r,t,e)=>{p.add(r,"context",{branch:t,parent:e})};var as=(r,t,e)=>{};var cs=(r,t,e)=>{if(!e)return;let s=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",r),console.log("Data: ",t),console.log("Layout: ",s),console.log("parent: ",e)};var ls=(r,t,e)=>{},us=(r,t,e)=>{if(!t||!e)return;let s=t(e,r);s&&y.build(s,r,e)},hs=(r,t,e)=>{if(!t||!e)return;let s=e.getId(t);r.id=s},fs=(r,t,e)=>{if(!t||!e)return;let s=t(e.data,r);s&&y.build(s,r,e)},ds=(r,t,e)=>{if(!t||!e)return;let s=t(e.state,r);s&&y.build(s,r,e)},ps=(r,t,e)=>{if(!t||!e)return;let s=e.state,n=t(s);if(!e.state){e.setStateHelper(n);return}e.addState(n)},ms=(r,t,e)=>{if(!t||!e)return;e.events||e.setEventHelper();let s=t[2];if(s){let n=s;s=i=>{n(i,e)}}e.events.on(t[0],t[1],s,t[3])};var gs=(r,t,e)=>{let s,n,i;if(typeof t=="string"){if(s=M(e),!s)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=M(e);if(!o)return;s=o,n=t[0],i=t[1]}else[s,n,i]=t;b.bind(r,s,n,i)};var Kt=(r,t,e)=>{bt(r,e.state,t,e)};var ys=r=>(t,e)=>{let[s,n,i="active"]=r,o=t===n?i:"";e.dataset[s]=o},bs=(r,t,e)=>{if(!t)return;let s=t.length-1,n=t[s],i=t.slice(0,s);i.push(ys(n)),it(r,i,e)},xs=(r,t,e)=>{if(!t)return;let s=t.length-1,n=t[s],i=t.slice(0,s);i.push(ys(n)),Kt(r,i,e)};var Ss=r=>{for(let t=0,e=r.length;t<e;t++){let s=r[t];s&&s.remove()}r.length=0};p.addType("forScopes",r=>{if(!r)return!1;Ss(r.scopes)});var ks=(r,t,e)=>{let s,n,i,o;if(typeof t[0]=="string"||t.length<3){let u=M(e);if(!u)return;s=u,[n,i,o]=t}else[s,n,i,o]=t;let a=o!==!1,c=n+"[",l=a?{scopes:[]}:null;l&&p.add(r,"forScopes",l),b.watch(r,s,n,u=>{if(y.removeAll(r),l&&Ss(l.scopes),!u||u.length<1)return;let h=[];for(let f=0,g=u.length;f<g;f++){let m=a?s.scope(c+f+"]"):null;m&&l&&l.scopes.push(m);let x=i(u[f],f,m,h);x!==null&&h.push(x)}return y.build(h,r,e)})};var ws=(r,t,e)=>{let s=t[0];if(!s||s.length<1)return;let n=t[1],i=[];for(let o=0,a=s.length;o<a;o++){let c=s[o];if(!c)continue;let l=n(c,o);l!==null&&i.push(l)}y.build(i,r,e)};var vs=(r,t,e)=>{t(r,e)};p.addType("destroyed",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var Cs=(r,t,e)=>{Qr(r,t,e)},Qr=(r,t,e)=>{p.add(r,"destroyed",{ele:r,callBack:t,parent:e})};var As=(r,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let s=0,n=t.length;s<n;s++)T.setup(r,t[s],e);else T.setup(r,t,e)};var $r=0,ot=class{constructor(t){this.router=t,this.locationId="base-app-router-"+$r++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var Yr=0,jr=()=>Date.now().toString(36)+"-"+(Yr++).toString(36)+"-"+Math.random().toString(36).substring(2,8),Es=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Ts=()=>{Es&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let r=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(r,t)}))},Vt=class extends ot{constructor(t){super(t),this.currentKey=null,this.positions=new v(200)}saveCurrentPosition(){let t=this.getScrollPosition(),e=this.currentKey;return e&&this.positions.set(e,t),t}addEvent(){d.on("popstate",window,this.callBack);let t=window.history;return t&&"scrollRestoration"in t&&(this.previousScrollRestoration=t.scrollRestoration,t.scrollRestoration="manual"),Es&&(this.pageShowCallBack=this.onPageShow.bind(this),d.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){d.off("popstate",window,this.callBack);let t=window.history;return this.previousScrollRestoration&&t&&"scrollRestoration"in t&&(t.scrollRestoration=this.previousScrollRestoration,this.previousScrollRestoration=null),this.pageShowCallBack&&d.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&Ts()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.saveCurrentPosition();let s=e.key||null;this.currentKey=s;let n=s&&this.positions.get(s)||e.scrollPosition,i=this.router;i.checkActiveRoutes(e.uri,!!n),n&&(typeof i.restoreScrollPosition=="function"?i.restoreScrollPosition(n):this.scrollTo(n)),Ts()}createState(t,e={}){let s=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:jr(),scrollPosition:s,uri:t}}addState(t,e,s=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return i.key&&i.location===this.locationId&&(this.currentKey=i.key),this;!s&&i&&i.location===this.locationId&&(i.scrollPosition=this.saveCurrentPosition(),n.replaceState(i,"",window.location.href));let o=this.createState(t,e);return s||(o.scrollPosition={x:0,y:0}),n[s===!1?"pushState":"replaceState"](o,null,t),this.currentKey=o.key,this.positions.set(o.key,o.scrollPosition),this}};var Gt={removeSlashes(r){return typeof r!="string"?"":(r[0]==="/"&&(r=r.substring(1)),r[r.length-1]==="/"&&(r=r.substring(0,r.length-1)),r)},getHashUri(r){if(typeof r!="string")return"";let t=r.indexOf("#");return t===-1?"":r.substring(t+1)}};var Qt=class extends ot{addEvent(){return d.on("hashchange",window,this.callBack),this}removeEvent(){return d.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(Gt.getHashUri(t.newURL))}addState(t,e,s){return window.location.hash=t,this}};var $t=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Vt(t).setup():new Qt(t).setup()}};var ge=5,Jr=200,Yt=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new v(Jr),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:ge}get size(){return this.pages.size}add(t){let e=this.pages;e.delete(t),e.add(t),this.trim()}delete(t){this.pages.delete(t)}trim(){let t=this.pages,e=this.getMax();for(;t.size>e;){let s=t.values().next().value;t.delete(s),s.evict()}}clear(){let t=Array.from(this.pages);this.pages.clear();for(let e=0,s=t.length;e<s;e++)t[e].evict()}saveScroll(t,e){if(e){this.scrollMemory.set(t,e);return}this.scrollMemory.has(t)&&this.scrollMemory.delete(t)}getScroll(t){return this.scrollMemory.get(t)||null}};var ye=class extends A{getChildScope(){return this.parent}},Ps=r=>z(r,ye);var be="data-scroll-key",Xr="["+be+"]",Ds=(r,t)=>{for(let e=0,s=r.length;e<s;e++){let n=r[e];if(!n||n.nodeType!==1)continue;let i=n.getAttribute(be);i!==null&&t(n,i);let o=n.querySelectorAll(Xr);for(let a=0,c=o.length;a<c;a++){let l=o[a];t(l,l.getAttribute(be))}}},xe=r=>{let t=null;return Ds(r,(e,s)=>{let n=e.scrollTop||0,i=e.scrollLeft||0;n===0&&i===0||(t=t||{},t[s]=[n,i])}),t},Se=(r,t)=>{if(!t)return!0;let e={},s=0;for(let n in t)e[n]=!0,s++;return Ds(r,(n,i)=>{let o=t[i];if(!o)return;let a=o[0],c=o[1];n.scrollTop=a,n.scrollLeft=c,Math.abs((n.scrollTop||0)-a)<1&&Math.abs((n.scrollLeft||0)-c)<1&&e[i]&&(e[i]=!1,s--)}),s<=0};var Zr=r=>{for(let t=0;t<r.length;t++){let e=r[t],s=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(s)||s.length===0)continue;let n=[];for(let i=0,o=s.length;i<o;i++){let a=s[i];a&&r.indexOf(a)===-1&&n.indexOf(a)===-1&&n.push(a)}r.splice(t+1,0,...n)}},tn=r=>/^class[\s{]/.test(Function.prototype.toString.call(r)),en=1500,Ms=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),sn=r=>{let t=r.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},ke=(r,t,e)=>{if(!(!r||typeof r[t]!="function"))try{r[t](...e)}catch(s){console.error("Error in "+t+":",s)}},jt=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent,this.keepAlive=typeof e.keepAlive=="boolean"?e.keepAlive:null,this.pageCache=e.pageCache||null,this.detachedNodes=null,this.detachedParents=null,this.detachedPath=null,this.savedScroll=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let s=t.layout;if(s&&s.isUnit===!0&&typeof s.keepAlive=="boolean")return s.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}isDetached(){return this.detachedNodes!==null}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.detachedPath!==this.getPagePath()&&this.evict(),this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=tn(t)?new t:t(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(Ps(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;y.render(t,this.container,this.parent)}afterCreate(t){let e=this.component;!e||this.pageCache===null||(e.loaded===!1&&e.src&&(e.onModuleRender=()=>this.onModuleRender(e)),this.isKeepAlive(e)&&this.callPageHook("onActivate",[t,{restored:!1}]),this.pageCache.historyNavigation===!0&&this.restoreHistoryScroll())}onModuleRender(t){if(this.setup!==!0||this.component!==t)return;let e=t.layout;e&&e.isUnit===!0&&this.isKeepAlive(t)&&ke(e,"onActivate",[this.params,{restored:!1}])}getScrollKey(){let t=this.route||{};return(t.routeId||"")+"|"+(t.path||"")}getPagePath(){let e=(this.route||{}).path||"",s=e.indexOf("#");return s>-1?e.substring(0,s):e}getRootNodes(t){let e=[],s=sn(t);s&&e.push(s);let n=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),i=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),o=[n,i];for(let a=0;a<2;a++){let c=o[a];if(c)for(let l=0,u=c.length;l<u;l++){let h=c[l];h&&e.indexOf(h)===-1&&e.push(h)}}return Zr(e),e}callPageHook(t,e){let s=this.component;if(!s)return;ke(s,t,e);let n=s.layout;n&&n!==s&&n.isUnit===!0&&ke(n,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,s=this.component,n=()=>Se(this.getRootNodes(s),t);if(n()||typeof requestAnimationFrame>"u")return;let i=Ms(),o=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==s||n()||Ms()-i>en||requestAnimationFrame(o)};requestAnimationFrame(o)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null,!(!t||!this.component)&&Se(this.getRootNodes(this.component),t)}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let s=xe(e);this.savedScroll=s,this.pageCache.saveScroll(this.getScrollKey(),s);let n=new WeakMap;for(let i=0,o=e.length;i<o;i++){let a=e[i],c=a.parentNode;c&&(n.set(a,c),c.removeChild(a))}return this.detachedNodes=e,this.detachedParents=n,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let s=this.component,n=this.container;if(!s||s.rendered!==!0||!n||typeof n.appendChild!="function")return this.savedScroll=null,this.releaseComponent(),!1;let i=this.getRootNodes(s);for(let o=0,a=i.length;o<a;o++){let c=i[o],l=e?e.get(c):null;(l&&l.isConnected?l:n).appendChild(c)}return this.setup=!0,O.schedule(),!0}evict(){if(this.detachedNodes===null)return;let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null,this.savedScroll=null,this.releaseComponent()}releaseComponent(){let t=this.component;this.component=null,t&&typeof t.destroy=="function"&&t.destroy()}remove(t){if(this.setup!==!0){t===!0&&this.evict();return}this.setup=!1,this.scrollToken++;let e=this.component;if(!e)return;let s=this.pageCache;if(t!==!0&&s!==null){if(this.isKeepAlive(e)&&this.detach(e))return;s.saveScroll(this.getScrollKey(),xe(this.getRootNodes(e)))}this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var Is=r=>{if(!r.length)return null;let t={};for(let e=0,s=r.length;e<s;e++)t[r[e]]=null;return t},_s=r=>{let t=[];if(!r)return t;let e=/[*?]/g;r=r.replace(e,"");let s=/:(.[^./?&($]+)\?*/g,n=r.match(s);if(n===null)return t;for(let i=0,o=n.length;i<o;i++){let a=n[i];a&&t.push(a.replace(":",""))}return t};var rn=/(\/):[^/(]*?\?/g,nn=/\//g,on=/(\?\/+\*?)/g,an=/(:[^/?&($]+)/g,cn=/(\*)/g,ln=r=>r.replace(rn,t=>t.replace(nn,"(?:$|/)")),un=r=>(r=r.replace(on,"?/*"),r.replace(an,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),hn=r=>r.replace(cn,".*"),fn=(r,t)=>r+=t[t.length-1]==="*"?"":"$",Rs=r=>{if(!r)return"";let t=r;return t=ln(t),t=un(t),t=hn(t),t=fn(t,r),t};var dn=0,Os=(r,t="")=>{let e=r||"",s=typeof t=="string"&&t?t:e,n=null,i=[],o=s.match(/#\{([^}]+)\}/);o&&o[1]&&(n=o[1].trim(),s=s.replace(o[0],""),e=e.replace(o[0],""));let a=s.indexOf("?");if(a>-1){let u=s.substring(a+1);if(u.indexOf("=")>-1){let h=u.split("&");for(let g=0,m=h.length;g<m;g++){let x=h[g];if(!x)continue;let[_,Q=""]=x.split("="),ve=(_||"").trim();ve&&i.push({key:ve,value:(Q||"").trim()})}s=s.substring(0,a);let f=e.indexOf("?");f>-1&&(e=e.substring(0,f))}}let c=n!==null||i.length>0;return c&&!s&&(e="*"),{uriPath:e,requiredHash:n,requiredQuery:i,hasConditions:c}},pn=r=>{if(!r)return"";let t=r.indexOf("?"),e=r.indexOf("#"),s=r.length;return t>-1&&(s=t),e>-1&&e<s&&(s=e),r.substring(0,s).replace(/\/\.(?:\/|$)/g,"/")},mn=r=>{if(!r)return"";let t=r.indexOf("#");return t===-1?"":r.substring(t+1)},gn=r=>{if(!r)return"";let t=r.indexOf("?");if(t===-1)return"";let e=r.indexOf("#",t);return e===-1?r.substring(t+1):r.substring(t+1,e)},Jt=class extends R{constructor(t,e,s=null){let n=t.baseUri,o=Os(n,t.rawUri).uriPath,a=_s(o),c=Is(a),l=super(c);return this.uri=n,this.matchUri=o,this.paramKeys=a,this.titleCallBack=e,this.pageCache=s,this.setupRoute(t),this.set("active",!1),l}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null,this.pageCache=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+dn++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=Os(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let s=Rs(this.matchUri);this.uriQuery=new RegExp("^"+s),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1,this.scrollTo=t.scrollTo||null}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(t){this.set("active",!1);let e=this.controller;e&&e.remove(t===!0)}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return!!e&&e.isConnected===!1}getLayout(t){if(t.component)return t.component;let e=t.import;return e?pe(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:s,persist:n,parent:i,keepAlive:o}=t,a={component:e,container:s,persist:n,parent:i,keepAlive:o,pageCache:this.pageCache},c=Dt(this);this.controller=new jt(c,a)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let s=this.controller;s&&s.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];i&&this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,s=pn(t),n=this.uriQuery||/$^/,i=s.match(n);return i===null?(this.resetParams(),e):Array.isArray(i)?this.matchConditions(t)?(this.setParams(i,1),e=i,e):(this.resetParams(),!1):e}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&mn(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let s=gn(t);if(!s)return!1;let n=new URLSearchParams(s);for(let i=0,o=e.length;i<o;i++){let a=e[i];if(!n.has(a.key)||n.get(a.key)!==a.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let s=this.paramKeys;if(!s)return;let n={};for(let i=0,o=s.length;i<o;i++){let a=s[i];typeof a<"u"&&(n[a]=t[i+e])}this.set(n)}getParams(){return this.stage}};var yn=r=>{let t=/\w\S*/;return r.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},bn=r=>r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),xn=(r,t)=>{if(r.indexOf(":")===-1)return r;let e=t.stage;for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s)){let n=new RegExp(":"+bn(s),"gi");r=r.replace(n,()=>e[s])}return r},Sn=(r,t)=>t&&(typeof t=="function"&&(t=t(r.stage)),t=xn(t,r),yn(t)),kn=(r,t)=>(t!==""&&(r+=" - "+t),r),Ls=(r,t,e)=>t&&(t=Sn(r,t),kn(t,e));var Ns=(r,t)=>({attr:r,value:t}),wn=(r,t)=>{if(!t.startsWith(r))return!1;let e=t[r.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},Xt=class extends A{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,s=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:s}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let s=this.exact===!0,n=N.data,i=[];t&&typeof t=="object"&&i.push(Ns("href",t)),e&&typeof e=="object"&&i.push(Ns("text",e));let o=null,a="",c="";return i.push({value:["[[path]]",n],callBack:(l,u)=>{if(typeof u.pathname>"u")return;let h=u.getAttribute("href");if(h!==o){o=h;let g=u.pathname+u.search+u.hash;a=g,c=u.hash||u.search?g:u.pathname}let f=s?l===a:wn(c,l);this.update(f)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var vn=()=>typeof window<"u"?window.location:{},Cn=r=>{if(!r)return"";let t=r.indexOf("#");return t>-1?r.substring(t+1):""},An=1500,Zt=["wheel","touchstart","keydown","pointerdown"],Bs=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),we=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=ge,this.pageCache=new Yt(this),this.history=null,this.callBackLink=null,this.location=vn(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new U({path:""})}setupHistory(){this.history=$t.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new Jt(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let s=e?e.max:void 0;return typeof s=="number"&&s>=0&&(this.keepAliveMax=s),this.pageCache.trim(),this}add(t){if(typeof t!="object"){let s=arguments;t={uri:s[0],component:s[1],callBack:s[2],title:s[3],id:s[4],container:s[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resumeRoute(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){let e=this.getBasePath(),s=Gt.removeSlashes(t);return s=s.replace(/^(?:\.\/)+/,""),s==="."&&(s=""),e+s}getRoute(t){let e=this.routes,s=e.length;if(s>0)for(let n=0;n<s;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,s=e.length;if(s>0)for(let n=0;n<s;n++){let i=e[n];if(i.routeId===t)return i}return!1}removeRoute(t){let e=this.routes,s=e.indexOf(t);s>-1&&e.splice(s,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate(!0)}addSwitch(t){let e=this.switchCount++,s=this.getSwitchGroup(e);for(let n=0,i=t.length;n<i;n++){let o=t[n];if(!o)continue;let a=this.createRoute(o);s.push(a)}return this.checkGroupForRegistration(e,s),e}resumeSwitch(t,e){let s=this.switchCount++,n=this.getSwitchGroup(s);for(let i=0,o=t.length;i<o;i++){let c=t[i].component.route;c.resumeRoute(e),n.push(c)}return this.checkGroupForRegistration(s,n),s}checkGroupForRegistration(t,e){let s=this.scrollIntent,n=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=n;let i=this.scrollIntent;i&&i.type==="target"&&i.groupId!==null&&i.groupId!==void 0&&(this.lastScrollGroup=i.groupId),this.scrollIntent=s}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let s=[];return this.switches.set(t,s),s}removeSwitch(t){let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let s=0,n=e.length;s<n;s++){let i=e[s];i&&typeof i.deactivate=="function"&&i.deactivate(!0)}}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),d.on("click",document,this.callBackLink);let s=this.getEndPoint();return this.navigate(s,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.defaultPrevented===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0||t.altKey===!0||typeof t.button=="number"&&t.button!==0)return!0;let e=t.target&&t.target.closest?t.target.closest("a"):null;if(!e||e.dataset.cancelRoute||e.hasAttribute("download"))return!0;let s=e.getAttribute("target");if(s&&s!=="_self")return!0;let n=e.getAttribute("href");if(n===null)return!0;let i=this.getLinkPath(n);if(i===null)return!0;let o=e.dataset.replace==="true";return this.navigate(i,null,o),t.preventDefault(),t.stopPropagation(),!1}getLinkPath(t){let e=t;if(e.substring(0,2)==="//"||/^[a-z][a-z0-9+.-]*:/i.test(e)){let n=this.location;if(!n||!n.origin||typeof URL>"u")return null;let i;try{i=new URL(e,n.href)}catch{return null}if(i.origin!==n.origin)return null;e=i.pathname+i.search+i.hash}let s=this.baseURI;return s!=="/"&&e.indexOf(s)===0&&(e=e.substring(s.length)),e}reset(){let t=this.routes;for(let e=0,s=t.length;e<s;e++){let n=t[e];n&&typeof n.deactivate=="function"&&n.deactivate(!0)}return this.pageCache.clear(),this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,s){return t=this.createURI(t),this.history.addState(t,e,s),this.updatePath(),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=Ls(t,e,this.title),this}checkActiveRoutes(t,e){t=t||this.getPath(),t!==this.path&&(this.lastPath=this.path),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollWaitToken++;let s=this.pageCache;s.historyNavigation=e===!0;let n=this.routes;for(let i=0,o=n.length;i<o;i++){let a=n[i];typeof a>"u"||s.size>0&&a.isDormant()||this.checkRoute(a,t)}if(this.checkSwitches(t,!0),s.historyNavigation=!1,e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}checkSwitches(t,e){let s=this.switches;for(let[n,i]of s.entries())e===!0&&this.pageCache.size>0&&i.length&&i[0].isDormant()||(this.currentGroupId=n,this.checkGroup(i,t));this.currentGroupId=null}checkGroup(t,e){let s=t.length;if(!s)return;let n=null;for(let a=0;a<s;a++)if(t[a].get("active")){n=t[a];break}let i=!1;n&&(i=n.match(e)!==!1);let o;for(let a=0;a<s;a++){let c=t[a];if(typeof c>"u")continue;(c===n?i:c.match(e))!==!1&&o===void 0&&c.controller&&(o=c)}if(!o){n&&n!==t[0]&&n.deactivate(),this.select(t[0],!0);return}this.select(o),n&&n!==o&&n.deactivate();for(let a=0;a<s;a++){let c=t[a];c&&c!==o&&c!==n&&c.deactivate()}}checkRoute(t,e){let s=this.check(t,e);return s!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),s}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t,e){if(!t||(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e===!0))return;let s=this.scrollIntent;if(s&&s.type==="hash")return;let n=Cn(this.path);if(n){this.scrollIntent={type:"hash",hash:n};return}t.scrollTo?this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId}:t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,s=e&&this.lastScrollGroup===t.groupId;s||(typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()),this.lastScrollGroup=e?t.groupId:null,s&&this.scrollToTarget(t.selector)}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let s=t.x||0,n=t.y||0;if(typeof requestAnimationFrame>"u"||this.canReachScroll(s,n)){window.scrollTo(s,n);return}let i=()=>{e===this.scrollWaitToken&&this.scrollWaitToken++,this.clearScrollWait()},o={capture:!0,passive:!0};for(let l=0,u=Zt.length;l<u;l++)window.addEventListener(Zt[l],i,o);this.cancelScrollWait=()=>{for(let l=0,u=Zt.length;l<u;l++)window.removeEventListener(Zt[l],i,o)};let a=Bs(),c=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(s,n)||Bs()-a>=An){this.clearScrollWait(),window.scrollTo(s,n);return}requestAnimationFrame(c)};requestAnimationFrame(c)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){let s=document.documentElement;if(!s)return!0;let n=(s.scrollHeight||0)-(window.innerHeight||0),i=(s.scrollWidth||0)-(window.innerWidth||0);return(e<=0||e<=n+1)&&(t<=0||t<=i+1)}scrollToHash(t){if(!t||typeof document>"u")return;let e=()=>{let c=document.getElementById(t);if(c)return c;try{return document.getElementById(decodeURIComponent(t))}catch{return null}},s=e();if(s){s.scrollIntoView(!0);return}if(typeof requestAnimationFrame>"u")return;let n=++this.scrollWaitToken,i=30,o=0,a=()=>{if(n!==this.scrollWaitToken)return;let c=e();if(c){c.scrollIntoView(!0);return}++o<i&&requestAnimationFrame(a)};requestAnimationFrame(a)}scrollToTarget(t){if(typeof t!="string"||typeof document>"u")return;let e=a=>{let c=window.getComputedStyle(a),l=c.position==="sticky",u;if(l){let g=a.style.position;a.style.position="static",u=a.getBoundingClientRect().top+window.scrollY,a.style.position=g}else u=a.getBoundingClientRect().top+window.scrollY;let h=l&&parseFloat(c.top)||0,f=u-h;window.scrollY>f&&window.scrollTo(0,f)};if(typeof requestAnimationFrame>"u"){let a=document.querySelector(t);a&&e(a);return}let s=++this.scrollWaitToken,n=30,i=0,o=()=>{if(s!==this.scrollWaitToken)return;let a=document.querySelector(t);if(a){e(a);return}++i<n&&requestAnimationFrame(o)};requestAnimationFrame(o)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),s=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(s.length!==n.length)return!0;let i=s[s.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&d.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent(),this.clearScrollWait(),this.pageCache.clear()}getPath(){let t=this.location,e=this.history;return e&&e.type==="hash"?t.hash.replace("#",""):t.pathname+t.search+t.hash}},N=new we;p.addType("routes",r=>{if(!r)return!1;let t=r.route;t&&N.removeRoute(t)});var Us=(r,t,e)=>{if(t)if(Array.isArray(t))for(let s=0,n=t.length;s<n;s++){let i=t[s];i&&Hs(r,i,e)}else Hs(r,t,e)},Hs=(r,t,e)=>{t.container=r,t.parent=e;let s=N.add(t);Tn(r,s)},Tn=(r,t)=>{p.add(r,"routes",{route:t})};var Fs=(r,t,e)=>{};p.addType("switch",r=>{if(!r)return!1;let t=r.id;N.removeSwitch(t)});var Ws=(r,t,e)=>{let s=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=r,a.parent=e)}let n=N.addSwitch(t);En(r,n)},En=(r,t)=>{p.add(r,"switch",{id:t})};st.add("cache",ls).add("onCreated",vs).add("onDestroyed",Cs).add("bind",gs).add("data",as).add("state",Fs).add("onSet",it).add("onState",Kt).add("animateIn",Xe).add("animateOut",Ze).add("watch",As).add("useParent",us).add("useData",fs).add("useState",ds).add("getId",hs).add("addState",ps).add("addEvent",ms).add("map",ws).add("for",ks).add("useContext",is).add("addContext",os).add("context",ns).add("role",es).add("aria",ss).add("route",Us).add("debug",cs).add("dataSet",bs).add("dataStateSet",xs).add("switch",Ws);export{ht as Ajax,at as Arrays,ir as Atom,y as Builder,A as Component,U as Data,p as DataTracker,Ar as DateTime,st as Directives,X as Dom,pt as Encode,zs as Events,D as Html,pe as Import,z as Jot,mt as Model,Xt as NavLink,S as Objects,Cr as Pod,wt as ResourceCache,tt as SimpleData,gt as State,I as Store,w as Strings,k as Types,yt as Unit,B as base,b as dataBinder,N as router};
2
2
  //# sourceMappingURL=base.js.map
@@ -0,0 +1,2 @@
1
+ import{b as P}from"./chunk-6YJAZHX6.js";import{a as _,b as bt,c as At,d as Et,e as T,f as S,g as O}from"./chunk-HBL2JSVL.js";import{a as W,b as Tt}from"./chunk-VSCHM2ZB.js";import{a as Pt,c as I,d as Rt,f as q}from"./chunk-LY736NR2.js";import{b as f,c as p}from"./chunk-7ZHUXJZT.js";var F={items:new Map,add(n,t){return this.items.set(n,t),this},get(n){return this.items.get(n)??null}};var y=[],G=0,lt=!1,Le=typeof queueMicrotask=="function"?queueMicrotask:n=>Promise.resolve().then(n),De=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||n.container||null},Be=n=>{n._mountPending=!1;try{n.afterMount()}catch(t){console.error("Error in afterMount:",t)}},It=()=>{lt=!1;let n=y;if(n.length===0)return;y=[];let t=[];for(let e=0,r=n.length;e<r;e++){let s=n[e];if(s.rendered!==!0||s._mountPending!==!0){s._mountPending=!1;continue}let o=De(s);if(o&&o.isConnected===!0){Be(s);continue}t.push(s)}t.length&&(y=y.length?t.concat(y):t),y.length&&G===0&&y.length!==t.length&&ct()},ct=()=>{lt||(lt=!0,Le(It))},v={add(n){n._mountPending!==!0&&(n._mountPending=!0,y.push(n))},enter(){G++},leave(){--G>0||(G=0,y.length&&ct())},schedule(){y.length&&ct()},flush(){It()},get size(){return y.length}};f.addType("components",n=>{if(!n)return;let t=n.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken,t),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Me=0,z=class{constructor(t,e,r){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let s,o;if(t==null)s={},o=[];else{let i=typeof t;i==="string"||i==="number"?(s={},o=[{tag:"text",textContent:t}]):Array.isArray(t)?(s={},o=t):(s=t||{},o=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(s),this.children=o||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Me++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,s;r!=null&&e!=null?s="pk:"+r+":"+e:r!=null?s="pk:"+r:e!=null?s="pk:"+e:s="pc"+this.persistedCount++;let o=this.persistedChildren[s];return o&&t.unitType===o.unitType&&t.resumeScope(o),t.persistToken=s,this.persistedChildren[s]=t,s}removePersistedChild(t,e){if(!this.rendered)return;let r=t?this.persistedChildren[t]:null;r&&(e&&r!==e||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){f.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout(),typeof this.afterMount=="function"&&v.add(this)}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(let s=0,o=t.length;s<o;s++){let i=e(t[s],s);r.push(i)}return r}removeAll(t){return q.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy();let t=this.panel;t&&q.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,r=t.length;e<r;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var L=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static _releaseLinks(t,e){!t||t===e||typeof t.unlink!="function"||t.unlink()}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let r=t.getParentContext();if(!r||!r.data)return;let s=r.data.stage,o=e.data.stage,i=null;for(let a in s){if(!Object.prototype.hasOwnProperty.call(s,a))continue;let l=s[a];l!==o[a]&&(i===null&&(i={}),i[a]=l)}i!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(i):e.data.set(i))}static _resumeExternal(t,e){let r=t.setData();if(!r){t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let s=e._retainState||r._retainState,o=!s&&(e._refreshState||r._refreshState),i=this._buildExternalUpdates(e.stage,r.stage,s,o);W.isEmpty(i)||r._silentSet(i)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,s){let o={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(s){Object.prototype.hasOwnProperty.call(e,i)||(o[i]=t[i]);continue}let a=t[i];!r&&a==null||a!==e[i]&&(o[i]=a)}return o}static _resumeOwned(t,e){let r=t.data;if(!r){this._releaseLinks(e),t.data=e;return}if(e&&e._retainState){this._releaseLinks(r,e),this._releaseLinks(e),t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let s=e._refreshState||t.data._refreshState,o=this._buildOwnedUpdates(e.stage,t.data.stage,s);W.isEmpty(o)||t.data._silentSet(o)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let s={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(r){Object.prototype.hasOwnProperty.call(e,o)||(s[o]=t[o]);continue}let i=t[o];i!=null&&i!==e[o]&&(s[o]=i)}return s}};var Q=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let s=t[r];this.on(s[0],s[1],s[2],s[3])}}on(t,e,r,s){p.on(t,e,r,s),this.events.push({event:t,obj:e,callBack:r,capture:s})}off(t,e,r,s){p.off(t,e,r,s);let o,i=this.events;for(let a=0,l=i.length;a<l;a++)if(o=i[a],o.event===t&&o.obj===e&&o.callBack===r&&o.capture===s){i.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let s=t[e];p.on(s.event,s.obj,s.callBack,s.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let s=t[e];p.off(s.event,s.obj,s.callBack,s.capture)}}reset(){this.unset(),this.events=[]}};var j=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,s){return{action:t,state:e,callBack:r,targetId:s,token:null,callBackToken:null}}convertStates(t){let e=[];for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}let s=null,o=null,i=t[r];i&&typeof i=="object"&&(o=i.callBack,s=i.id||i.targetId,i=i.state),e.push(this.createState(r,i,o,s))}return e}setupRemoteStates(t,e){for(let r=0,s=t.length;r<s;r++){let o=t[r];if(o)for(let i in o){if(!Object.prototype.hasOwnProperty.call(o,i)||i==="id")continue;let a=null,l=o[i],c=l!==null?l:void 0;c&&typeof c=="object"&&(a=c.callBack,c=c.state),e.push(this.createState(i,c,a,o.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let r=0,s=e.length;r<s;r++){let o=e[r];o.callBackToken&&(t.off(o.action,o.callBackToken),o.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,s=e.length;r<s;r++){let o=e[r];o.token&&this.unbindRemoteState(t,o.token),o.targetId&&P.remove(o.targetId,o.action,o.token)}}restore(t){P.restore(t.id,t);let e=this.callBackStates;if(e)for(let s=0,o=e.length;s<o;s++){let i=e[s];i.callBackToken=t.on(i.action,i.callBack)}let r=this.remoteStates;if(r)for(let s=0,o=r.length;s<o;s++){let i=r[s];i.token=this.bindRemoteState(t,i.action,i.targetId)}}bindRemoteState(t,e,r){let s=P.getTarget(r);return t.link(s,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(let s=0,o=e.length;s<o;s++){let i=e[s],a=this.addAction(t,i);i.targetId&&(i.token=a,r.push(i))}}addAction(t,e){let r,s=e.action,o=e.targetId;o&&(r=this.bindRemoteState(t,s,o)),typeof e.state<"u"&&t.addAction(s,e.state);let i=e.callBack;return typeof i=="function"&&(e.callBackToken=t.on(s,i),this.callBackStates.push(e)),r||null}};var x=class extends z{constructor(t,e,r){super(t,e,r),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._externalData=this._externalData??!1,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){if(this._resumeData(t.data),this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,t.context){let e=t.context.data;e&&e._refreshState===!0&&e._retainState!==!0||(this.context=t.context,this._contextResumed=!0)}this.id=t.id,this._refreshContextData()}_resumeData(t){L.resume(this,t)}_refreshData(){L.refresh(this)}_refreshContextData(){L.refreshContext(this)}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=P.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();W.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new j(this.state??{},t))}addState(t){!this.stateHelper||this.stateResumed===!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;if(!t)return;let e=this.stateHelper;e&&(e.removeRemoteStates(t),e.removeLocalStates(t)),P.detach(String(t.id)),this.stateResumed=!1}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new Q)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}};var _t={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},Ot=(n,t)=>typeof n!="function"&&t==="setupStates"?()=>n:n;var ht=(n,t)=>{if(!n)return t;let e=Object.keys(n);for(let r=0,s=e.length;r<s;r++){let o=e[r],i=n[o],a=_t[o]||o;t[a]=Ot(i,a)}return t},Ue=n=>ht(n,{}),He=0,Lt=(n,t)=>{class e extends n{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+He++,e},D=(n,t=x)=>{n||(n={});let e,r=typeof n;return r==="object"&&n.render?(e=Ue(n),Lt(t,e)):(e={render:r==="function"?n:()=>n},Lt(t,e))};var ut=(n,t)=>({attr:n,directive:t});var k=(n,t)=>({key:n,value:t});var Dt=(n,t,e,r)=>({tag:n,attr:t,directives:e,children:r});var Bt=null,Ne=()=>Bt||(Bt=F.get("watch")),w=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,s){return t==="text"?(s.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(k("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(ut(k(e,O.getWatcherSettings(r,Rt(e))),Ne()))}static setButtonType(t,e,r){if(t==="button"){let s=e.type||"button";r.push(k("type",s))}}static parse(t,e){let r=[],s=[],o=t.tag||"div";o==="button"&&r.push(k("type",t.type||"button"));let i=[],a,l;for(let c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||c==="tag"||(a=t[c],a==null))continue;if(c==="children"||c==="nest"){if(Array.isArray(a))for(let u=0;u<a.length;u++)i.push(a[u]);else i.push(a);continue}if((l=F.get(c))!==null){s.push(ut(k(c,a),l));continue}let h=typeof a;if(h==="object"){if(O.isWatching(a)){this.setTextAsWatcher(s,c,a);continue}i.push(a);continue}if(h==="function"){let u=a,m=function(g){u.call(this,g,e)};m.originalCallback=u,r.push(k(c,m));continue}if(h==="string"&&a.includes("[[")){this.setTextAsWatcher(s,c,a);continue}if(c==="text"){i.push({tag:"text",textContent:a});continue}if(c==="html"||c==="innerHTML"){r.push(k("innerHTML",a));continue}r.push(k(c,a))}return Dt(o,r,s,i)}};var B=class{build(t,e,r){}setupComponent(t,e,r){let s=r?.getChildScope();t.parent=s,s&&s.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&s&&(s[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var We=n=>{for(let e in n)if(e!=="tag"&&e!=="textContent")return!1;let t=n.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},V=class extends B{build(t,e,r){let s=S.createDocFragment();if(Array.isArray(t))for(let o=0,i=t.length;o<i;o++)this.buildElement(t[o],s,r);else this.buildElement(t,s,r);return e&&typeof e=="object"&&e.appendChild(s),s}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){if(t.tag==="text"&&We(t)){let c=t.textContent;S.createText(c??"",e);return}let s=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,s);return}let o=w.parse(t,s),i=this.createNode(o,e,s);this.cache(i,t.cache,r);let a=o.children;for(let c=0,h=a.length;c<h;c++){let u=a[c];u!==null&&this.buildElement(u,i,r)}let l=o.directives;l.length&&this.setDirectives(i,l,s)}createTempComponent(t,e,r){let s={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...ht(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(s.setupStateTarget=function(i){this.state=t.state});let o=new x(s);this.createComponent(o,e,r)}setDirectives(t,e,r){for(let s=0,o=e.length;s<o;s++)this.handleDirective(t,e[s],r)}handleDirective(t,e,r){e.directive(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let s=t.tag;if(s==="text"){let o=t.attr[0],i=o?o.value:"";return S.createText(i,e)}else if(s==="comment"){let o=t.attr[0],i=o?o.value:"";return S.createComment(i,e)}return S.create(s,t.attr,e,r)}removeNode(t){S.removeElement(t)}removeAll(t){S.removeAll(t)}};var qe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),Fe=/[&<>"]/,dt=n=>{let t=typeof n=="string"?n:String(n);return Fe.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t},M=class{static create(t,e=[],r=""){let s="",o="";for(let i=0,a=e.length;i<a;i++){let l=e[i],c=l.key,h=l.value;if(c==="text"||c==="textContent"){s+=dt(h);continue}if(c==="html"||c==="innerHTML"){s+=h;continue}if(typeof h=="function")continue;let u=c+'="'+dt(h)+'"';o?o+=" "+u:o=u}return qe.has(t)?"<"+t+" "+o+" />":"<"+t+" "+o+">"+s+r+"</"+t+">"}static createText(t){return dt(t)}static createComment(t){return"<!-- "+t+" -->"}};var Y=class extends B{build(t,e,r){if(Array.isArray(t)){let s="";for(let o=0,i=t.length;o<i;o++)s+=this.buildElement(t[o],r);return s}return this.buildElement(t,r)}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let r=w.parse(t,e),s=r.children,o="";for(let i=0,a=s.length;i<a;i++){let l=s[i];l!==null&&(o+=this.buildElement(l,e))}return this.createNode(r,o)}createNode(t,e){let r=t.tag;if(r==="text"){let s=t.attr[0],o=s?s.value:"";return M.createText(o)}else if(r==="comment"){let s=t.attr[0],o=s?s.value:"";return M.createComment(o)}return M.create(r,t.attr,e)}removeAll(t){}};var $=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new V:new Y}};var R=$.setup(),Ke=n=>typeof n=="object"&&n.isUnit===!0,Mt=new WeakMap,Ge=n=>{let t=Mt.get(n);if(!t){if(t=D(n),!t)return null;Mt.set(n,t)}return new t},d=class{static render(t,e,r){if(!t||(Ke(t)||(t=Ge(t)),!t))return null;v.enter();try{return R.createComponent(t,e,r)}finally{v.leave()}}static build(t,e,r){v.enter();try{return R.build(t,e,r)}finally{v.leave()}}static rebuild(t,e,r){return R.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){R.setDirectives(t,e,r)}static createNode(t,e,r){return R.createNode(t,e,r)}static removeNode(t){R.removeNode(t)}static removeAll(t){R.removeAll(t)}};Tt.augment({buildLayout(n,t,e){d.build(n,t,e)}});var ft=[],ze=n=>ft.indexOf(n)!==-1,Qe=n=>({tag:"script",src:n.src,async:!1,load(t){ft.push(n.src);let e=n.load;e&&e()}}),je=n=>({tag:"link",rel:"stylesheet",type:"text/css",href:n.src,load(t){ft.push(n.src);let e=n.load;e&&e()}}),J=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,r=this.update.bind(this);t.indexOf(".css")!==-1?e=je({load:r,src:t}):e=Qe({load:r,src:t}),d.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{ze(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var Ve=n=>n?typeof n?.prototype?.constructor=="function":!1,b=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Ve(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){return this.renderNodes(t,e,r)[0]||null}static renderNodes(t,e,r){let s=d.build(t,null,r),o=Array.from(s.childNodes);return o.length===0&&t?.panel&&o.push(t.panel),e.after(s),o}};var X=class{static load(t,e,r){return t.then(s=>(e&&e(s),s)).catch(s=>{console.error("Error loading module:",s),r&&r(s)})}};var Ye=n=>({tag:"comment",textContent:"import placeholder",onCreated:n.onCreated}),A=new _(100),$e=n=>{if(A.has(n)){let r=A.get(n);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof n,e;if(t==="string")e=import(n);else if(t==="function")e=n();else return n;return e.then(r=>{A.set(n,r)}).catch(()=>{A.delete(n)}),A.set(n,e),e},Je=n=>{if(!A.has(n))return null;let t=A.get(n);return t&&typeof t.then=="function"?null:t||null},Ut=n=>{for(let t=0,e=n.length;t<e;t++){let r=n[t];r&&d.removeNode(r)}},Ht=D({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return Ye({onCreated:n=>{if(this.src){if(this.layout){this.setLayoutRoots(b.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){new J(()=>{this.loadAndRender(n)}).addFiles(this.depends);return}this.loadAndRender(n)}}})},loadAndRender(n){let t=this.generation,e=Je(this.src);if(e){this.renderModule(n,e);return}X.load($e(this.src),r=>{t===this.generation&&this.renderModule(n,r)},r=>{t===this.generation&&(this.loaded=!1,this.renderError(n,r))})},renderError(n,t){let e=()=>this.retry(n),r=this.fallback,s=typeof r=="function"?r(t,e):r||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};if(!s)return;let o=b.renderNodes(s,n,this.parent);this.errorRoots=o,this.errorRoot=o[0]||null},setLayoutRoots(n){this.layoutRoots=n,this.layoutRoot=n[0]||null},retry(n){this.removeErrorLayout(),this.loadAndRender(n)},removeErrorLayout(){this.errorRoot&&(Ut(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(n,t){this.loaded=!0;let e=this.layout||b.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(b.renderNodes(e,n,this.parent)),typeof this.onModuleRender=="function"&&this.onModuleRender(e)},shouldUpdate(n){return this.updateLayout===!0?!0:this.updateLayout=n&&n.isUnit&&typeof n.update=="function"},updateModuleLayout(n){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(n)},update(n){this.loaded===!0&&this.updateModuleLayout(n)},destroy(){this.generation++,this.removeErrorLayout(),this.layoutRoot&&(Ut(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Nt=n=>{let t=typeof n;return(t==="string"||t==="function"||n instanceof Promise)&&(n={src:n}),new Ht(n)};var Xe=0,U=class{constructor(t){this.router=t,this.locationId="base-app-router-"+Xe++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var Ze=0,tr=()=>Date.now().toString(36)+"-"+(Ze++).toString(36)+"-"+Math.random().toString(36).substring(2,8),qt=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Wt=()=>{qt&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let n=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(n,t)}))},Z=class extends U{constructor(t){super(t),this.currentKey=null,this.positions=new _(200)}saveCurrentPosition(){let t=this.getScrollPosition(),e=this.currentKey;return e&&this.positions.set(e,t),t}addEvent(){p.on("popstate",window,this.callBack);let t=window.history;return t&&"scrollRestoration"in t&&(this.previousScrollRestoration=t.scrollRestoration,t.scrollRestoration="manual"),qt&&(this.pageShowCallBack=this.onPageShow.bind(this),p.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){p.off("popstate",window,this.callBack);let t=window.history;return this.previousScrollRestoration&&t&&"scrollRestoration"in t&&(t.scrollRestoration=this.previousScrollRestoration,this.previousScrollRestoration=null),this.pageShowCallBack&&p.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&Wt()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.saveCurrentPosition();let r=e.key||null;this.currentKey=r;let s=r&&this.positions.get(r)||e.scrollPosition,o=this.router;o.checkActiveRoutes(e.uri,!!s),s&&(typeof o.restoreScrollPosition=="function"?o.restoreScrollPosition(s):this.scrollTo(s)),Wt()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:tr(),scrollPosition:r,uri:t}}addState(t,e,r=!1){let s=window.history,o=s.state;if(o&&o.uri===t)return o.key&&o.location===this.locationId&&(this.currentKey=o.key),this;!r&&o&&o.location===this.locationId&&(o.scrollPosition=this.saveCurrentPosition(),s.replaceState(o,"",window.location.href));let i=this.createState(t,e);return r||(i.scrollPosition={x:0,y:0}),s[r===!1?"pushState":"replaceState"](i,null,t),this.currentKey=i.key,this.positions.set(i.key,i.scrollPosition),this}};var tt={removeSlashes(n){return typeof n!="string"?"":(n[0]==="/"&&(n=n.substring(1)),n[n.length-1]==="/"&&(n=n.substring(0,n.length-1)),n)},getHashUri(n){if(typeof n!="string")return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)}};var et=class extends U{addEvent(){return p.on("hashchange",window,this.callBack),this}removeEvent(){return p.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(tt.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var rt=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Z(t).setup():new et(t).setup()}};var pt=5,er=200,nt=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new _(er),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:pt}get size(){return this.pages.size}add(t){let e=this.pages;e.delete(t),e.add(t),this.trim()}delete(t){this.pages.delete(t)}trim(){let t=this.pages,e=this.getMax();for(;t.size>e;){let r=t.values().next().value;t.delete(r),r.evict()}}clear(){let t=Array.from(this.pages);this.pages.clear();for(let e=0,r=t.length;e<r;e++)t[e].evict()}saveScroll(t,e){if(e){this.scrollMemory.set(t,e);return}this.scrollMemory.has(t)&&this.scrollMemory.delete(t)}getScroll(t){return this.scrollMemory.get(t)||null}};var mt=class extends x{getChildScope(){return this.parent}},Ft=n=>D(n,mt);var gt="data-scroll-key",rr="["+gt+"]",Kt=(n,t)=>{for(let e=0,r=n.length;e<r;e++){let s=n[e];if(!s||s.nodeType!==1)continue;let o=s.getAttribute(gt);o!==null&&t(s,o);let i=s.querySelectorAll(rr);for(let a=0,l=i.length;a<l;a++){let c=i[a];t(c,c.getAttribute(gt))}}},yt=n=>{let t=null;return Kt(n,(e,r)=>{let s=e.scrollTop||0,o=e.scrollLeft||0;s===0&&o===0||(t=t||{},t[r]=[s,o])}),t},St=(n,t)=>{if(!t)return!0;let e={},r=0;for(let s in t)e[s]=!0,r++;return Kt(n,(s,o)=>{let i=t[o];if(!i)return;let a=i[0],l=i[1];s.scrollTop=a,s.scrollLeft=l,Math.abs((s.scrollTop||0)-a)<1&&Math.abs((s.scrollLeft||0)-l)<1&&e[o]&&(e[o]=!1,r--)}),r<=0};var nr=n=>{for(let t=0;t<n.length;t++){let e=n[t],r=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(r)||r.length===0)continue;let s=[];for(let o=0,i=r.length;o<i;o++){let a=r[o];a&&n.indexOf(a)===-1&&s.indexOf(a)===-1&&s.push(a)}n.splice(t+1,0,...s)}},sr=n=>/^class[\s{]/.test(Function.prototype.toString.call(n)),or=1500,Gt=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),ir=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},xt=(n,t,e)=>{if(!(!n||typeof n[t]!="function"))try{n[t](...e)}catch(r){console.error("Error in "+t+":",r)}},st=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent,this.keepAlive=typeof e.keepAlive=="boolean"?e.keepAlive:null,this.pageCache=e.pageCache||null,this.detachedNodes=null,this.detachedParents=null,this.detachedPath=null,this.savedScroll=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let r=t.layout;if(r&&r.isUnit===!0&&typeof r.keepAlive=="boolean")return r.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}isDetached(){return this.detachedNodes!==null}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.detachedPath!==this.getPagePath()&&this.evict(),this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=sr(t)?new t:t(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(Ft(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;d.render(t,this.container,this.parent)}afterCreate(t){let e=this.component;!e||this.pageCache===null||(e.loaded===!1&&e.src&&(e.onModuleRender=()=>this.onModuleRender(e)),this.isKeepAlive(e)&&this.callPageHook("onActivate",[t,{restored:!1}]),this.pageCache.historyNavigation===!0&&this.restoreHistoryScroll())}onModuleRender(t){if(this.setup!==!0||this.component!==t)return;let e=t.layout;e&&e.isUnit===!0&&this.isKeepAlive(t)&&xt(e,"onActivate",[this.params,{restored:!1}])}getScrollKey(){let t=this.route||{};return(t.routeId||"")+"|"+(t.path||"")}getPagePath(){let e=(this.route||{}).path||"",r=e.indexOf("#");return r>-1?e.substring(0,r):e}getRootNodes(t){let e=[],r=ir(t);r&&e.push(r);let s=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),o=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),i=[s,o];for(let a=0;a<2;a++){let l=i[a];if(l)for(let c=0,h=l.length;c<h;c++){let u=l[c];u&&e.indexOf(u)===-1&&e.push(u)}}return nr(e),e}callPageHook(t,e){let r=this.component;if(!r)return;xt(r,t,e);let s=r.layout;s&&s!==r&&s.isUnit===!0&&xt(s,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,s=()=>St(this.getRootNodes(r),t);if(s()||typeof requestAnimationFrame>"u")return;let o=Gt(),i=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||s()||Gt()-o>or||requestAnimationFrame(i)};requestAnimationFrame(i)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null,!(!t||!this.component)&&St(this.getRootNodes(this.component),t)}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let r=yt(e);this.savedScroll=r,this.pageCache.saveScroll(this.getScrollKey(),r);let s=new WeakMap;for(let o=0,i=e.length;o<i;o++){let a=e[o],l=a.parentNode;l&&(s.set(a,l),l.removeChild(a))}return this.detachedNodes=e,this.detachedParents=s,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.component,s=this.container;if(!r||r.rendered!==!0||!s||typeof s.appendChild!="function")return this.savedScroll=null,this.releaseComponent(),!1;let o=this.getRootNodes(r);for(let i=0,a=o.length;i<a;i++){let l=o[i],c=e?e.get(l):null;(c&&c.isConnected?c:s).appendChild(l)}return this.setup=!0,v.schedule(),!0}evict(){if(this.detachedNodes===null)return;let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null,this.savedScroll=null,this.releaseComponent()}releaseComponent(){let t=this.component;this.component=null,t&&typeof t.destroy=="function"&&t.destroy()}remove(t){if(this.setup!==!0){t===!0&&this.evict();return}this.setup=!1,this.scrollToken++;let e=this.component;if(!e)return;let r=this.pageCache;if(t!==!0&&r!==null){if(this.isKeepAlive(e)&&this.detach(e))return;r.saveScroll(this.getScrollKey(),yt(this.getRootNodes(e)))}this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var zt=n=>{if(!n.length)return null;let t={};for(let e=0,r=n.length;e<r;e++)t[n[e]]=null;return t},Qt=n=>{let t=[];if(!n)return t;let e=/[*?]/g;n=n.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,s=n.match(r);if(s===null)return t;for(let o=0,i=s.length;o<i;o++){let a=s[o];a&&t.push(a.replace(":",""))}return t};var ar=/(\/):[^/(]*?\?/g,lr=/\//g,cr=/(\?\/+\*?)/g,hr=/(:[^/?&($]+)/g,ur=/(\*)/g,dr=n=>n.replace(ar,t=>t.replace(lr,"(?:$|/)")),fr=n=>(n=n.replace(cr,"?/*"),n.replace(hr,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),pr=n=>n.replace(ur,".*"),mr=(n,t)=>n+=t[t.length-1]==="*"?"":"$",jt=n=>{if(!n)return"";let t=n;return t=dr(t),t=fr(t),t=pr(t),t=mr(t,n),t};var gr=0,Vt=(n,t="")=>{let e=n||"",r=typeof t=="string"&&t?t:e,s=null,o=[],i=r.match(/#\{([^}]+)\}/);i&&i[1]&&(s=i[1].trim(),r=r.replace(i[0],""),e=e.replace(i[0],""));let a=r.indexOf("?");if(a>-1){let h=r.substring(a+1);if(h.indexOf("=")>-1){let u=h.split("&");for(let g=0,E=u.length;g<E;g++){let N=u[g];if(!N)continue;let[_e,Oe=""]=N.split("="),Ct=(_e||"").trim();Ct&&o.push({key:Ct,value:(Oe||"").trim()})}r=r.substring(0,a);let m=e.indexOf("?");m>-1&&(e=e.substring(0,m))}}let l=s!==null||o.length>0;return l&&!r&&(e="*"),{uriPath:e,requiredHash:s,requiredQuery:o,hasConditions:l}},yr=n=>{if(!n)return"";let t=n.indexOf("?"),e=n.indexOf("#"),r=n.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),n.substring(0,r).replace(/\/\.(?:\/|$)/g,"/")},Sr=n=>{if(!n)return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)},xr=n=>{if(!n)return"";let t=n.indexOf("?");if(t===-1)return"";let e=n.indexOf("#",t);return e===-1?n.substring(t+1):n.substring(t+1,e)},ot=class extends At{constructor(t,e,r=null){let s=t.baseUri,i=Vt(s,t.rawUri).uriPath,a=Qt(i),l=zt(a),c=super(l);return this.uri=s,this.matchUri=i,this.paramKeys=a,this.titleCallBack=e,this.pageCache=r,this.setupRoute(t),this.set("active",!1),c}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null,this.pageCache=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+gr++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=Vt(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=jt(this.matchUri);this.uriQuery=new RegExp("^"+r),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1,this.scrollTo=t.scrollTo||null}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(t){this.set("active",!1);let e=this.controller;e&&e.remove(t===!0)}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return!!e&&e.isConnected===!1}getLayout(t){if(t.component)return t.component;let e=t.import;return e?Nt(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:s,parent:o,keepAlive:i}=t,a={component:e,container:r,persist:s,parent:o,keepAlive:i,pageCache:this.pageCache},l=bt(this);this.controller=new st(l,a)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let r=this.controller;r&&r.focus(t);let s=this.path;if(!s)return;let o=s.split("#")[1];o&&this.scrollToId(o)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=yr(t),s=this.uriQuery||/$^/,o=r.match(s);return o===null?(this.resetParams(),e):Array.isArray(o)?this.matchConditions(t)?(this.setParams(o,1),e=o,e):(this.resetParams(),!1):e}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&Sr(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=xr(t);if(!r)return!1;let s=new URLSearchParams(r);for(let o=0,i=e.length;o<i;o++){let a=e[o];if(!s.has(a.key)||s.get(a.key)!==a.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let r=this.paramKeys;if(!r)return;let s={};for(let o=0,i=r.length;o<i;o++){let a=r[o];typeof a<"u"&&(s[a]=t[o+e])}this.set(s)}getParams(){return this.stage}};var vr=n=>{let t=/\w\S*/;return n.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},kr=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),wr=(n,t)=>{if(n.indexOf(":")===-1)return n;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let s=new RegExp(":"+kr(r),"gi");n=n.replace(s,()=>e[r])}return n},Cr=(n,t)=>t&&(typeof t=="function"&&(t=t(n.stage)),t=wr(t,n),vr(t)),Tr=(n,t)=>(t!==""&&(n+=" - "+t),n),Yt=(n,t,e)=>t&&(t=Cr(n,t),Tr(t,e));var Pr=()=>typeof window<"u"?window.location:{},Rr=n=>{if(!n)return"";let t=n.indexOf("#");return t>-1?n.substring(t+1):""},br=1500,it=["wheel","touchstart","keydown","pointerdown"],$t=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),vt=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=pt,this.pageCache=new nt(this),this.history=null,this.callBackLink=null,this.location=Pr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new Et({path:""})}setupHistory(){this.history=rt.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new ot(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let r=e?e.max:void 0;return typeof r=="number"&&r>=0&&(this.keepAliveMax=r),this.pageCache.trim(),this}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resumeRoute(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){let e=this.getBasePath(),r=tt.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let s=0;s<r;s++){let o=e[s];if(o.uri===t)return o}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let s=0;s<r;s++){let o=e[s];if(o.routeId===t)return o}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate(!0)}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(let s=0,o=t.length;s<o;s++){let i=t[s];if(!i)continue;let a=this.createRoute(i);r.push(a)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,s=this.getSwitchGroup(r);for(let o=0,i=t.length;o<i;o++){let l=t[o].component.route;l.resumeRoute(e),s.push(l)}return this.checkGroupForRegistration(r,s),r}checkGroupForRegistration(t,e){let r=this.scrollIntent,s=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=s;let o=this.scrollIntent;o&&o.type==="target"&&o.groupId!==null&&o.groupId!==void 0&&(this.lastScrollGroup=o.groupId),this.scrollIntent=r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,s=e.length;r<s;r++){let o=e[r];o&&typeof o.deactivate=="function"&&o.deactivate(!0)}}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),p.on("click",document,this.callBackLink);let r=this.getEndPoint();return this.navigate(r,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.defaultPrevented===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0||t.altKey===!0||typeof t.button=="number"&&t.button!==0)return!0;let e=t.target&&t.target.closest?t.target.closest("a"):null;if(!e||e.dataset.cancelRoute||e.hasAttribute("download"))return!0;let r=e.getAttribute("target");if(r&&r!=="_self")return!0;let s=e.getAttribute("href");if(s===null)return!0;let o=this.getLinkPath(s);if(o===null)return!0;let i=e.dataset.replace==="true";return this.navigate(o,null,i),t.preventDefault(),t.stopPropagation(),!1}getLinkPath(t){let e=t;if(e.substring(0,2)==="//"||/^[a-z][a-z0-9+.-]*:/i.test(e)){let s=this.location;if(!s||!s.origin||typeof URL>"u")return null;let o;try{o=new URL(e,s.href)}catch{return null}if(o.origin!==s.origin)return null;e=o.pathname+o.search+o.hash}let r=this.baseURI;return r!=="/"&&e.indexOf(r)===0&&(e=e.substring(r.length)),e}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let s=t[e];s&&typeof s.deactivate=="function"&&s.deactivate(!0)}return this.pageCache.clear(),this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.updatePath(),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=Yt(t,e,this.title),this}checkActiveRoutes(t,e){t=t||this.getPath(),t!==this.path&&(this.lastPath=this.path),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollWaitToken++;let r=this.pageCache;r.historyNavigation=e===!0;let s=this.routes;for(let o=0,i=s.length;o<i;o++){let a=s[o];typeof a>"u"||r.size>0&&a.isDormant()||this.checkRoute(a,t)}if(this.checkSwitches(t,!0),r.historyNavigation=!1,e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}checkSwitches(t,e){let r=this.switches;for(let[s,o]of r.entries())e===!0&&this.pageCache.size>0&&o.length&&o[0].isDormant()||(this.currentGroupId=s,this.checkGroup(o,t));this.currentGroupId=null}checkGroup(t,e){let r=t.length;if(!r)return;let s=null;for(let a=0;a<r;a++)if(t[a].get("active")){s=t[a];break}let o=!1;s&&(o=s.match(e)!==!1);let i;for(let a=0;a<r;a++){let l=t[a];if(typeof l>"u")continue;(l===s?o:l.match(e))!==!1&&i===void 0&&l.controller&&(i=l)}if(!i){s&&s!==t[0]&&s.deactivate(),this.select(t[0],!0);return}this.select(i),s&&s!==i&&s.deactivate();for(let a=0;a<r;a++){let l=t[a];l&&l!==i&&l!==s&&l.deactivate()}}checkRoute(t,e){let r=this.check(t,e);return r!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),r}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t,e){if(!t||(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e===!0))return;let r=this.scrollIntent;if(r&&r.type==="hash")return;let s=Rr(this.path);if(s){this.scrollIntent={type:"hash",hash:s};return}t.scrollTo?this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId}:t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,r=e&&this.lastScrollGroup===t.groupId;r||(typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()),this.lastScrollGroup=e?t.groupId:null,r&&this.scrollToTarget(t.selector)}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let r=t.x||0,s=t.y||0;if(typeof requestAnimationFrame>"u"||this.canReachScroll(r,s)){window.scrollTo(r,s);return}let o=()=>{e===this.scrollWaitToken&&this.scrollWaitToken++,this.clearScrollWait()},i={capture:!0,passive:!0};for(let c=0,h=it.length;c<h;c++)window.addEventListener(it[c],o,i);this.cancelScrollWait=()=>{for(let c=0,h=it.length;c<h;c++)window.removeEventListener(it[c],o,i)};let a=$t(),l=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,s)||$t()-a>=br){this.clearScrollWait(),window.scrollTo(r,s);return}requestAnimationFrame(l)};requestAnimationFrame(l)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){let r=document.documentElement;if(!r)return!0;let s=(r.scrollHeight||0)-(window.innerHeight||0),o=(r.scrollWidth||0)-(window.innerWidth||0);return(e<=0||e<=s+1)&&(t<=0||t<=o+1)}scrollToHash(t){if(!t||typeof document>"u")return;let e=()=>{let l=document.getElementById(t);if(l)return l;try{return document.getElementById(decodeURIComponent(t))}catch{return null}},r=e();if(r){r.scrollIntoView(!0);return}if(typeof requestAnimationFrame>"u")return;let s=++this.scrollWaitToken,o=30,i=0,a=()=>{if(s!==this.scrollWaitToken)return;let l=e();if(l){l.scrollIntoView(!0);return}++i<o&&requestAnimationFrame(a)};requestAnimationFrame(a)}scrollToTarget(t){if(typeof t!="string"||typeof document>"u")return;let e=a=>{let l=window.getComputedStyle(a),c=l.position==="sticky",h;if(c){let g=a.style.position;a.style.position="static",h=a.getBoundingClientRect().top+window.scrollY,a.style.position=g}else h=a.getBoundingClientRect().top+window.scrollY;let u=c&&parseFloat(l.top)||0,m=h-u;window.scrollY>m&&window.scrollTo(0,m)};if(typeof requestAnimationFrame>"u"){let a=document.querySelector(t);a&&e(a);return}let r=++this.scrollWaitToken,s=30,o=0,i=()=>{if(r!==this.scrollWaitToken)return;let a=document.querySelector(t);if(a){e(a);return}++o<s&&requestAnimationFrame(i)};requestAnimationFrame(i)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),s=t.split("/");if(r.length!==s.length)return!0;let o=r[r.length-1],i=s[s.length-1];return o!==i}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&p.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent(),this.clearScrollWait(),this.pageCache.clear()}getPath(){let t=this.location,e=this.history;return e&&e.type==="hash"?t.hash.replace("#",""):t.pathname+t.search+t.hash}},C=new vt;var Jt=(n,t)=>({attr:n,value:t}),Ar=(n,t)=>{if(!t.startsWith(n))return!1;let e=t[n.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},kt=class extends x{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,s=C.data,o=[];t&&typeof t=="object"&&o.push(Jt("href",t)),e&&typeof e=="object"&&o.push(Jt("text",e));let i=null,a="",l="";return o.push({value:["[[path]]",s],callBack:(c,h)=>{if(typeof h.pathname>"u")return;let u=h.getAttribute("href");if(u!==i){i=u;let g=h.pathname+h.search+h.hash;a=g,l=h.hash||h.search?g:h.pathname}let m=r?c===a:Ar(l,c);this.update(m)}}),o}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var Xt=(n,t,e=null)=>{if(!n)return;let r=null,s=!1,o=()=>{s||(s=!0,r&&(clearTimeout(r),r=null),p.off("animationend",n,i),n&&n.classList.remove(t),e&&e())},i=l=>{l.target===n&&o()};p.on("animationend",n,i),n.classList.add(t);let a=()=>{if(!s)try{let l=window.getComputedStyle(n),c=parseFloat(l.animationDuration)*1e3||1e3,h=parseFloat(l.animationDelay)*1e3||0;r=setTimeout(o,c+h+100)}catch{r=setTimeout(o,1e3)}};if(typeof requestAnimationFrame>"u"){r=setTimeout(o,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(a))},Zt=(n,t,e)=>{Xt(n,t)},te=(n,t,e)=>{let r=()=>{n&&n.remove&&n.remove()};Er(n,()=>Xt(n,t,r),e)};f.addType("manual-destroy",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Er=(n,t,e)=>{f.add(n,"manual-destroy",{ele:n,callBack:t,parent:e})};var K=(n,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(s=>{s&&K(n,t,s,r)});return}Ir(n,t,e,r)},Ir=(n,t,e,r)=>{let s,o;if(e.length<3?[s,o]=e:[t,s,o]=e,!t||!s)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',n,t);return}let i=_r(n,s,o,r);I.watch(n,t,s,i)},_r=(n,t,e,r)=>typeof e=="object"?s=>{Dr(n,e,s)}:s=>{Lr(n,e,t,s,r)},ee=new WeakSet,Or=(n,t,e)=>{!n||!n.isUnit&&!n.isComponent||ee.has(e)||ee.add(e)},Lr=(n,t,e,r,s)=>{let o=t(r,n,s);switch(typeof o){case"object":if(o===null)break;Or(o,e,n),d.rebuild(o,n,s);break;case"string":let i=Pt(n);if(i!=="textContent"){n.setAttribute(i,o);break}q.addHtml(n,o);break}},Dr=(n,t,e)=>{let r=Object.keys(t);for(let s=0,o=r.length;s<o;s++){let i=r[s];i&&(t[i]===e?n.classList.add(i):n.classList.remove(i))}};var H=(n,t,e)=>{let r=T(e);K(n,r,t,e)};var re=(n,t,e)=>{t&&n.setAttribute("role",t)},Br=n=>(t,e)=>{let r=t?"true":"false";e.setAttribute(n,r)},ne=(n,t,e)=>{if(!t)return;let r=t.role;r&&(n.setAttribute("role",r),t.role=null);let s=Object.keys(t);for(let o=0,i=s.length;o<i;o++){let a=s[o],l=t[a];if(l===null)continue;let c="aria-"+a;if(Array.isArray(l)){let h=l.slice();h.push(Br(c)),H(n,h,e)}else n.setAttribute(c,l)}};var se=(n,t,e)=>{if(!t)return;let r=w.parse(t,e);S.addAttributes(n,r.attr,e),d.setDirectives(n,r.directives,e)};f.addType("context",n=>{if(!n)return!1;n.parent.removeContextBranch(n.branch)});var wt=n=>n?n.getContext():null,oe=(n,t,e)=>{if(typeof t!="function")return;let r=wt(e),s=t(r);se(n,s,e)},ie=(n,t,e)=>{if(typeof t!="function")return;let r=wt(e);t(r)},ae=(n,t,e)=>{if(typeof t!="function"||!e)return;let r=wt(e),s=t(r);if(!s)return;let o=s[0];o&&(e.addContextBranch(o,s[1]),Mr(n,o,e))},Mr=(n,t,e)=>{f.add(n,"context",{branch:t,parent:e})};var le=(n,t,e)=>{};var ce=(n,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",n),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var he=(n,t,e)=>{},ue=(n,t,e)=>{if(!t||!e)return;let r=t(e,n);r&&d.build(r,n,e)},de=(n,t,e)=>{if(!t||!e)return;let r=e.getId(t);n.id=r},fe=(n,t,e)=>{if(!t||!e)return;let r=t(e.data,n);r&&d.build(r,n,e)},pe=(n,t,e)=>{if(!t||!e)return;let r=t(e.state,n);r&&d.build(r,n,e)},me=(n,t,e)=>{if(!t||!e)return;let r=e.state,s=t(r);if(!e.state){e.setStateHelper(s);return}e.addState(s)},ge=(n,t,e)=>{if(!t||!e)return;e.events||e.setEventHelper();let r=t[2];if(r){let s=r;r=o=>{s(o,e)}}e.events.on(t[0],t[1],r,t[3])};var ye=(n,t,e)=>{let r,s,o;if(typeof t=="string"){if(r=T(e),!r)return;s=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let i=T(e);if(!i)return;r=i,s=t[0],o=t[1]}else[r,s,o]=t;I.bind(n,r,s,o)};var at=(n,t,e)=>{K(n,e.state,t,e)};var Se=n=>(t,e)=>{let[r,s,o="active"]=n,i=t===s?o:"";e.dataset[r]=i},xe=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Se(s)),H(n,o,e)},ve=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Se(s)),at(n,o,e)};var ke=n=>{for(let t=0,e=n.length;t<e;t++){let r=n[t];r&&r.remove()}n.length=0};f.addType("forScopes",n=>{if(!n)return!1;ke(n.scopes)});var we=(n,t,e)=>{let r,s,o,i;if(typeof t[0]=="string"||t.length<3){let h=T(e);if(!h)return;r=h,[s,o,i]=t}else[r,s,o,i]=t;let a=i!==!1,l=s+"[",c=a?{scopes:[]}:null;c&&f.add(n,"forScopes",c),I.watch(n,r,s,h=>{if(d.removeAll(n),c&&ke(c.scopes),!h||h.length<1)return;let u=[];for(let m=0,g=h.length;m<g;m++){let E=a?r.scope(l+m+"]"):null;E&&c&&c.scopes.push(E);let N=o(h[m],m,E,u);N!==null&&u.push(N)}return d.build(u,n,e)})};var Ce=(n,t,e)=>{let r=t[0];if(!r||r.length<1)return;let s=t[1],o=[];for(let i=0,a=r.length;i<a;i++){let l=r[i];if(!l)continue;let c=s(l,i);c!==null&&o.push(c)}d.build(o,n,e)};var Te=(n,t,e)=>{t(n,e)};f.addType("destroyed",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Pe=(n,t,e)=>{Ur(n,t,e)},Ur=(n,t,e)=>{f.add(n,"destroyed",{ele:n,callBack:t,parent:e})};var Re=(n,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,s=t.length;r<s;r++)O.setup(n,t[r],e);else O.setup(n,t,e)};f.addType("routes",n=>{if(!n)return!1;let t=n.route;t&&C.removeRoute(t)});var Ae=(n,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&be(n,o,e)}else be(n,t,e)},be=(n,t,e)=>{t.container=n,t.parent=e;let r=C.add(t);Hr(n,r)},Hr=(n,t)=>{f.add(n,"routes",{route:t})};var Ee=(n,t,e)=>{};f.addType("switch",n=>{if(!n)return!1;let t=n.id;C.removeSwitch(t)});var Ie=(n,t,e)=>{let r=t[0];for(let o=0,i=t.length;o<i;o++){let a=t[o];a&&(a.container=n,a.parent=e)}let s=C.addSwitch(t);Nr(n,s)},Nr=(n,t)=>{f.add(n,"switch",{id:t})};F.add("cache",he).add("onCreated",Te).add("onDestroyed",Pe).add("bind",ye).add("data",le).add("state",Ee).add("onSet",H).add("onState",at).add("animateIn",Zt).add("animateOut",te).add("watch",Re).add("useParent",ue).add("useData",fe).add("useState",pe).add("getId",de).add("addState",me).add("addEvent",ge).add("map",Ce).add("for",we).add("useContext",ie).add("addContext",ae).add("context",oe).add("role",re).add("aria",ne).add("route",Ae).add("debug",ce).add("dataSet",xe).add("dataStateSet",ve).add("switch",Ie);export{F as a,z as b,x as c,_t as d,Ot as e,D as f,d as g,Nt as h,kt as i,vt as j,C as k};
2
+ //# sourceMappingURL=chunk-HH7TRCMU.js.map
@@ -1,2 +1,2 @@
1
- import{a,b as A,c,d as f,e as m,f as P,g as C,h as S}from"../chunks/chunk-KYW6QACR.js";import"../chunks/chunk-6YJAZHX6.js";import{g as s}from"../chunks/chunk-HBL2JSVL.js";import"../chunks/chunk-VSCHM2ZB.js";import"../chunks/chunk-LY736NR2.js";import"../chunks/chunk-7ZHUXJZT.js";var b=r=>{let t=typeof r;return t!=="string"&&t!=="number"?r:d(r)},d=r=>[{tag:"text",textContent:r}],l=()=>({props:{},children:[]}),h=r=>({props:{},children:d(r)}),u=r=>({props:{},children:r}),y=r=>({props:r[0]||{},children:b(r[1])});var D=r=>({props:{watch:r},children:[]}),O=r=>{if(r.length===0)return l();let t=r[0],e=typeof t;if(e==="string"||e==="number")return h(t);if(Array.isArray(t))return s.isWatching(t)?D(t):u(t);let o=r[1]??r[0]??[];if(o&&Array.isArray(o)&&s.isWatching(o)){let n=r[0]&&!Array.isArray(r[0])?r[0]:{};r[0]={...n,watch:o},r[1]=[]}return y(r)},H=r=>(...t)=>{let{props:e,children:o}=O(t);return r(e,o)};var T=(r,t)=>{let e=Object.keys(r);for(let o=0,n=e.length;o<n;o++){let p=e[o],x=r[p],i=f[p]||p;t.prototype[i]=m(x,i)}return t},W=0,j=r=>{let t=class extends r{};return t.prototype._classId="pod"+W++,t},I=(r,t=c)=>{if(!r)return null;let e=j(t),o={},n=r(o);return T(o,e),e.prototype.render=n,e};export{H as Atom,C as Builder,c as Component,a as Directives,S as Import,P as Jot,I as Pod,A as Unit};
1
+ import{a,b as A,c,d as f,e as m,f as P,g as C,h as S}from"../chunks/chunk-HH7TRCMU.js";import"../chunks/chunk-6YJAZHX6.js";import{g as s}from"../chunks/chunk-HBL2JSVL.js";import"../chunks/chunk-VSCHM2ZB.js";import"../chunks/chunk-LY736NR2.js";import"../chunks/chunk-7ZHUXJZT.js";var b=r=>{let t=typeof r;return t!=="string"&&t!=="number"?r:d(r)},d=r=>[{tag:"text",textContent:r}],l=()=>({props:{},children:[]}),h=r=>({props:{},children:d(r)}),u=r=>({props:{},children:r}),y=r=>({props:r[0]||{},children:b(r[1])});var D=r=>({props:{watch:r},children:[]}),O=r=>{if(r.length===0)return l();let t=r[0],e=typeof t;if(e==="string"||e==="number")return h(t);if(Array.isArray(t))return s.isWatching(t)?D(t):u(t);let o=r[1]??r[0]??[];if(o&&Array.isArray(o)&&s.isWatching(o)){let n=r[0]&&!Array.isArray(r[0])?r[0]:{};r[0]={...n,watch:o},r[1]=[]}return y(r)},H=r=>(...t)=>{let{props:e,children:o}=O(t);return r(e,o)};var T=(r,t)=>{let e=Object.keys(r);for(let o=0,n=e.length;o<n;o++){let p=e[o],x=r[p],i=f[p]||p;t.prototype[i]=m(x,i)}return t},W=0,j=r=>{let t=class extends r{};return t.prototype._classId="pod"+W++,t},I=(r,t=c)=>{if(!r)return null;let e=j(t),o={},n=r(o);return T(o,e),e.prototype.render=n,e};export{H as Atom,C as Builder,c as Component,a as Directives,S as Import,P as Jot,I as Pod,A as Unit};
2
2
  //# sourceMappingURL=component.js.map
@@ -1,2 +1,2 @@
1
- import{i as r,j as o,k as t}from"../chunks/chunk-KYW6QACR.js";import"../chunks/chunk-6YJAZHX6.js";import"../chunks/chunk-HBL2JSVL.js";import"../chunks/chunk-VSCHM2ZB.js";import"../chunks/chunk-LY736NR2.js";import"../chunks/chunk-7ZHUXJZT.js";export{r as NavLink,o as Router,t as router};
1
+ import{i as r,j as o,k as t}from"../chunks/chunk-HH7TRCMU.js";import"../chunks/chunk-6YJAZHX6.js";import"../chunks/chunk-HBL2JSVL.js";import"../chunks/chunk-VSCHM2ZB.js";import"../chunks/chunk-LY736NR2.js";import"../chunks/chunk-7ZHUXJZT.js";export{r as NavLink,o as Router,t as router};
2
2
  //# sourceMappingURL=router.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/base",
3
- "version": "3.9.20",
3
+ "version": "3.9.21",
4
4
  "description": "This is a javascript framework.",
5
5
  "main": "./dist/base.js",
6
6
  "module": "./dist/base.js",