@base-framework/base 3.9.24 → 3.9.25
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 +1 -1
- package/dist/chunks/chunk-6N533MOU.js +2 -0
- package/dist/chunks/chunk-DNPDLUU4.js +2 -0
- package/dist/chunks/chunk-HL52UJBX.js +2 -0
- package/dist/chunks/chunk-KB5AL3PM.js +2 -0
- package/dist/chunks/chunk-KMMYW6DR.js +2 -0
- package/dist/chunks/chunk-ZUB7I6Z4.js +2 -0
- package/dist/modules/ajax.js +1 -1
- package/dist/modules/component.js +1 -1
- package/dist/modules/data.js +1 -1
- package/dist/modules/html.js +1 -1
- package/dist/modules/router.js +1 -1
- package/dist/modules/state.js +1 -1
- package/dist/types/main/data-tracker/data-tracker.d.ts +9 -14
- package/dist/types/modules/data/types/basic-data.d.ts +30 -0
- package/dist/types/modules/data/types/deep-data/deep-data.d.ts +20 -0
- package/dist/types/modules/data-binder/data-pub-sub.d.ts +39 -1
- package/package.json +1 -1
package/dist/base.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var lt=class{static toArray(t){return Array.from(t)}static inArray(t,e,r){return Array.isArray(t)?t.indexOf(e,r):-1}};var ts=Object.prototype.toString,wt=Object.prototype.hasOwnProperty,S={create(s){return Object.create(s||null)},extendObject(s,t){if(!s||typeof s!="object"||!t||typeof t!="object")return!1;for(let e in s)wt.call(s,e)&&!wt.call(t,e)&&(t[e]=s[e]);return t},clone(s){if(!s||typeof s!="object")return{};try{return structuredClone(s)}catch{return JSON.parse(JSON.stringify(s))}},getClassObject(s){return typeof s=="function"?s.prototype:s},extendClass(s,t){let e=this.getClassObject(s),r=this.getClassObject(t);if(typeof e!="object"||typeof r!="object")return!1;let n=Object.create(e);for(let i in r)n[i]=r[i];return n},hasOwnProp(s,t){return wt.call(s,t)},isPlainObject(s){return!!s&&ts.call(s)==="[object Object]"},isEmpty(s){if(!s||typeof s!="object"||Array.isArray(s))return!0;if(s instanceof Map||s instanceof Set)return s.size===0;for(let t in s)if(wt.call(s,t))return!1;return!0}};var v=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 ut={types:{},add(s,t){this.types[s]=t},get(s){return this.types[s]||!1},remove(s){delete this.types[s]}};var Ct=class{constructor(){this.types=new Map}add(t,e){let r=this.types.get(t);r||(r=[],this.types.set(t,r)),r.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 r,n=ut.get(t);if(n){for(let i=0,o=e.length;i<o;i++)r=e[i],r&&(e[i]=null,typeof n=="function"&&n(r));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}let e=this.types.keys();for(let r of e)r&&this.removeType(r);this.types.clear()}};var j=new WeakMap,p=class{static trackers=new Map;static trackingCount=0;static addType(t,e){ut.add(t,e)}static removeType(t){ut.remove(t)}static getTrackingId(t){if(!t||typeof t!="object")return"";let e=j.get(t);return e||(e="dt"+this.trackingCount++,j.set(t,e)),e}static add(t,e,r){let n=this.getTrackingId(t);this.find(n).add(e,r)}static get(t,e){let r=j.get(t),n=this.trackers.get(r);return n?e?n.get(e):n:!1}static has(t,e){let r=this.getTrackingId(t);if(!r)return!1;let n=this.trackers.get(r);return n&&e?n.has(e):!1}static find(t){let e=this.trackers.get(t);return e||(e=new Ct,this.trackers.set(t,e)),e}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let r=j.get(t);if(!r)return;let n=this.trackers.get(r);if(n){if(!e){n.remove(),this.trackers.delete(r),j.delete(t);return}n.remove(e),this.isEmpty(n.types)&&(this.trackers.delete(r),j.delete(t))}}};var d={getEvents(s){return typeof s!="object"||s===null?[]:p.get(s,"events")},create(s,t,e,r=!1,n=!1,i=null){return{event:s,obj:t,fn:e,capture:r,swapped:n,originalFn:i}},on(s,t,e,r){if(Array.isArray(s))for(let n=0,i=s.length;n<i;n++)this.add(s[n],t,e,r);else this.add(s,t,e,r);return this},off(s,t,e,r){if(Array.isArray(s))for(let n=0,i=s.length;n<i;n++)this.remove(s[n],t,e,r);else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,n=!1,i=null){if(typeof t!="object"||t===null)return this;let o=this.create(s,t,e,r,n,i);return p.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let n=this.getEvent(s,t,e,r);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(s){return typeof s=="object"&&s.obj.removeEventListener(s.event,s.fn,s.capture),this},getEvent(s,t,e,r){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(s,t,e,r);return this.search(i,n)},search(s,t){let e,r=this.isSwappable(s.event);for(let n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==s.event||e.obj!==s.obj)&&(e.fn===s.fn||r===!0&&e.originalFn===s.fn))return e;return!1},removeEvents(s){return typeof s!="object"||s===null?this:(p.remove(s,"events"),this)},swap:new Set(["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"]),addSwapped(s){this.swap.add(s)},isSwappable(s){return this.swap.has(s)}};p.addType("events",s=>{d.removeEvent(s)});var Ie={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},Re=Object.keys(Ie),es={events:d,addListener(s,t,e,r){return this.events.add(s,t,e,r),this},on(s,t,e,r){let n=this.events;if(Array.isArray(s))for(let i=0,o=s.length;i<o;i++)n.add(s[i],t,e,r);else n.add(s,t,e,r);return this},off(s,t,e,r){let n=this.events;if(Array.isArray(s))for(let i=0,o=s.length;i<o;i++)n.remove(s[i],t,e,r);else n.remove(s,t,e,r);return this},removeListener(s,t,e,r){return this.events.remove(s,t,e,r),this},_createEvent(s,t,e,r){let n;switch(t){case"HTMLEvents":n=new Event(s,e);break;case"MouseEvents":n=new MouseEvent(s,e);break;default:n=new CustomEvent(s,r);break}return n},createEvent(s,t,e,r){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(s);return this._createEvent(s,i,n,r)},_getEventType(s){for(let t=0,e=Re.length;t<e;t++){let r=Re[t];if(Ie[r].test(s))return r}return"CustomEvent"},trigger(s,t,e){if(typeof t!="object"||t===null)return this;let r=typeof s=="string"?this.createEvent(s,t,null,e):s;return t.dispatchEvent(r),this},mouseWheelEventType:null,getWheelEventType(){let s=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=s())},onMouseWheel(s,t,e,r=!1){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof s=="function"&&s(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,r,!0,s),this},offMouseWheel(s,t,e=!1){typeof t>"u"&&(t=window);let r=this.getWheelEventType();return this.off(r,t,s,e),this},preventDefault(s){return typeof s.preventDefault=="function"?s.preventDefault():s.returnValue=!1,this},stopPropagation(s){return typeof s.stopPropagation=="function"?s.stopPropagation():s.cancelBubble=!0,this}};var ht=class{constructor(){this.errors=[],this.dataTracker=p}augment(t){if(!v.isObject(t))return this;let e=this.constructor.prototype;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,n){return(t[e]=r).apply(t,lt.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(v.isObject(t)===!1)return"";let n=t[e];return typeof n<"u"?n:typeof r<"u"?r:""}createCallBack(t,e,r=[],n=!1){return typeof e!="function"?!1:(...i)=>(n===!0&&(r=r.concat(i)),e.apply(t,r))}bind(t,e){return e.bind(t)}};ht.prototype.extend=(function(){return ht.prototype})();var B=new ht;var ft={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 _e=()=>{B.augment({xhrSettings:ft,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=S.extendClass(B.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=ft}})};var k=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,r=!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,r=>r[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let r=/([A-Z]{1,})/g;return t.replace(r,n=>e+n.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,r=>r.charAt(0).toUpperCase()+r.substring(1).toLowerCase())}};var At=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:r,url:n,async:i}=this.settings;e.open(r,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=ft.beforeSend;if(t.length<1)return;let e=this.xhr,r=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];o&&o(e,r)}}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")}setupParams(t,e=null){let r=typeof t;if(!e)return!(t instanceof FormData)&&r==="object"&&(t=this.objectToString(t)),t;let n=typeof e;if(r==="string")return n!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(n==="string"&&(e=k.parseQueryString(e,!1)),t instanceof FormData)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.append(i,e[i]);else r==="object"&&(t=Object.assign({},e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,r=t.params;return r?r=this.setupParams(r,e):e&&(r=this.setupParams(e)),r}getXhrSettings(t){let e=this.settings={...B.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var r=0,n=t.length;r<n;r++){var i=t[r];switch(r){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 r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.xhr?.setRequestHeader(r,e[r])}update(t,e){let r=this.xhr,n=()=>{d.removeEvents(r?.upload),d.removeEvents(r)},i=this.settings;if(!i)return!1;switch(e||t.type){case"load":{if((r?.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 r=this.update.bind(this);d.on(["load","error","abort"],e,r),d.on("progress",e.upload,r)}};_e();var dt=(...s)=>new At(s).xhr;var rs=(s,t)=>{if(s===t)return!1;try{return JSON.stringify(s)!==JSON.stringify(t)}catch{return!0}},oe=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,r,n=null){let i=this.getEntry(t)||this.createEntry(t);i.value=e,i.meta=n,i.time=Date.now(),i.ttl=typeof r=="number"?r: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 r=0;for(let[n,i]of Array.from(this.entries))e(n,i)&&(this.entries.delete(n),r++);return r}clear(){this.entries.clear()}fetch(t,e,r,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 r(c)}catch(l){return c(!1,void 0,l),null}}resolve(t,e,r,n){r=r||{};let i=typeof r.ttl=="number"?r.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(r.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&&rs(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,r={}){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,r,(c,l,u)=>{if(o)return o=!1,u?n(c):i(l);typeof r.onUpdate=="function"&&r.onUpdate(c)})})}},Tt=new oe;var ss=s=>{let t=typeof s;return t!=="string"&&t!=="number"?s:Oe(s)},Oe=s=>[{tag:"text",textContent:s}],Le=()=>({props:{},children:[]}),Ne=s=>({props:{},children:Oe(s)}),Be=s=>({props:{},children:s}),He=s=>({props:s[0]||{},children:ss(s[1])});var w=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 r=this.cache,n=r.get(t);if(n!==void 0){n.value=e,n.used=!0;return}r.set(t,{value:e,used:!1}),r.size>this.maxSize&&this.evict()}evict(){let t=this.cache,e=this.maxSize-this.evictCount+1;for(let r=0;r<2&&t.size>e;r++){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 Pt=class{constructor(){this.connections=new Map}add(t,e,r){let n=this.getOrCreate(t),i=n.get(e);return i?Array.isArray(i)?i.push(r):n.set(e,[i,r]):n.set(e,r),r}get(t,e){let r=this.connections.get(t)?.get(e);return r?Array.isArray(r)?r[r.length-1]||!1:r:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let r=this.connections.get(t);if(r)if(e)this.unsubscribe(r.get(e)),r.delete(e),r.size===0&&this.connections.delete(t);else{for(let n of r.values())this.unsubscribe(n);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,r=t.length;e<r;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var J=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var Et=class extends J{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 r=t.length,n=new Array(r);for(let i=0;i<r;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,r=t.length;e<r;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 X=class{unsubscribe(){}};var pt=class extends X{constructor(){super(),this.source=null}addSource(t){return this.source=new Et(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var Z=class extends J{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 Mt=class extends Z{constructor(t,e,r){super(r),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 tt=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 r=document.querySelectorAll(t);return r?r.length===1?r[0]:Array.from(r):!1}static html(t,e){return!t||typeof t!="object"?!1:typeof e<"u"?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return!t||typeof t!="object"||typeof e>"u"?this:(e=k.uncamelCase(e),t.style[e]=r,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=k.uncamelCase(e);let r=t.style[e];if(r!=="")return r;let n=null,i=t.currentStyle;if(i&&(n=i[e]))return n;let o=window.getComputedStyle(t,null);return o?o[e]:r}static css(t,e,r){return typeof r<"u"?(this.setCss(t,e,r),this):this.getCss(t,e)}static removeAttr(t,e){return typeof t=="object"&&t!==null&&t.removeAttribute(e),this}static setAttr(t,e,r){t.setAttribute(e,r)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,r){return!t||typeof t!="object"?!1:typeof r<"u"?(this.setAttr(t,e,r),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=k.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,r){e=this.removeDataPrefix(e),e=k.camelCase(e),t.dataset[e]=r}static getData(t,e){return e=k.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,r){return!t||typeof t!="object"?!1:typeof r<"u"?(this.setData(t,e,r),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"),r=typeof e=="string"?e:"";return this.css(t,"display",r),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,r=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,r=t.scrollTop;break;case"object":e=t.scrollLeft,r=t.scrollTop;break}return!t||typeof t!="object"?!1:{left:e-(t.clientLeft||0),top:r-(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,r=e.documentElement,n=e.getElementsByTagName("body")[0],i=t.innerWidth||r.clientWidth||n.clientWidth,o=t.innerHeight||r.clientHeight||n.clientHeight;return{width:i,height:o}}static getDocumentSize(){let t=document,e=t.body,r=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,r.clientWidth,r.scrollWidth,r.offsetWidth),height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let r={x:0,y:0};if(!t||typeof t!="object")return r;let n=0;for(;t&&(e===0||n<e);)n++,r.x+=t.offsetLeft+t.clientLeft,r.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return r}static addClass(t,e){if(!t||typeof t!="object"||e==="")return this;if(typeof e=="string"){let r=e.split(" ");for(let n=0,i=r.length;n<i;n++)t.classList.add(r[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 Dt=s=>{let t="textContent";if(!s||typeof s!="object")return t;let e=s.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let r=s.type;if(!r)return t="value",t;switch(r){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var ns=(s,t,e)=>{tt.setAttr(s,t,e)},is=(s,t,e)=>{s.checked=s.value==e},os=(s,t,e)=>{e=e==1,Ue(s,t,e)},Ue=(s,t,e)=>{s[t]=e},as=(s,t)=>tt.getAttr(s,t),cs=(s,t)=>s[t],Rt=class extends Z{constructor(t,e,r,n){super(n),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof r=="string"?this.setupFilter(r):r}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=ns,this.getValue=as,this;this.getValue=cs;let r=t.type;if(r)switch(r){case"checkbox":return this.setValue=os,this;case"radio":return this.setValue=is,this}return this.setValue=Ue,this}getAttrBind(t){return t||Dt(this.element)}setupFilter(t){let e=/\[\[[^\]]+\]\]/;return r=>t.replace(e,()=>r)}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 It=class extends X{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new Rt(t,e,r,this.pubSub)}addData(t,e){return this.data=new Mt(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 ls=0,et=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 r=++ls,n=this.callBacks.get(t);return n||(n=new Map,this.callBacks.set(t,n),this.prefixIndex&&this._indexMessage(t)),n.set(r,e),r}_indexMessage(t){let e=t.indexOf(":");if(e===-1)return;let r=t.substring(0,e+1),n=this.prefixIndex.get(r);n||(n=new Set,this.prefixIndex.set(r,n)),n.add(t)}_unindexMessage(t){let e=t.indexOf(":");if(e===-1)return;let r=t.substring(0,e+1),n=this.prefixIndex.get(r);n&&(n.delete(t),n.size===0&&this.prefixIndex.delete(r))}getPrefixMessages(t){return this.prefixIndex&&this.prefixIndex.get(t)||null}getMessages(){return this.callBacks.keys()}off(t,e){let r=this.callBacks.get(t);r&&(r.delete(e),r.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,r){if(!this.batchingEnabled){this.publishImmediate(t,e,r);return}this.suppressQueue||(t===this.deliveringMessage&&(this.reentrantMessages??=new Set).add(t),this.callBacks.has(t)&&(this.updateQueue.set(t,[e,r]),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,r]of t)this.publishImmediate(e,r[0],r[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[r,n]of t)e&&e.has(r)||this.publishImmediate(r,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 r=0;r<e;r++)t[r]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let r=0;r<e;r++)t[r]()}}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 r=e.length;for(let n=0;n<r;n++)e[n]()}})}flushSync(){this.flush()}publishImmediate(t,e,r){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,r)}catch(a){console.error('[DataPubSub] Subscriber error for "'+t+'":',a)}this.deliveringMessage=i}};var ae=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new Pt,this.pubSub=new et(!0),this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null,a=r.indexOf(":");a!==-1&&(o=r.substring(0,a),i=r.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,r,n,i){let o=this.getBindId(t),a=new It(this.pubSub);a.addData(e,r).subscribe(o);let u=`${e.getDataId()}:${r}`;return a.addElement(t,n,i).subscribe(u),this.addConnection(o,"bind",a),a}addConnection(t,e,r){return this.connections.add(t,e,r),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,r,n){if(v.isObject(t)===!1)return this;let i=new pt,o=e.get(r),a=!0,c=f=>{a&&(a=!1,f===o&&(f===null||typeof f!="object"))||n(f)};i.addSource(e).subscribe(r,c);let u=this.getBindId(t),h=e.getDataId()+":"+r;return this.addConnection(u,h,i),n(o),this}watchMany(t,e,r,n){if(v.isObject(t)===!1)return this;let i=r?r.length:0;if(i===0)return this;if(i===1)return this.watch(t,e,r[0],n);let o=new pt,a=o.addSource(e),c=new Array(i),l=new Array(i);for(let m=0;m<i;m++)c[m]=e.get(r[m]),l[m]=!0;let u=new Array(i);for(let m=0;m<i;m++){let x=m,_=c[m];u[m]=Y=>{l[x]&&(l[x]=!1,Y===_&&(Y===null||typeof Y!="object"))||n(Y)}}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:r[m],token:e.on(r[m],u[m])};a.subscriptions=h;let f=this.getBindId(t),g=e.getDataId()+":"+r.join(",");return this.addConnection(f,g,o),n(c[0]),this}unwatch(t,e,r){if(v.isObject(t)===!1)return this;let n=t[this.attr];if(n){let i=e.getDataId()+":"+r;this.connections.remove(n,i)}return this}publish(t,e,r){return this.pubSub.publish(t,e,r),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,r=this.isDataBound(e);if(r!==null){let n=this.connections.get(r,"bind");if(n){let i=n.element.get();this.pubSub.publish(r,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 ae;var us=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"]]),z=s=>us.get(s)||s,ce=s=>typeof s=="string"&&s.charCodeAt(0)===111&&s.charCodeAt(1)===110?s.substring(2):s,hs=/(?:<[a-z][\s\S]*>)/i,M=class{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(r,i):this.append(r,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return;let r=e.type;r!==void 0&&t.setAttribute("type",r);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:(hs.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,r){if(r===""||!e)return;if(typeof r==="function")e=ce(e),r.originalCallback?d.add(e,t,r,!1,!0,r.originalCallback):d.add(e,t,r);else{let i=z(e);t[i]=r}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let r=document.createTextNode(t);return e&&this.append(e,r),r}static createComment(t,e){let r=document.createComment(t);return e&&this.append(e,r),r}static setupSelectOptions(t,e,r){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),r!==null&&i.value==r&&(i.selected=!0)})}static removeElementData(t){let e=[t];for(;e.length>0;){let r=e.pop(),n=r.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(r),r.bindId&&b.unbind(r)}}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,r){let n=r||t.firstChild;return t.insertBefore(e,n),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var D=s=>s?s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null:null;var C=class extends M{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e,n),r.appendChild(i),i}static addAttributes(t,e,r){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,r)}}static addAttr(t,e,r,n){if(r===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){if(e=ce(e),r.originalCallback)d.add(e,t,r,!1,!0,r.originalCallback);else{let a=r,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,r);return}let o=z(e);t[o]=r}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 Fe=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,We=new w(1e3),fs=new Set(["disabled","checked","required","selected","hidden","readonly","readOnly","multiple","open","autofocus","inert"]),ds=s=>typeof s=="string"?s!==""&&s!=="false":!!s,ps=(s,t)=>{if(t.charCodeAt(4)===45){s.removeAttribute(t);return}let e=z(t);if(e in s){s[e]="";return}s.removeAttribute(t)},T={isWatching(s){if(Array.isArray(s)){let t=s[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(s)},hasParams(s){return typeof s=="string"&&s.includes("[[")},_getWatcherProps(s){let t=We.get(s);if(t!==void 0)return t;let e=s.match(Fe),r=e?e.map(n=>n.slice(2,-2)):null;return We.set(s,r),r},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.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":s[t==="readonly"?"readOnly":t]=ds(e);break;case"src":if(s.tagName==="IMG"){s.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}s.src=e;break;default:if(e===""&&t){ps(s,t);break}C.addAttr(s,t,e);break}},replaceParams(s,t,e=!1){let r=0;return s.replace(Fe,function(n,i,o){let a=e?t[r]:t;r++;let c=a.get(o);return c??""})},_getWatcherCallBack(s,t,e,r,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 fs.has(r)?()=>{this.updateAttr(s,r,a.get(o))}:()=>{let c=a.get(o);this.updateAttr(s,r,c!=null?String(c):"")}}return()=>{let o=this.replaceParams(e,t,n);this.updateAttr(s,r,o)}},getValue(s,t){let e=s.value;return Array.isArray(e)===!1?[e,D(t)]:e.length<2?[e[0],D(t)]:e},getPropValues(s,t,e){let r=[];for(let n=0,i=t.length;n<i;n++){let a=(e?s[n]:s).get(t[n])??"";r.push(a)}return r},getCallBack(s,t,e,r,n,i){let o=s.attr||"textContent",a=s.callBack;if(typeof a=="function"){let c=i||this._getWatcherProps(r)||[],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,r,o,n)},addDataWatcher(s,t,e){let r=this.getValue(t,e),n=r[1]??e?.data??e?.context?.data??e?.state??null;if(!n)return;let i=r[0],o=Array.isArray(n),a=this._getWatcherProps(i);if(!a)return;let c=this.getCallBack(t,s,n,i,o,a);if(!o)a.length>1?b.watchMany(s,n,a,c):this.addWatcher(s,n,a[0],c);else for(let l=0,u=a.length;l<u;l++)this.addWatcher(s,n[l],a[l],c)},getWatcherSettings(s,t=null){if(typeof s=="string")return{attr:t,value:s};if(Array.isArray(s)){let e=s[s.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let r=s[1]&&typeof s[1]=="object"?[s[0],s[1]]:[s[0]];return typeof e=="function"?{attr:t,value:r,callBack:e}:{attr:e||"textContent",value:r}}return s},setup(s,t,e){t&&this.addDataWatcher(s,this.getWatcherSettings(t),e)},addWatcher(s,t,e,r){b.watch(s,t,e,r)}};var ms=s=>({props:{watch:s},children:[]}),gs=s=>{if(s.length===0)return Le();let t=s[0],e=typeof t;if(e==="string"||e==="number")return Ne(t);if(Array.isArray(t))return T.isWatching(t)?ms(t):Be(t);let r=s[1]??s[0]??[];if(r&&Array.isArray(r)&&T.isWatching(r)){let n=s[0]&&!Array.isArray(s[0])?s[0]:{};s[0]={...n,watch:r},s[1]=[]}return He(s)},ys=s=>(...t)=>{let{props:e,children:r}=gs(t);return s(e,r)};var le=new WeakMap,ue=new WeakMap;function Ge(s){if(!s||typeof s!="object")return s;let t=ue.get(s);return t!==void 0?t:s}var qe=new WeakMap;function bs(s,t,e,r){let n=le.get(s);n||(n=new Map,le.set(s,n));let i=n.get(e);if(i)return i;let o=new Proxy(s,Ke(t,e,r));return n.set(e,o),ue.set(o,s),o}function xs(s){s&&typeof s=="object"&&le.delete(s)}function ze(s,t){let e=t.charCodeAt(0),r=e>=48&&e<=57;return s===""?r?"["+t+"]":t:r?s+"["+t+"]":s+"."+t}function Ke(s,t="",e=""){return{get(r,n,i){let o=r[n];if(t===""&&n in r){if(typeof o=="function"){let c=qe.get(r);c||(c=new Map,qe.set(r,c));let l=c.get(n);if(l)return l;let u=o.bind(r);return c.set(n,u),u}return o}if(o=(r[e]||r)[n],o!==null&&typeof o=="object"){let c=ze(t,n);return bs(o,s,c,e)}return o},set(r,n,i,o){if(t===""&&n in r)return r[n]=i,!0;let c=(r[e]||r)[n],l=ze(t,n);return s.set(l,i),c!==i&&c!==null&&typeof c=="object"&&xs(c),!0}}}var _t=(s,t="stage")=>{let e=new Proxy(s,Ke(s,"",t));return ue.set(e,s),e};var mt=class{static resume(t,e){if(!t)return null;let r=localStorage.getItem(t);if(r===null)return e!==void 0?e:void 0;try{let n=JSON.parse(r);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 r=JSON.stringify(e);return localStorage.setItem(t,r),!0}catch(r){return console.error('[LocalData] Failed to store data for key "'+t+'".',r),!1}}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Ot=(s={})=>{let t={};if(!v.isObject(s))return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i];typeof o!="function"&&(t[i]=o)}return t};var Ss=0,Ve=new w(2e3),H={CHANGE:"change",DELETE:"delete"},he=(s,t)=>{let e=Ve.get(s);return e||(e={change:`${s}:change`,delete:`${s}:delete`},Ve.set(s,e)),t==="change"?e.change:e.delete},O=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 et;let e=Ot(t);this.set(e);let r=_t(this);return this._proxy=r,r}retainState(){return this._retainState=!0,this._proxy||this}refreshState(){return this._refreshState=!0,this._proxy||this}setup(){this.stage={}}_init(){let t=++Ss;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 r=he(t,H.CHANGE);return this.eventSub.on(r,e)}off(t,e){let r=he(t,H.CHANGE);this.eventSub.off(r,e)}_setAttr(t,e,r=this,n=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,r,H.CHANGE))}publishLocalEvent(t,e,r,n){let i=he(t,n);this.eventSub.publish(i,e,r)}_publish(t,e,r,n){this.publishLocalEvent(t,e,r,n),r=r||this,b.publish(this._dataId+t,e,r)}set(t,e,r){if(typeof t!="object")return this._setAttr(t,e,r),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,r)}return this}_silentSet(t){let e=this.stage,r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];e[o]=t[o]}}getModelData(){return this.stage}_deleteAttr(t,e,r=this){delete t[e],this.publishLocalEvent(e,null,r,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 r=this.get(t);return this.set(t,r+e),this}decrement(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let r=this.get(t);return this.set(t,r-e),this}concat(t,e){if(typeof t>"u")return this;let r=this.get(t);return this.set(t,r+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=mt.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return mt.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,r){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,r);let n=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,r){let n=r||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,r,n){this.links.set(t,{data:e,attr:r,pair:n})}unlink(t){if(t){this.removeLink(t);return}let e=this.links;e.size!==0&&(e.forEach((r,n)=>{this.removeLink(n,!1)}),e.clear())}removeLink(t,e=!0){let r=this.links.get(t);if(r){let n=r.data;r.attr&&n.off(r.attr,t);let i=r.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)}};O.prototype.isData=!0;var Qe=new Set(["__proto__","prototype","constructor"]),vs=s=>{let t=[],e=s.length,r=0;for(let n=0;n<e;n++){let i=s.charCodeAt(n);i!==46&&i!==91&&i!==93||(n>r&&t.push(s.substring(r,n)),r=n+1)}return e>r&&t.push(s.substring(r)),t.length>0?t:null},P={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new w(1e3),hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},isSafeAttr(s){return!Qe.has(s)},getSegments(s){let t=this.segmentCache.get(s);if(t!==void 0)return t;if(t=vs(s),t){for(let e=0,r=t.length;e<r;e++)if(Qe.has(t[e])){console.warn("[Data] Blocked unsafe path segment in: "+s),t=null;break}}return this.segmentCache.set(s,t),t}};var G=class{static set(t,e,r){if(!P.hasDeepData(e)){if(!P.isSafeAttr(e))return;t[e]=r;return}let n,i=P.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]=r;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(!P.hasDeepData(e)){if(!P.isSafeAttr(e))return;delete t[e];return}let r=P.getSegments(e);if(!r)return;let n=r.length,i=n-1;for(let o=0;o<n;o++){let a=r[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(!P.hasDeepData(e))return t[e]??void 0;let r=P.getSegments(e);if(!r)return;let n=r.length,i=n-1;for(let o=0;o<n;o++){let a=r[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===i)return t}}};var $e=new Set,Lt=class{static MAX_DEPTH=50;static publishDeep(t,e,r,n){if(!P.hasDeepData(e)){this.publish(e,r,n);return}let i,o=P.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=r;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,r,n=null,i=0){if(t=t||"",r(t,e),!(!e||typeof e!="object"||(e=Ge(e),n===null&&($e.clear(),n=$e),!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,r,n,i):this.publishObject(t,e,r,n,i)}}static publishArray(t,e,r,n,i){let o=e.length;for(let a=0;a<o;a++){let c=e[a],l=t+"["+a+"]";this._checkPublish(l,c,r,n,i)}}static publishObject(t,e,r,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,r,n,i)}}static _checkPublish(t,e,r,n,i){if(!e||typeof e!="object"){r(t,e);return}this.publish(t,e,r,n,i+1)}};var U=class extends O{setup(){this.attributes={},this.stage={}}_setAttr(t,e,r,n){typeof e!="object"&&e===this.get(t)||(!r&&n!==!0?G.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),G.set(this.stage,t,e),r=r||this,this._publish(t,e,r,H.CHANGE))}_silentSet(t){let e=this.stage,r=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,r[a]=c}}linkAttr(t,e){let r=t.get(e);if(!r)return;let n=Object.keys(r);for(let i=0,o=n.length;i<o;i++){let a=n[i];this.link(t,e+"."+a,a)}}scope(t,e){let r=this.get(t);if(!r)return!1;e=e||this.constructor;let n=new e(r);return n.linkAttr(this,t),n}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.push(e),this.set(t,r),this}concat(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r=r.concat(e),this.set(t,r),this}unshift(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.unshift(e),this.set(t,r),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.shift();return this.set(t,e),r}getIndex(t,e,r){let n=this.get(t);return Array.isArray(n)===!1?-1:typeof n[0]!="object"?n.indexOf(e):n.findIndex(o=>o[e]===r)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.pop();return this.set(t,e),r}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,r,n){if(this._publishAttr(t,e,r,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),r,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),r)}}}_publishAttr(t,e,r,n){let i=this._dataId+t;b.publish(i,e,r),this.publishLocalEvent(t,e,r,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,r=this){G.delete(t,e),this._delCommitter=r;let n=this._deleteCb||(this._deleteCb=i=>this._publishAttr(i,null,this._delCommitter,H.DELETE));Lt.publish(e,null,n)}_getAttr(t,e){return G.get(t,e)}};var ks={"\n":"\\n","\r":"\\n"," ":"\\t"},ws=(s,t)=>{typeof s!="string"&&(s=String(s));let e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>ks[r])},Ye=(s,t)=>{if(typeof s!="string")return s;s=ws(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},fe=(s,t)=>{let e=typeof s;if(e==="undefined")return s;if(e!=="object")return s=Ye(s),s;let r=Array.isArray(s)?[...s]:{...s};return Object.keys(r).forEach(n=>{let i=r[n];i!==null&&(r[n]=typeof i=="string"?fe(i,t):Ye(i,t))}),r};function je(s){if(typeof s>"u"||s.length<1)return!1;try{return JSON.parse(s)}catch(t){return console.warn("[Encode] Failed to parse JSON.",t),!1}}function de(s){return typeof s<"u"?JSON.stringify(s):null}var gt=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?S.clone(t):t,n=fe(r,e);return de(n)}static json={encode:de,decode:je};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var Nt=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 r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r+"="+t[r]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=k.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=k.parseQueryString(e,!1)),this._isFormData(t))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.append(r,e[r]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let r=this.model.get("id"),n="id="+r,i=r?`/${r}`:"",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+"="+gt.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._put(i,r,t,e)}add(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._post(i,r,t,e)}update(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._patch(i,r,t,e)}delete(t,e){let r=this.model.get("id"),n=typeof r<"u"?"id="+r:this.setupObjectData(),i=r!=null?`/${r}`:"";return this._delete(i,n,t,e)}getAllParams(t,e,r,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 r<"u"&&r!==null?encodeURIComponent(r):"")+"&since="+(typeof n<"u"&&n!==null?encodeURIComponent(n):"")}all(t,e,r,n,i=null,o=null){let a=this.getAllParams(r,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 r=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(r)}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,r,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:r,completed:a},l=this._isFormData(r);if(l&&(c.headers={}),!o)return dt(c);o.invalidate&&(c.completed=(h,f)=>{h!==!1&&h!=null&&Tt.invalidate(o.invalidate),a(h,f)});let u=o.cache;return!u||!this.isCacheableMethod(e)||l?dt(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 r=e.key||this.getCacheKey(t),n=t.completed,i=o=>dt({...t,completed:(a,c)=>o(a!=null,a,c),failed:(a,c)=>o(!1,!1,c),aborted:(a,c)=>o(!1,!1,c)});return Tt.resolve(r,i,{ttl:e.ttl,swr:e.swr},(o,a)=>n(o,a))}setupEventSource(t,e,r,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);r&&r(_)}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,r,n,i){return this._request("","POST",t,e,r,n,i)}_get(t,e,r,n,i,o){return e=this.setupParams(e),e=this.addParams(e,r),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",n,i,o)}_post(t,e,r,n,i,o){return this._request(t,"POST",e,r,n,i,o)}_put(t,e,r,n,i,o){return this._request(t,"PUT",e,r,n,i,o)}_patch(t,e,r,n,i,o){return this._request(t,"PATCH",e,r,n,i,o)}_delete(t,e,r,n,i,o){return this._request(t,"DELETE",e,r,n,i,o)}_request(t,e,r,n,i,o,a){return r=this.setupParams(r),r=this.addParams(r,n),this.setupRequest(t,e,r,i,o,a)}getResponse(t,e,r){typeof e=="function"&&e(t,r)}static extend(t){if(!t)return{};let e=this;class r extends e{constructor(i){super(i)}}return Object.assign(r.prototype,t),r}};var Cs=s=>{let t={};if(!v.isObject(s)||!s.defaults)return t;let{defaults:e}=s;return Object.keys(e).forEach(r=>{let n=e[r];typeof n!="function"&&(t[r]=n)}),delete s.defaults,t},As=s=>{if(!s||typeof s.xhr!="object")return{};let t={...s.xhr};return delete s.xhr,t},Ts=0,yt=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,r=As(t),n=e.prototype.service.extend(r),i=Cs(t);class o extends e{constructor(c){let l={...i,...Ot(c)};super(l),this.xhr=new n(this)}dataTypeId=`bm${Ts++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};yt.prototype.service=Nt;var rt=class extends O{};var bt=class extends rt{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 r=this.stage;return typeof r[t]<"u"&&delete r[t],this}};var Bt=class extends bt{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var R=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 Bt(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 r=this.targets.get(t);r&&(r.remove(),this.targets.delete(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,r){let n=this.getTarget(t);return e&&n.addAction(e,r),n}static addAction(t,e,r){return this.add(t,e,r)}static removeAction(t,e,r){if(r){this.off(t,e,r);return}let n=this.getTarget(t);n&&e&&n.removeAction(e)}static on(t,e,r){let n=this.getTarget(t);return e?n.on(e,r):null}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let n=this.targets,i=n.get(t);if(i){if(e){i.off(e,r);return}this.targets.delete(t),this.ownerCounts.delete(t)}}static set(t,e,r){this.getTarget(t).set(e,r)}};var st=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 n=r.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 r=t.setData();if(!r){t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let n=e._retainState||r._retainState,i=!n&&(e._refreshState||r._refreshState),o=this._buildExternalUpdates(e.stage,r.stage,n,i);S.isEmpty(o)||r._silentSet(o)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,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];!r&&a==null||a!==e[o]&&(i[o]=a)}return i}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 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,r){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(r){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 Ht=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let n=t[r];this.on(n[0],n[1],n[2],n[3])}}on(t,e,r,n){d.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){d.off(t,e,r,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===r&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];d.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];d.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var Ut=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,n){return{action:t,state:e,callBack:r,targetId:n,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 n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){for(let r=0,n=t.length;r<n;r++){let i=t[r];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 r=0,n=e.length;r<n;r++){let i=e[r];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,n=e.length;r<n;r++){let i=e[r];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&R.remove(i.targetId,i.action,i.token)}}restore(t){R.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 r=this.remoteStates;if(r)for(let n=0,i=r.length;n<i;n++){let o=r[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,r){let n=R.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=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,r.push(o))}}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=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)),r||null}};var E=[],Ft=0,pe=!1,Ps=typeof queueMicrotask=="function"?queueMicrotask:s=>Promise.resolve().then(s),Es=s=>{let t=s.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||s.container||null},Ms=s=>{s._mountPending=!1;try{s.afterMount()}catch(t){console.error("Error in afterMount:",t)}},Je=()=>{pe=!1;let s=E;if(s.length===0)return;E=[];let t=[];for(let e=0,r=s.length;e<r;e++){let n=s[e];if(n.rendered!==!0||n._mountPending!==!0){n._mountPending=!1;continue}let i=Es(n);if(i&&i.isConnected===!0){Ms(n);continue}t.push(n)}t.length&&(E=E.length?t.concat(E):t),E.length&&Ft===0&&E.length!==t.length&&me()},me=()=>{pe||(pe=!0,Ps(Je))},I={add(s){s._mountPending!==!0&&(s._mountPending=!0,E.push(s))},enter(){Ft++},leave(){--Ft>0||(Ft=0,E.length&&me())},schedule(){E.length&&me()},flush(){Je()},get size(){return E.length}};p.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken,t),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Ds=0,xt=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 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-"+Ds++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,n;r!=null&&e!=null?n="pk:"+r+":"+e:r!=null?n="pk:"+r: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 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(){p.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout(),typeof this.afterMount=="function"&&I.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 n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return M.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&&M.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 A=class extends xt{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){st.resume(this,t)}_refreshData(){st.refresh(this)}_refreshContextData(){st.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=R.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 Ut(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)),R.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 Ht)}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 Wt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},qt=(s,t)=>typeof s!="function"&&t==="setupStates"?()=>s:s;var ge=(s,t)=>{if(!s)return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=Wt[i]||i;t[a]=qt(o,a)}return t},Rs=s=>ge(s,{}),Is=0,Xe=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Is++,e},K=(s,t=A)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=Rs(s),Xe(t,e)):(e={render:r==="function"?s:()=>s},Xe(t,e))};var _s=(s,t)=>{let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=Wt[i]||i;t.prototype[a]=qt(o,a)}return t},Os=0,Ls=s=>{let t=class extends s{};return t.prototype._classId="pod"+Os++,t},Ns=(s,t=A)=>{if(!s)return null;let e=Ls(t),r={},n=s(r);return _s(r,e),e.prototype.render=n,e};var Ze=new Map,V=()=>typeof Intl<"u"&&typeof Intl.DateTimeFormat=="function",Q=(s,t,e)=>{let r=Ze.get(s);return r||(r=new Intl.DateTimeFormat(t,e),Ze.set(s,r)),r},St=s=>s instanceof Date&&!Number.isNaN(s.getTime()),Bs=/(?:Z|[+-]\d{2}:?\d{2})$/i,Hs=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3})\d*)?)?)?$/,Us=s=>{if(typeof s=="string"){let e=Hs.exec(s.trim());if(e){let r=e[7]?Number((e[7]+"00").substring(0,3)):0;return[Number(e[1]),Number(e[2]),Number(e[3]),Number(e[4]||0),Number(e[5]||0),Number(e[6]||0),r]}}let t=new Date(s);return St(t)?[t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]:null},tr=(s,t)=>{let e=Q("zone|"+t,"en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),r={year:0,month:1,day:1,hour:0,minute:0,second:0},n=e.formatToParts(s);for(let c=0,l=n.length;c<l;c++){let u=n[c];u.type in r&&(r[u.type]=Number(u.value))}let i=r.hour===24?0:r.hour,o=Date.UTC(r.year,r.month-1,r.day,i,r.minute,r.second),a=s-(s%1e3+1e3)%1e3;return o-a},Fs=[31,28,31,30,31,30,31,31,30,31,30,31],Ws={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(s=new Date().getDay(),t=!1){if(V()){let n=new Date(2004,0,4+s),i=t?"short":"long";return Q("weekday|"+i,void 0,{weekday:i}).format(n)}let e=this.dayNames;if(s<0||s>=e.length)return null;let r=e[s];return t?r.substring(0,3):r},convertJsMonth(s){return this.padNumber(s+1)},convertDate(s,t=!1){if(!s)return"";let e=this.createDate(s);if(!St(e))return"";if(V()){let n={weekday:"long",month:"short",day:"2-digit"};return t&&(n.year="numeric"),Q("convert|"+(t?1:0),void 0,n).format(e)}let r=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+r},padNumber(s){return s<=9?"0"+s:String(s)},createDate(s){return s?(typeof s=="string"&&s.indexOf("-")>-1&&(s=s.replace(/\s/,"T"),s=s.indexOf(":")>-1?s:s+"T00:00:00"),new Date(s)):new Date},format(s,t){let e=this.createDate(t);return St(e)?s!=="sql"&&V()?Q("date",void 0,{year:"numeric",month:"2-digit",day:"2-digit"}).format(e):this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),s):""},formatTime(s,t){let e=this.createDate(s);if(!St(e))return"";if(t!==24&&V())return Q("time",void 0,{hour:"numeric",minute:"2-digit",hour12:!0}).format(e);let r=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),r)},getMeridian(s){return s=Number(s),s>=12?"PM":"AM"},convert24To12(s){return s=Number(s),s%12||12},convert12To24(s,t){return s=Number(s)%12,String(t||"").toLowerCase()==="pm"&&(s=s+12),s},renderDate(s,t,e,r="sql"){return t=Number(t),e=Number(e),r==="sql"?`${s}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${s}`},renderTime(s,t,e=0,r="sql"){if(r==="sql")return`${this.padNumber(s)}:${this.padNumber(t)}:${this.padNumber(e)}`;let n=this.getMeridian(s);return s=this.convert24To12(s),`${s}:${this.padNumber(t)} ${n}`},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=!1){if(V()){let n=new Date(2e3,s,1),i=t?"short":"long";return Q("month|"+i,void 0,{month:i}).format(n)}let e=this.monthNames;if(s<0||s>=e.length)return"";let r=e[s];return r?t?r.substring(0,3):r:""},getMonthLength(s,t){let e=new Date;return s=typeof s<"u"?s:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[s]},getMonthsLength(s=new Date().getFullYear()){let t=Fs.slice();return this.leapYear(s)===!0&&(t[1]=29),t},getLocalDate(s,t="America/Denver"){if(typeof s=="string"&&s.indexOf("-")>-1&&Bs.test(s.trim()))return new Date(s.trim());let e=Us(s);if(!e)return new Date(NaN);let[r,n,i,o,a,c,l]=e;if(!V())return new Date(r,n-1,i,o,a,c,l);let u=Date.UTC(r,n-1,i,o,a,c,l);try{let h=tr(u,t),f=u-h,g=tr(f,t);return g!==h&&(f=u-g),new Date(f)}catch{return new Date(r,n-1,i,o,a,c,l)}},getLocalTime(s,t=!1,e=!1,r="America/Denver"){if(!s)return"";let n=this.getLocalDate(s,r);if(!St(n))return"";if(!t&&V()){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"),Q("local|"+(e?1:0),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(s,t=!1){let e=this.createDate(s),r=new Date;return t===!0&&r.setHours(0,0,0,0),r.getTime()-e.getTime()},getAge(s){let t=this.getDiffFromNow(s),e=(r,n)=>r+" "+n+(r===1?"":"s");return t<864e5?"1 day":t<6048e5?e(this.toDays(t),"day"):t<12096e5?"1 week":t<2592e6?e(Math.floor(this.toDays(t)/7),"week"):t<5184e6?"1 month":t<31104e6?e(this.toMonths(t),"month"):e(Math.max(1,this.toYears(t)),"year")},getTimeFrame(s){let t=this.getDiffFromNow(s);return this.convertToEstimate(t)},convertToEstimate(s){let t="",e,r,n,i,o,a,c;if(s<=0)switch(!0){case s<-63072e6:n=this.toYears(Math.abs(s)),t="in "+n+"y";break;case s<-31536e6:t="in 1y";break;case s<-5184e6:i=this.toMonths(Math.abs(s)),t="in "+i+"mo";break;case s<-2592e6:t="in 1mo";break;case s<-12096e5:e=this.toDays(Math.abs(s)),r=Math.floor(e/7),t="in "+r+"w";break;case s<-6048e5:t="in 1w";break;case s<-1728e5:e=this.toDays(Math.abs(s)),t="in "+e+"d";break;case s<-864e5:t="tomorrow";break;case s<-72e5:o=this.toHours(Math.abs(s)),t="in "+o+"h";break;case s<=-36e5:t="in 1h";break;case s<-12e4:a=this.toMinutes(Math.abs(s)),t="in "+a+"m";break;case s<-6e4:t="in 1m";break;case s<-2e3:c=this.toSeconds(Math.abs(s)),t="in "+c+"s";break;case s<-1:t="in 1s";break;default:t="now"}else switch(!0){case s<1e3:t="1s ago";break;case s<6e4:c=this.toSeconds(s),t=c+"s ago";break;case s<12e4:t="1m ago";break;case s<36e5:a=this.toMinutes(s),t=a+"m ago";break;case s<72e5:t="1h ago";break;case s<864e5:o=this.toHours(s),t=o+"h ago";break;case s<1728e5:t="yesterday";break;case s<6048e5:e=this.toDays(s),t=e+"d ago";break;case s<12096e5:t="1w ago";break;case s<2592e6:e=this.toDays(s),r=Math.floor(e/7),t=r+"w ago";break;case s<5184e6:t="1mo ago";break;case s<31536e6:i=this.toMonths(s),t=i+"mo ago";break;case s<63072e6:t="1y ago";break;default:n=this.toYears(s),t=n+"y ago"}return t},toYears(s){return typeof s!="number"?0:Math.floor(s/(1e3*60*60*24*365.26))},toMonths(s){return typeof s=="number"?Math.floor(s/(1e3*60*60*24*30)):0},toDays(s){return typeof s!="number"?0:Math.floor(s/(3600*1e3*24))},toHours(s){return typeof s!="number"?0:Math.floor(s%(3600*1e3*24)/(3600*1e3))},toMinutes(s){return typeof s!="number"?0:Math.floor(s%(3600*1e3)/(60*1e3))},toSeconds(s){return typeof s!="number"?0:Math.floor(s%(60*1e3)/1e3)},getDifference(s,t){let e=this.createDate(s),r=this.createDate(t),n=r.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 nt={items:new Map,add(s,t){return this.items.set(s,t),this},get(s){return this.items.get(s)??null}};var ye=(s,t)=>({attr:s,directive:t});var L=(s,t)=>({key:s,value:t});var er=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var rr=null,qs=()=>rr||(rr=nt.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,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(L("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(ye(L(e,T.getWatcherSettings(r,z(e))),qs()))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(L("type",n))}}static parse(t,e){let r=[],n=[],i=t.tag||"div";i==="button"&&r.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=nt.get(l))!==null){n.push(ye(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,r.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"){r.push(L("innerHTML",a));continue}r.push(L(l,a))}return er(i,r,n,o)}};var it=class{build(t,e,r){}setupComponent(t,e,r){let n=r?.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(),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 zs=s=>{for(let e in s)if(e!=="tag"&&e!=="textContent")return!1;let t=s.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},zt=class extends it{build(t,e,r){let n=C.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}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"&&zs(t)){let l=t.textContent;C.createText(l??"",e);return}let n=r?.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,r);let a=i.children;for(let l=0,u=a.length;l<u;l++){let h=a[l];h!==null&&this.buildElement(h,o,r)}let c=i.directives;c.length&&this.setDirectives(o,c,n)}createTempComponent(t,e,r){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...ge(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,r)}setDirectives(t,e,r){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],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 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,r)}removeNode(t){C.removeElement(t)}removeAll(t){C.removeAll(t)}};var Gs=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),Ks=/[&<>"]/,be=s=>{let t=typeof s=="string"?s:String(s);return Ks.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t},ot=class{static create(t,e=[],r=""){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+=be(u);continue}if(l==="html"||l==="innerHTML"){n+=u;continue}if(typeof u=="function")continue;let h=l+'="'+be(u)+'"';i?i+=" "+h:i=h}return Gs.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+r+"</"+t+">"}static createText(t){return be(t)}static createComment(t){return"<!-- "+t+" -->"}};var Gt=class extends it{build(t,e,r){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],r);return n}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=F.parse(t,e),n=r.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(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return ot.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return ot.createComment(i)}return ot.create(r,t.attr,e)}removeAll(t){}};var Kt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new zt:new Gt}};var $=Kt.setup(),Vs=s=>typeof s=="object"&&s.isUnit===!0,sr=new WeakMap,Qs=s=>{let t=sr.get(s);if(!t){if(t=K(s),!t)return null;sr.set(s,t)}return new t},y=class{static render(t,e,r){if(!t||(Vs(t)||(t=Qs(t)),!t))return null;I.enter();try{return $.createComponent(t,e,r)}finally{I.leave()}}static build(t,e,r){I.enter();try{return $.build(t,e,r)}finally{I.leave()}}static rebuild(t,e,r){return $.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){$.setDirectives(t,e,r)}static createNode(t,e,r){return $.createNode(t,e,r)}static removeNode(t){$.removeNode(t)}static removeAll(t){$.removeAll(t)}};B.augment({buildLayout(s,t,e){y.build(s,t,e)}});var xe=[],$s=s=>xe.indexOf(s)!==-1,Ys=s=>({tag:"script",src:s.src,async:!1,load(t){xe.push(s.src);let e=s.load;e&&e()}}),js=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){xe.push(s.src);let e=s.load;e&&e()}}),Vt=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=js({load:r,src:t}):e=Ys({load:r,src:t}),y.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{$s(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 Js=s=>s?typeof s?.prototype?.constructor=="function":!1,W=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Js(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 n=y.build(t,null,r),i=Array.from(n.childNodes);return i.length===0&&t?.panel&&i.push(t.panel),e.after(n),i}};var Qt=class{static load(t,e,r){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),r&&r(n)})}};var Xs=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),q=new w(100),nr=s=>{if(q.has(s)){let r=q.get(s);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof s,e;if(t==="string")e=import(s);else if(t==="function")e=s();else return s;return e.then(r=>{q.set(s,r)}).catch(()=>{q.delete(s)}),q.set(s,e),e},ir=s=>{if(!q.has(s))return null;let t=q.get(s);return t&&typeof t.then=="function"?null:t||null},ve=s=>{let t=typeof s;if(t!=="string"&&t!=="function")return null;if(ir(s))return Promise.resolve(q.get(s));let e;try{e=nr(s)}catch{return null}return e.catch(()=>null)},Se=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&y.removeNode(r)}},or=K({declareProps(){this.loaded=!1,this.errorRoot=null,this.loadingRoots=null,this.generation=0},render(){return Xs({onCreated:s=>{if(this.src){if(this.layout){this.setLayoutRoots(W.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){this.renderLoading(s),new Vt(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){let t=this.generation,e=ir(this.src);if(e){this.renderModule(s,e);return}this.renderLoading(s),Qt.load(nr(this.src),r=>{t===this.generation&&this.renderModule(s,r)},r=>{t===this.generation&&(this.loaded=!1,this.removeLoadingLayout(),this.renderError(s,r))})},renderLoading(s){let t=this.loading;if(!t||this.loadingRoots)return;let e=typeof t=="function"?t():t;e&&(this.loadingRoots=W.renderNodes(e,s,this.parent))},removeLoadingLayout(){let s=this.loadingRoots;return s?(this.loadingRoots=null,Se(s),!0):!1},renderError(s,t){let e=()=>this.retry(s),r=this.fallback,n=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(!n)return;let i=W.renderNodes(n,s,this.parent);this.errorRoots=i,this.errorRoot=i[0]||null},setLayoutRoots(s){this.layoutRoots=s,this.layoutRoot=s[0]||null},retry(s){this.removeErrorLayout(),this.loadAndRender(s)},removeErrorLayout(){this.errorRoot&&(Se(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(s,t){this.loaded=!0;let e=this.layout||W.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(W.renderNodes(e,s,this.parent)),this.removeLoadingLayout()&&typeof this.onReplaceLoading=="function"&&this.onReplaceLoading(this.layoutRoots,e),typeof this.onModuleRender=="function"&&this.onModuleRender(e)},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},destroy(){this.generation++,this.removeErrorLayout(),this.removeLoadingLayout(),this.layoutRoot&&(Se(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var ke=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new or(s)};var ar=(s,t,e=null)=>{if(!s)return;let r=null,n=!1,i=()=>{n||(n=!0,r&&(clearTimeout(r),r=null),d.off("animationend",s,o),s&&s.classList.remove(t),e&&e())},o=c=>{c.target===s&&i()};d.on("animationend",s,o),s.classList.add(t);let a=()=>{if(!n)try{let c=window.getComputedStyle(s),l=parseFloat(c.animationDuration)*1e3||1e3,u=parseFloat(c.animationDelay)*1e3||0;r=setTimeout(i,l+u+100)}catch{r=setTimeout(i,1e3)}};if(typeof requestAnimationFrame>"u"){r=setTimeout(i,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(a))},cr=(s,t,e)=>{ar(s,t)},lr=(s,t,e)=>{let r=()=>{s&&s.remove&&s.remove()};Zs(s,()=>ar(s,t,r),e)};p.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var Zs=(s,t,e)=>{p.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var vt=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&vt(s,t,n,r)});return}tn(s,t,e,r)},tn=(s,t,e,r)=>{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.',s,t);return}let o=en(s,n,i,r);b.watch(s,t,n,o)},en=(s,t,e,r)=>typeof e=="object"?n=>{nn(s,e,n)}:n=>{sn(s,e,t,n,r)},ur=new WeakSet,rn=(s,t,e)=>{!s||!s.isUnit&&!s.isComponent||ur.has(e)||ur.add(e)},sn=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(i===null)break;rn(i,e,s),y.rebuild(i,s,n);break;case"string":let o=Dt(s);if(o!=="textContent"){s.setAttribute(o,i);break}M.addHtml(s,i);break}},nn=(s,t,e)=>{let r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];o&&(t[o]===e?s.classList.add(o):s.classList.remove(o))}};var at=(s,t,e)=>{let r=D(e);vt(s,r,t,e)};var hr=(s,t,e)=>{t&&s.setAttribute("role",t)},on=s=>(t,e)=>{let r=t?"true":"false";e.setAttribute(s,r)},fr=(s,t,e)=>{if(!t)return;let r=t.role;r&&(s.setAttribute("role",r),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(on(l)),at(s,u,e)}else s.setAttribute(l,c)}};var dr=(s,t,e)=>{if(!t)return;let r=F.parse(t,e);C.addAttributes(s,r.attr,e),y.setDirectives(s,r.directives,e)};p.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var we=s=>s?s.getContext():null,pr=(s,t,e)=>{if(typeof t!="function")return;let r=we(e),n=t(r);dr(s,n,e)},mr=(s,t,e)=>{if(typeof t!="function")return;let r=we(e);t(r)},gr=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=we(e),n=t(r);if(!n)return;let i=n[0];i&&(e.addContextBranch(i,n[1]),an(s,i,e))},an=(s,t,e)=>{p.add(s,"context",{branch:t,parent:e})};var yr=(s,t,e)=>{};var br=(s,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",s),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var xr=(s,t,e)=>{},Sr=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&y.build(r,s,e)},vr=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},kr=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&y.build(r,s,e)},wr=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&y.build(r,s,e)},Cr=(s,t,e)=>{if(!t||!e)return;let r=e.state,n=t(r);if(!e.state){e.setStateHelper(n);return}e.addState(n)},Ar=(s,t,e)=>{if(!t||!e)return;e.events||e.setEventHelper();let r=t[2];if(r){let n=r;r=i=>{n(i,e)}}e.events.on(t[0],t[1],r,t[3])};var Tr=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=D(e),!r)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=D(e);if(!o)return;r=o,n=t[0],i=t[1]}else[r,n,i]=t;b.bind(s,r,n,i)};var $t=(s,t,e)=>{vt(s,e.state,t,e)};var Pr=s=>(t,e)=>{let[r,n,i="active"]=s,o=t===n?i:"";e.dataset[r]=o},Er=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(Pr(n)),at(s,i,e)},Mr=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(Pr(n)),$t(s,i,e)};var Dr=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&r.remove()}s.length=0};p.addType("forScopes",s=>{if(!s)return!1;Dr(s.scopes)});var Rr=(s,t,e)=>{let r,n,i,o;if(typeof t[0]=="string"||t.length<3){let u=D(e);if(!u)return;r=u,[n,i,o]=t}else[r,n,i,o]=t;let a=o!==!1,c=n+"[",l=a?{scopes:[]}:null;l&&p.add(s,"forScopes",l),b.watch(s,r,n,u=>{if(y.removeAll(s),l&&Dr(l.scopes),!u||u.length<1)return;let h=[];for(let f=0,g=u.length;f<g;f++){let m=a?r.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,s,e)})};var Ir=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];for(let o=0,a=r.length;o<a;o++){let c=r[o];if(!c)continue;let l=n(c,o);l!==null&&i.push(l)}y.build(i,s,e)};var _r=(s,t,e)=>{t(s,e)};p.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var Or=(s,t,e)=>{cn(s,t,e)},cn=(s,t,e)=>{p.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var Lr=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,n=t.length;r<n;r++)T.setup(s,t[r],e);else T.setup(s,t,e)};var ln=0,ct=class{constructor(t){this.router=t,this.locationId="base-app-router-"+ln++,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 un=0,hn=()=>Date.now().toString(36)+"-"+(un++).toString(36)+"-"+Math.random().toString(36).substring(2,8),Br=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Nr=()=>{Br&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let s=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(s,t)}))},Yt=class extends ct{constructor(t){super(t),this.currentKey=null,this.positions=new w(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"),Br&&(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&&Nr()}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 n=r&&this.positions.get(r)||e.scrollPosition,i=this.router;i.checkActiveRoutes(e.uri,!!n),n&&(typeof i.restoreScrollPosition=="function"?i.restoreScrollPosition(n):this.scrollTo(n)),Nr()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:hn(),scrollPosition:r,uri:t}}addState(t,e,r=!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;!r&&i&&i.location===this.locationId&&(i.scrollPosition=this.saveCurrentPosition(),n.replaceState(i,"",window.location.href));let o=this.createState(t,e);return r||(o.scrollPosition={x:0,y:0}),n[r===!1?"pushState":"replaceState"](o,null,t),this.currentKey=o.key,this.positions.set(o.key,o.scrollPosition),this}};var jt={removeSlashes(s){return typeof s!="string"?"":(s[0]==="/"&&(s=s.substring(1)),s[s.length-1]==="/"&&(s=s.substring(0,s.length-1)),s)},getHashUri(s){if(typeof s!="string")return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)}};var Jt=class extends ct{addEvent(){return d.on("hashchange",window,this.callBack),this}removeEvent(){return d.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(jt.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var Xt=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Yt(t).setup():new Jt(t).setup()}};var Ce=5,fn=200,Zt=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new w(fn),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMode(){let t=this.owner;return t!==null&&t.keepAliveMode==="hide"?"hide":"detach"}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:Ce}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 Ae=class extends A{getChildScope(){return this.parent}},Hr=s=>K(s,Ae);var Te="data-scroll-key",dn="["+Te+"]",pn="[data-route-dormant]",Ur=s=>typeof s.closest=="function"&&s.closest(pn)!==null,Fr=(s,t)=>{for(let e=0,r=s.length;e<r;e++){let n=s[e];if(!n||n.nodeType!==1||Ur(n))continue;let i=n.getAttribute(Te);i!==null&&t(n,i);let o=n.querySelectorAll(dn);for(let a=0,c=o.length;a<c;a++){let l=o[a];Ur(l)||t(l,l.getAttribute(Te))}}},Pe=s=>{let t=null;return Fr(s,(e,r)=>{let n=e.scrollTop||0,i=e.scrollLeft||0;n===0&&i===0||(t=t||{},t[r]=[n,i])}),t},te=(s,t)=>{if(!t)return!0;let e={},r=0;for(let n in t)e[n]=!0,r++;return Fr(s,(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,r--)}),r<=0};var mn=s=>{for(let t=0;t<s.length;t++){let e=s[t],r=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(r)||r.length===0)continue;let n=[];for(let i=0,o=r.length;i<o;i++){let a=r[i];a&&s.indexOf(a)===-1&&n.indexOf(a)===-1&&n.push(a)}s.splice(t+1,0,...n)}},kt="data-route-dormant",ee=[["content-visibility","hidden"],["position","absolute"],["top","0"],["left","0"],["width","100%"]],gn=s=>{let t=s.style,e=[];for(let r=0,n=ee.length;r<n;r++){let[i,o]=ee[r];e.push([i,t.getPropertyValue(i),t.getPropertyPriority(i)]),t.setProperty(i,o,"important")}return e.push(["aria-hidden",s.getAttribute("aria-hidden")]),s.setAttribute("aria-hidden","true"),s.setAttribute(kt,""),s.inert=!0,e},yn=(s,t)=>{let e=s.style,r=t||[];for(let i=0,o=ee.length;i<o;i++){let a=ee[i][0],c=r.find(l=>l[0]===a);c&&c[1]?e.setProperty(a,c[1],c[2]||""):e.removeProperty(a)}let n=r.find(i=>i[0]==="aria-hidden");n&&n[1]!==null?s.setAttribute("aria-hidden",n[1]):s.removeAttribute("aria-hidden"),s.removeAttribute(kt),s.inert=!1},bn=s=>/^class[\s{]/.test(Function.prototype.toString.call(s)),xn=1500,Wr=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Sn=s=>{let t=s.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},Ee=(s,t,e)=>{if(!(!s||typeof s[t]!="function"))try{s[t](...e)}catch(r){console.error("Error in "+t+":",r)}},re=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.keepAliveMode=e.keepAliveMode==="hide"||e.keepAliveMode==="detach"?e.keepAliveMode:null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.capturedScroll=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()}getKeepAliveMode(t){if(this.keepAliveMode!==null)return this.keepAliveMode;if(t=t||this.component,t){let r=t.keepAliveMode;if(r==="hide"||r==="detach")return r;let n=t.layout;if(n&&n.isUnit===!0&&(n.keepAliveMode==="hide"||n.keepAliveMode==="detach"))return n.keepAliveMode}let e=this.pageCache;return e!==null&&typeof e.getMode=="function"?e.getMode():"detach"}isDetached(){return this.detachedNodes!==null}captureScroll(){let t=this.component;if(this.setup!==!0||!t||t.rendered!==!0){this.capturedScroll=null;return}this.capturedScroll={value:Pe(this.getRootNodes(t))}}releaseCapturedScroll(){this.capturedScroll=null}takeScroll(t){let e=this.capturedScroll;return this.capturedScroll=null,e?e.value:Pe(this.getRootNodes(t))}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=bn(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(Hr(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)&&Ee(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=Sn(t);r&&e.push(r);let n=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),i=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),o=t.loadingRoots||null,a=[n,i,o];for(let c=0;c<3;c++){let l=a[c];if(l)for(let u=0,h=l.length;u<h;u++){let f=l[u];f&&e.indexOf(f)===-1&&e.push(f)}}return mn(e),e}callPageHook(t,e){let r=this.component;if(!r)return;Ee(r,t,e);let n=r.layout;n&&n!==r&&n.isUnit===!0&&Ee(n,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,n=()=>te(this.getRootNodes(r),t);if(n()||typeof requestAnimationFrame>"u")return;let i=Wr(),o=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||n()||Wr()-i>xn||requestAnimationFrame(o)};requestAnimationFrame(o)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null;let e=this.component;if(!t||!e)return;if(typeof requestAnimationFrame>"u"){te(this.getRootNodes(e),t);return}let r=++this.scrollToken;requestAnimationFrame(()=>{r!==this.scrollToken||this.setup!==!0||this.component!==e||te(this.getRootNodes(e),t)})}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let r=this.takeScroll(t);return this.savedScroll=r,this.pageCache.saveScroll(this.getScrollKey(),r),this.getKeepAliveMode(t)==="hide"&&t.loaded!==!1?this.hideInPlace(e):this.removeNodes(e),this.detachedNodes=e,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}removeNodes(t){let e=new WeakMap;for(let r=0,n=t.length;r<n;r++){let i=t[r],o=i.parentNode;o&&(e.set(i,o),o.removeChild(i))}this.detachedParents=e,this.hiddenInPlace=!1,this.hiddenStyles=null}hideInPlace(t){let e=new WeakMap;for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&i.nodeType===1&&e.set(i,gn(i))}this.detachedParents=null,this.hiddenInPlace=!0,this.hiddenStyles=e}showInPlace(t,e){let r=this.hiddenStyles;for(let n=0,i=t.length;n<i;n++){let o=t[n];o.nodeType===1&&o.hasAttribute(kt)&&yn(o,r?r.get(o):void 0),o.isConnected||e.appendChild(o)}}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.hiddenInPlace;this.hiddenInPlace=!1;let n=this.component,i=this.container;if(!n||n.rendered!==!0||!i||typeof i.appendChild!="function")return this.savedScroll=null,this.hiddenStyles=null,this.releaseComponent(),!1;if(r)return this.showInPlace(this.getRootNodes(n),i),this.hiddenStyles=null,this.setup=!0,I.schedule(),!0;let o=this.getRootNodes(n);for(let a=0,c=o.length;a<c;a++){let l=o[a],u=e?e.get(l):null;(u&&u.isConnected?u:i).appendChild(l)}return this.setup=!0,I.schedule(),!0}evict(){if(this.detachedNodes===null)return;let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null,this.detachedParents=null,this.savedScroll=null,this.hiddenInPlace=!1,this.hiddenStyles=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(),this.takeScroll(e))}this.capturedScroll=null,this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var qr=s=>{if(!s.length)return null;let t={};for(let e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},zr=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);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 vn=/(\/):[^/(]*?\?/g,kn=/\//g,wn=/(\?\/+\*?)/g,Cn=/(:[^/?&($]+)/g,An=/(\*)/g,Tn=s=>s.replace(vn,t=>t.replace(kn,"(?:$|/)")),Pn=s=>(s=s.replace(wn,"?/*"),s.replace(Cn,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),En=s=>s.replace(An,".*"),Mn=(s,t)=>s+=t[t.length-1]==="*"?"":"$",Gr=s=>{if(!s)return"";let t=s;return t=Tn(t),t=Pn(t),t=En(t),t=Mn(t,s),t};var Dn=0,Kr=(s,t="")=>{let e=s||"",r=typeof t=="string"&&t?t:e,n=null,i=[],o=r.match(/#\{([^}]+)\}/);o&&o[1]&&(n=o[1].trim(),r=r.replace(o[0],""),e=e.replace(o[0],""));let a=r.indexOf("?");if(a>-1){let u=r.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[_,Y=""]=x.split("="),De=(_||"").trim();De&&i.push({key:De,value:(Y||"").trim()})}r=r.substring(0,a);let f=e.indexOf("?");f>-1&&(e=e.substring(0,f))}}let c=n!==null||i.length>0;return c&&!r&&(e="*"),{uriPath:e,requiredHash:n,requiredQuery:i,hasConditions:c}},Vr=s=>{if(!s)return"";let t=s.indexOf("?"),e=s.indexOf("#"),r=s.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),s.substring(0,r).replace(/\/\.(?:\/|$)/g,"/")},Rn=s=>{if(!s)return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)},In=s=>{if(!s)return"";let t=s.indexOf("?");if(t===-1)return"";let e=s.indexOf("#",t);return e===-1?s.substring(t+1):s.substring(t+1,e)},se=class extends O{constructor(t,e,r=null){let n=t.baseUri,o=Kr(n,t.rawUri).uriPath,a=zr(o),c=qr(a),l=super(c);return this.uri=n,this.matchUri=o,this.paramKeys=a,this.titleCallBack=e,this.pageCache=r,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,this.importSrc=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+Dn++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=Kr(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=Gr(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)}captureScroll(){let t=this.controller;t&&this.get("active")&&t.captureScroll()}releaseCapturedScroll(){let t=this.controller;t&&t.releaseCapturedScroll()}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return e?e.isConnected===!1?!0:typeof e.closest=="function"&&e.closest("["+kt+"]")!==null:!1}getLayout(t){if(t.component)return t.component;let e=t.import;if(!e)return null;let r=e&&typeof e=="object"&&!(e instanceof Promise)?e.src:e;return this.importSrc=typeof r=="string"||typeof r=="function"?r:null,ke(e)}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:n,parent:i,keepAlive:o,keepAliveMode:a}=t,c={component:e,container:r,persist:n,parent:i,keepAlive:o,keepAliveMode:a,pageCache:this.pageCache},l=_t(this);this.controller=new re(l,c)}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 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,r=Vr(t),n=this.uriQuery||/$^/,i=r.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}matches(t){return(this.uriQuery||/$^/).test(Vr(t))&&this.matchConditions(t)}prefetch(){let t=this.importSrc;return t?ve(t):null}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&Rn(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=In(t);if(!r)return!1;let n=new URLSearchParams(r);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 r=this.paramKeys;if(!r)return;let n={};for(let i=0,o=r.length;i<o;i++){let a=r[i];typeof a<"u"&&(n[a]=t[i+e])}this.set(n)}getParams(){return this.stage}};var _n=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},On=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ln=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=new RegExp(":"+On(r),"gi");s=s.replace(n,()=>e[r])}return s},Nn=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=Ln(t,s),_n(t)),Bn=(s,t)=>(t!==""&&(s+=" - "+t),s),Qr=(s,t,e)=>t&&(t=Nn(s,t),Bn(t,e));var $r=(s,t)=>({attr:s,value:t}),Hn=(s,t)=>{if(!t.startsWith(s))return!1;let e=t[s.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},ne=class extends A{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,n=N.data,i=[];t&&typeof t=="object"&&i.push($r("href",t)),e&&typeof e=="object"&&i.push($r("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=r?l===a:Hn(c,l);this.update(f)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var Un=()=>typeof window<"u"?window.location:{},Fn=s=>{if(!s)return"";let t=s.indexOf("#");return t>-1?s.substring(t+1):""},Wn=1500,ie=["wheel","touchstart","keydown","pointerdown"],Yr=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Me=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.activeScrollGroups=new Set,this.scrollGroupsReady=new Set,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=Ce,this.keepAliveMode="detach",this.pageCache=new Zt(this),this.history=null,this.callBackLink=null,this.location=Un(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new U({path:""})}setupHistory(){this.history=Xt.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new se(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let r=e?e.max:void 0;typeof r=="number"&&r>=0&&(this.keepAliveMax=r);let n=e?e.mode:void 0;return(n==="hide"||n==="detach")&&(this.keepAliveMode=n),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=jt.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.routeId===t)return i}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 n=0,i=t.length;n<i;n++){let o=t[n];if(!o)continue;let a=this.createRoute(o);r.push(a)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);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(r,n),r}checkGroupForRegistration(t,e){let r=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.activeScrollGroups.add(i.groupId),this.lastScrollGroup=i.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){this.activeScrollGroups.delete(t),this.lastScrollGroup===t&&(this.lastScrollGroup=null);let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,n=e.length;r<n;r++){let i=e[r];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 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 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 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 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,r){return t=this.createURI(t),this.history.addState(t,e,r),this.updatePath(),this.activate(),this}prefetch(t){if(typeof t!="string"||!t)return Promise.resolve([]);let e=this.getLinkPath(t);if(e===null)return Promise.resolve([]);let r=this.createURI(e),n=[],i=a=>{if(!a||!a.controller||typeof a.matches!="function"||!a.matches(r))return!1;let c=a.prefetch();return c&&n.push(c),!0},o=this.routes;for(let a=0,c=o.length;a<c;a++)i(o[a]);for(let a of this.switches.values())for(let c=0,l=a.length;c<l&&!i(a[c]);c++);return Promise.all(n)}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=Qr(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.scrollGroupsReady=new Set(this.activeScrollGroups),this.scrollWaitToken++;let r=this.pageCache;r.historyNavigation=e===!0;let n=this.captureActiveScroll(),i=this.routes;for(let o=0,a=i.length;o<a;o++){let c=i[o];typeof c>"u"||r.size>0&&c.isDormant()||this.checkRoute(c,t)}if(this.checkSwitches(t,!0),r.historyNavigation=!1,this.releaseCapturedScroll(n),e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}captureActiveScroll(){let t=[],e=n=>{!n||!n.controller||!n.get("active")||n.isDormant()||(n.captureScroll(),t.push(n))},r=this.routes;for(let n=0,i=r.length;n<i;n++)e(r[n]);for(let n of this.switches.values())for(let i=0,o=n.length;i<o;i++)e(n[i]);return t}releaseCapturedScroll(t){for(let e=0,r=t.length;e<r;e++)t[e].releaseCapturedScroll()}checkSwitches(t,e){let r=this.switches;for(let[n,i]of r.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 r=t.length;if(!r)return;let n=null;for(let a=0;a<r;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<r;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<r;a++){let c=t[a];c&&c!==o&&c!==n&&c.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 n=Fn(this.path);if(n){this.scrollIntent={type:"hash",hash:n};return}t.scrollTo?(this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId},this.currentGroupId!==null&&this.currentGroupId!==void 0&&this.activeScrollGroups.add(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.scrollGroupsReady.has(t.groupId);if(this.lastScrollGroup=e?t.groupId:null,r){this.scrollToTarget(t.selector,t.groupId);return}typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()}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,n=t.y||0;if(typeof requestAnimationFrame>"u"||this.canReachScroll(r,n)){window.scrollTo(r,n);return}let i=()=>{e===this.scrollWaitToken&&this.scrollWaitToken++,this.clearScrollWait()},o={capture:!0,passive:!0};for(let l=0,u=ie.length;l<u;l++)window.addEventListener(ie[l],i,o);this.cancelScrollWait=()=>{for(let l=0,u=ie.length;l<u;l++)window.removeEventListener(ie[l],i,o)};let a=Yr(),c=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,n)||Yr()-a>=Wn){this.clearScrollWait(),window.scrollTo(r,n);return}requestAnimationFrame(c)};requestAnimationFrame(c)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){let r=document.documentElement;if(!r)return!0;let n=(r.scrollHeight||0)-(window.innerHeight||0),i=(r.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}},r=e();if(r){r.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)}findScrollTarget(t,e){if(typeof document>"u")return null;let r=this.findScopedScrollTarget(t,e);if(r)return r;let n=document.querySelectorAll(t);for(let i=0,o=n.length;i<o;i++){let a=n[i];if(a&&a.isConnected!==!1)return a}return null}findScopedScrollTarget(t,e){if(e==null||!this.switches)return null;let r=this.switches.get(e),n=r&&r[0],i=n&&n.controller&&n.controller.container;if(!i||i.nodeType!==1)return null;let o=i;for(let a=0;a<8;a++){let c=o.parentElement;if(!c||c===document.body||c===document.documentElement)break;let l=c.querySelector(t);if(l)return l;o=c}return null}readScrollTarget(t){let e=window.getComputedStyle(t),r=e.position==="sticky",n=r&&parseFloat(e.top)||0,i=(t.offsetWidth||0)>0||(t.offsetHeight||0)>0,o;if(r){let a=t.style.position;t.style.position="static",o=t.getBoundingClientRect().top+window.scrollY,t.style.position=a}else o=t.getBoundingClientRect().top+window.scrollY;return{sized:i,targetScroll:o-n}}scrollToTarget(t,e){if(typeof t!="string"||typeof document>"u")return;let r=l=>{window.scrollY>l&&window.scrollTo(0,Math.max(0,l))};if(typeof requestAnimationFrame>"u"){let l=this.findScrollTarget(t,e);if(l){let u=this.readScrollTarget(l);u.sized&&r(u.targetScroll)}return}let n=++this.scrollWaitToken,i=30,o=0,a=null,c=()=>{if(n!==this.scrollWaitToken)return;let l=this.findScrollTarget(t,e);if(l){let u=this.readScrollTarget(l);if(u.sized){if(a!==null&&Math.abs(a-u.targetScroll)<1){r(u.targetScroll);return}a=u.targetScroll}}if(++o<i){requestAnimationFrame(c);return}a!==null&&r(a)};requestAnimationFrame(c)}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("/"),n=t.split("/");if(r.length!==n.length)return!0;let i=r[r.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 Me;p.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&N.removeRoute(t)});var Jr=(s,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&jr(s,i,e)}else jr(s,t,e)},jr=(s,t,e)=>{t.container=s,t.parent=e;let r=N.add(t);qn(s,r)},qn=(s,t)=>{p.add(s,"routes",{route:t})};var Xr=(s,t,e)=>{};p.addType("switch",s=>{if(!s)return!1;let t=s.id;N.removeSwitch(t)});var Zr=(s,t,e)=>{let r=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=s,a.parent=e)}let n=N.addSwitch(t);zn(s,n)},zn=(s,t)=>{p.add(s,"switch",{id:t})};nt.add("cache",xr).add("onCreated",_r).add("onDestroyed",Or).add("bind",Tr).add("data",yr).add("state",Xr).add("onSet",at).add("onState",$t).add("animateIn",cr).add("animateOut",lr).add("watch",Lr).add("useParent",Sr).add("useData",kr).add("useState",wr).add("getId",vr).add("addState",Cr).add("addEvent",Ar).add("map",Ir).add("for",Rr).add("useContext",mr).add("addContext",gr).add("context",pr).add("role",hr).add("aria",fr).add("route",Jr).add("debug",br).add("dataSet",Er).add("dataStateSet",Mr).add("switch",Zr);export{dt as Ajax,lt as Arrays,ys as Atom,y as Builder,A as Component,U as Data,p as DataTracker,Ws as DateTime,nt as Directives,tt as Dom,gt as Encode,es as Events,M as Html,ke as Import,K as Jot,yt as Model,ne as NavLink,S as Objects,Ns as Pod,Tt as ResourceCache,rt as SimpleData,bt as State,R as Store,k as Strings,v as Types,xt as Unit,B as base,b as dataBinder,ve as preloadImport,N as router};
|
|
1
|
+
var lt=class{static toArray(t){return Array.from(t)}static inArray(t,e,r){return Array.isArray(t)?t.indexOf(e,r):-1}};var ss=Object.prototype.toString,wt=Object.prototype.hasOwnProperty,v={create(s){return Object.create(s||null)},extendObject(s,t){if(!s||typeof s!="object"||!t||typeof t!="object")return!1;for(let e in s)wt.call(s,e)&&!wt.call(t,e)&&(t[e]=s[e]);return t},clone(s){if(!s||typeof s!="object")return{};try{return structuredClone(s)}catch{return JSON.parse(JSON.stringify(s))}},getClassObject(s){return typeof s=="function"?s.prototype:s},extendClass(s,t){let e=this.getClassObject(s),r=this.getClassObject(t);if(typeof e!="object"||typeof r!="object")return!1;let n=Object.create(e);for(let i in r)n[i]=r[i];return n},hasOwnProp(s,t){return wt.call(s,t)},isPlainObject(s){return!!s&&ss.call(s)==="[object Object]"},isEmpty(s){if(!s||typeof s!="object"||Array.isArray(s))return!0;if(s instanceof Map||s instanceof Set)return s.size===0;for(let t in s)if(wt.call(s,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 ut={types:{},add(s,t){this.types[s]=t},get(s){return this.types[s]||!1},remove(s){delete this.types[s]}};var Ct=class{constructor(){this.types=new Map}add(t,e){let r=this.types.get(t);r||(r=[],this.types.set(t,r)),r.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 r,n=ut.get(t);if(n){for(let i=0,o=e.length;i<o;i++)r=e[i],r&&(e[i]=null,typeof n=="function"&&n(r));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}let e=this.types.keys();for(let r of e)r&&this.removeType(r);this.types.clear()}};var K=new WeakMap,_e=new WeakMap,At=s=>!!s&&(typeof s=="object"||typeof s=="function"),p=class{static trackingCount=0;static addType(t,e){ut.add(t,e)}static removeType(t){ut.remove(t)}static getTrackingId(t){if(!t||typeof t!="object")return"";let e=_e.get(t);return e||(e="dt"+this.trackingCount++,_e.set(t,e)),e}static add(t,e,r){At(t)&&this.find(t).add(e,r)}static get(t,e){let r=At(t)?K.get(t):void 0;return r?e?r.get(e):r:!1}static has(t,e){let r=At(t)?K.get(t):void 0;return r&&e?r.has(e):!1}static find(t){let e=K.get(t);return e||(e=new Ct,K.set(t,e)),e}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let r=At(t)?K.get(t):void 0;if(r){if(!e){r.remove(),K.delete(t);return}r.remove(e),this.isEmpty(r.types)&&K.delete(t)}}};var d={getEvents(s){return typeof s!="object"||s===null?[]:p.get(s,"events")},create(s,t,e,r=!1,n=!1,i=null){return{event:s,obj:t,fn:e,capture:r,swapped:n,originalFn:i}},on(s,t,e,r){if(Array.isArray(s))for(let n=0,i=s.length;n<i;n++)this.add(s[n],t,e,r);else this.add(s,t,e,r);return this},off(s,t,e,r){if(Array.isArray(s))for(let n=0,i=s.length;n<i;n++)this.remove(s[n],t,e,r);else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,n=!1,i=null){if(typeof t!="object"||t===null)return this;let o=this.create(s,t,e,r,n,i);return p.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let n=this.getEvent(s,t,e,r);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(s){return typeof s=="object"&&s.obj.removeEventListener(s.event,s.fn,s.capture),this},getEvent(s,t,e,r){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(s,t,e,r);return this.search(i,n)},search(s,t){let e,r=this.isSwappable(s.event);for(let n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==s.event||e.obj!==s.obj)&&(e.fn===s.fn||r===!0&&e.originalFn===s.fn))return e;return!1},removeEvents(s){return typeof s!="object"||s===null?this:(p.remove(s,"events"),this)},swap:new Set(["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"]),addSwapped(s){this.swap.add(s)},isSwappable(s){return this.swap.has(s)}};p.addType("events",s=>{d.removeEvent(s)});var Le={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},Oe=Object.keys(Le),ns={events:d,addListener(s,t,e,r){return this.events.add(s,t,e,r),this},on(s,t,e,r){let n=this.events;if(Array.isArray(s))for(let i=0,o=s.length;i<o;i++)n.add(s[i],t,e,r);else n.add(s,t,e,r);return this},off(s,t,e,r){let n=this.events;if(Array.isArray(s))for(let i=0,o=s.length;i<o;i++)n.remove(s[i],t,e,r);else n.remove(s,t,e,r);return this},removeListener(s,t,e,r){return this.events.remove(s,t,e,r),this},_createEvent(s,t,e,r){let n;switch(t){case"HTMLEvents":n=new Event(s,e);break;case"MouseEvents":n=new MouseEvent(s,e);break;default:n=new CustomEvent(s,r);break}return n},createEvent(s,t,e,r){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(s);return this._createEvent(s,i,n,r)},_getEventType(s){for(let t=0,e=Oe.length;t<e;t++){let r=Oe[t];if(Le[r].test(s))return r}return"CustomEvent"},trigger(s,t,e){if(typeof t!="object"||t===null)return this;let r=typeof s=="string"?this.createEvent(s,t,null,e):s;return t.dispatchEvent(r),this},mouseWheelEventType:null,getWheelEventType(){let s=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=s())},onMouseWheel(s,t,e,r=!1){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof s=="function"&&s(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,r,!0,s),this},offMouseWheel(s,t,e=!1){typeof t>"u"&&(t=window);let r=this.getWheelEventType();return this.off(r,t,s,e),this},preventDefault(s){return typeof s.preventDefault=="function"?s.preventDefault():s.returnValue=!1,this},stopPropagation(s){return typeof s.stopPropagation=="function"?s.stopPropagation():s.cancelBubble=!0,this}};var ht=class{constructor(){this.errors=[],this.dataTracker=p}augment(t){if(!k.isObject(t))return this;let e=this.constructor.prototype;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,n){return(t[e]=r).apply(t,lt.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(k.isObject(t)===!1)return"";let n=t[e];return typeof n<"u"?n:typeof r<"u"?r:""}createCallBack(t,e,r=[],n=!1){return typeof e!="function"?!1:(...i)=>(n===!0&&(r=r.concat(i)),e.apply(t,r))}bind(t,e){return e.bind(t)}};ht.prototype.extend=(function(){return ht.prototype})();var H=new ht;var ft={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 Ne=()=>{H.augment({xhrSettings:ft,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=v.extendClass(H.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=ft}})};var w=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,r=!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,r=>r[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let r=/([A-Z]{1,})/g;return t.replace(r,n=>e+n.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,r=>r.charAt(0).toUpperCase()+r.substring(1).toLowerCase())}};var Tt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:r,url:n,async:i}=this.settings;e.open(r,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=ft.beforeSend;if(t.length<1)return;let e=this.xhr,r=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];o&&o(e,r)}}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")}setupParams(t,e=null){let r=typeof t;if(!e)return!(t instanceof FormData)&&r==="object"&&(t=this.objectToString(t)),t;let n=typeof e;if(r==="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 r==="object"&&(t=Object.assign({},e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,r=t.params;return r?r=this.setupParams(r,e):e&&(r=this.setupParams(e)),r}getXhrSettings(t){let e=this.settings={...H.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var r=0,n=t.length;r<n;r++){var i=t[r];switch(r){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=v.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 r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.xhr?.setRequestHeader(r,e[r])}update(t,e){let r=this.xhr,n=()=>{d.removeEvents(r?.upload),d.removeEvents(r)},i=this.settings;if(!i)return!1;switch(e||t.type){case"load":{if((r?.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 r=this.update.bind(this);d.on(["load","error","abort"],e,r),d.on("progress",e.upload,r)}};Ne();var dt=(...s)=>new Tt(s).xhr;var is=(s,t)=>{if(s===t)return!1;try{return JSON.stringify(s)!==JSON.stringify(t)}catch{return!0}},ce=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,r,n=null){let i=this.getEntry(t)||this.createEntry(t);i.value=e,i.meta=n,i.time=Date.now(),i.ttl=typeof r=="number"?r: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 r=0;for(let[n,i]of Array.from(this.entries))e(n,i)&&(this.entries.delete(n),r++);return r}clear(){this.entries.clear()}fetch(t,e,r,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 r(c)}catch(l){return c(!1,void 0,l),null}}resolve(t,e,r,n){r=r||{};let i=typeof r.ttl=="number"?r.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(r.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&&is(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,r={}){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,r,(c,l,u)=>{if(o)return o=!1,u?n(c):i(l);typeof r.onUpdate=="function"&&r.onUpdate(c)})})}},Pt=new ce;var os=s=>{let t=typeof s;return t!=="string"&&t!=="number"?s:Be(s)},Be=s=>[{tag:"text",textContent:s}],He=()=>({props:{},children:[]}),Ue=s=>({props:{},children:Be(s)}),Fe=s=>({props:{},children:s}),We=s=>({props:s[0]||{},children:os(s[1])});var C=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 r=this.cache,n=r.get(t);if(n!==void 0){n.value=e,n.used=!0;return}r.set(t,{value:e,used:!1}),r.size>this.maxSize&&this.evict()}evict(){let t=this.cache,e=this.maxSize-this.evictCount+1;for(let r=0;r<2&&t.size>e;r++){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 Et=class{constructor(){this.connections=new Map}add(t,e,r){let n=this.getOrCreate(t),i=n.get(e);return i?Array.isArray(i)?i.push(r):n.set(e,[i,r]):n.set(e,r),r}get(t,e){let r=this.connections.get(t)?.get(e);return r?Array.isArray(r)?r[r.length-1]||!1:r:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let r=this.connections.get(t);if(r)if(e)this.unsubscribe(r.get(e)),r.delete(e),r.size===0&&this.connections.delete(t);else{for(let n of r.values())this.unsubscribe(n);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,r=t.length;e<r;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var X=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var Mt=class extends X{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 r=t.length,n=new Array(r);for(let i=0;i<r;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,r=t.length;e<r;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 Z=class{unsubscribe(){}};var pt=class extends Z{constructor(){super(),this.source=null}addSource(t){return this.source=new Mt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var tt=class extends X{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 Dt=class extends tt{constructor(t,e,r){super(r),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 et=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 r=document.querySelectorAll(t);return r?r.length===1?r[0]:Array.from(r):!1}static html(t,e){return!t||typeof t!="object"?!1:typeof e<"u"?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return!t||typeof t!="object"||typeof e>"u"?this:(e=w.uncamelCase(e),t.style[e]=r,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=w.uncamelCase(e);let r=t.style[e];if(r!=="")return r;let n=null,i=t.currentStyle;if(i&&(n=i[e]))return n;let o=window.getComputedStyle(t,null);return o?o[e]:r}static css(t,e,r){return typeof r<"u"?(this.setCss(t,e,r),this):this.getCss(t,e)}static removeAttr(t,e){return typeof t=="object"&&t!==null&&t.removeAttribute(e),this}static setAttr(t,e,r){t.setAttribute(e,r)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,r){return!t||typeof t!="object"?!1:typeof r<"u"?(this.setAttr(t,e,r),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,r){e=this.removeDataPrefix(e),e=w.camelCase(e),t.dataset[e]=r}static getData(t,e){return e=w.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,r){return!t||typeof t!="object"?!1:typeof r<"u"?(this.setData(t,e,r),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"),r=typeof e=="string"?e:"";return this.css(t,"display",r),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,r=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,r=t.scrollTop;break;case"object":e=t.scrollLeft,r=t.scrollTop;break}return!t||typeof t!="object"?!1:{left:e-(t.clientLeft||0),top:r-(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,r=e.documentElement,n=e.getElementsByTagName("body")[0],i=t.innerWidth||r.clientWidth||n.clientWidth,o=t.innerHeight||r.clientHeight||n.clientHeight;return{width:i,height:o}}static getDocumentSize(){let t=document,e=t.body,r=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,r.clientHeight,r.scrollHeight,r.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,r.clientWidth,r.scrollWidth,r.offsetWidth),height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let r={x:0,y:0};if(!t||typeof t!="object")return r;let n=0;for(;t&&(e===0||n<e);)n++,r.x+=t.offsetLeft+t.clientLeft,r.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return r}static addClass(t,e){if(!t||typeof t!="object"||e==="")return this;if(typeof e=="string"){let r=e.split(" ");for(let n=0,i=r.length;n<i;n++)t.classList.add(r[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 Rt=s=>{let t="textContent";if(!s||typeof s!="object")return t;let e=s.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let r=s.type;if(!r)return t="value",t;switch(r){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var as=(s,t,e)=>{et.setAttr(s,t,e)},cs=(s,t,e)=>{s.checked=s.value==e},ls=(s,t,e)=>{e=e==1,qe(s,t,e)},qe=(s,t,e)=>{s[t]=e},us=(s,t)=>et.getAttr(s,t),hs=(s,t)=>s[t],It=class extends tt{constructor(t,e,r,n){super(n),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof r=="string"?this.setupFilter(r):r}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=as,this.getValue=us,this;this.getValue=hs;let r=t.type;if(r)switch(r){case"checkbox":return this.setValue=ls,this;case"radio":return this.setValue=cs,this}return this.setValue=qe,this}getAttrBind(t){return t||Rt(this.element)}setupFilter(t){let e=/\[\[[^\]]+\]\]/;return r=>t.replace(e,()=>r)}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 _t=class extends Z{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new It(t,e,r,this.pubSub)}addData(t,e){return this.data=new Dt(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 fs=0,Ot=s=>{for(let t=0,e=s.length;t<e;t++){let r=s.charCodeAt(t);if(r===46||r===58||r===91)return s.substring(0,t)}return s},U=class{constructor(t=!1,e=!1){this.callBacks=new Map,this.prefixIndex=t?new Map:null,this.rootIndex=e?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.rootIndex?.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.reentrantMessages=null}on(t,e){let r=++fs,n=this.callBacks.get(t);return n||(n=new Map,this.callBacks.set(t,n),this.prefixIndex&&this._indexMessage(t),this.rootIndex&&this._indexRoot(t)),n.set(r,e),r}_indexMessage(t){let e=t.indexOf(":");if(e===-1)return;let r=t.substring(0,e+1),n=this.prefixIndex.get(r);n||(n=new Set,this.prefixIndex.set(r,n)),n.add(t)}_unindexMessage(t){let e=t.indexOf(":");if(e===-1)return;let r=t.substring(0,e+1),n=this.prefixIndex.get(r);n&&(n.delete(t),n.size===0&&this.prefixIndex.delete(r))}_indexRoot(t){let e=Ot(t),r=this.rootIndex.get(e);r||(r=new Set,this.rootIndex.set(e,r)),r.add(t)}_unindexRoot(t){let e=Ot(t),r=this.rootIndex.get(e);r&&(r.delete(t),r.size===0&&this.rootIndex.delete(e))}getRootMessages(t){return this.rootIndex?this.rootIndex.get(t)||null:this.callBacks.keys()}getPrefixMessages(t){return this.prefixIndex&&this.prefixIndex.get(t)||null}getMessages(){return this.callBacks.keys()}off(t,e){let r=this.callBacks.get(t);r&&(r.delete(e),r.size===0&&(this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t),this.rootIndex&&this._unindexRoot(t)))}remove(t){this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t),this.rootIndex&&this._unindexRoot(t)}publish(t,e,r){if(!this.batchingEnabled){this.publishImmediate(t,e,r);return}this.suppressQueue||(t===this.deliveringMessage&&(this.reentrantMessages??=new Set).add(t),this.callBacks.has(t)&&(this.updateQueue.set(t,[e,r]),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,r]of t)this.publishImmediate(e,r[0],r[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[r,n]of t)e&&e.has(r)||this.publishImmediate(r,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 r=0;r<e;r++)t[r]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let r=0;r<e;r++)t[r]()}}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 r=e.length;for(let n=0;n<r;n++)e[n]()}})}flushSync(){this.flush()}publishImmediate(t,e,r){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,r)}catch(a){console.error('[DataPubSub] Subscriber error for "'+t+'":',a)}this.deliveringMessage=i}};var le=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new Et,this.pubSub=new U(!0),this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,n){let i=r,o=null,a=r.indexOf(":");a!==-1&&(o=r.substring(0,a),i=r.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,r,n,i){let o=this.getBindId(t),a=new _t(this.pubSub);a.addData(e,r).subscribe(o);let u=`${e.getDataId()}:${r}`;return a.addElement(t,n,i).subscribe(u),this.addConnection(o,"bind",a),a}addConnection(t,e,r){return this.connections.add(t,e,r),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,r,n){if(k.isObject(t)===!1)return this;let i=new pt,o=e.get(r),a=!0,c=f=>{a&&(a=!1,f===o&&(f===null||typeof f!="object"))||n(f)};i.addSource(e).subscribe(r,c);let u=this.getBindId(t),h=e.getDataId()+":"+r;return this.addConnection(u,h,i),n(o),this}watchMany(t,e,r,n){if(k.isObject(t)===!1)return this;let i=r?r.length:0;if(i===0)return this;if(i===1)return this.watch(t,e,r[0],n);let o=new pt,a=o.addSource(e),c=new Array(i),l=new Array(i);for(let m=0;m<i;m++)c[m]=e.get(r[m]),l[m]=!0;let u=new Array(i);for(let m=0;m<i;m++){let x=m,O=c[m];u[m]=J=>{l[x]&&(l[x]=!1,J===O&&(J===null||typeof J!="object"))||n(J)}}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:r[m],token:e.on(r[m],u[m])};a.subscriptions=h;let f=this.getBindId(t),g=e.getDataId()+":"+r.join(",");return this.addConnection(f,g,o),n(c[0]),this}unwatch(t,e,r){if(k.isObject(t)===!1)return this;let n=t[this.attr];if(n){let i=e.getDataId()+":"+r;this.connections.remove(n,i)}return this}publish(t,e,r){return this.pubSub.publish(t,e,r),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,r=this.isDataBound(e);if(r!==null){let n=this.connections.get(r,"bind");if(n){let i=n.element.get();this.pubSub.publish(r,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 le;var ds=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"]]),V=s=>ds.get(s)||s,ue=s=>typeof s=="string"&&s.charCodeAt(0)===111&&s.charCodeAt(1)===110?s.substring(2):s,ps=/(?:<[a-z][\s\S]*>)/i,M=class{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(r,i):this.append(r,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return;let r=e.type;r!==void 0&&t.setAttribute("type",r);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:(ps.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,r){if(r===""||!e)return;if(typeof r==="function")e=ue(e),r.originalCallback?d.add(e,t,r,!1,!0,r.originalCallback):d.add(e,t,r);else{let i=V(e);t[i]=r}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let r=document.createTextNode(t);return e&&this.append(e,r),r}static createComment(t,e){let r=document.createComment(t);return e&&this.append(e,r),r}static setupSelectOptions(t,e,r){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),r!==null&&i.value==r&&(i.selected=!0)})}static removeElementData(t){let e=[t];for(;e.length>0;){let r=e.pop(),n=r.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(r),r.bindId&&b.unbind(r)}}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,r){let n=r||t.firstChild;return t.insertBefore(e,n),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var D=s=>s?s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null:null;var A=class extends M{static create(t,e,r,n){let i=document.createElement(t);return this.addAttributes(i,e,n),r.appendChild(i),i}static addAttributes(t,e,r){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,r)}}static addAttr(t,e,r,n){if(r===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){if(e=ue(e),r.originalCallback)d.add(e,t,r,!1,!0,r.originalCallback);else{let a=r,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,r);return}let o=V(e);t[o]=r}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 ze=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,Ge=new C(1e3),ms=new Set(["disabled","checked","required","selected","hidden","readonly","readOnly","multiple","open","autofocus","inert"]),gs=s=>typeof s=="string"?s!==""&&s!=="false":!!s,ys=(s,t)=>{if(t.charCodeAt(4)===45){s.removeAttribute(t);return}let e=V(t);if(e in s){s[e]="";return}s.removeAttribute(t)},P={isWatching(s){if(Array.isArray(s)){let t=s[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(s)},hasParams(s){return typeof s=="string"&&s.includes("[[")},_getWatcherProps(s){let t=Ge.get(s);if(t!==void 0)return t;let e=s.match(ze),r=e?e.map(n=>n.slice(2,-2)):null;return Ge.set(s,r),r},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.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":s[t==="readonly"?"readOnly":t]=gs(e);break;case"src":if(s.tagName==="IMG"){s.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}s.src=e;break;default:if(e===""&&t){ys(s,t);break}A.addAttr(s,t,e);break}},replaceParams(s,t,e=!1){let r=0;return s.replace(ze,function(n,i,o){let a=e?t[r]:t;r++;let c=a.get(o);return c??""})},_getWatcherCallBack(s,t,e,r,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 ms.has(r)?()=>{this.updateAttr(s,r,a.get(o))}:()=>{let c=a.get(o);this.updateAttr(s,r,c!=null?String(c):"")}}return()=>{let o=this.replaceParams(e,t,n);this.updateAttr(s,r,o)}},getValue(s,t){let e=s.value;return Array.isArray(e)===!1?[e,D(t)]:e.length<2?[e[0],D(t)]:e},getPropValues(s,t,e){let r=[];for(let n=0,i=t.length;n<i;n++){let a=(e?s[n]:s).get(t[n])??"";r.push(a)}return r},getCallBack(s,t,e,r,n,i){let o=s.attr||"textContent",a=s.callBack;if(typeof a=="function"){let c=i||this._getWatcherProps(r)||[],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,r,o,n)},addDataWatcher(s,t,e){let r=this.getValue(t,e),n=r[1]??e?.data??e?.context?.data??e?.state??null;if(!n)return;let i=r[0],o=Array.isArray(n),a=this._getWatcherProps(i);if(!a)return;let c=this.getCallBack(t,s,n,i,o,a);if(!o)a.length>1?b.watchMany(s,n,a,c):this.addWatcher(s,n,a[0],c);else for(let l=0,u=a.length;l<u;l++)this.addWatcher(s,n[l],a[l],c)},getWatcherSettings(s,t=null){if(typeof s=="string")return{attr:t,value:s};if(Array.isArray(s)){let e=s[s.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let r=s[1]&&typeof s[1]=="object"?[s[0],s[1]]:[s[0]];return typeof e=="function"?{attr:t,value:r,callBack:e}:{attr:e||"textContent",value:r}}return s},setup(s,t,e){t&&this.addDataWatcher(s,this.getWatcherSettings(t),e)},addWatcher(s,t,e,r){b.watch(s,t,e,r)}};var bs=s=>({props:{watch:s},children:[]}),xs=s=>{if(s.length===0)return He();let t=s[0],e=typeof t;if(e==="string"||e==="number")return Ue(t);if(Array.isArray(t))return P.isWatching(t)?bs(t):Fe(t);let r=s[1]??s[0]??[];if(r&&Array.isArray(r)&&P.isWatching(r)){let n=s[0]&&!Array.isArray(s[0])?s[0]:{};s[0]={...n,watch:r},s[1]=[]}return We(s)},Ss=s=>(...t)=>{let{props:e,children:r}=xs(t);return s(e,r)};var he=new WeakMap,fe=new WeakMap;function Qe(s){if(!s||typeof s!="object")return s;let t=fe.get(s);return t!==void 0?t:s}var Ke=new WeakMap;function vs(s,t,e,r){let n=he.get(s);n||(n=new Map,he.set(s,n));let i=n.get(e);if(i)return i;let o=new Proxy(s,$e(t,e,r));return n.set(e,o),fe.set(o,s),o}function ks(s){s&&typeof s=="object"&&he.delete(s)}function Ve(s,t){let e=t.charCodeAt(0),r=e>=48&&e<=57;return s===""?r?"["+t+"]":t:r?s+"["+t+"]":s+"."+t}function $e(s,t="",e=""){return{get(r,n,i){let o=r[n];if(t===""&&n in r){if(typeof o=="function"){let c=Ke.get(r);c||(c=new Map,Ke.set(r,c));let l=c.get(n);if(l)return l;let u=o.bind(r);return c.set(n,u),u}return o}if(o=(r[e]||r)[n],o!==null&&typeof o=="object"){let c=Ve(t,n);return vs(o,s,c,e)}return o},set(r,n,i,o){if(t===""&&n in r)return r[n]=i,!0;let c=(r[e]||r)[n],l=Ve(t,n);return s.set(l,i),c!==i&&c!==null&&typeof c=="object"&&ks(c),!0}}}var Lt=(s,t="stage")=>{let e=new Proxy(s,$e(s,"",t));return fe.set(e,s),e};var mt=class{static resume(t,e){if(!t)return null;let r=localStorage.getItem(t);if(r===null)return e!==void 0?e:void 0;try{let n=JSON.parse(r);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 r=JSON.stringify(e);return localStorage.setItem(t,r),!0}catch(r){return console.error('[LocalData] Failed to store data for key "'+t+'".',r),!1}}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Nt=(s={})=>{let t={};if(!k.isObject(s))return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i];typeof o!="function"&&(t[i]=o)}return t};var ws=0,Ye=new C(2e3),F={CHANGE:"change",DELETE:"delete"},de=(s,t)=>{let e=Ye.get(s);return e||(e={change:`${s}:change`,delete:`${s}:delete`},Ye.set(s,e)),t==="change"?e.change:e.delete},R=class s{constructor(t={}){this.dirty=!1,this._retainState=!1,this._refreshState=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=this.createEventSub();let e=Nt(t);this._initAttributes(e);let r=Lt(this);return this._proxy=r,r}retainState(){return this._retainState=!0,this._proxy||this}refreshState(){return this._refreshState=!0,this._proxy||this}setup(){this.stage={}}createEventSub(){return new U}_canSilentInit(){let t=s.prototype;return this.set===t.set&&this._setAttr===t._setAttr&&this._publish===t._publish}_initAttributes(t){if(this._canSilentInit()===!1){this.set(t);return}let e=this.stage,r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n],a=t[o];a!==void 0&&(e[o]=a)}}_init(){let t=++ws;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 r=de(t,F.CHANGE);return this.eventSub.on(r,e)}off(t,e){let r=de(t,F.CHANGE);this.eventSub.off(r,e)}_setAttr(t,e,r=this,n=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,r,F.CHANGE))}publishLocalEvent(t,e,r,n){let i=de(t,n);this.eventSub.publish(i,e,r)}_publish(t,e,r,n){this.publishLocalEvent(t,e,r,n),b.getPrefixMessages(this._dataId)!==null&&(r=r||this,b.publish(this._dataId+t,e,r))}set(t,e,r){if(typeof t!="object")return this._setAttr(t,e,r),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,r)}return this}_silentSet(t){let e=this.stage,r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];e[o]=t[o]}}getModelData(){return this.stage}_deleteAttr(t,e,r=this){delete t[e],this.publishLocalEvent(e,null,r,F.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 r=this.get(t);return this.set(t,r+e),this}decrement(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let r=this.get(t);return this.set(t,r-e),this}concat(t,e){if(typeof t>"u")return this;let r=this.get(t);return this.set(t,r+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=mt.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return mt.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,r){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,r);let n=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,r){let n=r||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,r,n){this.links.set(t,{data:e,attr:r,pair:n})}unlink(t){if(t){this.removeLink(t);return}let e=this.links;e.size!==0&&(e.forEach((r,n)=>{this.removeLink(n,!1)}),e.clear())}removeLink(t,e=!0){let r=this.links.get(t);if(r){let n=r.data;r.attr&&n.off(r.attr,t);let i=r.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 je=new Set(["__proto__","prototype","constructor"]),Cs=s=>{let t=[],e=s.length,r=0;for(let n=0;n<e;n++){let i=s.charCodeAt(n);i!==46&&i!==91&&i!==93||(n>r&&t.push(s.substring(r,n)),r=n+1)}return e>r&&t.push(s.substring(r)),t.length>0?t:null},S={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new C(1e3),hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},isSafeAttr(s){return!je.has(s)},getSegments(s){let t=this.segmentCache.get(s);if(t!==void 0)return t;if(t=Cs(s),t){for(let e=0,r=t.length;e<r;e++)if(je.has(t[e])){console.warn("[Data] Blocked unsafe path segment in: "+s),t=null;break}}return this.segmentCache.set(s,t),t}};var L=class{static set(t,e,r){if(!S.hasDeepData(e)){if(!S.isSafeAttr(e))return;t[e]=r;return}let n,i=S.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]=r;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(!S.hasDeepData(e)){if(!S.isSafeAttr(e))return;delete t[e];return}let r=S.getSegments(e);if(!r)return;let n=r.length,i=n-1;for(let o=0;o<n;o++){let a=r[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(!S.hasDeepData(e))return t[e]??void 0;let r=S.getSegments(e);if(!r)return;let n=r.length,i=n-1;for(let o=0;o<n;o++){let a=r[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===i)return t}}};var Je=new Set,Bt=class{static MAX_DEPTH=50;static publishDeep(t,e,r,n){if(!S.hasDeepData(e)){this.publish(e,r,n);return}let i,o=S.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=r;else{let m=o[u+1],x=m.charCodeAt(0);if(x>=48&&x<=57){l+="["+m+"]";continue}let O={};O[m]=t[m],g=O}this.publish(l,g,n)}}static publish(t,e,r,n=null,i=0){if(t=t||"",r(t,e),!(!e||typeof e!="object"||(e=Qe(e),n===null&&(Je.clear(),n=Je),!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,r,n,i):this.publishObject(t,e,r,n,i)}}static publishArray(t,e,r,n,i){let o=e.length;for(let a=0;a<o;a++){let c=e[a],l=t+"["+a+"]";this._checkPublish(l,c,r,n,i)}}static publishObject(t,e,r,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,r,n,i)}}static _checkPublish(t,e,r,n,i){if(!e||typeof e!="object"){r(t,e);return}this.publish(t,e,r,n,i+1)}};var W=class s extends R{setup(){this.attributes={},this.stage={}}createEventSub(){return new U(!1,!0)}_canSilentInit(){let t=s.prototype;return this.set===R.prototype.set&&this._setAttr===t._setAttr&&this._publish===t._publish}_initAttributes(t){if(this._canSilentInit()===!1){this.set(t);return}let e=this.stage,r=this.attributes,n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];if(c!==void 0){if(S.hasDeepData(a)){L.set(r,a,c),L.set(e,a,c);continue}S.isSafeAttr(a)&&(r[a]=c,e[a]=c)}}}_setAttr(t,e,r,n){if(typeof e!="object"&&e===this.get(t))return;!r&&n!==!0?L.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),L.set(this.stage,t,e);let i=this._upstream,o=r;r=r||this,this._publish(t,e,r,F.CHANGE),i&&o!==i.data&&i.keys.has(t)&&i.data.set(i.prefix+t,e,this)}_silentSet(t){let e=this.stage,r=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,r[a]=c}}linkAttr(t,e){let r=t.get(e);if(!r)return;let n=Object.keys(r);for(let i=0,o=n.length;i<o;i++){let a=n[i];this.link(t,e+"."+a,a)}}scope(t,e){let r=this.get(t);if(!r)return!1;e=e||this.constructor;let n=new e(r);return typeof n.linkScope=="function"?n.linkScope(this,t):n.linkAttr(this,t),n}linkScope(t,e){let r=t.get(e);if(!r)return;let n=e+".",i=new Set(Object.keys(r));for(let o of i){let a=n+o,c=t.on(a,(l,u)=>{if(u===this)return!1;this.set(o,l,t)});this.addLink(c,t,a,null)}this._upstream={data:t,prefix:n,keys:i}}unlink(t){t||(this._upstream=null),super.unlink(t)}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.push(e),this.set(t,r),this}concat(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r=r.concat(e),this.set(t,r),this}unshift(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.unshift(e),this.set(t,r),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.shift();return this.set(t,e),r}getIndex(t,e,r){let n=this.get(t);return Array.isArray(n)===!1?-1:typeof n[0]!="object"?n.indexOf(e):n.findIndex(o=>o[e]===r)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.pop();return this.set(t,e),r}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,r,n){if(this._publishAttr(t,e,r,n),!e||typeof e!="object")return;let i=t.length,o=n===F.CHANGE?":change":":"+n,a=o.length,c=i+a,l=this.eventSub.getRootMessages(Ot(t))||[];for(let h of l){if(h.length<=c||!h.endsWith(o)||!h.startsWith(t))continue;let f=h.charCodeAt(i);if(f!==46&&f!==91)continue;let g=h.slice(0,h.length-a);this._publishAttr(g,this.get(g),r,n)}let u=b.getPrefixMessages(this._dataId);if(u){let h=this._dataId.length;for(let f of u){if(f.length-h<=i||!f.startsWith(t,h))continue;let m=f.charCodeAt(h+i);if(m!==46&&m!==91)continue;let x=f.slice(h);b.publish(f,this.get(x),r)}}}_publishAttr(t,e,r,n){b.getPrefixMessages(this._dataId)!==null&&b.publish(this._dataId+t,e,r),this.publishLocalEvent(t,e,r,n)}mergeStage(){this.attributes=v.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,r=this){L.delete(t,e),this._delCommitter=r;let n=this._deleteCb||(this._deleteCb=i=>this._publishAttr(i,null,this._delCommitter,F.DELETE));Bt.publish(e,null,n)}_getAttr(t,e){return L.get(t,e)}};var As={"\n":"\\n","\r":"\\n"," ":"\\t"},Ts=(s,t)=>{typeof s!="string"&&(s=String(s));let e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>As[r])},Xe=(s,t)=>{if(typeof s!="string")return s;s=Ts(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},pe=(s,t)=>{let e=typeof s;if(e==="undefined")return s;if(e!=="object")return s=Xe(s),s;let r=Array.isArray(s)?[...s]:{...s};return Object.keys(r).forEach(n=>{let i=r[n];i!==null&&(r[n]=typeof i=="string"?pe(i,t):Xe(i,t))}),r};function Ze(s){if(typeof s>"u"||s.length<1)return!1;try{return JSON.parse(s)}catch(t){return console.warn("[Encode] Failed to parse JSON.",t),!1}}function me(s){return typeof s<"u"?JSON.stringify(s):null}var gt=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?v.clone(t):t,n=pe(r,e);return me(n)}static json={encode:me,decode:Ze};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var Ht=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 r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r+"="+t[r]);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 r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.append(r,e[r]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let r=this.model.get("id"),n="id="+r,i=r?`/${r}`:"",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+"="+gt.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._put(i,r,t,e)}add(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._post(i,r,t,e)}update(t,e){if(!this.isValid())return;let r=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._patch(i,r,t,e)}delete(t,e){let r=this.model.get("id"),n=typeof r<"u"?"id="+r:this.setupObjectData(),i=r!=null?`/${r}`:"";return this._delete(i,n,t,e)}getAllParams(t,e,r,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 r<"u"&&r!==null?encodeURIComponent(r):"")+"&since="+(typeof n<"u"&&n!==null?encodeURIComponent(n):"")}all(t,e,r,n,i=null,o=null){let a=this.getAllParams(r,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 r=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(r)}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,r,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:r,completed:a},l=this._isFormData(r);if(l&&(c.headers={}),!o)return dt(c);o.invalidate&&(c.completed=(h,f)=>{h!==!1&&h!=null&&Pt.invalidate(o.invalidate),a(h,f)});let u=o.cache;return!u||!this.isCacheableMethod(e)||l?dt(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 r=e.key||this.getCacheKey(t),n=t.completed,i=o=>dt({...t,completed:(a,c)=>o(a!=null,a,c),failed:(a,c)=>o(!1,!1,c),aborted:(a,c)=>o(!1,!1,c)});return Pt.resolve(r,i,{ttl:e.ttl,swr:e.swr},(o,a)=>n(o,a))}setupEventSource(t,e,r,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 O=JSON.parse(x.data);r&&r(O)}catch{}}};return f(),{get source(){return o},close:()=>{if(c=!0,l=!1,u(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return P.isWatching(t)&&(t=P.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,r,n,i){return this._request("","POST",t,e,r,n,i)}_get(t,e,r,n,i,o){return e=this.setupParams(e),e=this.addParams(e,r),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",n,i,o)}_post(t,e,r,n,i,o){return this._request(t,"POST",e,r,n,i,o)}_put(t,e,r,n,i,o){return this._request(t,"PUT",e,r,n,i,o)}_patch(t,e,r,n,i,o){return this._request(t,"PATCH",e,r,n,i,o)}_delete(t,e,r,n,i,o){return this._request(t,"DELETE",e,r,n,i,o)}_request(t,e,r,n,i,o,a){return r=this.setupParams(r),r=this.addParams(r,n),this.setupRequest(t,e,r,i,o,a)}getResponse(t,e,r){typeof e=="function"&&e(t,r)}static extend(t){if(!t)return{};let e=this;class r extends e{constructor(i){super(i)}}return Object.assign(r.prototype,t),r}};var Ps=s=>{let t={};if(!k.isObject(s)||!s.defaults)return t;let{defaults:e}=s;return Object.keys(e).forEach(r=>{let n=e[r];typeof n!="function"&&(t[r]=n)}),delete s.defaults,t},Es=s=>{if(!s||typeof s.xhr!="object")return{};let t={...s.xhr};return delete s.xhr,t},Ms=0,yt=class extends W{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,r=Es(t),n=e.prototype.service.extend(r),i=Ps(t);class o extends e{constructor(c){let l={...i,...Nt(c)};super(l),this.xhr=new n(this)}dataTypeId=`bm${Ms++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};yt.prototype.service=Ht;var rt=class extends R{};var bt=class extends rt{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 r=this.stage;return typeof r[t]<"u"&&delete r[t],this}};var Ut=class extends bt{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 Ut(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 r=this.targets.get(t);r&&(r.remove(),this.targets.delete(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,r){let n=this.getTarget(t);return e&&n.addAction(e,r),n}static addAction(t,e,r){return this.add(t,e,r)}static removeAction(t,e,r){if(r){this.off(t,e,r);return}let n=this.getTarget(t);n&&e&&n.removeAction(e)}static on(t,e,r){let n=this.getTarget(t);return e?n.on(e,r):null}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let n=this.targets,i=n.get(t);if(i){if(e){i.off(e,r);return}this.targets.delete(t),this.ownerCounts.delete(t)}}static set(t,e,r){this.getTarget(t).set(e,r)}};var st=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 n=r.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 r=t.setData();if(!r){t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let n=e._retainState||r._retainState,i=!n&&(e._refreshState||r._refreshState),o=this._buildExternalUpdates(e.stage,r.stage,n,i);v.isEmpty(o)||r._silentSet(o)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,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];!r&&a==null||a!==e[o]&&(i[o]=a)}return i}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 n=e._refreshState||t.data._refreshState,i=this._buildOwnedUpdates(e.stage,t.data.stage,n);v.isEmpty(i)||t.data._silentSet(i)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(r){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 Ft=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let n=t[r];this.on(n[0],n[1],n[2],n[3])}}on(t,e,r,n){d.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){d.off(t,e,r,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===r&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];d.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];d.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var Wt=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,n){return{action:t,state:e,callBack:r,targetId:n,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 n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){for(let r=0,n=t.length;r<n;r++){let i=t[r];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 r=0,n=e.length;r<n;r++){let i=e[r];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,n=e.length;r<n;r++){let i=e[r];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 r=this.remoteStates;if(r)for(let n=0,i=r.length;n<i;n++){let o=r[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,r){let n=I.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=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,r.push(o))}}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=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)),r||null}};var E=[],qt=0,ge=!1,Ds=typeof queueMicrotask=="function"?queueMicrotask:s=>Promise.resolve().then(s),Rs=s=>{let t=s.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||s.container||null},Is=s=>{s._mountPending=!1;try{s.afterMount()}catch(t){console.error("Error in afterMount:",t)}},tr=()=>{ge=!1;let s=E;if(s.length===0)return;E=[];let t=[];for(let e=0,r=s.length;e<r;e++){let n=s[e];if(n.rendered!==!0||n._mountPending!==!0){n._mountPending=!1;continue}let i=Rs(n);if(i&&i.isConnected===!0){Is(n);continue}t.push(n)}t.length&&(E=E.length?t.concat(E):t),E.length&&qt===0&&E.length!==t.length&&ye()},ye=()=>{ge||(ge=!0,Ds(tr))},_={add(s){s._mountPending!==!0&&(s._mountPending=!0,E.push(s))},enter(){qt++},leave(){--qt>0||(qt=0,E.length&&ye())},schedule(){E.length&&ye()},flush(){tr()},get size(){return E.length}};p.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken,t),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var _s=0,xt=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 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-"+_s++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,n;r!=null&&e!=null?n="pk:"+r+":"+e:r!=null?n="pk:"+r: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 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(){p.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout(),typeof this.afterMount=="function"&&_.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 n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return M.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&&M.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 T=class extends xt{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){st.resume(this,t)}_refreshData(){st.refresh(this)}_refreshContextData(){st.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();v.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Wt(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 Ft)}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 zt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},Gt=(s,t)=>typeof s!="function"&&t==="setupStates"?()=>s:s;var be=(s,t)=>{if(!s)return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=zt[i]||i;t[a]=Gt(o,a)}return t},Os=s=>be(s,{}),Ls=0,er=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Ls++,e},Q=(s,t=T)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=Os(s),er(t,e)):(e={render:r==="function"?s:()=>s},er(t,e))};var Ns=(s,t)=>{let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=zt[i]||i;t.prototype[a]=Gt(o,a)}return t},Bs=0,Hs=s=>{let t=class extends s{};return t.prototype._classId="pod"+Bs++,t},Us=(s,t=T)=>{if(!s)return null;let e=Hs(t),r={},n=s(r);return Ns(r,e),e.prototype.render=n,e};var rr=new Map,$=()=>typeof Intl<"u"&&typeof Intl.DateTimeFormat=="function",Y=(s,t,e)=>{let r=rr.get(s);return r||(r=new Intl.DateTimeFormat(t,e),rr.set(s,r)),r},St=s=>s instanceof Date&&!Number.isNaN(s.getTime()),Fs=/(?:Z|[+-]\d{2}:?\d{2})$/i,Ws=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3})\d*)?)?)?$/,qs=s=>{if(typeof s=="string"){let e=Ws.exec(s.trim());if(e){let r=e[7]?Number((e[7]+"00").substring(0,3)):0;return[Number(e[1]),Number(e[2]),Number(e[3]),Number(e[4]||0),Number(e[5]||0),Number(e[6]||0),r]}}let t=new Date(s);return St(t)?[t.getFullYear(),t.getMonth()+1,t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()]:null},sr=(s,t)=>{let e=Y("zone|"+t,"en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),r={year:0,month:1,day:1,hour:0,minute:0,second:0},n=e.formatToParts(s);for(let c=0,l=n.length;c<l;c++){let u=n[c];u.type in r&&(r[u.type]=Number(u.value))}let i=r.hour===24?0:r.hour,o=Date.UTC(r.year,r.month-1,r.day,i,r.minute,r.second),a=s-(s%1e3+1e3)%1e3;return o-a},zs=[31,28,31,30,31,30,31,31,30,31,30,31],Gs={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(s=new Date().getDay(),t=!1){if($()){let n=new Date(2004,0,4+s),i=t?"short":"long";return Y("weekday|"+i,void 0,{weekday:i}).format(n)}let e=this.dayNames;if(s<0||s>=e.length)return null;let r=e[s];return t?r.substring(0,3):r},convertJsMonth(s){return this.padNumber(s+1)},convertDate(s,t=!1){if(!s)return"";let e=this.createDate(s);if(!St(e))return"";if($()){let n={weekday:"long",month:"short",day:"2-digit"};return t&&(n.year="numeric"),Y("convert|"+(t?1:0),void 0,n).format(e)}let r=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+r},padNumber(s){return s<=9?"0"+s:String(s)},createDate(s){return s?(typeof s=="string"&&s.indexOf("-")>-1&&(s=s.replace(/\s/,"T"),s=s.indexOf(":")>-1?s:s+"T00:00:00"),new Date(s)):new Date},format(s,t){let e=this.createDate(t);return St(e)?s!=="sql"&&$()?Y("date",void 0,{year:"numeric",month:"2-digit",day:"2-digit"}).format(e):this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),s):""},formatTime(s,t){let e=this.createDate(s);if(!St(e))return"";if(t!==24&&$())return Y("time",void 0,{hour:"numeric",minute:"2-digit",hour12:!0}).format(e);let r=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),r)},getMeridian(s){return s=Number(s),s>=12?"PM":"AM"},convert24To12(s){return s=Number(s),s%12||12},convert12To24(s,t){return s=Number(s)%12,String(t||"").toLowerCase()==="pm"&&(s=s+12),s},renderDate(s,t,e,r="sql"){return t=Number(t),e=Number(e),r==="sql"?`${s}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${s}`},renderTime(s,t,e=0,r="sql"){if(r==="sql")return`${this.padNumber(s)}:${this.padNumber(t)}:${this.padNumber(e)}`;let n=this.getMeridian(s);return s=this.convert24To12(s),`${s}:${this.padNumber(t)} ${n}`},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=!1){if($()){let n=new Date(2e3,s,1),i=t?"short":"long";return Y("month|"+i,void 0,{month:i}).format(n)}let e=this.monthNames;if(s<0||s>=e.length)return"";let r=e[s];return r?t?r.substring(0,3):r:""},getMonthLength(s,t){let e=new Date;return s=typeof s<"u"?s:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[s]},getMonthsLength(s=new Date().getFullYear()){let t=zs.slice();return this.leapYear(s)===!0&&(t[1]=29),t},getLocalDate(s,t="America/Denver"){if(typeof s=="string"&&s.indexOf("-")>-1&&Fs.test(s.trim()))return new Date(s.trim());let e=qs(s);if(!e)return new Date(NaN);let[r,n,i,o,a,c,l]=e;if(!$())return new Date(r,n-1,i,o,a,c,l);let u=Date.UTC(r,n-1,i,o,a,c,l);try{let h=sr(u,t),f=u-h,g=sr(f,t);return g!==h&&(f=u-g),new Date(f)}catch{return new Date(r,n-1,i,o,a,c,l)}},getLocalTime(s,t=!1,e=!1,r="America/Denver"){if(!s)return"";let n=this.getLocalDate(s,r);if(!St(n))return"";if(!t&&$()){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"),Y("local|"+(e?1:0),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(s,t=!1){let e=this.createDate(s),r=new Date;return t===!0&&r.setHours(0,0,0,0),r.getTime()-e.getTime()},getAge(s){let t=this.getDiffFromNow(s),e=(r,n)=>r+" "+n+(r===1?"":"s");return t<864e5?"1 day":t<6048e5?e(this.toDays(t),"day"):t<12096e5?"1 week":t<2592e6?e(Math.floor(this.toDays(t)/7),"week"):t<5184e6?"1 month":t<31104e6?e(this.toMonths(t),"month"):e(Math.max(1,this.toYears(t)),"year")},getTimeFrame(s){let t=this.getDiffFromNow(s);return this.convertToEstimate(t)},convertToEstimate(s){let t="",e,r,n,i,o,a,c;if(s<=0)switch(!0){case s<-63072e6:n=this.toYears(Math.abs(s)),t="in "+n+"y";break;case s<-31536e6:t="in 1y";break;case s<-5184e6:i=this.toMonths(Math.abs(s)),t="in "+i+"mo";break;case s<-2592e6:t="in 1mo";break;case s<-12096e5:e=this.toDays(Math.abs(s)),r=Math.floor(e/7),t="in "+r+"w";break;case s<-6048e5:t="in 1w";break;case s<-1728e5:e=this.toDays(Math.abs(s)),t="in "+e+"d";break;case s<-864e5:t="tomorrow";break;case s<-72e5:o=this.toHours(Math.abs(s)),t="in "+o+"h";break;case s<=-36e5:t="in 1h";break;case s<-12e4:a=this.toMinutes(Math.abs(s)),t="in "+a+"m";break;case s<-6e4:t="in 1m";break;case s<-2e3:c=this.toSeconds(Math.abs(s)),t="in "+c+"s";break;case s<-1:t="in 1s";break;default:t="now"}else switch(!0){case s<1e3:t="1s ago";break;case s<6e4:c=this.toSeconds(s),t=c+"s ago";break;case s<12e4:t="1m ago";break;case s<36e5:a=this.toMinutes(s),t=a+"m ago";break;case s<72e5:t="1h ago";break;case s<864e5:o=this.toHours(s),t=o+"h ago";break;case s<1728e5:t="yesterday";break;case s<6048e5:e=this.toDays(s),t=e+"d ago";break;case s<12096e5:t="1w ago";break;case s<2592e6:e=this.toDays(s),r=Math.floor(e/7),t=r+"w ago";break;case s<5184e6:t="1mo ago";break;case s<31536e6:i=this.toMonths(s),t=i+"mo ago";break;case s<63072e6:t="1y ago";break;default:n=this.toYears(s),t=n+"y ago"}return t},toYears(s){return typeof s!="number"?0:Math.floor(s/(1e3*60*60*24*365.26))},toMonths(s){return typeof s=="number"?Math.floor(s/(1e3*60*60*24*30)):0},toDays(s){return typeof s!="number"?0:Math.floor(s/(3600*1e3*24))},toHours(s){return typeof s!="number"?0:Math.floor(s%(3600*1e3*24)/(3600*1e3))},toMinutes(s){return typeof s!="number"?0:Math.floor(s%(3600*1e3)/(60*1e3))},toSeconds(s){return typeof s!="number"?0:Math.floor(s%(60*1e3)/1e3)},getDifference(s,t){let e=this.createDate(s),r=this.createDate(t),n=r.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 nt={items:new Map,add(s,t){return this.items.set(s,t),this},get(s){return this.items.get(s)??null}};var xe=(s,t)=>({attr:s,directive:t});var N=(s,t)=>({key:s,value:t});var nr=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var ir=null,Ks=()=>ir||(ir=nt.get("watch")),q=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,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(N("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(xe(N(e,P.getWatcherSettings(r,V(e))),Ks()))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(N("type",n))}}static parse(t,e){let r=[],n=[],i=t.tag||"div";i==="button"&&r.push(N("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=nt.get(l))!==null){n.push(xe(N(l,a),c));continue}let u=typeof a;if(u==="object"){if(P.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,r.push(N(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"){r.push(N("innerHTML",a));continue}r.push(N(l,a))}return nr(i,r,n,o)}};var it=class{build(t,e,r){}setupComponent(t,e,r){let n=r?.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(),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 Vs=s=>{for(let e in s)if(e!=="tag"&&e!=="textContent")return!1;let t=s.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},Kt=class extends it{build(t,e,r){let n=A.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}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"&&Vs(t)){let l=t.textContent;A.createText(l??"",e);return}let n=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=q.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,r);let a=i.children;for(let l=0,u=a.length;l<u;l++){let h=a[l];h!==null&&this.buildElement(h,o,r)}let c=i.directives;c.length&&this.setDirectives(o,c,n)}createTempComponent(t,e,r){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...be(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 T(n);this.createComponent(i,e,r)}setDirectives(t,e,r){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],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 n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return A.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return A.createComment(o,e)}return A.create(n,t.attr,e,r)}removeNode(t){A.removeElement(t)}removeAll(t){A.removeAll(t)}};var Qs=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),$s=/[&<>"]/,Se=s=>{let t=typeof s=="string"?s:String(s);return $s.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t},ot=class{static create(t,e=[],r=""){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+=Se(u);continue}if(l==="html"||l==="innerHTML"){n+=u;continue}if(typeof u=="function")continue;let h=l+'="'+Se(u)+'"';i?i+=" "+h:i=h}return Qs.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+r+"</"+t+">"}static createText(t){return Se(t)}static createComment(t){return"<!-- "+t+" -->"}};var Vt=class extends it{build(t,e,r){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],r);return n}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=q.parse(t,e),n=r.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(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return ot.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return ot.createComment(i)}return ot.create(r,t.attr,e)}removeAll(t){}};var Qt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Kt:new Vt}};var j=Qt.setup(),Ys=s=>typeof s=="object"&&s.isUnit===!0,or=new WeakMap,js=s=>{let t=or.get(s);if(!t){if(t=Q(s),!t)return null;or.set(s,t)}return new t},y=class{static render(t,e,r){if(!t||(Ys(t)||(t=js(t)),!t))return null;_.enter();try{return j.createComponent(t,e,r)}finally{_.leave()}}static build(t,e,r){_.enter();try{return j.build(t,e,r)}finally{_.leave()}}static rebuild(t,e,r){return j.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){j.setDirectives(t,e,r)}static createNode(t,e,r){return j.createNode(t,e,r)}static removeNode(t){j.removeNode(t)}static removeAll(t){j.removeAll(t)}};H.augment({buildLayout(s,t,e){y.build(s,t,e)}});var ve=[],Js=s=>ve.indexOf(s)!==-1,Xs=s=>({tag:"script",src:s.src,async:!1,load(t){ve.push(s.src);let e=s.load;e&&e()}}),Zs=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){ve.push(s.src);let e=s.load;e&&e()}}),$t=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=Zs({load:r,src:t}):e=Xs({load:r,src:t}),y.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Js(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 tn=s=>s?typeof s?.prototype?.constructor=="function":!1,z=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(tn(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 n=y.build(t,null,r),i=Array.from(n.childNodes);return i.length===0&&t?.panel&&i.push(t.panel),e.after(n),i}};var Yt=class{static load(t,e,r){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),r&&r(n)})}};var en=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),G=new C(100),ar=s=>{if(G.has(s)){let r=G.get(s);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof s,e;if(t==="string")e=import(s);else if(t==="function")e=s();else return s;return e.then(r=>{G.set(s,r)}).catch(()=>{G.delete(s)}),G.set(s,e),e},cr=s=>{if(!G.has(s))return null;let t=G.get(s);return t&&typeof t.then=="function"?null:t||null},we=s=>{let t=typeof s;if(t!=="string"&&t!=="function")return null;if(cr(s))return Promise.resolve(G.get(s));let e;try{e=ar(s)}catch{return null}return e.catch(()=>null)},ke=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&y.removeNode(r)}},lr=Q({declareProps(){this.loaded=!1,this.errorRoot=null,this.loadingRoots=null,this.generation=0},render(){return en({onCreated:s=>{if(this.src){if(this.layout){this.setLayoutRoots(z.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){this.renderLoading(s),new $t(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){let t=this.generation,e=cr(this.src);if(e){this.renderModule(s,e);return}this.renderLoading(s),Yt.load(ar(this.src),r=>{t===this.generation&&this.renderModule(s,r)},r=>{t===this.generation&&(this.loaded=!1,this.removeLoadingLayout(),this.renderError(s,r))})},renderLoading(s){let t=this.loading;if(!t||this.loadingRoots)return;let e=typeof t=="function"?t():t;e&&(this.loadingRoots=z.renderNodes(e,s,this.parent))},removeLoadingLayout(){let s=this.loadingRoots;return s?(this.loadingRoots=null,ke(s),!0):!1},renderError(s,t){let e=()=>this.retry(s),r=this.fallback,n=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(!n)return;let i=z.renderNodes(n,s,this.parent);this.errorRoots=i,this.errorRoot=i[0]||null},setLayoutRoots(s){this.layoutRoots=s,this.layoutRoot=s[0]||null},retry(s){this.removeErrorLayout(),this.loadAndRender(s)},removeErrorLayout(){this.errorRoot&&(ke(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(s,t){this.loaded=!0;let e=this.layout||z.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(z.renderNodes(e,s,this.parent)),this.removeLoadingLayout()&&typeof this.onReplaceLoading=="function"&&this.onReplaceLoading(this.layoutRoots,e),typeof this.onModuleRender=="function"&&this.onModuleRender(e)},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},destroy(){this.generation++,this.removeErrorLayout(),this.removeLoadingLayout(),this.layoutRoot&&(ke(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Ce=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new lr(s)};var ur=(s,t,e=null)=>{if(!s)return;let r=null,n=!1,i=()=>{n||(n=!0,r&&(clearTimeout(r),r=null),d.off("animationend",s,o),s&&s.classList.remove(t),e&&e())},o=c=>{c.target===s&&i()};d.on("animationend",s,o),s.classList.add(t);let a=()=>{if(!n)try{let c=window.getComputedStyle(s),l=parseFloat(c.animationDuration)*1e3||1e3,u=parseFloat(c.animationDelay)*1e3||0;r=setTimeout(i,l+u+100)}catch{r=setTimeout(i,1e3)}};if(typeof requestAnimationFrame>"u"){r=setTimeout(i,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(a))},hr=(s,t,e)=>{ur(s,t)},fr=(s,t,e)=>{let r=()=>{s&&s.remove&&s.remove()};rn(s,()=>ur(s,t,r),e)};p.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var rn=(s,t,e)=>{p.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var vt=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&vt(s,t,n,r)});return}sn(s,t,e,r)},sn=(s,t,e,r)=>{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.',s,t);return}let o=nn(s,n,i,r);b.watch(s,t,n,o)},nn=(s,t,e,r)=>typeof e=="object"?n=>{cn(s,e,n)}:n=>{an(s,e,t,n,r)},dr=new WeakSet,on=(s,t,e)=>{!s||!s.isUnit&&!s.isComponent||dr.has(e)||dr.add(e)},an=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(i===null)break;on(i,e,s),y.rebuild(i,s,n);break;case"string":let o=Rt(s);if(o!=="textContent"){s.setAttribute(o,i);break}M.addHtml(s,i);break}},cn=(s,t,e)=>{let r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];o&&(t[o]===e?s.classList.add(o):s.classList.remove(o))}};var at=(s,t,e)=>{let r=D(e);vt(s,r,t,e)};var pr=(s,t,e)=>{t&&s.setAttribute("role",t)},ln=s=>(t,e)=>{let r=t?"true":"false";e.setAttribute(s,r)},mr=(s,t,e)=>{if(!t)return;let r=t.role;r&&(s.setAttribute("role",r),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(ln(l)),at(s,u,e)}else s.setAttribute(l,c)}};var gr=(s,t,e)=>{if(!t)return;let r=q.parse(t,e);A.addAttributes(s,r.attr,e),y.setDirectives(s,r.directives,e)};p.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var Ae=s=>s?s.getContext():null,yr=(s,t,e)=>{if(typeof t!="function")return;let r=Ae(e),n=t(r);gr(s,n,e)},br=(s,t,e)=>{if(typeof t!="function")return;let r=Ae(e);t(r)},xr=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=Ae(e),n=t(r);if(!n)return;let i=n[0];i&&(e.addContextBranch(i,n[1]),un(s,i,e))},un=(s,t,e)=>{p.add(s,"context",{branch:t,parent:e})};var Sr=(s,t,e)=>{};var vr=(s,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",s),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var kr=(s,t,e)=>{},wr=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&y.build(r,s,e)},Cr=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Ar=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&y.build(r,s,e)},Tr=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&y.build(r,s,e)},Pr=(s,t,e)=>{if(!t||!e)return;let r=e.state,n=t(r);if(!e.state){e.setStateHelper(n);return}e.addState(n)},Er=(s,t,e)=>{if(!t||!e)return;e.events||e.setEventHelper();let r=t[2];if(r){let n=r;r=i=>{n(i,e)}}e.events.on(t[0],t[1],r,t[3])};var Mr=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=D(e),!r)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=D(e);if(!o)return;r=o,n=t[0],i=t[1]}else[r,n,i]=t;b.bind(s,r,n,i)};var jt=(s,t,e)=>{vt(s,e.state,t,e)};var Dr=s=>(t,e)=>{let[r,n,i="active"]=s,o=t===n?i:"";e.dataset[r]=o},Rr=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(Dr(n)),at(s,i,e)},Ir=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(Dr(n)),jt(s,i,e)};var _r=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&r.remove()}s.length=0};p.addType("forScopes",s=>{if(!s)return!1;_r(s.scopes)});var Or=(s,t,e)=>{let r,n,i,o;if(typeof t[0]=="string"||t.length<3){let u=D(e);if(!u)return;r=u,[n,i,o]=t}else[r,n,i,o]=t;let a=o!==!1,c=n+"[",l=a?{scopes:[]}:null;l&&p.add(s,"forScopes",l),b.watch(s,r,n,u=>{if(y.removeAll(s),l&&_r(l.scopes),!u||u.length<1)return;let h=[];for(let f=0,g=u.length;f<g;f++){let m=a?r.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,s,e)})};var Lr=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];for(let o=0,a=r.length;o<a;o++){let c=r[o];if(!c)continue;let l=n(c,o);l!==null&&i.push(l)}y.build(i,s,e)};var Nr=(s,t,e)=>{t(s,e)};p.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var Br=(s,t,e)=>{hn(s,t,e)},hn=(s,t,e)=>{p.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var Hr=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,n=t.length;r<n;r++)P.setup(s,t[r],e);else P.setup(s,t,e)};var fn=0,ct=class{constructor(t){this.router=t,this.locationId="base-app-router-"+fn++,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 dn=0,pn=()=>Date.now().toString(36)+"-"+(dn++).toString(36)+"-"+Math.random().toString(36).substring(2,8),Fr=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Ur=()=>{Fr&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let s=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(s,t)}))},Jt=class extends ct{constructor(t){super(t),this.currentKey=null,this.positions=new C(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"),Fr&&(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&&Ur()}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 n=r&&this.positions.get(r)||e.scrollPosition,i=this.router;i.checkActiveRoutes(e.uri,!!n),n&&(typeof i.restoreScrollPosition=="function"?i.restoreScrollPosition(n):this.scrollTo(n)),Ur()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:pn(),scrollPosition:r,uri:t}}addState(t,e,r=!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;!r&&i&&i.location===this.locationId&&(i.scrollPosition=this.saveCurrentPosition(),n.replaceState(i,"",window.location.href));let o=this.createState(t,e);return r||(o.scrollPosition={x:0,y:0}),n[r===!1?"pushState":"replaceState"](o,null,t),this.currentKey=o.key,this.positions.set(o.key,o.scrollPosition),this}};var Xt={removeSlashes(s){return typeof s!="string"?"":(s[0]==="/"&&(s=s.substring(1)),s[s.length-1]==="/"&&(s=s.substring(0,s.length-1)),s)},getHashUri(s){if(typeof s!="string")return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)}};var Zt=class extends ct{addEvent(){return d.on("hashchange",window,this.callBack),this}removeEvent(){return d.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(Xt.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var te=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Jt(t).setup():new Zt(t).setup()}};var Te=5,mn=200,ee=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new C(mn),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMode(){let t=this.owner;return t!==null&&t.keepAliveMode==="hide"?"hide":"detach"}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:Te}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 Pe=class extends T{getChildScope(){return this.parent}},Wr=s=>Q(s,Pe);var Ee="data-scroll-key",gn="["+Ee+"]",yn="[data-route-dormant]",qr=s=>typeof s.closest=="function"&&s.closest(yn)!==null,zr=(s,t)=>{for(let e=0,r=s.length;e<r;e++){let n=s[e];if(!n||n.nodeType!==1||qr(n))continue;let i=n.getAttribute(Ee);i!==null&&t(n,i);let o=n.querySelectorAll(gn);for(let a=0,c=o.length;a<c;a++){let l=o[a];qr(l)||t(l,l.getAttribute(Ee))}}},Me=s=>{let t=null;return zr(s,(e,r)=>{let n=e.scrollTop||0,i=e.scrollLeft||0;n===0&&i===0||(t=t||{},t[r]=[n,i])}),t},re=(s,t)=>{if(!t)return!0;let e={},r=0;for(let n in t)e[n]=!0,r++;return zr(s,(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,r--)}),r<=0};var bn=s=>{for(let t=0;t<s.length;t++){let e=s[t],r=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(r)||r.length===0)continue;let n=[];for(let i=0,o=r.length;i<o;i++){let a=r[i];a&&s.indexOf(a)===-1&&n.indexOf(a)===-1&&n.push(a)}s.splice(t+1,0,...n)}},kt="data-route-dormant",se=[["content-visibility","hidden"],["position","absolute"],["top","0"],["left","0"],["width","100%"]],xn=s=>{let t=s.style,e=[];for(let r=0,n=se.length;r<n;r++){let[i,o]=se[r];e.push([i,t.getPropertyValue(i),t.getPropertyPriority(i)]),t.setProperty(i,o,"important")}return e.push(["aria-hidden",s.getAttribute("aria-hidden")]),s.setAttribute("aria-hidden","true"),s.setAttribute(kt,""),s.inert=!0,e},Sn=(s,t)=>{let e=s.style,r=t||[];for(let i=0,o=se.length;i<o;i++){let a=se[i][0],c=r.find(l=>l[0]===a);c&&c[1]?e.setProperty(a,c[1],c[2]||""):e.removeProperty(a)}let n=r.find(i=>i[0]==="aria-hidden");n&&n[1]!==null?s.setAttribute("aria-hidden",n[1]):s.removeAttribute("aria-hidden"),s.removeAttribute(kt),s.inert=!1},vn=s=>/^class[\s{]/.test(Function.prototype.toString.call(s)),kn=1500,Gr=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),wn=s=>{let t=s.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},De=(s,t,e)=>{if(!(!s||typeof s[t]!="function"))try{s[t](...e)}catch(r){console.error("Error in "+t+":",r)}},ne=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.keepAliveMode=e.keepAliveMode==="hide"||e.keepAliveMode==="detach"?e.keepAliveMode:null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.capturedScroll=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()}getKeepAliveMode(t){if(this.keepAliveMode!==null)return this.keepAliveMode;if(t=t||this.component,t){let r=t.keepAliveMode;if(r==="hide"||r==="detach")return r;let n=t.layout;if(n&&n.isUnit===!0&&(n.keepAliveMode==="hide"||n.keepAliveMode==="detach"))return n.keepAliveMode}let e=this.pageCache;return e!==null&&typeof e.getMode=="function"?e.getMode():"detach"}isDetached(){return this.detachedNodes!==null}captureScroll(){let t=this.component;if(this.setup!==!0||!t||t.rendered!==!0){this.capturedScroll=null;return}this.capturedScroll={value:Me(this.getRootNodes(t))}}releaseCapturedScroll(){this.capturedScroll=null}takeScroll(t){let e=this.capturedScroll;return this.capturedScroll=null,e?e.value:Me(this.getRootNodes(t))}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=vn(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(Wr(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)&&De(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=wn(t);r&&e.push(r);let n=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),i=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),o=t.loadingRoots||null,a=[n,i,o];for(let c=0;c<3;c++){let l=a[c];if(l)for(let u=0,h=l.length;u<h;u++){let f=l[u];f&&e.indexOf(f)===-1&&e.push(f)}}return bn(e),e}callPageHook(t,e){let r=this.component;if(!r)return;De(r,t,e);let n=r.layout;n&&n!==r&&n.isUnit===!0&&De(n,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,n=()=>re(this.getRootNodes(r),t);if(n()||typeof requestAnimationFrame>"u")return;let i=Gr(),o=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||n()||Gr()-i>kn||requestAnimationFrame(o)};requestAnimationFrame(o)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null;let e=this.component;if(!t||!e)return;if(typeof requestAnimationFrame>"u"){re(this.getRootNodes(e),t);return}let r=++this.scrollToken;requestAnimationFrame(()=>{r!==this.scrollToken||this.setup!==!0||this.component!==e||re(this.getRootNodes(e),t)})}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let r=this.takeScroll(t);return this.savedScroll=r,this.pageCache.saveScroll(this.getScrollKey(),r),this.getKeepAliveMode(t)==="hide"&&t.loaded!==!1?this.hideInPlace(e):this.removeNodes(e),this.detachedNodes=e,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}removeNodes(t){let e=new WeakMap;for(let r=0,n=t.length;r<n;r++){let i=t[r],o=i.parentNode;o&&(e.set(i,o),o.removeChild(i))}this.detachedParents=e,this.hiddenInPlace=!1,this.hiddenStyles=null}hideInPlace(t){let e=new WeakMap;for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&i.nodeType===1&&e.set(i,xn(i))}this.detachedParents=null,this.hiddenInPlace=!0,this.hiddenStyles=e}showInPlace(t,e){let r=this.hiddenStyles;for(let n=0,i=t.length;n<i;n++){let o=t[n];o.nodeType===1&&o.hasAttribute(kt)&&Sn(o,r?r.get(o):void 0),o.isConnected||e.appendChild(o)}}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.hiddenInPlace;this.hiddenInPlace=!1;let n=this.component,i=this.container;if(!n||n.rendered!==!0||!i||typeof i.appendChild!="function")return this.savedScroll=null,this.hiddenStyles=null,this.releaseComponent(),!1;if(r)return this.showInPlace(this.getRootNodes(n),i),this.hiddenStyles=null,this.setup=!0,_.schedule(),!0;let o=this.getRootNodes(n);for(let a=0,c=o.length;a<c;a++){let l=o[a],u=e?e.get(l):null;(u&&u.isConnected?u:i).appendChild(l)}return this.setup=!0,_.schedule(),!0}evict(){if(this.detachedNodes===null)return;let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null,this.detachedParents=null,this.savedScroll=null,this.hiddenInPlace=!1,this.hiddenStyles=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(),this.takeScroll(e))}this.capturedScroll=null,this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var Kr=s=>{if(!s.length)return null;let t={};for(let e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},Vr=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);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 Cn=/(\/):[^/(]*?\?/g,An=/\//g,Tn=/(\?\/+\*?)/g,Pn=/(:[^/?&($]+)/g,En=/(\*)/g,Mn=s=>s.replace(Cn,t=>t.replace(An,"(?:$|/)")),Dn=s=>(s=s.replace(Tn,"?/*"),s.replace(Pn,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),Rn=s=>s.replace(En,".*"),In=(s,t)=>s+=t[t.length-1]==="*"?"":"$",Qr=s=>{if(!s)return"";let t=s;return t=Mn(t),t=Dn(t),t=Rn(t),t=In(t,s),t};var _n=0,$r=(s,t="")=>{let e=s||"",r=typeof t=="string"&&t?t:e,n=null,i=[],o=r.match(/#\{([^}]+)\}/);o&&o[1]&&(n=o[1].trim(),r=r.replace(o[0],""),e=e.replace(o[0],""));let a=r.indexOf("?");if(a>-1){let u=r.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[O,J=""]=x.split("="),Ie=(O||"").trim();Ie&&i.push({key:Ie,value:(J||"").trim()})}r=r.substring(0,a);let f=e.indexOf("?");f>-1&&(e=e.substring(0,f))}}let c=n!==null||i.length>0;return c&&!r&&(e="*"),{uriPath:e,requiredHash:n,requiredQuery:i,hasConditions:c}},Yr=s=>{if(!s)return"";let t=s.indexOf("?"),e=s.indexOf("#"),r=s.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),s.substring(0,r).replace(/\/\.(?:\/|$)/g,"/")},On=s=>{if(!s)return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)},Ln=s=>{if(!s)return"";let t=s.indexOf("?");if(t===-1)return"";let e=s.indexOf("#",t);return e===-1?s.substring(t+1):s.substring(t+1,e)},ie=class extends R{constructor(t,e,r=null){let n=t.baseUri,o=$r(n,t.rawUri).uriPath,a=Vr(o),c=Kr(a),l=super(c);return this.uri=n,this.matchUri=o,this.paramKeys=a,this.titleCallBack=e,this.pageCache=r,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,this.importSrc=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+_n++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=$r(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=Qr(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)}captureScroll(){let t=this.controller;t&&this.get("active")&&t.captureScroll()}releaseCapturedScroll(){let t=this.controller;t&&t.releaseCapturedScroll()}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return e?e.isConnected===!1?!0:typeof e.closest=="function"&&e.closest("["+kt+"]")!==null:!1}getLayout(t){if(t.component)return t.component;let e=t.import;if(!e)return null;let r=e&&typeof e=="object"&&!(e instanceof Promise)?e.src:e;return this.importSrc=typeof r=="string"||typeof r=="function"?r:null,Ce(e)}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:n,parent:i,keepAlive:o,keepAliveMode:a}=t,c={component:e,container:r,persist:n,parent:i,keepAlive:o,keepAliveMode:a,pageCache:this.pageCache},l=Lt(this);this.controller=new ne(l,c)}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 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,r=Yr(t),n=this.uriQuery||/$^/,i=r.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}matches(t){return(this.uriQuery||/$^/).test(Yr(t))&&this.matchConditions(t)}prefetch(){let t=this.importSrc;return t?we(t):null}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&On(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=Ln(t);if(!r)return!1;let n=new URLSearchParams(r);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 r=this.paramKeys;if(!r)return;let n={};for(let i=0,o=r.length;i<o;i++){let a=r[i];typeof a<"u"&&(n[a]=t[i+e])}this.set(n)}getParams(){return this.stage}};var Nn=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},Bn=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Hn=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=new RegExp(":"+Bn(r),"gi");s=s.replace(n,()=>e[r])}return s},Un=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=Hn(t,s),Nn(t)),Fn=(s,t)=>(t!==""&&(s+=" - "+t),s),jr=(s,t,e)=>t&&(t=Un(s,t),Fn(t,e));var Jr=(s,t)=>({attr:s,value:t}),Wn=(s,t)=>{if(!t.startsWith(s))return!1;let e=t[s.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},oe=class extends T{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,n=B.data,i=[];t&&typeof t=="object"&&i.push(Jr("href",t)),e&&typeof e=="object"&&i.push(Jr("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=r?l===a:Wn(c,l);this.update(f)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var qn=()=>typeof window<"u"?window.location:{},zn=s=>{if(!s)return"";let t=s.indexOf("#");return t>-1?s.substring(t+1):""},Gn=1500,ae=["wheel","touchstart","keydown","pointerdown"],Xr=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Re=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.activeScrollGroups=new Set,this.scrollGroupsReady=new Set,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=Te,this.keepAliveMode="detach",this.pageCache=new ee(this),this.history=null,this.callBackLink=null,this.location=qn(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new W({path:""})}setupHistory(){this.history=te.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new ie(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let r=e?e.max:void 0;typeof r=="number"&&r>=0&&(this.keepAliveMax=r);let n=e?e.mode:void 0;return(n==="hide"||n==="detach")&&(this.keepAliveMode=n),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=Xt.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.routeId===t)return i}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 n=0,i=t.length;n<i;n++){let o=t[n];if(!o)continue;let a=this.createRoute(o);r.push(a)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);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(r,n),r}checkGroupForRegistration(t,e){let r=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.activeScrollGroups.add(i.groupId),this.lastScrollGroup=i.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){this.activeScrollGroups.delete(t),this.lastScrollGroup===t&&(this.lastScrollGroup=null);let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,n=e.length;r<n;r++){let i=e[r];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 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 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 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 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,r){return t=this.createURI(t),this.history.addState(t,e,r),this.updatePath(),this.activate(),this}prefetch(t){if(typeof t!="string"||!t)return Promise.resolve([]);let e=this.getLinkPath(t);if(e===null)return Promise.resolve([]);let r=this.createURI(e),n=[],i=a=>{if(!a||!a.controller||typeof a.matches!="function"||!a.matches(r))return!1;let c=a.prefetch();return c&&n.push(c),!0},o=this.routes;for(let a=0,c=o.length;a<c;a++)i(o[a]);for(let a of this.switches.values())for(let c=0,l=a.length;c<l&&!i(a[c]);c++);return Promise.all(n)}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=jr(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.scrollGroupsReady=new Set(this.activeScrollGroups),this.scrollWaitToken++;let r=this.pageCache;r.historyNavigation=e===!0;let n=this.captureActiveScroll(),i=this.routes;for(let o=0,a=i.length;o<a;o++){let c=i[o];typeof c>"u"||r.size>0&&c.isDormant()||this.checkRoute(c,t)}if(this.checkSwitches(t,!0),r.historyNavigation=!1,this.releaseCapturedScroll(n),e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}captureActiveScroll(){let t=[],e=n=>{!n||!n.controller||!n.get("active")||n.isDormant()||(n.captureScroll(),t.push(n))},r=this.routes;for(let n=0,i=r.length;n<i;n++)e(r[n]);for(let n of this.switches.values())for(let i=0,o=n.length;i<o;i++)e(n[i]);return t}releaseCapturedScroll(t){for(let e=0,r=t.length;e<r;e++)t[e].releaseCapturedScroll()}checkSwitches(t,e){let r=this.switches;for(let[n,i]of r.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 r=t.length;if(!r)return;let n=null;for(let a=0;a<r;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<r;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<r;a++){let c=t[a];c&&c!==o&&c!==n&&c.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 n=zn(this.path);if(n){this.scrollIntent={type:"hash",hash:n};return}t.scrollTo?(this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId},this.currentGroupId!==null&&this.currentGroupId!==void 0&&this.activeScrollGroups.add(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.scrollGroupsReady.has(t.groupId);if(this.lastScrollGroup=e?t.groupId:null,r){this.scrollToTarget(t.selector,t.groupId);return}typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()}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,n=t.y||0;if(typeof requestAnimationFrame>"u"||this.canReachScroll(r,n)){window.scrollTo(r,n);return}let i=()=>{e===this.scrollWaitToken&&this.scrollWaitToken++,this.clearScrollWait()},o={capture:!0,passive:!0};for(let l=0,u=ae.length;l<u;l++)window.addEventListener(ae[l],i,o);this.cancelScrollWait=()=>{for(let l=0,u=ae.length;l<u;l++)window.removeEventListener(ae[l],i,o)};let a=Xr(),c=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,n)||Xr()-a>=Gn){this.clearScrollWait(),window.scrollTo(r,n);return}requestAnimationFrame(c)};requestAnimationFrame(c)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){let r=document.documentElement;if(!r)return!0;let n=(r.scrollHeight||0)-(window.innerHeight||0),i=(r.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}},r=e();if(r){r.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)}findScrollTarget(t,e){if(typeof document>"u")return null;let r=this.findScopedScrollTarget(t,e);if(r)return r;let n=document.querySelectorAll(t);for(let i=0,o=n.length;i<o;i++){let a=n[i];if(a&&a.isConnected!==!1)return a}return null}findScopedScrollTarget(t,e){if(e==null||!this.switches)return null;let r=this.switches.get(e),n=r&&r[0],i=n&&n.controller&&n.controller.container;if(!i||i.nodeType!==1)return null;let o=i;for(let a=0;a<8;a++){let c=o.parentElement;if(!c||c===document.body||c===document.documentElement)break;let l=c.querySelector(t);if(l)return l;o=c}return null}readScrollTarget(t){let e=window.getComputedStyle(t),r=e.position==="sticky",n=r&&parseFloat(e.top)||0,i=(t.offsetWidth||0)>0||(t.offsetHeight||0)>0,o;if(r){let a=t.style.position;t.style.position="static",o=t.getBoundingClientRect().top+window.scrollY,t.style.position=a}else o=t.getBoundingClientRect().top+window.scrollY;return{sized:i,targetScroll:o-n}}scrollToTarget(t,e){if(typeof t!="string"||typeof document>"u")return;let r=l=>{window.scrollY>l&&window.scrollTo(0,Math.max(0,l))};if(typeof requestAnimationFrame>"u"){let l=this.findScrollTarget(t,e);if(l){let u=this.readScrollTarget(l);u.sized&&r(u.targetScroll)}return}let n=++this.scrollWaitToken,i=30,o=0,a=null,c=()=>{if(n!==this.scrollWaitToken)return;let l=this.findScrollTarget(t,e);if(l){let u=this.readScrollTarget(l);if(u.sized){if(a!==null&&Math.abs(a-u.targetScroll)<1){r(u.targetScroll);return}a=u.targetScroll}}if(++o<i){requestAnimationFrame(c);return}a!==null&&r(a)};requestAnimationFrame(c)}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("/"),n=t.split("/");if(r.length!==n.length)return!0;let i=r[r.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 Re;p.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&B.removeRoute(t)});var ts=(s,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&Zr(s,i,e)}else Zr(s,t,e)},Zr=(s,t,e)=>{t.container=s,t.parent=e;let r=B.add(t);Kn(s,r)},Kn=(s,t)=>{p.add(s,"routes",{route:t})};var es=(s,t,e)=>{};p.addType("switch",s=>{if(!s)return!1;let t=s.id;B.removeSwitch(t)});var rs=(s,t,e)=>{let r=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=s,a.parent=e)}let n=B.addSwitch(t);Vn(s,n)},Vn=(s,t)=>{p.add(s,"switch",{id:t})};nt.add("cache",kr).add("onCreated",Nr).add("onDestroyed",Br).add("bind",Mr).add("data",Sr).add("state",es).add("onSet",at).add("onState",jt).add("animateIn",hr).add("animateOut",fr).add("watch",Hr).add("useParent",wr).add("useData",Ar).add("useState",Tr).add("getId",Cr).add("addState",Pr).add("addEvent",Er).add("map",Lr).add("for",Or).add("useContext",br).add("addContext",xr).add("context",yr).add("role",pr).add("aria",mr).add("route",ts).add("debug",vr).add("dataSet",Rr).add("dataStateSet",Ir).add("switch",rs);export{dt as Ajax,lt as Arrays,Ss as Atom,y as Builder,T as Component,W as Data,p as DataTracker,Gs as DateTime,nt as Directives,et as Dom,gt as Encode,ns as Events,M as Html,Ce as Import,Q as Jot,yt as Model,oe as NavLink,v as Objects,Us as Pod,Pt as ResourceCache,rt as SimpleData,bt as State,I as Store,w as Strings,k as Types,xt as Unit,H as base,b as dataBinder,we as preloadImport,B as router};
|
|
2
2
|
//# sourceMappingURL=base.js.map
|