@base-framework/base 3.6.8 → 3.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/base.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var R=class{static toArray(t){return Array.from(t)}static inArray(t,e,r){return Array.isArray(t)?t.indexOf(e,r):-1}};var h=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 b={create(s){return Object.create(s||null)},extendObject(s,t){return!h.isObject(s)||!h.isObject(t)?!1:(Object.keys(s).forEach(e=>{this.hasOwnProp(t,e)||(t[e]=s[e])}),t)},clone(s){return!s||!h.isObject(s)?{}: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 i=Object.create(e);for(var n in r)i[n]=r[n];return i},hasOwnProp(s,t){return Object.prototype.hasOwnProperty.call(s,t)},isPlainObject(s){return!!s&&Object.prototype.toString.call(s)==="[object Object]"},isEmpty(s){return h.isObject(s)?Object.keys(s).length===0:!0}};var et={types:{},add(s,t){this.types[s]=t},get(s){return this.types[s]||!1},remove(s){delete this.types[s]}};var ft=class{constructor(){this.types=new Map}add(t,e){this.types.has(t)||this.types.set(t,[]),this.types.get(t).push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){if(!this.types.has(t))return;let e=this.types.get(t);if(!e.length)return;let r,i=et.get(t);if(i){for(var n=0,o=e.length;n<o;n++)r=e[n],r&&(e[n]=null,this.removeByCallBack(i,r));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}this.types.forEach((e,r)=>{r&&this.removeType(r)}),this.types.clear()}};var p=class{static trackers=new Map;static trackingCount=0;static addType(t,e){et.add(t,e)}static removeType(t){et.remove(t)}static getTrackingId(t){return!t||typeof t!="object"?"":t.trackingId||(t.trackingId=`dt${this.trackingCount++}`)}static add(t,e,r){let i=this.getTrackingId(t);this.find(i).add(e,r)}static get(t,e){let r=t.trackingId,i=this.trackers.get(r);return i?e?i.get(e):i:!1}static has(t,e){let r=this.getTrackingId(t);if(!r)return!1;let i=this.trackers.get(r);return i&&e?i.has(e):!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new ft),this.trackers.get(t)}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let r=t.trackingId;if(!r||!this.trackers.has(r))return;let i=this.trackers.get(r);if(!e){i.remove(),this.trackers.delete(r),delete t.trackingId;return}i.remove(e),this.isEmpty(i.types)&&(this.trackers.delete(r),delete t.trackingId)}};var zt=s=>{let t=0;for(let[e,r]of Object.entries(s))t++,typeof s[e]=="object"&&(t+=zt(s[e]));return t},ne=(s,t)=>{let e=!1;if(typeof s!="object"||typeof t!="object")return e;for(let[r,i]of Object.entries(s)){if(!b.hasOwnProp(t,r))break;let n=t[r];if(typeof i!=typeof n)break;if(typeof i=="object"){if(e=ne(i,n),e!==!0)break}else if(i===n)e=!0;else break}return e},nr=(s,t)=>{let e=zt(s),r=zt(t);return e!==r?!1:ne(s,t)},oe=(s,t)=>{let e=typeof s;return e!==typeof t?!1:e==="object"?nr(s,t):s===t};var f={getEvents(s){return h.isObject(s)===!1?[]:p.get(s,"events")},create(s,t,e,r=!1,i=!1,n=null){return i=i===!0,{event:s,obj:t,fn:e,capture:r,swapped:i,originalFn:n}},on(s,t,e,r){return Array.isArray(s)?s.forEach(i=>this.add(i,t,e,r)):this.add(s,t,e,r),this},off(s,t,e,r){if(Array.isArray(s)){var i;s.forEach(n=>this.remove(n,t,e,r))}else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,i=!1,n=null){if(h.isObject(t)===!1)return this;let o=this.create(s,t,e,r,i,n);return p.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let i=this.getEvent(s,t,e,r);return i===!1?this:(typeof i=="object"&&this.removeEvent(i),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 i=this.getEvents(t);if(!i||i.length<1)return!1;let n=this.create(s,t,e,r);return this.search(n,i)},search(s,t){let e,r=this.isSwappable(s.event);for(var i=0,n=t.length;i<n;i++)if(e=t[i],!(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 h.isObject(s)===!1?this:(p.remove(s,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(s){this.swap.push(s)},isSwappable(s){return this.swap.includes(s)}};p.addType("events",s=>{f.removeEvent(s)});var qt={events:f,addListener(s,t,e,r){return this.events.add(s,t,e,r),this},on(s,t,e,r){let i=this.events;return Array.isArray(s)?s.forEach(n=>{i.add(n,t,e,r)}):i.add(s,t,e,r),this},off(s,t,e,r){let i=this.events;return Array.isArray(s)?s.forEach(n=>{i.remove(n,t,e,r)}):i.remove(s,t,e,r),this},removeListener(s,t,e,r){return this.events.remove(s,t,e,r),this},_createEvent(s,t,e,r){let i;switch(t){case"HTMLEvents":i=new Event(s,e);break;case"MouseEvents":i=new MouseEvent(s,e);break;default:i=new CustomEvent(s,r);break}return i},createEvent(s,t,e,r){if(h.isObject(t)===!1)return!1;let i={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};h.isObject(e)&&(i=Object.assign(i,e));let n=this._getEventType(s);return this._createEvent(s,n,i,r)},_getEventType(s){let t={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},e="CustomEvent";for(let[r,i]of Object.entries(t))if(s.match(i)){e=r;break}return e},trigger(s,t,e){if(h.isObject(t)===!1)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 i=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()},n=this.getWheelEventType();return this.events.add(n,t,i,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 rt=class{constructor(){this.errors=[],this.dataTracker=p}augment(t){if(!h.isObject(t))return this;let e=this.constructor.prototype;for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,i){return(t[e]=r).apply(t,R.toArray(i))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(h.isObject(t)===!1)return"";let i=t[e];return typeof i<"u"?i:typeof r<"u"?r:""}createCallBack(t,e,r=[],i=!1){return typeof e!="function"?!1:(...n)=>(i===!0&&(r=r.concat(n)),e.apply(t,r))}bind(t,e){return e.bind(t)}};rt.prototype.extend=(function(){return rt.prototype})();var D=new rt;D.augment({...b,...qt,...h,equals:oe});var st={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 ae=()=>{D.augment({xhrSettings:st,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=b.extendClass(D.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=st}})};var S=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 i={},n=/([^?=&]+)(=([^&]*))?/g;return t.replace(n,function(o,a,u,c){i[a]=e!==!1?decodeURIComponent(c):c}),i}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,i=>e+i.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 pt=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:i,async:n}=this.settings;e.open(r,i,n),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=st.beforeSend;if(t.length<1)return;let e=this.xhr,r=this.settings;for(var i=0,n=t.length;i<n;i++){var o=t[i];o&&o(e,r)}}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(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 i=typeof e;if(r==="string")return i!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(i==="string"&&(e=S.parseQueryString(e,!1)),t instanceof FormData)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.append(n,e[n]);else r==="object"&&(t=b.clone(t),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={...D.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var r=0,i=t.length;r<i;r++){var n=t[r];switch(r){case 0:e.url=n;break;case 1:e.params=n;break;case 2:e.completed=n,e.failed=n;break;case 3:e.responseType=n||"json";break;case 4:e.method=n?n.toUpperCase():"POST";break;case 5:e.async=typeof n<"u"?n:!0;break}}else e=this.settings=b.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,i=()=>{f.removeEvents(r?.upload),f.removeEvents(r)},n=this.settings;if(!n)return!1;switch(e||t.type){case"load":if(typeof n.completed=="function"){let a=this.getResponseData();n.completed(a,this.xhr)}i();break;case"error":typeof n.failed=="function"&&n.failed(!1,this.xhr),i();break;case"progress":typeof n.progress=="function"&&n.progress(t);break;case"abort":typeof n.aborted=="function"&&n.aborted(!1,this.xhr),i();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);f.on(["load","error","abort"],e,r),f.on("progress",e.upload,r)}};ae();var dt=(...s)=>new pt(s).xhr;var or=s=>typeof s!="string"?s:ce(s),ce=s=>[{tag:"text",textContent:s}],mt=()=>({props:{},children:[]}),gt=s=>({props:{},children:ce(s)}),yt=s=>({props:{},children:s}),bt=s=>({props:s[0]||{},children:or(s[1])});var xt=class{constructor(){this.connections=new Map}add(t,e,r){let i=this.getOrCreate(t),n=i.get(e);return n?Array.isArray(n)?n.push(r):i.set(e,[n,r]):i.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 i of r.values())this.unsubscribe(i);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 W=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var vt=class extends W{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)}unsubscribe(){this.data&&this.msg&&this.token&&this.data.off(this.msg,this.token),this.data=null,this.msg=null,this.token=null}};var F=class{unsubscribe(){}};var St=class extends F{constructor(){super(),this.source=null}addSource(t){return this.source=new vt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var $=class extends W{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 kt=class extends ${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 m=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?R.toArray(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]:R.toArray(r):!1}static html(t,e){return h.isObject(t)===!1?!1:h.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return h.isObject(t)===!1||h.isUndefined(e)?this:(e=S.uncamelCase(e),t.style[e]=r,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=S.uncamelCase(e);let r=t.style[e];if(r!=="")return r;let i=null,n=t.currentStyle;if(n&&(i=n[e]))return i;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 h.isObject(t)&&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 h.isObject(t)===!1?!1:typeof r<"u"?(this.setAttr(t,e,r),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=S.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=S.camelCase(e),t.dataset[e]=r}static getData(t,e){return e=S.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,r){return h.isObject(t)===!1?!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(h.isObject(t)===!1)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(h.isObject(t)===!1)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 h.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return h.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return h.isObject(t)?t.offsetWidth:!1}static getHeight(t){return h.isObject(t)?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 h.isObject(t)===!1?!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,i=e.getElementsByTagName("body")[0],n=t.innerWidth||r.clientWidth||i.clientWidth,o=t.innerHeight||r.clientHeight||i.clientHeight;return{width:n,height:o}}static getDocumentSize(){let t=document,e=t.body,r=t.documentElement,i=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:i}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let r={x:0,y:0};if(h.isObject(t)===!1)return r;let i=0;for(;t&&(e===0||i<e);)i++,r.x+=t.offsetLeft+t.clientLeft,r.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return r}static addClass(t,e){if(h.isObject(t)===!1||e==="")return this;if(typeof e=="string"){let n=e.split(" ");for(var r=0,i=n.length;r<i;r++)t.classList.add(e)}return this}static removeClass(t,e){return h.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return h.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return h.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var Ct=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 ar=(s,t,e)=>{m.setAttr(s,t,e)},cr=(s,t,e)=>{s.checked=s.value==e},ur=(s,t,e)=>{e=e==1,ue(s,t,e)},ue=(s,t,e)=>{s[t]=e},hr=(s,t)=>m.getAttr(s,t),lr=(s,t)=>s[t],wt=class extends ${constructor(t,e,r,i){super(i),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.substring(4,1)==="-")return this.setValue=ar,this.getValue=hr,this;this.getValue=lr;let r=t.type;if(r)switch(r){case"checkbox":this.setValue=ur;return;case"radio":this.setValue=cr;return}return this.setValue=ue,this}getAttrBind(t){return t||Ct(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=()=>{},this.setValue=null,this.getValue=null}};var At=class extends F{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new wt(t,e,r,this.pubSub)}addData(t,e){return this.data=new kt(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 he=-1,V=class{constructor(){this.callBacks=new Map,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=100,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[]}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,he=-1}on(t,e){let r=(++he).toString();return this.get(t).set(r,e),r}off(t,e){let r=this.callBacks.get(t);r&&(e=String(e),r.delete(e),r.size===0&&this.callBacks.delete(t))}remove(t){this.callBacks.delete(t)}publish(t,...e){if(!this.batchingEnabled){this.publishImmediate(t,...e);return}this.updateQueue.set(t,e),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=!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.updateQueue.clear(),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=new Map(this.updateQueue);this.updateQueue.clear();for(let[e,r]of t)this.publishImmediate(e,...r);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._resolveFlushComplete())}_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 i=0;i<r;i++)e[i]()}})}flushSync(){this.flush()}publishImmediate(t,...e){let r=this.callBacks.get(t);if(r)for(let i of r.values())i&&i.apply(this,e)}};var Jt=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=[20,37,38,39,40],this.connections=new xt,this.pubSub=new V,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,i){let n=r,o=null;if(r.indexOf(":")!==-1){let d=r.split(":");d.length>1&&(n=d[1],o=d[0])}let a=o??"",u=this.setupConnection(t,e,n,a,i),c=u.element,l=e.get(n);return typeof l<"u"?c.set(l):(l=c.get(),l!==""&&u.data.set(l)),this}setupConnection(t,e,r,i,n){let o=this.getBindId(t),a=new At(this.pubSub);a.addData(e,r).subscribe(o);let l=`${e.getDataId()}:${r}`;return a.addElement(t,i,n).subscribe(l),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.dataset&&(t.dataset[this.attr]=e),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,i){if(h.isObject(t)===!1)return this;let n=new St;n.addSource(e).subscribe(r,i);let a=this.getBindId(t),u=e.getDataId()+":"+r;this.addConnection(a,u,n);let c=e.get(r);return i(c),this}unwatch(t,e,r){if(h.isObject(t)===!1)return this;let i=t[this.attr];if(i){let n=e.getDataId()+":"+r;this.connections.remove(i,n)}return this}publish(t,e,r){return this.pubSub.publish(t,e,r),this}isDataBound(t){if(!t)return null;let e=t[this.attr];return e||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.indexOf(t.keyCode)!==-1}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,r=this.isDataBound(e);if(r!==null){let i=this.connections.get(r,"bind");if(i){let n=i.element.get();this.pubSub.publish(r,n,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&f.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&f.off(["change","paste","input"],document,this.changeHandler,!1)}},v=new Jt;var T=s=>s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null;var fr={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"},it=s=>fr[s]||s,nt=s=>typeof s=="string"&&s.substring(0,2)==="on"?s.substring(2):s,A=class{static create(t,e,r,i){let n=document.createElement(t);return this.addAttributes(n,e),i===!0?this.prepend(r,n):this.append(r,n),n}static addAttributes(t,e){if(!e||typeof e!="object")return;let r=e.type;typeof r<"u"&&m.setAttr(t,"type",r);for(let[i,n]of Object.entries(e))i==="innerHTML"?t.innerHTML=n:i.indexOf("-")!==-1?m.setAttr(t,i,n):this.addAttr(t,i,n)}static addHtml(t,e){return typeof e>"u"||e===""?this:(/(?:<[a-z][\s\S]*>)/i.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,r){if(r===""||!e)return;if(typeof r==="function")e=nt(e),r.originalCallback?f.add(e,t,r,!1,!0,r.originalCallback):f.add(e,t,r);else{let n=it(e);t[n]=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(!h.isObject(t)||!h.isArray(e))return!1;e.forEach(i=>{let n=new Option(i.label,i.value);t.options.add(n),r!==null&&n.value==r&&(n.selected=!0)})}static removeElementData(t){p.remove(t);let e=t.childNodes;if(e){let o=e.length-1;for(var r=o;r>=0;r--){var i=e[r];i&&this.removeElementData(i)}}t.bindId&&v.unbind(t)}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(!h.isObject(t))return this;let e=t.childNodes;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.removeElementData(e[r]);return t.innerHTML="",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 i=r||t.firstChild;return t.insertBefore(e,i),this}static clone(t,e=!1){return h.isObject(t)?t.cloneNode(e):!1}};var C=class extends A{static create(t,e,r,i){let n=document.createElement(t);return this.addAttributes(n,e,i),r.appendChild(n),n}static addAttributes(t,e,r){!e||e.length<1||e.forEach(i=>{let{key:n,value:o}=i;this.addAttr(t,n,o,r)})}static addAttr(t,e,r,i){if(r===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){e=nt(e);let a=r,u=function(c){a.call(this,c,i)};f.add(e,t,u,!1,!0,a);return}if(e.substring(4,1)==="-"){m.setAttr(t,e,r);return}let o=it(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 Yt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,w={isWatching(s){return Array.isArray(s)?typeof s[0]=="string"&&this.hasParams(s[0]):this.hasParams(s)},hasParams(s){return h.isString(s)&&s.includes("[[")},_getWatcherProps(s){let t=s.match(Yt);return t?t.map(e=>e.slice(2,-2)):null},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.textContent=e;break;case"disabled":s.disabled=!e;break;case"checked":s.checked=!!e;break;case"required":s.required=!!e;break;case"src":if(s.tagName.toLowerCase()==="img"){s.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}s.src=e;break;default:C.addAttr(s,t,e);break}},replaceParams(s,t,e=!1){let r=0;return s.replace(Yt,function(){let i=e?t[r]:t;r++;let n=i.get(arguments[2]);return typeof n<"u"&&n!==null?n:""})},_getWatcherCallBack(s,t,e,r,i){return()=>{let n=this.replaceParams(e,t,i);this.updateAttr(s,r,n)}},getValue(s,t){let e=s.value;return Array.isArray(e)===!1?[e,T(t)]:(e.length<2&&e.push(T(t)),e)},getPropValues(s,t,e){let r=[];for(let i=0,n=t.length;i<n;i++){let a=(e?s[i]:s).get(t[i])??"";r.push(a)}return r},getCallBack(s,t,e,r,i){let n=s.attr||"textContent",o=s.callBack;if(typeof o=="function"){let a=r.match(Yt)||[],u=a&&a.length>1;return(c,l)=>{c=u!==!0?c:this.getPropValues(e,a,i);let d=o(c,t,l);typeof d<"u"&&this.updateAttr(t,n,d)}}return this._getWatcherCallBack(t,e,r,n,i)},addDataWatcher(s,t,e){let r=this.getValue(t,e),i=r[1]??e?.data??e?.context?.data??e?.state??null;if(!i)return;let n=r[0],o=Array.isArray(i),a=this.getCallBack(t,s,i,n,o),u=this._getWatcherProps(n);for(var c=0,l=u.length;c<l;c++){var d=o?i[c]:i;this.addWatcher(s,d,u[c],a)}},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){v.watch(s,t,e,r)}};var pr=s=>({props:{watch:s},children:[]}),dr=s=>{if(!s)return mt();let t=s[0],e=typeof t;if(e==="string"||e==="number")return gt(t);if(Array.isArray(t))return w.isWatching(t)===!1?yt(t):pr(t);let r=s[1]??s[0]??[];return r&&Array.isArray(r)&&w.isWatching(r)===!0&&(s[0]=Array.isArray(s[0])?{}:s[0],s[0].watch=r,s[1]=[]),bt(s)},mr=s=>(...t)=>{let{props:e,children:r}=dr(t);return s(e,r)};var le=new WeakMap;function gr(s,t,e,r){let i=le.get(s);i||(i=new Map,le.set(s,i));let n=i.get(e);if(n)return n;let o=new Proxy(s,pe(t,e,r));return i.set(e,o),o}function fe(s,t){let e=isNaN(Number(t)),r=e?t:`[${t}]`;return s===""?r:e?`${s}.${r}`:`${s}${r}`}function pe(s,t="",e=""){return{get(r,i,n){let o=r[i];if(t===""&&i in r)return typeof o=="function"?o.bind(r):o;let a=r[e]||r;if(o=Reflect.get(a,i,n),b.isPlainObject(o)||Array.isArray(o)){let u=fe(t,i);return gr(o,s,u,e)}return o},set(r,i,n,o){if(t===""&&i in r)return r[i]=n,!0;let a=fe(t,i);return s.set(a,n),!0}}}var Dt=(s,t="stage")=>new Proxy(s,pe(s,"",t));var ot=class{static resume(t,e){if(!t)return null;let r,i=localStorage.getItem(t);return i===null?e&&(r=e):r=JSON.parse(i),r}static store(t,e){if(!t||!e)return!1;let r=JSON.stringify(e);return localStorage.setItem(t,r),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Tt=(s={})=>{let t={};if(!h.isObject(s))return t;let e=b.clone(s);return Object.keys(e).forEach(r=>{let i=e[r];typeof i!="function"&&(t[r]=i)}),t};var yr=0,H={CHANGE:"change",DELETE:"delete"},Qt=(s,t)=>`${s}:${t}`,O=class{constructor(t={}){this.dirty=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new V;let e=Tt(t);return this.set(e),Dt(this)}setup(){this.stage={}}_init(){let t=++yr;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}getDataId(){return String(this._id)}remove(){}on(t,e){let r=Qt(t,H.CHANGE);return this.eventSub.on(r,e)}off(t,e){let r=Qt(t,H.CHANGE);this.eventSub.off(r,e)}_setAttr(t,e,r=this,i=!1){let n=this.stage[t];e!==n&&(this.stage[t]=e,this._publish(t,e,r,H.CHANGE))}publishLocalEvent(t,e,r,i){let n=Qt(t,i);this.eventSub.publish(n,e,r)}_publish(t,e,r,i){this.publishLocalEvent(t,e,r,i),r=r||this,v.publish(this._dataId+t,e,r)}set(...t){if(typeof t[0]!="object")return this._setAttr(...t),this;let[e,r,i]=t;return Object.entries(e).forEach(([n,o])=>{typeof o!="function"&&this._setAttr(n,o,r,i)}),this}getModelData(){return this.stage}_deleteAttr(t,e,r=this){delete t[e],this.publishLocalEvent(e,null,r,H.DELETE)}toggle(t){if(!(typeof t>"u"))return this.set(t,!this.get(t)),this}increment(t,e=null){if(typeof t>"u")return;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;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;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){return this.key=t,this}resume(t){let e=ot.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return ot.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 i=[];return Object.entries(e).forEach(([n])=>{i.push(this.remoteLink(t,n))}),i}remoteLink(t,e,r){let i=r||e,n=t.get(e);typeof n<"u"&&this.get(e)!==n&&this.set(e,n);let o=t.on(e,(u,c)=>{if(c===this)return!1;this.set(i,u,t)});this.addLink(o,t);let a=this.on(i,(u,c)=>{if(c===t)return!1;t.set(e,u,this)});return t.addLink(a,this),o}addLink(t,e){this.links.set(t,e)}unlink(t){if(t){this.removeLink(t);return}let e=this.links;b.isEmpty(e)||(e.forEach((r,i)=>{this.removeLink(i,!1)}),this.links=new Map)}removeLink(t,e=!0){let r=this.links.get(t);r&&r.off(t),e!==!1&&this.links.delete(t)}};O.prototype.isData=!0;var Xt=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t}get(t){if(!this.cache.has(t))return;let e=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,e),e}set(t,e){if(this.cache.has(t)&&this.cache.delete(t),this.cache.set(t,e),this.cache.size>this.maxSize){let r=this.cache.keys().next().value;this.cache.delete(r)}}clear(){this.cache.clear()}},E={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new Xt(1e3),hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},getSegments(s){let t=this.segmentCache.get(s);if(t!==void 0)return t;let e=this.deepDataPattern;return t=s.match(e),this.segmentCache.set(s,t),t}};var L=class{static set(t,e,r){if(!E.hasDeepData(e)){t[e]=r;return}let i,n=E.getSegments(e);if(!n)return;let o=n.length,a=o-1;for(let u=0;u<o;u++){let c=n[u];if(u===a){t[c]=r;break}t[c]===void 0&&(t[c]=isNaN(c)?{}:[]),t=t[c]}}static delete(t,e){if(!E.hasDeepData(e)){delete t[e];return}let r=E.getSegments(e);if(!r)return;let i=r.length,n=i-1;for(let o=0;o<i;o++){let a=r[o],u=t[a];if(u===void 0)break;if(o===n){if(Array.isArray(t)){t.splice(Number(a),1);break}delete t[a];break}t=u}}static get(t,e){if(!E.hasDeepData(e))return t[e]??void 0;let r=E.getSegments(e);if(!r)return;let i=r.length,n=i-1;for(let o=0;o<i;o++){let a=r[o],u=t[a]??void 0;if(u===void 0)break;if(t=u,o===n)return t}}};var at=class{static MAX_DEPTH=50;static publishDeep(t,e,r,i){if(!E.hasDeepData(e)){this.publish(e,r,i);return}let n,o=E.getSegments(e);if(!o)return;let a=o.length,u=a-1,c="";for(let l=0;l<a;l++){let d=o[l];t=t[d],l>0?isNaN(d)&&(c+="."+d):c=d;let y;if(l===u)y=r;else{let x=o[l+1];if(isNaN(x)===!1){c+="["+x+"]";continue}let N={};N[x]=t[x],y=N}this.publish(c,y,i)}}static publish(t,e,r,i=null,n=0){if(t=t||"",r(t,e),!(!e||typeof e!="object")){if(i===null&&(i=new WeakSet),i.has(e)){console.warn("[Publisher] Circular reference detected at path:",t);return}if(n>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion");return}if(i.add(e),Array.isArray(e)){this.publishArray(t,e,r,i,n);return}this.publishObject(t,e,r,i,n)}}static publishArray(t,e,r,i,n){let o,a,u=e.length;for(let c=0;c<u;c++)a=e[c],o=t+"["+c+"]",this._checkPublish(o,a,r,i,n)}static publishObject(t,e,r,i,n){let o,a,u=Object.keys(e);for(let c=0;c<u.length;c++){let l=u[c];a=e[l],o=t+"."+l,this._checkPublish(o,a,r,i,n)}}static _checkPublish(t,e,r,i,n){if(!e||typeof e!="object"){r(t,e);return}this.publish(t,e,r,i,n+1)}};var M=class extends O{setup(){this.attributes={},this.stage={}}_setAttr(t,e,r,i){typeof e!="object"&&e===this.get(t)||(!r&&i!==!0?L.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),L.set(this.stage,t,e),r=r||this,this._publish(t,e,r,H.CHANGE))}linkAttr(t,e){let r=t.get(e);if(!r)return;let i=Object.keys(r);for(let n=0,o=i.length;n<o;n++){let a=i[n];this.link(t,e+"."+a,a)}}scope(t,e){let r=this.get(t);if(!r)return!1;e=e||this.constructor;let i=new e(r);return i.linkAttr(this,t),i}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 i=this.get(t);return Array.isArray(i)===!1?-1:typeof i[0]!="object"?i.indexOf(e):i.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,i){let n=(o,a)=>this._publishAttr(o,a,r,i);at.publish(t,e,n)}_publishAttr(t,e,r,i){let n=this._dataId+t;v.publish(n,e,r),this.publishLocalEvent(t,e,r,i)}mergeStage(){this.attributes=b.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);let i=(n,o)=>this.publishLocalEvent(n,o,r,H.DELETE);at.publish(e,e,i)}_getAttr(t,e){return L.get(t,e)}};var br={"\n":"\\n","\r":"\\n"," ":"\\t"},xr=(s,t)=>{typeof s!="string"&&(s=String(s));let e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>br[r])},de=(s,t)=>{if(typeof s!="string")return s;s=xr(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},Gt=(s,t)=>{let e=typeof s;return e==="undefined"?s:e!=="object"?(s=de(s),s):(Object.entries(s).forEach(([r,i])=>{i!==null&&(s[r]=typeof i=="string"?Gt(i,t):de(i,t))}),s)};function me(s){return typeof s<"u"&&s.length>0?JSON.parse(s):!1}function Kt(s){return typeof s<"u"?JSON.stringify(s):null}var ct=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?b.clone(t):t,i=Gt(r,e);return Kt(i)}static json={encode:Kt,decode:me};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var Et=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=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=S.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=S.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"),i="id="+r,n=r?`/${r}`:"",o=this.model;return this._get(n,i,t,e,a=>{if(a){let u=this.getObject(a);u&&o.set(u)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+ct.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let r=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._put(n,r,t,e)}add(t,e){if(!this.isValid())return;let r=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._post(n,r,t,e)}update(t,e){if(!this.isValid())return;let r=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._patch(n,r,t,e)}delete(t,e){let r=this.model.get("id"),i=typeof r<"u"?"id="+r:this.setupObjectData(),n=r!=null?`/${r}`:"";return this._delete(n,i,t,e)}all(t,e,r,i,n=null,o=null){let a=this.model.get();r=isNaN(r)?0:r,i=isNaN(i)?50:i;let u=a.search||"",c=a.filter||"";typeof c=="object"&&(c=JSON.stringify(c));let l=a.dates||"";typeof l=="object"&&(l=JSON.stringify(l));let d=a.orderBy||"";typeof d=="object"&&(d=JSON.stringify(d));let y=a.groupBy||"";Array.isArray(y)&&(y=JSON.stringify(y));let x="&filter="+c+"&offset="+r+"&limit="+i+"&dates="+l+"&orderBy="+d+"&groupBy="+y+"&search="+u+"&lastCursor="+(typeof n<"u"&&n!==null?n:"")+"&since="+(typeof o<"u"&&o!==null?o:"");return this._get("",x,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)}setupRequest(t,e,r,i,n){let o={url:this.getUrl(t),method:e,params:r,completed:(u,c)=>{typeof n=="function"&&n(u),this.getResponse(u,i,c)}};return this._isFormData(r)&&(o.headers={}),dt(o)}setupEventSource(t,e,r,i,n=!0){let o=null,a=null,u=!1,c=!1,l=()=>{a&&(clearTimeout(a),a=null)},d=()=>{if(u||!n||c)return;l(),a=setTimeout(()=>{a=null,y()},3e3)},y=()=>{if(u||c)return;if(o){try{o.close()}catch{}o=null}c=!0;let x=this.getUrl(t),N=e?"?"+e:"";o=new EventSource(x+N,{withCredentials:!0}),o.onopen=()=>{c=!1,l(),i&&i()},o.onerror=()=>{c=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,d())},o.onmessage=tt=>{try{let lt=JSON.parse(tt.data);r&&r(lt)}catch{}}};return y(),{get source(){return o},close:()=>{if(u=!0,c=!1,l(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return w.isWatching(t)&&(t=w.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,r,i){return this._request("","POST",t,e,r,i)}_get(t,e,r,i,n){return e=this.setupParams(e),e=this.addParams(e,r),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",i,n)}_post(t,e,r,i,n){return this._request(t,"POST",e,r,i,n)}_put(t,e,r,i,n){return this._request(t,"PUT",e,r,i,n)}_patch(t,e,r,i,n){return this._request(t,"PATCH",e,r,i,n)}_delete(t,e,r,i,n){return this._request(t,"DELETE",e,r,i,n)}_request(t,e,r,i,n,o){return r=this.setupParams(r),r=this.addParams(r,i),this.setupRequest(t,e,r,n,o)}getResponse(t,e,r){typeof e=="function"&&e(t,r)}static extend(t){if(!t)return!1;let e=this;class r extends e{constructor(n){super(n)}}return Object.assign(r.prototype,t),r}};var vr=s=>{let t={};if(!h.isObject(s)||!s.defaults)return t;let{defaults:e}=s;return Object.keys(e).forEach(r=>{let i=e[r];typeof i!="function"&&(t[r]=i)}),delete s.defaults,t},Sr=s=>{if(!s||typeof s.xhr!="object")return{};let t={...s.xhr};return delete s.xhr,t},kr=0,z=class extends M{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=Sr(t),i=e.prototype.service.extend(r),n=vr(t);class o extends e{constructor(u){let c={...n,...Tt(u)};super(c),this.xhr=new i(this)}dataTypeId=`bm${kr++}`}return Object.assign(o.prototype,t),o.prototype.service=i,o}};z.prototype.service=Et;var _=class extends O{};var q=class extends _{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 Pt=class extends q{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var B=class{static targets=new Map;static restore(t,e){this.targets.set(t,e)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new Pt(t)),this.targets.get(t)}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,r){let i=this.getTarget(t);return e&&i.addAction(e,r),i}static addAction(t,e,r){return this.add(t,e,r)}static removeAction(t,e,r){r&&this.off(t,e,r)}static on(t,e,r){let i=this.getTarget(t);return e?i.on(e,r):null}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let i=this.targets,n=i.get(t);if(n){if(e){n.off(e,r);return}this.targets.delete(t)}}static set(t,e,r){this.getTarget(t).set(e,r)}};var Ot=class{constructor(){this.events=[]}addEvents(t){t.length<1||t.forEach(r=>{this.on(...r)})}on(t,e,r,i){f.on(t,e,r,i),this.events.push({event:t,obj:e,callBack:r,capture:i})}off(t,e,r,i){f.off(t,e,r,i);let n,o=this.events;for(var a=0,u=o.length;a<u;a++)if(n=o[a],n.event===t&&n.obj===e){o.splice(a,1);break}}set(){this.events.forEach(t=>{f.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{f.off(t.event,t.obj,t.callBack,t.capture)})}reset(){this.unset(),this.events=[]}};var Mt=class{constructor(t,e){this.remoteStates=[];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,i){return{action:t,state:e,callBack:r,targetId:i,token:null}}convertStates(t){let e=[];for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}var i=null,n=null,o=t[r];o&&typeof o=="object"&&(n=o.callBack,i=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,n,i))}return e}setupRemoteStates(t,e){let r;for(var i=0,n=t.length;i<n;i++)if(r=t[i],!!r){for(var o in r)if(!(!Object.prototype.hasOwnProperty.call(r,o)||o==="id")){var a=null,u=r[o],c=u!==null?u:void 0;c&&typeof c=="object"&&(a=c.callBack,c=c.state),e.push(this.createState(o,c,a,r.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeActions(t,e){if(!(e.length<1))for(var r=0,i=e.length;r<i;r++){var n=e[r];n.token&&this.unbindRemoteState(t,n.token),B.remove(n.targetId,n.action,n.token)}}restore(t){B.restore(t.id,t);let e=this.remoteStates;if(e)for(var r=0,i=e.length;r<i;r++){var n=e[r];n.token=this.bindRemoteState(t,n.action,n.targetId)}}bindRemoteState(t,e,r){let i=B.getTarget(r);return t.link(i,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(var i=0,n=e.length;i<n;i++){var o=e[i],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}r.length<1&&(this.remoteStates=[])}addAction(t,e){let r,i=e.action,n=e.targetId;n&&(r=this.bindRemoteState(t,i,n)),typeof e.state<"u"&&t.addAction(i,e.state);let o=e.callBack;return typeof o=="function"&&t.on(i,o),r||null}};var ge=s=>{if(!s)return mt();let t=s[0],e=typeof t;return e==="string"||e==="number"?gt(t):Array.isArray(t)?yt(t):bt(s)};p.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Cr=0,ut=class{constructor(...t){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.cached=[],this.init();let{props:e,children:r}=ge(t);this.setupProps(e),this.children=r||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Cr++,this.unitType=this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=this.persistedCount++,r="pc"+e,n=Object.keys(this.persistedChildren)[e],o=this.persistedChildren[n];return o&&t.unitType===o.unitType&&(r=n,t.resumeScope(o)),t.persistToken=r,this.persistedChildren[r]=t,r}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){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()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(var i=0,n=t.length;i<n;i++){let o=e(t[i],i);r.push(o)}return r}removeAll(t){return A.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),String(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(),this.removeContext();let t=this.panel;t&&A.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null,this.cached.forEach(t=>{this[t]=null}),this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy(),this.data&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var k=class extends ut{constructor(...t){super(...t),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){this.data=t.data,this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,this.id=t.id}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=B.getTarget(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper.restore(t);return}let e=this.setupStates();b.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Mt(this.state,t))}addState(t){!this.stateHelper||this.stateResumed==!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;t&&(this.stateHelper.removeRemoteStates(t),t.remove(),this.stateResumed=!1)}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new Ot)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy(),this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&this.data.unlink()}};var Bt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"};var wr=s=>typeof s=="function"?s:()=>s,Ar=s=>{let t={};return s&&Object.entries(s).forEach(([e,r])=>{let i=Bt[e]||e;t[i]=wr(r)}),t},ye=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e},U=(s,t=k)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=Ar(s),ye(t,e)):(e={render:r==="function"?s:()=>s},ye(t,e))};var Dr=(s,t)=>(Object.entries(s).forEach(([e,r])=>{let i=Bt[e]||e;t.prototype[i]=r}),t),Tr=s=>class extends s{},Er=(s,t=k)=>{if(!s)return null;let e=Tr(t),r={},i=s(r);return Dr(r,e),e.prototype.render=i,e};var Pr={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){let e=this.dayNames;if(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){s=s?s.replace(/\s/,"T"):"";let e=new Date(s),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 this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),s)},formatTime(s,t){let e=this.createDate(s),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&&(s=s-12),s},convert12To24(s,t){return s=Number(s),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 i=this.getMeridian(s);return s=this.convert24To12(s),`${s}:${this.padNumber(t)} ${i}`},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=!1){let e=this.monthNames;if(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()){return this.leapYear(s)===!0?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31]},getLocalDate(s,t="America/Denver"){let e=new Date(s);if(Number.isNaN(e.getMonth())===!0){let n=/[- :]/,o=s.split(n);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let r=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),i=e.getTime()-r.getTime();return new Date(e.getTime()+i)},getLocalTime(s,t=!1,e=!1,r="America/Denver"){if(!s)return"";let i=this.getLocalDate(s,r),n=i.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(i.getFullYear(),n,i.getDate(),o)+" "),a+this.renderTime(i.getHours(),i.getMinutes(),i.getSeconds(),o)},getDiffFromNow(s,t=!1){s=s.replace(/\s/,"T");let e=new Date(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;switch(!0){case t<864e5:e="1 day";break;case t<6048e5:r=this.toDays(t),e=r+" days";break;case t<12096e5:e="1 week";break;case t<2592e6:r=this.toDays(t);var i=Math.floor(r/7);e=i+" weeks";break;case t<5184e6:e="1 month";break;case t<31104e6:var n=this.toMonths(t);e=n+" months";break;default:var o=this.toYears(t);e=o}return String(e)},getTimeFrame(s){let t=this.getDiffFromNow(s);return this.convertToEstimate(t)},convertToEstimate(s){let t="",e,r,i,n,o,a,u;if(s<=0)switch(!0){case s<-63072e6:i=this.toYears(Math.abs(s)),t="in "+i+" years";break;case s<-31536e6:t="in a year";break;case s<-5184e6:n=this.toMonths(Math.abs(s)),t="in "+n+" months";break;case s<-2592e6:t="in a month";break;case s<-12096e5:e=this.toDays(Math.abs(s)),r=Math.floor(e/7),t="in "+r+" weeks";break;case s<-6048e5:t="in a week";break;case s<-1728e5:e=this.toDays(Math.abs(s)),t="in "+e+" days";break;case s<-864e5:t="tomorrow";break;case s<-72e5:o=this.toHours(Math.abs(s)),t="in "+o+" hours";break;case s<=-36e5:t="in an hour";break;case s<-12e4:a=this.toMinutes(Math.abs(s)),t="in "+a+" minutes";break;case s<-6e4:t="in a minute";break;case s<-2e3:u=this.toSeconds(Math.abs(s)),t="in "+u+" seconds";break;case s<-1:t="in 1 second";break;default:t="now"}else switch(!0){case s<1e3:t="1 second ago";break;case s<6e4:u=this.toSeconds(s),t=u+" seconds ago";break;case s<12e4:t="1 minute ago";break;case s<36e5:a=this.toMinutes(s),t=a+" minutes ago";break;case s<72e5:t="1 hour ago";break;case s<864e5:o=this.toHours(s),t=o+" hours ago";break;case s<1728e5:t="yesterday";break;case s<6048e5:e=this.toDays(s),t=e+" days ago";break;case s<12096e5:t="a week ago";break;case s<2592e6:e=this.toDays(s),r=Math.floor(e/7),t=r+" weeks ago";break;case s<5184e6:t="a month ago";break;case s<31536e6:n=this.toMonths(s),t=n+" months ago";break;case s<63072e6:t="a year ago";break;default:i=this.toYears(s),t=i+" years ago"}return t},toYears(s){return typeof s!="number"?0:Math.floor(s/31558464e3)},toMonths(s){return typeof s=="number"?Math.floor(s/2592e6):0},toDays(s){return typeof s!="number"?0:Math.floor(s/864e5*1)},toHours(s){return typeof s!="number"?0:Math.floor(s%864e5/36e5*1)},toMinutes(s){return typeof s!="number"?0:Math.floor(s%864e5%36e5/6e4*1)},toSeconds(s){return typeof s!="number"?0:Math.floor(s%864e5%36e5%6e4/1e3*1)},getDifference(s,t){let e=new Date(s),r=new Date(t),i=r.getTime()-e.getTime();return{years:this.toYears(i),days:this.toDays(i),hours:this.toHours(i),minutes:this.toMinutes(i),seconds:this.toSeconds(i)}}};var be=(s,t)=>({name:s,callBack:t});var J={keys:[],items:{},add(s,t){return this.keys.push(s),this.items[s]=be(s,t),this},get(s){return this.items[s]||null},all(){return this.keys}};var Zt=(s,t)=>({attr:s,directive:t});var Y=(s,t)=>({key:s,value:t});var xe=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var I=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,i){return t==="text"?(i.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(Y("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(Zt(Y(e,w.getWatcherSettings(r,it(e))),J.get("watch")))}static setButtonType(t,e,r){if(t==="button"){let i=e.type||"button";r.push(Y("type",i))}}static parse(t,e){let r=[],i=[],n=this.getTag(t);this.setButtonType(n,t,r),this.setupChildren(t);let o=[],a,u,c=Object.keys(t);for(let l=0,d=c.length;l<d;l++){let y=c[l];if(y==="tag"||(a=t[y],a==null))continue;if(y==="children"){o=Array.isArray(a)?o.concat(a):o.concat([a]);continue}if((u=J.get(y))!==null){i.push(Zt(Y(y,a),u));continue}let x=typeof a;if(x==="object"){if(w.isWatching(a)){this.setTextAsWatcher(i,y,a);continue}o.push(a);continue}if(x==="function"){let N=a,tt=function(lt){N.call(this,lt,e)};tt.originalCallback=N,a=tt}if(w.isWatching(a)){this.setTextAsWatcher(i,y,a);continue}this.setElementContent(y,a,r,o)||r.push(Y(y,a))}return xe(n,r,i,o)}};var Q=class{build(t,e,r){}setupComponent(t,e,r){let i=r?.getChildScope();t.parent=i,i&&i.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&i&&(i[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 Rt=class extends Q{build(t,e,r){let i=C.createDocFragment(),n=Array.isArray(t)?t:[t];for(let o=0,a=n.length;o<a;o++)this.buildElement(n[o],i,r);return e&&typeof e=="object"&&e.appendChild(i),i}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){let i=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,i);return}let n=I.parse(t,i),o=this.createNode(n,e,i);this.cache(o,t.cache,r);let a=n.children;for(let c=0,l=a.length;c<l;c++){let d=a[c];d!==null&&this.buildElement(d,o,r)}let u=n.directives;u&&u.length&&this.setDirectives(o,u,i)}createTempComponent(t,e,r){let i={setData:()=>t.data,render(){return{...t,data:null,state:null}}};t.state&&(i.setupStateTarget=function(o){this.state=t.state});let n=new k(i);this.createComponent(n,e,r)}setDirectives(t,e,r){for(let i=0,n=e.length;i<n;i++)this.handleDirective(t,e[i],r)}handleDirective(t,e,r){e.directive.callBack(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let i=t.tag;if(i==="text"){let n=t.attr[0],o=n?n.value:"";return C.createText(o,e)}else if(i==="comment"){let n=t.attr[0],o=n?n.value:"";return C.createComment(o,e)}return C.create(i,t.attr,e,r)}removeNode(t){C.removeElement(t)}removeAll(t){C.removeAll(t)}};var Or=["area","base","br","col","embed","hr","img","input","link","meta","source"],X=class{static create(t,e=[],r=""){let i=this.getInnerContent(e);i+=this.getInnerHtml(e);let n=this.createAttributes(e);return Or.includes(t)?`<${t} ${n} />`:`<${t} ${n}>`+i+r+`</${t}>`}static getInnerContent(t){let e="";return t.forEach(({key:r,value:i},n)=>{if(r!=="text"&&r!=="textContent")return"";t.splice(n,1),e+=i}),e}static getInnerHtml(t){let e="";return t.forEach(({key:r,value:i},n)=>{if(r!=="html"&&r!=="innerHTML")return"";t.splice(n,1),e+=i}),e}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:r,value:i}=e;return typeof i=="function"&&(r="on"+nt(r)),`${r}="${i}"`}).join(" ")}static createText(t){return t}static createComment(t){return`<!-- ${t} -->`}};var It=class extends Q{build(t,e,r){return(Array.isArray(t)?t:[t]).map(n=>this.buildElement(n,r)).join("")}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=I.parse(t,e),i=r.children.map(n=>n!==null?this.buildElement(n,e):"").join("");return this.createNode(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let i=t.attr[0],n=i?i.value:"";return X.createText(n)}else if(r==="comment"){let i=t.attr[0],n=i?i.value:"";return X.createComment(n)}return X.create(r,t.attr,e)}removeAll(t){}};var Nt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Rt:new It}};var j=Nt.setup(),Mr=s=>typeof s=="object"&&s.isUnit===!0,Br=s=>{let t=U(s);return t?new t:null},g=class{static render(t,e,r){return!t||(Mr(t)||(t=Br(t)),!t)?null:j.createComponent(t,e,r)}static build(t,e,r){return j.build(t,e,r)}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)}};D.augment({buildLayout(s,t,e){g.build(s,t,e)}});var te=[],Rr=s=>te.indexOf(s)!==-1,Ir=s=>({tag:"script",src:s.src,async:!1,load(t){te.push(s.src);let e=s.load;e&&e()}}),Nr=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){te.push(s.src);let e=s.load;e&&e()}}),Ht=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=Nr({load:r,src:t}):e=Ir({load:r,src:t}),g.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Rr(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 Hr=s=>s?typeof s?.prototype?.constructor=="function":!1,G=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Hr(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){let i=g.build(t,null,r),n=i.firstChild||t?.panel;return e.after(i),n}};var Lt=class{static load(t,e){return t.then(r=>(e&&e(r),r)).catch(r=>{console.error("Error loading module:",r)})}};var Lr=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),_r=s=>{let t=typeof s;return t==="string"?import(s):t==="function"?s():s},ve=U({declareProps(){this.loaded=!1,this.blockRender=!1},render(){return Lr({onCreated:s=>{if(this.src){if(this.layout){this.layoutRoot=G.render(this.layout,this.panel,this.parent);return}if(this.depends){new Ht(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){this.src=_r(this.src),Lt.load(this.src,t=>{if(this.loaded=!0,this.blockRender===!0){this.blockRender=!1;return}let e=this.layout||G.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.layoutRoot=G.render(e,s,this.parent)})},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(){if(!this.layoutRoot){this.blockRender=!0;return}this.blockRender=!1,g.removeNode(this.layoutRoot),this.persist!==!0&&(this.layoutRoot=null,this.layout=null)}});var ee=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new ve(s)};var Se=(s,t,e=null)=>{if(!s)return;let r=null,i=!1,n=()=>{i||(i=!0,r&&(clearTimeout(r),r=null),f.off("animationend",s,o),s&&m.removeClass(s,t),e&&e())},o=a=>{a.target===s&&n()};f.on("animationend",s,o),requestAnimationFrame(()=>{if(!s){n();return}m.addClass(s,t);try{let a=window.getComputedStyle(s),u=parseFloat(a.animationDuration)*1e3||1e3,c=parseFloat(a.animationDelay)*1e3||0;r=setTimeout(n,u+c+100)}catch{r=setTimeout(n,1e3)}})},ke=(s,t,e)=>{Se(s,t)},Ce=(s,t,e)=>{let r=()=>{s&&s.remove&&s.remove()};Ur(s,()=>Se(s,t,r),e)};p.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var Ur=(s,t,e)=>{p.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var ht=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(i=>{i&&ht(s,t,i,r)});return}jr(s,t,e,r)},jr=(s,t,e,r)=>{let i,n;if(e.length<3?[i,n]=e:[t,i,n]=e,!t||!i)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=Wr(s,i,n,r);v.watch(s,t,i,o)},Wr=(s,t,e,r)=>typeof e=="object"?i=>{Vr(s,e,i)}:i=>{Fr(s,e,t,i,r)},Fr=(s,t,e,r,i)=>{let n=t(r,s,i);switch(typeof n){case"object":$r(n,s,i);break;case"string":let o=Ct(s);if(o!=="textContent"){m.setAttr(s,o,n);break}A.addHtml(s,n);break}},$r=(s,t,e)=>{g.rebuild(s,t,e)},Vr=(s,t,e)=>{for(let[r,i]of Object.entries(t))r&&(i===e?m.addClass(s,r):m.removeClass(s,r))};var K=(s,t,e)=>{let r=T(e);ht(s,r,t,e)};var we=(s,t,e)=>{t&&t&&m.setAttr(s,"role",t)},zr=s=>(t,e)=>{let r=t?"true":"false";m.setAttr(e,s,r)},Ae=(s,t,e)=>{if(!t)return;let r=t.role;r&&(m.setAttr(s,"role",r),t.role=null),Object.entries(t).forEach(([i,n])=>{if(n===null)return;let o=`aria-${i}`;if(Array.isArray(n)){let a=[...n];a.push(zr(o)),K(s,a,e)}else m.setAttr(s,o,n)})};var De=(s,t,e)=>{if(!t)return;let r=I.parse(t,e);C.addAttributes(s,r.attr,e),g.setDirectives(s,r.directives,e)};p.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var re=s=>s?s.getContext():null,Te=(s,t,e)=>{if(typeof t!="function")return;let r=re(e),i=t(r);De(s,i,e)},Ee=(s,t,e)=>{if(typeof t!="function")return;let r=re(e);t(r)},Pe=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=re(e),i=t(r);i&&e.addContextBranch(i[0],i[1])};var Oe=(s,t,e)=>{};var Me=(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 Be=(s,t,e)=>{},Re=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&g.build(r,s,e)},Ie=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Ne=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&g.build(r,s,e)},He=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&g.build(r,s,e)},Le=(s,t,e)=>{if(!t||!e)return;let r=e.state,i=t(r);if(!e.state){e.setStateHelper(i);return}e.addState(i)},_e=(s,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let r=t[2];t[2]=i=>{r(i,e)}}e.events.on(...t)}};var Ue=(s,t,e)=>{let r,i,n;if(typeof t=="string"){if(r=T(e),!r)return;i=t}else if(Array.isArray(t)){if(typeof t[0]!="object"){let o=T(e);if(!o)return;t.unshift(o)}[r,i,n]=t}v.bind(s,r,i,n)};var _t=(s,t,e)=>{ht(s,e.state,t,e)};var je=s=>(t,e)=>{let[r,i,n="active"]=s,o=t===i?n:"";m.setData(e,r,o)},We=(s,t,e)=>{if(!t)return;let r=[...t],i=r.pop();r.push(je(i)),K(s,r,e)},Fe=(s,t,e)=>{if(!t)return;let r=[...t],i=r.pop();r.push(je(i)),_t(s,r,e)};var $e=(s,t,e)=>{let r,i,n,o;if(t.length<3){let u=T(e);if(!u)return;r=u,[i,n,o]=t}else[r,i,n,o]=t;let a=o!==!1;v.watch(s,r,i,u=>{if(g.removeAll(s),!u||u.length<1)return;let c=[];for(let l=0,d=u.length;l<d;l++){let y=a?r.scope(`${i}[${l}]`):null,x=n(u[l],l,y,c);x!==null&&c.push(x)}return g.build(c,s,e)})};var Ve=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let i=t[1],n=[];for(let o=0,a=r.length;o<a;o++){let u=r[o];if(!u)continue;let c=i(u,o);c!==null&&n.push(c)}g.build(n,s,e)};var ze=(s,t,e)=>{t(s,e)};p.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var qe=(s,t,e)=>{qr(s,t,e)},qr=(s,t,e)=>{p.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var Je=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(var r=0,i=t.length;r<i;r++)w.setup(s,t[r],e);else w.setup(s,t,e)};var Jr=0,Z=class{constructor(t){this.router=t,this.locationId="base-app-router-"+Jr++,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 Ut=class extends Z{addEvent(){return f.on("popstate",window,this.callBack),this}removeEvent(){return f.off("popstate",window,this.callBack),this}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let r=e.scrollPosition;r&&this.scrollTo(r)}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:r,uri:t}}addState(t,e,r=!1){let i=window.history,n=i.state;if(n&&n.uri===t)return this;let o=this.createState(t,e);return i[r===!1?"pushState":"replaceState"](o,null,t),this}};var jt=class extends Z{addEvent(){return f.on("hashchange",window,this.callBack),this}removeEvent(){return f.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,r){return window.location.hash=t,this}};var Wt=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Ut(t).setup():new jt(t).setup()}};var se=class extends k{getChildScope(){return this.parent}},Ye=s=>U(s,se);var Ft=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}focus(t){this.setup===!1&&this.create(),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){this.template=this.template(),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(Ye(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;g.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var Qe=s=>{if(!s.length)return null;let t={};return s.forEach(e=>{t[e]=null}),t},Xe=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,i=s.match(r);return i===null||i.forEach(n=>{n&&(n=n.replace(":",""),t.push(n))}),t};var Yr=s=>s.replace(/\//g,"/"),Qr=s=>s.replace(/(\/):[^/(]*?\?/g,t=>t.replace(/\//g,"(?:$|/)")),Xr=s=>(s=s.replace(/(\?\/+\*?)/g,"?/*"),s.replace(/(:[^/?&($]+)/g,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),Gr=s=>s.replace(/(\*)/g,".*"),Kr=(s,t)=>s+=t[t.length-1]==="*"?"":"$",Ge=s=>{if(!s)return"";let t=Yr(s);return t=Qr(t),t=Xr(t),t=Gr(t),t=Kr(t,s),t};var Zr=0,$t=class extends O{constructor(t,e){let r=t.baseUri,i=Xe(r),n=Qe(i),o=super(n);return this.uri=r,this.paramKeys=i,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setup(){this.stage={},this.id=null,this.uri=null,this.uriQuery=null,this.controller=null,this.paramKeys=[],this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1}setupRoute(t){this.id=t.id||"bs-rte-"+Zr++,this.path=null,this.referralPath=null;let e=Ge(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?ee(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:i,parent:n}=t,o={component:e,container:r,persist:i,parent:n},a=Dt(this);this.controller=new Ft(a,o)}resume(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 i=this.path;if(!i)return;let n=i.split("#")[1];n&&this.scrollToId(n)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=t.match(this.uriQuery);return r===null?(this.resetParams(),e):(Array.isArray(r)&&(r.shift(),e=r,this.setParams(r)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let r={};e.forEach((i,n)=>{typeof i<"u"&&(r[i]=t[n])}),this.set(r)}getParams(){return this.stage}};var ts=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},es=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let[r,i]of Object.entries(e)){let n=new RegExp(":"+r,"gi");s=s.replace(n,i)}return s},rs=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=es(t,s),ts(t)),ss=(s,t)=>(t!==""&&(s+=" - "+t),s),Ke=(s,t,e)=>t&&(t=rs(s,t),ss(t,e));var Ze={removeSlashes(s){return typeof s!="string"?"":(s.substring(0,1)==="/"&&(s=s.substring(1)),s.substring(-1)==="/"&&(s=s.substring(0,s.length-1)),s)}};var tr=(s,t)=>({attr:s,value:t}),is=(s,t)=>new RegExp("^"+s+"($|#|/|\\.).*").test(t),Vt=class extends k{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,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,i=P.data,n=[];return t&&typeof t=="object"&&n.push(tr("href",t)),e&&typeof e=="object"&&n.push(tr("text",e)),n.push({value:["[[path]]",i],callBack:(o,a)=>{if(typeof a.pathname>"u")return;let u=a.pathname+a.hash,c=r?o===u:is(a.pathname,o);this.update(c)}}),n}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var ns=()=>typeof window<"u"?window.location:{},ie=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.history=null,this.callBackLink=null,this.location=ns(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new M({path:""})}setupHistory(){this.history=Wt.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new $t(t,this.updateTitle.bind(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.resume(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){return this.getBasePath()+Ze.removeSlashes(t)}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let i=0;i<r;i++){let n=e[i];if(n.uri===t)return n}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let i=0;i<r;i++){let n=e[i];if(n.id===t)return n}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1)}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);return t.forEach(i=>{if(!i)return;let n=this.createRoute(i);r.push(n)}),this.checkGroup(r,this.getPath()),e}resumeSwitch(t,e){let r=this.switchCount++,i=this.getSwitchGroup(r);return t.forEach(n=>{let o=n.component.route;o.resume(e),i.push(o)}),this.checkGroup(i,this.getPath()),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.switches.delete(t)}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),f.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){let e=t.parentNode;for(;e!==null;){if(e.nodeName.toLowerCase()==="a")return e;e=e.parentNode}return!1}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target;if(e?.nodeName.toLowerCase()!=="a"&&(e=this.getParentLink(e),e===!1)||e.target==="_blank"||m.data(e,"cancel-route"))return!0;let r=e.getAttribute("href");if(typeof r<"u"){let i=this.baseURI,n=i!=="/"?r.replace(i,""):r;return this.navigate(n),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let i=t[e];i&&typeof i.deactivate=="function"&&i.deactivate()}return this.routes=[],this.switches=new Map,this.switchCount=0,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=Ke(t,e,this.title)}checkActiveRoutes(t){if(this.lastPath=this.path,t=t||this.getPath(),this.path=t,this.lastMatchedRoute&&this.check(this.lastMatchedRoute,t))this.select(this.lastMatchedRoute);else{let e=this.routes,r=e.length;for(let i=0;i<r;i++){let n=e[i];typeof n>"u"||this.checkRoute(n,t)}}this.checkSwitches(t),this.updatePath()}checkSwitches(t){let e=this.switches;for(let r of e.values())this.checkGroup(r,t)}checkGroup(t,e){if(!t.length)return;let r=t.find(o=>o.get("active"));r&&r.match(e)===!1&&r.deactivate();let i;for(let o of t){if(typeof o>"u")continue;if(i){o.deactivate();continue}o.match(e)!==!1&&i===void 0&&o.controller&&(i=o,this.select(o))}let n=t[0];i||this.select(n)}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){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),t.preventScroll!==!0&&this.checkToScroll())}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("/"),i=t.split("/");if(r.length!==i.length)return!0;let n=r[r.length-1],o=i[i.length-1];return n!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&f.off("click",document,this.callBackLink)}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},P=new ie;p.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&P.removeRoute(t)});var rr=(s,t,e)=>{t&&(Array.isArray(t)?t.forEach(r=>{r&&er(s,r,e)}):er(s,t,e))},er=(s,t,e)=>{t.container=s,t.parent=e;let r=P.add(t);os(s,r)},os=(s,t)=>{p.add(s,"routes",{route:t})};var sr=(s,t,e)=>{};p.addType("switch",s=>{if(!s)return!1;let t=s.id;P.removeSwitch(t)});var ir=(s,t,e)=>{let r=t[0];t.forEach(n=>{n&&(n.container=s,n.parent=e)});let i=P.addSwitch(t);as(s,i)},as=(s,t)=>{p.add(s,"switch",{id:t})};J.add("cache",Be).add("onCreated",ze).add("onDestroyed",qe).add("bind",Ue).add("data",Oe).add("state",sr).add("onSet",K).add("onState",_t).add("animateIn",ke).add("animateOut",Ce).add("watch",Je).add("useParent",Re).add("useData",Ne).add("useState",He).add("getId",Ie).add("addState",Le).add("addEvent",_e).add("map",Ve).add("for",$e).add("useContext",Ee).add("addContext",Pe).add("context",Te).add("role",we).add("aria",Ae).add("route",rr).add("debug",Me).add("dataSet",We).add("dataStateSet",Fe).add("switch",ir);D.augment({Ajax:dt,Html:A,dataBinder:v,Data:M,SimpleData:_,Model:z,State:q,Builder:g,router:P,Component:k});export{dt as Ajax,R as Arrays,mr as Atom,g as Builder,k as Component,M as Data,p as DataTracker,Pr as DateTime,J as Directives,m as Dom,ct as Encode,qt as Events,A as Html,ee as Import,U as Jot,z as Model,Vt as NavLink,b as Objects,Er as Pod,_ as SimpleData,q as State,B as Store,S as Strings,h as Types,ut as Unit,D as base,v as dataBinder,P as router};
|
|
1
|
+
var R=class{static toArray(t){return Array.from(t)}static inArray(t,e,r){return Array.isArray(t)?t.indexOf(e,r):-1}};var h=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 ur=Object.prototype.toString,qt=Object.prototype.hasOwnProperty,b={create(s){return Object.create(s||null)},extendObject(s,t){if(!h.isObject(s)||!h.isObject(t))return!1;for(let e in s)qt.call(s,e)&&!qt.call(t,e)&&(t[e]=s[e]);return t},clone(s){return!s||!h.isObject(s)?{}: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 i=Object.create(e);for(var n in r)i[n]=r[n];return i},hasOwnProp(s,t){return qt.call(s,t)},isPlainObject(s){return!!s&&ur.call(s)==="[object Object]"},isEmpty(s){return h.isObject(s)?Object.keys(s).length===0:!0}};var rt={types:{},add(s,t){this.types[s]=t},get(s){return this.types[s]||!1},remove(s){delete this.types[s]}};var dt=class{constructor(){this.types=new Map}add(t,e){this.types.has(t)||this.types.set(t,[]),this.types.get(t).push(e)}get(t){return this.types.get(t)||!1}has(t){return this.types.has(t)}removeByCallBack(t,e){typeof t=="function"&&t(e)}removeType(t){if(!this.types.has(t))return;let e=this.types.get(t);if(!e.length)return;let r,i=rt.get(t);if(i){for(var n=0,o=e.length;n<o;n++)r=e[n],r&&(e[n]=null,this.removeByCallBack(i,r));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}this.types.forEach((e,r)=>{r&&this.removeType(r)}),this.types.clear()}};var d=class{static trackers=new Map;static trackingCount=0;static addType(t,e){rt.add(t,e)}static removeType(t){rt.remove(t)}static getTrackingId(t){return!t||typeof t!="object"?"":t.trackingId||(t.trackingId=`dt${this.trackingCount++}`)}static add(t,e,r){let i=this.getTrackingId(t);this.find(i).add(e,r)}static get(t,e){let r=t.trackingId,i=this.trackers.get(r);return i?e?i.get(e):i:!1}static has(t,e){let r=this.getTrackingId(t);if(!r)return!1;let i=this.trackers.get(r);return i&&e?i.has(e):!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new dt),this.trackers.get(t)}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let r=t.trackingId;if(!r||!this.trackers.has(r))return;let i=this.trackers.get(r);if(!e){i.remove(),this.trackers.delete(r),delete t.trackingId;return}i.remove(e),this.isEmpty(i.types)&&(this.trackers.delete(r),delete t.trackingId)}};var Jt=s=>{let t=0;for(let[e,r]of Object.entries(s))t++,typeof s[e]=="object"&&(t+=Jt(s[e]));return t},ae=(s,t)=>{let e=!1;if(typeof s!="object"||typeof t!="object")return e;for(let[r,i]of Object.entries(s)){if(!b.hasOwnProp(t,r))break;let n=t[r];if(typeof i!=typeof n)break;if(typeof i=="object"){if(e=ae(i,n),e!==!0)break}else if(i===n)e=!0;else break}return e},hr=(s,t)=>{let e=Jt(s),r=Jt(t);return e!==r?!1:ae(s,t)},ce=(s,t)=>{let e=typeof s;return e!==typeof t?!1:e==="object"?hr(s,t):s===t};var f={getEvents(s){return h.isObject(s)===!1?[]:d.get(s,"events")},create(s,t,e,r=!1,i=!1,n=null){return i=i===!0,{event:s,obj:t,fn:e,capture:r,swapped:i,originalFn:n}},on(s,t,e,r){return Array.isArray(s)?s.forEach(i=>this.add(i,t,e,r)):this.add(s,t,e,r),this},off(s,t,e,r){if(Array.isArray(s)){var i;s.forEach(n=>this.remove(n,t,e,r))}else this.remove(s,t,e,r);return this},add(s,t,e,r=!1,i=!1,n=null){if(h.isObject(t)===!1)return this;let o=this.create(s,t,e,r,i,n);return d.add(t,"events",o),t.addEventListener(s,e,r),this},remove(s,t,e,r=!1){let i=this.getEvent(s,t,e,r);return i===!1?this:(typeof i=="object"&&this.removeEvent(i),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 i=this.getEvents(t);if(!i||i.length<1)return!1;let n=this.create(s,t,e,r);return this.search(n,i)},search(s,t){let e,r=this.isSwappable(s.event);for(var i=0,n=t.length;i<n;i++)if(e=t[i],!(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 h.isObject(s)===!1?this:(d.remove(s,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(s){this.swap.push(s)},isSwappable(s){return this.swap.includes(s)}};d.addType("events",s=>{f.removeEvent(s)});var Yt={events:f,addListener(s,t,e,r){return this.events.add(s,t,e,r),this},on(s,t,e,r){let i=this.events;return Array.isArray(s)?s.forEach(n=>{i.add(n,t,e,r)}):i.add(s,t,e,r),this},off(s,t,e,r){let i=this.events;return Array.isArray(s)?s.forEach(n=>{i.remove(n,t,e,r)}):i.remove(s,t,e,r),this},removeListener(s,t,e,r){return this.events.remove(s,t,e,r),this},_createEvent(s,t,e,r){let i;switch(t){case"HTMLEvents":i=new Event(s,e);break;case"MouseEvents":i=new MouseEvent(s,e);break;default:i=new CustomEvent(s,r);break}return i},createEvent(s,t,e,r){if(h.isObject(t)===!1)return!1;let i={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};h.isObject(e)&&(i=Object.assign(i,e));let n=this._getEventType(s);return this._createEvent(s,n,i,r)},_getEventType(s){let t={HTMLEvents:/^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,MouseEvents:/^(?:click|dblclick|mouse(?:down|up|over|move|out))$/},e="CustomEvent";for(let[r,i]of Object.entries(t))if(s.match(i)){e=r;break}return e},trigger(s,t,e){if(h.isObject(t)===!1)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 i=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()},n=this.getWheelEventType();return this.events.add(n,t,i,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 st=class{constructor(){this.errors=[],this.dataTracker=d}augment(t){if(!h.isObject(t))return this;let e=this.constructor.prototype;for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,i){return(t[e]=r).apply(t,R.toArray(i))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(h.isObject(t)===!1)return"";let i=t[e];return typeof i<"u"?i:typeof r<"u"?r:""}createCallBack(t,e,r=[],i=!1){return typeof e!="function"?!1:(...n)=>(i===!0&&(r=r.concat(n)),e.apply(t,r))}bind(t,e){return e.bind(t)}};st.prototype.extend=(function(){return st.prototype})();var D=new st;D.augment({...b,...Yt,...h,equals:ce});var it={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 ue=()=>{D.augment({xhrSettings:it,addFixedParams(s){this.xhrSettings.fixedParams=s},beforeSend(s){this.xhrSettings.beforeSend.push(s)},ajaxSettings(s){typeof s=="object"&&(this.xhrSettings=b.extendClass(D.xhrSettings,s))},resetAjaxSettings(){this.xhrSettings=it}})};var S=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 i={},n=/([^?=&]+)(=([^&]*))?/g;return t.replace(n,function(o,a,c,u){i[a]=e!==!1?decodeURIComponent(u):u}),i}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,i=>e+i.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 pt=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:i,async:n}=this.settings;e.open(r,i,n),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=it.beforeSend;if(t.length<1)return;let e=this.xhr,r=this.settings;for(var i=0,n=t.length;i<n;i++){var o=t[i];o&&o(e,r)}}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(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 i=typeof e;if(r==="string")return i!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(i==="string"&&(e=S.parseQueryString(e,!1)),t instanceof FormData)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.append(n,e[n]);else r==="object"&&(t=b.clone(t),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={...D.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var r=0,i=t.length;r<i;r++){var n=t[r];switch(r){case 0:e.url=n;break;case 1:e.params=n;break;case 2:e.completed=n,e.failed=n;break;case 3:e.responseType=n||"json";break;case 4:e.method=n?n.toUpperCase():"POST";break;case 5:e.async=typeof n<"u"?n:!0;break}}else e=this.settings=b.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,i=()=>{f.removeEvents(r?.upload),f.removeEvents(r)},n=this.settings;if(!n)return!1;switch(e||t.type){case"load":if(typeof n.completed=="function"){let a=this.getResponseData();n.completed(a,this.xhr)}i();break;case"error":typeof n.failed=="function"&&n.failed(!1,this.xhr),i();break;case"progress":typeof n.progress=="function"&&n.progress(t);break;case"abort":typeof n.aborted=="function"&&n.aborted(!1,this.xhr),i();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);f.on(["load","error","abort"],e,r),f.on("progress",e.upload,r)}};ue();var mt=(...s)=>new pt(s).xhr;var lr=s=>typeof s!="string"?s:he(s),he=s=>[{tag:"text",textContent:s}],gt=()=>({props:{},children:[]}),yt=s=>({props:{},children:he(s)}),bt=s=>({props:{},children:s}),xt=s=>({props:s[0]||{},children:lr(s[1])});var vt=class{constructor(){this.connections=new Map}add(t,e,r){let i=this.getOrCreate(t),n=i.get(e);return n?Array.isArray(n)?n.push(r):i.set(e,[n,r]):i.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 i of r.values())this.unsubscribe(i);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 F=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var St=class extends F{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)}unsubscribe(){this.data&&this.msg&&this.token&&this.data.off(this.msg,this.token),this.data=null,this.msg=null,this.token=null}};var $=class{unsubscribe(){}};var kt=class extends ${constructor(){super(),this.source=null}addSource(t){return this.source=new St(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var V=class extends F{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 Ct=class extends V{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 g=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?R.toArray(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]:R.toArray(r):!1}static html(t,e){return h.isObject(t)===!1?!1:h.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,r){return h.isObject(t)===!1||h.isUndefined(e)?this:(e=S.uncamelCase(e),t.style[e]=r,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=S.uncamelCase(e);let r=t.style[e];if(r!=="")return r;let i=null,n=t.currentStyle;if(n&&(i=n[e]))return i;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 h.isObject(t)&&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 h.isObject(t)===!1?!1:typeof r<"u"?(this.setAttr(t,e,r),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=S.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=S.camelCase(e),t.dataset[e]=r}static getData(t,e){return e=S.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,r){return h.isObject(t)===!1?!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(h.isObject(t)===!1)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(h.isObject(t)===!1)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 h.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return h.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return h.isObject(t)?t.offsetWidth:!1}static getHeight(t){return h.isObject(t)?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 h.isObject(t)===!1?!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,i=e.getElementsByTagName("body")[0],n=t.innerWidth||r.clientWidth||i.clientWidth,o=t.innerHeight||r.clientHeight||i.clientHeight;return{width:n,height:o}}static getDocumentSize(){let t=document,e=t.body,r=t.documentElement,i=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:i}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let r={x:0,y:0};if(h.isObject(t)===!1)return r;let i=0;for(;t&&(e===0||i<e);)i++,r.x+=t.offsetLeft+t.clientLeft,r.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return r}static addClass(t,e){if(h.isObject(t)===!1||e==="")return this;if(typeof e=="string"){let n=e.split(" ");for(var r=0,i=n.length;r<i;r++)t.classList.add(e)}return this}static removeClass(t,e){return h.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return h.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return h.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var wt=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 fr=(s,t,e)=>{g.setAttr(s,t,e)},dr=(s,t,e)=>{s.checked=s.value==e},pr=(s,t,e)=>{e=e==1,le(s,t,e)},le=(s,t,e)=>{s[t]=e},mr=(s,t)=>g.getAttr(s,t),gr=(s,t)=>s[t],Tt=class extends V{constructor(t,e,r,i){super(i),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=fr,this.getValue=mr,this;this.getValue=gr;let r=t.type;if(r)switch(r){case"checkbox":this.setValue=pr;return;case"radio":this.setValue=dr;return}return this.setValue=le,this}getAttrBind(t){return t||wt(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 At=class extends ${constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,r){return this.element=new Tt(t,e,r,this.pubSub)}addData(t,e){return this.data=new Ct(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 fe=-1,z=class{constructor(){this.callBacks=new Map,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=1e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[]}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,fe=-1}on(t,e){let r=(++fe).toString();return this.get(t).set(r,e),r}off(t,e){let r=this.callBacks.get(t);r&&(e=String(e),r.delete(e),r.size===0&&this.callBacks.delete(t))}remove(t){this.callBacks.delete(t)}publish(t,...e){if(!this.batchingEnabled){this.publishImmediate(t,...e);return}this.updateQueue.set(t,e),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=!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.updateQueue.clear(),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=new Map(this.updateQueue);this.updateQueue.clear();for(let[e,r]of t)this.publishImmediate(e,...r);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._resolveFlushComplete())}_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 i=0;i<r;i++)e[i]()}})}flushSync(){this.flush()}publishImmediate(t,...e){let r=this.callBacks.get(t);if(r)for(let i of r.values())i&&i.apply(this,e)}};var Qt=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new vt,this.pubSub=new z,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,r,i){let n=r,o=null,a=r.indexOf(":");a!==-1&&(o=r.substring(0,a),n=r.substring(a+1));let c=o??"",u=this.setupConnection(t,e,n,c,i),l=u.element,p=e.get(n);return typeof p<"u"?l.set(p):(p=l.get(),p!==""&&u.data.set(p)),this}setupConnection(t,e,r,i,n){let o=this.getBindId(t),a=new At(this.pubSub);a.addData(e,r).subscribe(o);let l=`${e.getDataId()}:${r}`;return a.addElement(t,i,n).subscribe(l),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,i){if(h.isObject(t)===!1)return this;let n=new kt;n.addSource(e).subscribe(r,i);let a=this.getBindId(t),c=e.getDataId()+":"+r;this.addConnection(a,c,n);let u=e.get(r);return i(u),this}unwatch(t,e,r){if(h.isObject(t)===!1)return this;let i=t[this.attr];if(i){let n=e.getDataId()+":"+r;this.connections.remove(i,n)}return this}publish(t,e,r){return this.pubSub.publish(t,e,r),this}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 i=this.connections.get(r,"bind");if(i){let n=i.element.get();this.pubSub.publish(r,n,e)}}t.stopPropagation()}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&f.on(["change","paste","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&f.off(["change","paste","input"],document,this.changeHandler,!1)}},v=new Qt;var E=s=>s.data?s.data:s.context&&s.context.data?s.context.data:s.state?s.state:null;var yr={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"},nt=s=>yr[s]||s,ot=s=>typeof s=="string"&&s.substring(0,2)==="on"?s.substring(2):s,A=class{static create(t,e,r,i){let n=document.createElement(t);return this.addAttributes(n,e),i===!0?this.prepend(r,n):this.append(r,n),n}static addAttributes(t,e){if(!e||typeof e!="object")return;let r=e.type;typeof r<"u"&&g.setAttr(t,"type",r);for(let[i,n]of Object.entries(e))i==="innerHTML"?t.innerHTML=n:i.indexOf("-")!==-1?g.setAttr(t,i,n):this.addAttr(t,i,n)}static addHtml(t,e){return typeof e>"u"||e===""?this:(/(?:<[a-z][\s\S]*>)/i.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,r){if(r===""||!e)return;if(typeof r==="function")e=ot(e),r.originalCallback?f.add(e,t,r,!1,!0,r.originalCallback):f.add(e,t,r);else{let n=nt(e);t[n]=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(!h.isObject(t)||!h.isArray(e))return!1;e.forEach(i=>{let n=new Option(i.label,i.value);t.options.add(n),r!==null&&n.value==r&&(n.selected=!0)})}static removeElementData(t){d.remove(t);let e=t.childNodes;if(e){let o=e.length-1;for(var r=o;r>=0;r--){var i=e[r];i&&this.removeElementData(i)}}t.bindId&&v.unbind(t)}static removeElement(t){if(!t)return this;let e=d.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(!h.isObject(t))return this;let e=t.childNodes;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.removeElementData(e[r]);return t.innerHTML="",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 i=r||t.firstChild;return t.insertBefore(e,i),this}static clone(t,e=!1){return h.isObject(t)?t.cloneNode(e):!1}};var C=class extends A{static create(t,e,r,i){let n=document.createElement(t);return this.addAttributes(n,e,i),r.appendChild(n),n}static addAttributes(t,e,r){!e||e.length<1||e.forEach(i=>{let{key:n,value:o}=i;this.addAttr(t,n,o,r)})}static addAttr(t,e,r,i){if(r===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){e=ot(e);let a=r,c=function(u){a.call(this,u,i)};f.add(e,t,c,!1,!0,a);return}if(e.substring(4,5)==="-"){g.setAttr(t,e,r);return}let o=nt(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 Xt=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,de=new Map,w={isWatching(s){return Array.isArray(s)?typeof s[0]=="string"&&this.hasParams(s[0]):this.hasParams(s)},hasParams(s){return h.isString(s)&&s.includes("[[")},_getWatcherProps(s){let t=de.get(s);if(t!==void 0)return t;let e=s.match(Xt),r=e?e.map(i=>i.slice(2,-2)):null;return de.set(s,r),r},updateAttr(s,t,e){switch(t){case"text":case"textContent":s.textContent=e;break;case"disabled":s.disabled=!e;break;case"checked":s.checked=!!e;break;case"required":s.required=!!e;break;case"src":if(s.tagName.toLowerCase()==="img"){s.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}s.src=e;break;default:C.addAttr(s,t,e);break}},replaceParams(s,t,e=!1){let r=0;return s.replace(Xt,function(){let i=e?t[r]:t;r++;let n=i.get(arguments[2]);return typeof n<"u"&&n!==null?n:""})},_getWatcherCallBack(s,t,e,r,i){return()=>{let n=this.replaceParams(e,t,i);this.updateAttr(s,r,n)}},getValue(s,t){let e=s.value;return Array.isArray(e)===!1?[e,E(t)]:(e.length<2&&e.push(E(t)),e)},getPropValues(s,t,e){let r=[];for(let i=0,n=t.length;i<n;i++){let a=(e?s[i]:s).get(t[i])??"";r.push(a)}return r},getCallBack(s,t,e,r,i,n){let o=s.attr||"textContent",a=s.callBack;if(typeof a=="function"){let c=n||r.match(Xt)||[],u=c.length>1;return(l,p)=>{l=u!==!0?l:this.getPropValues(e,c,i);let m=a(l,t,p);typeof m<"u"&&this.updateAttr(t,o,m)}}return this._getWatcherCallBack(t,e,r,o,i)},addDataWatcher(s,t,e){let r=this.getValue(t,e),i=r[1]??e?.data??e?.context?.data??e?.state??null;if(!i)return;let n=r[0],o=Array.isArray(i),a=this._getWatcherProps(n),c=this.getCallBack(t,s,i,n,o,a);if(o)for(let u=0,l=a.length;u<l;u++)this.addWatcher(s,i[u],a[u],c);else for(let u=0,l=a.length;u<l;u++)this.addWatcher(s,i,a[u],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){v.watch(s,t,e,r)}};var br=s=>({props:{watch:s},children:[]}),xr=s=>{if(!s)return gt();let t=s[0],e=typeof t;if(e==="string"||e==="number")return yt(t);if(Array.isArray(t))return w.isWatching(t)===!1?bt(t):br(t);let r=s[1]??s[0]??[];return r&&Array.isArray(r)&&w.isWatching(r)===!0&&(s[0]=Array.isArray(s[0])?{}:s[0],s[0].watch=r,s[1]=[]),xt(s)},vr=s=>(...t)=>{let{props:e,children:r}=xr(t);return s(e,r)};var pe=new WeakMap;function Sr(s,t,e,r){let i=pe.get(s);i||(i=new Map,pe.set(s,i));let n=i.get(e);if(n)return n;let o=new Proxy(s,ge(t,e,r));return i.set(e,o),o}var kr=/^\d+$/;function me(s,t){let e=kr.test(t);return s===""?e?`[${t}]`:t:e?`${s}[${t}]`:`${s}.${t}`}function ge(s,t="",e=""){return{get(r,i,n){let o=r[i];if(t===""&&i in r)return typeof o=="function"?o.bind(r):o;let a=r[e]||r;if(o=Reflect.get(a,i,n),o!==null&&typeof o=="object"){let c=me(t,i);return Sr(o,s,c,e)}return o},set(r,i,n,o){if(t===""&&i in r)return r[i]=n,!0;let a=me(t,i);return s.set(a,n),!0}}}var Dt=(s,t="stage")=>new Proxy(s,ge(s,"",t));var at=class{static resume(t,e){if(!t)return null;let r,i=localStorage.getItem(t);return i===null?e&&(r=e):r=JSON.parse(i),r}static store(t,e){if(!t||!e)return!1;let r=JSON.stringify(e);return localStorage.setItem(t,r),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Et=(s={})=>{let t={};if(!h.isObject(s))return t;let e=b.clone(s);return Object.keys(e).forEach(r=>{let i=e[r];typeof i!="function"&&(t[r]=i)}),t};var Cr=0,ye=new Map,H={CHANGE:"change",DELETE:"delete"},Gt=(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},M=class{constructor(t={}){this.dirty=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new z;let e=Et(t);return this.set(e),Dt(this)}setup(){this.stage={}}_init(){let t=++Cr;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}getDataId(){return String(this._id)}remove(){}on(t,e){let r=Gt(t,H.CHANGE);return this.eventSub.on(r,e)}off(t,e){let r=Gt(t,H.CHANGE);this.eventSub.off(r,e)}_setAttr(t,e,r=this,i=!1){let n=this.stage[t];e!==n&&(this.stage[t]=e,this._publish(t,e,r,H.CHANGE))}publishLocalEvent(t,e,r,i){let n=Gt(t,i);this.eventSub.publish(n,e,r)}_publish(t,e,r,i){this.publishLocalEvent(t,e,r,i),r=r||this,v.publish(this._dataId+t,e,r)}set(...t){if(typeof t[0]!="object")return this._setAttr(...t),this;let[e,r,i]=t,n=Object.keys(e);for(let o=0;o<n.length;o++){let a=n[o],c=e[a];typeof c!="function"&&this._setAttr(a,c,r,i)}return this}getModelData(){return this.stage}_deleteAttr(t,e,r=this){delete t[e],this.publishLocalEvent(e,null,r,H.DELETE)}toggle(t){if(!(typeof t>"u"))return this.set(t,!this.get(t)),this}increment(t,e=null){if(typeof t>"u")return;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;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;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){return this.key=t,this}resume(t){let e=at.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return at.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 i=[];return Object.entries(e).forEach(([n])=>{i.push(this.remoteLink(t,n))}),i}remoteLink(t,e,r){let i=r||e,n=t.get(e);typeof n<"u"&&this.get(e)!==n&&this.set(e,n);let o=t.on(e,(c,u)=>{if(u===this)return!1;this.set(i,c,t)});this.addLink(o,t);let a=this.on(i,(c,u)=>{if(u===t)return!1;t.set(e,c,this)});return t.addLink(a,this),o}addLink(t,e){this.links.set(t,e)}unlink(t){if(t){this.removeLink(t);return}let e=this.links;b.isEmpty(e)||(e.forEach((r,i)=>{this.removeLink(i,!1)}),this.links=new Map)}removeLink(t,e=!0){let r=this.links.get(t);r&&r.off(t),e!==!1&&this.links.delete(t)}};M.prototype.isData=!0;var Kt=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t}get(t){return this.cache.get(t)}set(t,e){if(this.cache.has(t)&&this.cache.delete(t),this.cache.set(t,e),this.cache.size>this.maxSize){let r=this.cache.keys().next().value;this.cache.delete(r)}}clear(){this.cache.clear()}},P={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new Kt(1e3),hasDeepData(s){return s.indexOf(".")!==-1||s.indexOf("[")!==-1},getSegments(s){let t=this.segmentCache.get(s);if(t!==void 0)return t;let e=this.deepDataPattern;return t=s.match(e),this.segmentCache.set(s,t),t}};var L=class{static set(t,e,r){if(!P.hasDeepData(e)){t[e]=r;return}let i,n=P.getSegments(e);if(!n)return;let o=n.length,a=o-1;for(let c=0;c<o;c++){let u=n[c];if(c===a){t[u]=r;break}t[u]===void 0&&(t[u]=isNaN(u)?{}:[]),t=t[u]}}static delete(t,e){if(!P.hasDeepData(e)){delete t[e];return}let r=P.getSegments(e);if(!r)return;let i=r.length,n=i-1;for(let o=0;o<i;o++){let a=r[o],c=t[a];if(c===void 0)break;if(o===n){if(Array.isArray(t)){t.splice(Number(a),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 i=r.length,n=i-1;for(let o=0;o<i;o++){let a=r[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===n)return t}}};var q=null,ct=class{static MAX_DEPTH=50;static publishDeep(t,e,r,i){if(!P.hasDeepData(e)){this.publish(e,r,i);return}let n,o=P.getSegments(e);if(!o)return;let a=o.length,c=a-1,u="";for(let l=0;l<a;l++){let p=o[l];t=t[p],l>0?isNaN(p)&&(u+="."+p):u=p;let m;if(l===c)m=r;else{let x=o[l+1];if(isNaN(x)===!1){u+="["+x+"]";continue}let T={};T[x]=t[x],m=T}this.publish(u,m,i)}}static publish(t,e,r,i=null,n=0){if(t=t||"",r(t,e),!e||typeof e!="object")return;let o=i===null;if(o&&(q||(q=new WeakSet),i=q),!!i){if(i.has(e)){console.warn("[Publisher] Circular reference detected at path:",t),o&&(q=null);return}if(n>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion"),o&&(q=null);return}i.add(e),Array.isArray(e)?this.publishArray(t,e,r,i,n):this.publishObject(t,e,r,i,n),o&&(q=null)}}static publishArray(t,e,r,i,n){let o=e.length;for(let a=0;a<o;a++){let c=e[a],u=`${t}[${a}]`;this._checkPublish(u,c,r,i,n)}}static publishObject(t,e,r,i,n){for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let a=e[o],c=`${t}.${o}`;this._checkPublish(c,a,r,i,n)}}static _checkPublish(t,e,r,i,n){if(!e||typeof e!="object"){r(t,e);return}this.publish(t,e,r,i,n+1)}};var B=class extends M{setup(){this.attributes={},this.stage={}}_setAttr(t,e,r,i){typeof e!="object"&&e===this.get(t)||(!r&&i!==!0?L.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),L.set(this.stage,t,e),r=r||this,this._publish(t,e,r,H.CHANGE))}linkAttr(t,e){let r=t.get(e);if(!r)return;let i=Object.keys(r);for(let n=0,o=i.length;n<o;n++){let a=i[n];this.link(t,e+"."+a,a)}}scope(t,e){let r=this.get(t);if(!r)return!1;e=e||this.constructor;let i=new e(r);return i.linkAttr(this,t),i}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 i=this.get(t);return Array.isArray(i)===!1?-1:typeof i[0]!="object"?i.indexOf(e):i.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,i){let n=(o,a)=>this._publishAttr(o,a,r,i);ct.publish(t,e,n)}_publishAttr(t,e,r,i){let n=this._dataId+t;v.publish(n,e,r),this.publishLocalEvent(t,e,r,i)}mergeStage(){this.attributes=b.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);let i=(n,o)=>this.publishLocalEvent(n,o,r,H.DELETE);ct.publish(e,e,i)}_getAttr(t,e){return L.get(t,e)}};var wr={"\n":"\\n","\r":"\\n"," ":"\\t"},Tr=(s,t)=>{typeof s!="string"&&(s=String(s));let e=t?/[\n\r\t]/g:/\t/g;return s.replace(e,r=>wr[r])},be=(s,t)=>{if(typeof s!="string")return s;s=Tr(s,t),s=encodeURIComponent(s);let e=/%22/g;return s.replace(e,'"')},Zt=(s,t)=>{let e=typeof s;return e==="undefined"?s:e!=="object"?(s=be(s),s):(Object.entries(s).forEach(([r,i])=>{i!==null&&(s[r]=typeof i=="string"?Zt(i,t):be(i,t))}),s)};function xe(s){return typeof s<"u"&&s.length>0?JSON.parse(s):!1}function te(s){return typeof s<"u"?JSON.stringify(s):null}var ut=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?b.clone(t):t,i=Zt(r,e);return te(i)}static json={encode:te,decode:xe};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var Pt=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=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=S.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=S.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"),i="id="+r,n=r?`/${r}`:"",o=this.model;return this._get(n,i,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+"="+ut.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let r=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._put(n,r,t,e)}add(t,e){if(!this.isValid())return;let r=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._post(n,r,t,e)}update(t,e){if(!this.isValid())return;let r=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._patch(n,r,t,e)}delete(t,e){let r=this.model.get("id"),i=typeof r<"u"?"id="+r:this.setupObjectData(),n=r!=null?`/${r}`:"";return this._delete(n,i,t,e)}all(t,e,r,i,n=null,o=null){let a=this.model.get();r=isNaN(r)?0:r,i=isNaN(i)?50:i;let c=a.search||"",u=a.filter||"";typeof u=="object"&&(u=JSON.stringify(u));let l=a.dates||"";typeof l=="object"&&(l=JSON.stringify(l));let p=a.orderBy||"";typeof p=="object"&&(p=JSON.stringify(p));let m=a.groupBy||"";Array.isArray(m)&&(m=JSON.stringify(m));let x="&filter="+u+"&offset="+r+"&limit="+i+"&dates="+l+"&orderBy="+p+"&groupBy="+m+"&search="+c+"&lastCursor="+(typeof n<"u"&&n!==null?n:"")+"&since="+(typeof o<"u"&&o!==null?o:"");return this._get("",x,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)}setupRequest(t,e,r,i,n){let o={url:this.getUrl(t),method:e,params:r,completed:(c,u)=>{typeof n=="function"&&n(c),this.getResponse(c,i,u)}};return this._isFormData(r)&&(o.headers={}),mt(o)}setupEventSource(t,e,r,i,n=!0){let o=null,a=null,c=!1,u=!1,l=()=>{a&&(clearTimeout(a),a=null)},p=()=>{if(c||!n||u)return;l(),a=setTimeout(()=>{a=null,m()},3e3)},m=()=>{if(c||u)return;if(o){try{o.close()}catch{}o=null}u=!0;let x=this.getUrl(t),T=e?"?"+e:"";o=new EventSource(x+T,{withCredentials:!0}),o.onopen=()=>{u=!1,l(),i&&i()},o.onerror=()=>{u=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,p())},o.onmessage=et=>{try{let ft=JSON.parse(et.data);r&&r(ft)}catch{}}};return m(),{get source(){return o},close:()=>{if(c=!0,u=!1,l(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return w.isWatching(t)&&(t=w.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,r,i){return this._request("","POST",t,e,r,i)}_get(t,e,r,i,n){return e=this.setupParams(e),e=this.addParams(e,r),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",i,n)}_post(t,e,r,i,n){return this._request(t,"POST",e,r,i,n)}_put(t,e,r,i,n){return this._request(t,"PUT",e,r,i,n)}_patch(t,e,r,i,n){return this._request(t,"PATCH",e,r,i,n)}_delete(t,e,r,i,n){return this._request(t,"DELETE",e,r,i,n)}_request(t,e,r,i,n,o){return r=this.setupParams(r),r=this.addParams(r,i),this.setupRequest(t,e,r,n,o)}getResponse(t,e,r){typeof e=="function"&&e(t,r)}static extend(t){if(!t)return!1;let e=this;class r extends e{constructor(n){super(n)}}return Object.assign(r.prototype,t),r}};var Ar=s=>{let t={};if(!h.isObject(s)||!s.defaults)return t;let{defaults:e}=s;return Object.keys(e).forEach(r=>{let i=e[r];typeof i!="function"&&(t[r]=i)}),delete s.defaults,t},Dr=s=>{if(!s||typeof s.xhr!="object")return{};let t={...s.xhr};return delete s.xhr,t},Er=0,J=class extends B{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=Dr(t),i=e.prototype.service.extend(r),n=Ar(t);class o extends e{constructor(c){let u={...n,...Et(c)};super(u),this.xhr=new i(this)}dataTypeId=`bm${Er++}`}return Object.assign(o.prototype,t),o.prototype.service=i,o}};J.prototype.service=Pt;var _=class extends M{};var Y=class extends _{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 Ot=class extends Y{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var I=class{static targets=new Map;static restore(t,e){this.targets.set(t,e)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new Ot(t)),this.targets.get(t)}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,r){let i=this.getTarget(t);return e&&i.addAction(e,r),i}static addAction(t,e,r){return this.add(t,e,r)}static removeAction(t,e,r){r&&this.off(t,e,r)}static on(t,e,r){let i=this.getTarget(t);return e?i.on(e,r):null}static off(t,e,r){this.remove(t,e,r)}static remove(t,e,r){let i=this.targets,n=i.get(t);if(n){if(e){n.off(e,r);return}this.targets.delete(t)}}static set(t,e,r){this.getTarget(t).set(e,r)}};var Mt=class{constructor(){this.events=[]}addEvents(t){t.length<1||t.forEach(r=>{this.on(...r)})}on(t,e,r,i){f.on(t,e,r,i),this.events.push({event:t,obj:e,callBack:r,capture:i})}off(t,e,r,i){f.off(t,e,r,i);let n,o=this.events;for(var a=0,c=o.length;a<c;a++)if(n=o[a],n.event===t&&n.obj===e){o.splice(a,1);break}}set(){this.events.forEach(t=>{f.on(t.event,t.obj,t.callBack,t.capture)})}unset(){this.events.forEach(t=>{f.off(t.event,t.obj,t.callBack,t.capture)})}reset(){this.unset(),this.events=[]}};var Bt=class{constructor(t,e){this.remoteStates=[];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,i){return{action:t,state:e,callBack:r,targetId:i,token:null}}convertStates(t){let e=[];for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}var i=null,n=null,o=t[r];o&&typeof o=="object"&&(n=o.callBack,i=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,n,i))}return e}setupRemoteStates(t,e){let r;for(var i=0,n=t.length;i<n;i++)if(r=t[i],!!r){for(var o in r)if(!(!Object.prototype.hasOwnProperty.call(r,o)||o==="id")){var a=null,c=r[o],u=c!==null?c:void 0;u&&typeof u=="object"&&(a=u.callBack,u=u.state),e.push(this.createState(o,u,a,r.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeActions(t,e){if(!(e.length<1))for(var r=0,i=e.length;r<i;r++){var n=e[r];n.token&&this.unbindRemoteState(t,n.token),I.remove(n.targetId,n.action,n.token)}}restore(t){I.restore(t.id,t);let e=this.remoteStates;if(e)for(var r=0,i=e.length;r<i;r++){var n=e[r];n.token=this.bindRemoteState(t,n.action,n.targetId)}}bindRemoteState(t,e,r){let i=I.getTarget(r);return t.link(i,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(var i=0,n=e.length;i<n;i++){var o=e[i],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}r.length<1&&(this.remoteStates=[])}addAction(t,e){let r,i=e.action,n=e.targetId;n&&(r=this.bindRemoteState(t,i,n)),typeof e.state<"u"&&t.addAction(i,e.state);let o=e.callBack;return typeof o=="function"&&t.on(i,o),r||null}};var ve=s=>{if(!s)return gt();let t=s[0],e=typeof t;return e==="string"||e==="number"?yt(t):Array.isArray(t)?bt(t):xt(s)};d.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Pr=0,ht=class{constructor(...t){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.cached=[],this.init();let{props:e,children:r}=ve(t);this.setupProps(e),this.children=r||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Pr++,this.unitType=this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=this.persistedCount++,r="pc"+e,n=Object.keys(this.persistedChildren)[e],o=this.persistedChildren[n];return o&&t.unitType===o.unitType&&(r=n,t.resumeScope(o)),t.persistToken=r,this.persistedChildren[r]=t,r}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){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(){d.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(var i=0,n=t.length;i<n;i++){let o=e(t[i],i);r.push(o)}return r}removeAll(t){return A.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),String(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(),this.removeContext();let t=this.panel;t&&A.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null,this.cached.forEach(t=>{this[t]=null}),this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy(),this.data&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var k=class extends ht{constructor(...t){super(...t),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){this.data=t.data,this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,this.id=t.id}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=I.getTarget(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper.restore(t);return}let e=this.setupStates();b.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Bt(this.state,t))}addState(t){!this.stateHelper||this.stateResumed==!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;t&&(this.stateHelper.removeRemoteStates(t),t.remove(),this.stateResumed=!1)}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new Mt)}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,this.beforeDestroy(),this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&this.data.unlink()}};var It={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"};var Or=s=>typeof s=="function"?s:()=>s,Mr=s=>{let t={};return s&&Object.entries(s).forEach(([e,r])=>{let i=It[e]||e;t[i]=Or(r)}),t},Se=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e},U=(s,t=k)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=Mr(s),Se(t,e)):(e={render:r==="function"?s:()=>s},Se(t,e))};var Br=(s,t)=>(Object.entries(s).forEach(([e,r])=>{let i=It[e]||e;t.prototype[i]=r}),t),Ir=s=>class extends s{},Rr=(s,t=k)=>{if(!s)return null;let e=Ir(t),r={},i=s(r);return Br(r,e),e.prototype.render=i,e};var Nr={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){let e=this.dayNames;if(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){s=s?s.replace(/\s/,"T"):"";let e=new Date(s),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 this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),s)},formatTime(s,t){let e=this.createDate(s),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&&(s=s-12),s},convert12To24(s,t){return s=Number(s),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 i=this.getMeridian(s);return s=this.convert24To12(s),`${s}:${this.padNumber(t)} ${i}`},leapYear(s){return s%400===0||s%100!==0&&s%4===0},getMonthName(s=new Date().getMonth(),t=!1){let e=this.monthNames;if(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()){return this.leapYear(s)===!0?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31]},getLocalDate(s,t="America/Denver"){let e=new Date(s);if(Number.isNaN(e.getMonth())===!0){let n=/[- :]/,o=s.split(n);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let r=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),i=e.getTime()-r.getTime();return new Date(e.getTime()+i)},getLocalTime(s,t=!1,e=!1,r="America/Denver"){if(!s)return"";let i=this.getLocalDate(s,r),n=i.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(i.getFullYear(),n,i.getDate(),o)+" "),a+this.renderTime(i.getHours(),i.getMinutes(),i.getSeconds(),o)},getDiffFromNow(s,t=!1){s=s.replace(/\s/,"T");let e=new Date(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;switch(!0){case t<864e5:e="1 day";break;case t<6048e5:r=this.toDays(t),e=r+" days";break;case t<12096e5:e="1 week";break;case t<2592e6:r=this.toDays(t);var i=Math.floor(r/7);e=i+" weeks";break;case t<5184e6:e="1 month";break;case t<31104e6:var n=this.toMonths(t);e=n+" months";break;default:var o=this.toYears(t);e=o}return String(e)},getTimeFrame(s){let t=this.getDiffFromNow(s);return this.convertToEstimate(t)},convertToEstimate(s){let t="",e,r,i,n,o,a,c;if(s<=0)switch(!0){case s<-63072e6:i=this.toYears(Math.abs(s)),t="in "+i+" years";break;case s<-31536e6:t="in a year";break;case s<-5184e6:n=this.toMonths(Math.abs(s)),t="in "+n+" months";break;case s<-2592e6:t="in a month";break;case s<-12096e5:e=this.toDays(Math.abs(s)),r=Math.floor(e/7),t="in "+r+" weeks";break;case s<-6048e5:t="in a week";break;case s<-1728e5:e=this.toDays(Math.abs(s)),t="in "+e+" days";break;case s<-864e5:t="tomorrow";break;case s<-72e5:o=this.toHours(Math.abs(s)),t="in "+o+" hours";break;case s<=-36e5:t="in an hour";break;case s<-12e4:a=this.toMinutes(Math.abs(s)),t="in "+a+" minutes";break;case s<-6e4:t="in a minute";break;case s<-2e3:c=this.toSeconds(Math.abs(s)),t="in "+c+" seconds";break;case s<-1:t="in 1 second";break;default:t="now"}else switch(!0){case s<1e3:t="1 second ago";break;case s<6e4:c=this.toSeconds(s),t=c+" seconds ago";break;case s<12e4:t="1 minute ago";break;case s<36e5:a=this.toMinutes(s),t=a+" minutes ago";break;case s<72e5:t="1 hour ago";break;case s<864e5:o=this.toHours(s),t=o+" hours ago";break;case s<1728e5:t="yesterday";break;case s<6048e5:e=this.toDays(s),t=e+" days ago";break;case s<12096e5:t="a week ago";break;case s<2592e6:e=this.toDays(s),r=Math.floor(e/7),t=r+" weeks ago";break;case s<5184e6:t="a month ago";break;case s<31536e6:n=this.toMonths(s),t=n+" months ago";break;case s<63072e6:t="a year ago";break;default:i=this.toYears(s),t=i+" years ago"}return t},toYears(s){return typeof s!="number"?0:Math.floor(s/31558464e3)},toMonths(s){return typeof s=="number"?Math.floor(s/2592e6):0},toDays(s){return typeof s!="number"?0:Math.floor(s/864e5*1)},toHours(s){return typeof s!="number"?0:Math.floor(s%864e5/36e5*1)},toMinutes(s){return typeof s!="number"?0:Math.floor(s%864e5%36e5/6e4*1)},toSeconds(s){return typeof s!="number"?0:Math.floor(s%864e5%36e5%6e4/1e3*1)},getDifference(s,t){let e=new Date(s),r=new Date(t),i=r.getTime()-e.getTime();return{years:this.toYears(i),days:this.toDays(i),hours:this.toHours(i),minutes:this.toMinutes(i),seconds:this.toSeconds(i)}}};var ke=(s,t)=>({name:s,callBack:t});var Q={keys:[],items:{},add(s,t){return this.keys.push(s),this.items[s]=ke(s,t),this},get(s){return this.items[s]||null},all(){return this.keys}};var ee=(s,t)=>({attr:s,directive:t});var W=(s,t)=>({key:s,value:t});var Ce=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var N=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,i){return t==="text"?(i.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(W("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(ee(W(e,w.getWatcherSettings(r,nt(e))),Q.get("watch")))}static setButtonType(t,e,r){if(t==="button"){let i=e.type||"button";r.push(W("type",i))}}static parse(t,e){let r=[],i=[],n=this.getTag(t);this.setButtonType(n,t,r),this.setupChildren(t);let o=[],a,c,u=Object.keys(t);for(let l=0,p=u.length;l<p;l++){let m=u[l];if(m==="tag"||(a=t[m],a==null))continue;if(m==="children"){if(Array.isArray(a))for(let T=0;T<a.length;T++)o.push(a[T]);else o.push(a);continue}if((c=Q.get(m))!==null){i.push(ee(W(m,a),c));continue}let x=typeof a;if(x==="object"){if(w.isWatching(a)){this.setTextAsWatcher(i,m,a);continue}o.push(a);continue}if(x==="function"){let T=a,et=function(ft){T.call(this,ft,e)};et.originalCallback=T,r.push(W(m,et));continue}if(w.isWatching(a)){this.setTextAsWatcher(i,m,a);continue}this.setElementContent(m,a,r,o)||r.push(W(m,a))}return Ce(n,r,i,o)}};var X=class{build(t,e,r){}setupComponent(t,e,r){let i=r?.getChildScope();t.parent=i,i&&i.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&i&&(i[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 Rt=class extends X{build(t,e,r){let i=C.createDocFragment(),n=Array.isArray(t)?t:[t];for(let o=0,a=n.length;o<a;o++)this.buildElement(n[o],i,r);return e&&typeof e=="object"&&e.appendChild(i),i}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){let i=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,i);return}let n=N.parse(t,i),o=this.createNode(n,e,i);this.cache(o,t.cache,r);let a=n.children;for(let u=0,l=a.length;u<l;u++){let p=a[u];p!==null&&this.buildElement(p,o,r)}let c=n.directives;c&&c.length&&this.setDirectives(o,c,i)}createTempComponent(t,e,r){let i={setData:()=>t.data,render(){return{...t,data:null,state:null}}};t.state&&(i.setupStateTarget=function(o){this.state=t.state});let n=new k(i);this.createComponent(n,e,r)}setDirectives(t,e,r){for(let i=0,n=e.length;i<n;i++)this.handleDirective(t,e[i],r)}handleDirective(t,e,r){e.directive.callBack(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let i=t.tag;if(i==="text"){let n=t.attr[0],o=n?n.value:"";return C.createText(o,e)}else if(i==="comment"){let n=t.attr[0],o=n?n.value:"";return C.createComment(o,e)}return C.create(i,t.attr,e,r)}removeNode(t){C.removeElement(t)}removeAll(t){C.removeAll(t)}};var Hr=["area","base","br","col","embed","hr","img","input","link","meta","source"],G=class{static create(t,e=[],r=""){let i=this.getInnerContent(e);i+=this.getInnerHtml(e);let n=this.createAttributes(e);return Hr.includes(t)?`<${t} ${n} />`:`<${t} ${n}>`+i+r+`</${t}>`}static getInnerContent(t){let e="";return t.forEach(({key:r,value:i},n)=>{if(r!=="text"&&r!=="textContent")return"";t.splice(n,1),e+=i}),e}static getInnerHtml(t){let e="";return t.forEach(({key:r,value:i},n)=>{if(r!=="html"&&r!=="innerHTML")return"";t.splice(n,1),e+=i}),e}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:r,value:i}=e;return typeof i=="function"&&(r="on"+ot(r)),`${r}="${i}"`}).join(" ")}static createText(t){return t}static createComment(t){return`<!-- ${t} -->`}};var Nt=class extends X{build(t,e,r){return(Array.isArray(t)?t:[t]).map(n=>this.buildElement(n,r)).join("")}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=N.parse(t,e),i=r.children.map(n=>n!==null?this.buildElement(n,e):"").join("");return this.createNode(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let i=t.attr[0],n=i?i.value:"";return G.createText(n)}else if(r==="comment"){let i=t.attr[0],n=i?i.value:"";return G.createComment(n)}return G.create(r,t.attr,e)}removeAll(t){}};var Ht=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Rt:new Nt}};var j=Ht.setup(),Lr=s=>typeof s=="object"&&s.isUnit===!0,_r=s=>{let t=U(s);return t?new t:null},y=class{static render(t,e,r){return!t||(Lr(t)||(t=_r(t)),!t)?null:j.createComponent(t,e,r)}static build(t,e,r){return j.build(t,e,r)}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)}};D.augment({buildLayout(s,t,e){y.build(s,t,e)}});var re=[],Ur=s=>re.indexOf(s)!==-1,Wr=s=>({tag:"script",src:s.src,async:!1,load(t){re.push(s.src);let e=s.load;e&&e()}}),jr=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){re.push(s.src);let e=s.load;e&&e()}}),Lt=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=jr({load:r,src:t}):e=Wr({load:r,src:t}),y.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Ur(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 Fr=s=>s?typeof s?.prototype?.constructor=="function":!1,K=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Fr(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){let i=y.build(t,null,r),n=i.firstChild||t?.panel;return e.after(i),n}};var _t=class{static load(t,e){return t.then(r=>(e&&e(r),r)).catch(r=>{console.error("Error loading module:",r)})}};var $r=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),Vr=s=>{let t=typeof s;return t==="string"?import(s):t==="function"?s():s},we=U({declareProps(){this.loaded=!1,this.blockRender=!1},render(){return $r({onCreated:s=>{if(this.src){if(this.layout){this.layoutRoot=K.render(this.layout,this.panel,this.parent);return}if(this.depends){new Lt(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){this.src=Vr(this.src),_t.load(this.src,t=>{if(this.loaded=!0,this.blockRender===!0){this.blockRender=!1;return}let e=this.layout||K.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.layoutRoot=K.render(e,s,this.parent)})},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(){if(!this.layoutRoot){this.blockRender=!0;return}this.blockRender=!1,y.removeNode(this.layoutRoot),this.persist!==!0&&(this.layoutRoot=null,this.layout=null)}});var se=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new we(s)};var Te=(s,t,e=null)=>{if(!s)return;let r=null,i=!1,n=()=>{i||(i=!0,r&&(clearTimeout(r),r=null),f.off("animationend",s,o),s&&g.removeClass(s,t),e&&e())},o=a=>{a.target===s&&n()};f.on("animationend",s,o),requestAnimationFrame(()=>{if(!s){n();return}g.addClass(s,t);try{let a=window.getComputedStyle(s),c=parseFloat(a.animationDuration)*1e3||1e3,u=parseFloat(a.animationDelay)*1e3||0;r=setTimeout(n,c+u+100)}catch{r=setTimeout(n,1e3)}})},Ae=(s,t,e)=>{Te(s,t)},De=(s,t,e)=>{let r=()=>{s&&s.remove&&s.remove()};zr(s,()=>Te(s,t,r),e)};d.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var zr=(s,t,e)=>{d.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var lt=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(i=>{i&<(s,t,i,r)});return}qr(s,t,e,r)},qr=(s,t,e,r)=>{let i,n;if(e.length<3?[i,n]=e:[t,i,n]=e,!t||!i)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=Jr(s,i,n,r);v.watch(s,t,i,o)},Jr=(s,t,e,r)=>typeof e=="object"?i=>{Xr(s,e,i)}:i=>{Yr(s,e,t,i,r)},Yr=(s,t,e,r,i)=>{let n=t(r,s,i);switch(typeof n){case"object":Qr(n,s,i);break;case"string":let o=wt(s);if(o!=="textContent"){g.setAttr(s,o,n);break}A.addHtml(s,n);break}},Qr=(s,t,e)=>{y.rebuild(s,t,e)},Xr=(s,t,e)=>{for(let[r,i]of Object.entries(t))r&&(i===e?g.addClass(s,r):g.removeClass(s,r))};var Z=(s,t,e)=>{let r=E(e);lt(s,r,t,e)};var Ee=(s,t,e)=>{t&&t&&g.setAttr(s,"role",t)},Gr=s=>(t,e)=>{let r=t?"true":"false";g.setAttr(e,s,r)},Pe=(s,t,e)=>{if(!t)return;let r=t.role;r&&(g.setAttr(s,"role",r),t.role=null),Object.entries(t).forEach(([i,n])=>{if(n===null)return;let o=`aria-${i}`;if(Array.isArray(n)){let a=[...n];a.push(Gr(o)),Z(s,a,e)}else g.setAttr(s,o,n)})};var Oe=(s,t,e)=>{if(!t)return;let r=N.parse(t,e);C.addAttributes(s,r.attr,e),y.setDirectives(s,r.directives,e)};d.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var ie=s=>s?s.getContext():null,Me=(s,t,e)=>{if(typeof t!="function")return;let r=ie(e),i=t(r);Oe(s,i,e)},Be=(s,t,e)=>{if(typeof t!="function")return;let r=ie(e);t(r)},Ie=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=ie(e),i=t(r);i&&e.addContextBranch(i[0],i[1])};var Re=(s,t,e)=>{};var Ne=(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 He=(s,t,e)=>{},Le=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&y.build(r,s,e)},_e=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Ue=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&y.build(r,s,e)},We=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&y.build(r,s,e)},je=(s,t,e)=>{if(!t||!e)return;let r=e.state,i=t(r);if(!e.state){e.setStateHelper(i);return}e.addState(i)},Fe=(s,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let r=t[2];t[2]=i=>{r(i,e)}}e.events.on(...t)}};var $e=(s,t,e)=>{let r,i,n;if(typeof t=="string"){if(r=E(e),!r)return;i=t}else if(Array.isArray(t)){if(typeof t[0]!="object"){let o=E(e);if(!o)return;t.unshift(o)}[r,i,n]=t}v.bind(s,r,i,n)};var Ut=(s,t,e)=>{lt(s,e.state,t,e)};var Ve=s=>(t,e)=>{let[r,i,n="active"]=s,o=t===i?n:"";g.setData(e,r,o)},ze=(s,t,e)=>{if(!t)return;let r=[...t],i=r.pop();r.push(Ve(i)),Z(s,r,e)},qe=(s,t,e)=>{if(!t)return;let r=[...t],i=r.pop();r.push(Ve(i)),Ut(s,r,e)};var Je=(s,t,e)=>{let r,i,n,o;if(t.length<3){let c=E(e);if(!c)return;r=c,[i,n,o]=t}else[r,i,n,o]=t;let a=o!==!1;v.watch(s,r,i,c=>{if(y.removeAll(s),!c||c.length<1)return;let u=[];for(let l=0,p=c.length;l<p;l++){let m=a?r.scope(`${i}[${l}]`):null,x=n(c[l],l,m,u);x!==null&&u.push(x)}return y.build(u,s,e)})};var Ye=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let i=t[1],n=[];for(let o=0,a=r.length;o<a;o++){let c=r[o];if(!c)continue;let u=i(c,o);u!==null&&n.push(u)}y.build(n,s,e)};var Qe=(s,t,e)=>{t(s,e)};d.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var Xe=(s,t,e)=>{Kr(s,t,e)},Kr=(s,t,e)=>{d.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var Ge=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(var r=0,i=t.length;r<i;r++)w.setup(s,t[r],e);else w.setup(s,t,e)};var Zr=0,tt=class{constructor(t){this.router=t,this.locationId="base-app-router-"+Zr++,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 Wt=class extends tt{addEvent(){return f.on("popstate",window,this.callBack),this}removeEvent(){return f.off("popstate",window,this.callBack),this}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let r=e.scrollPosition;r&&this.scrollTo(r)}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:r,uri:t}}addState(t,e,r=!1){let i=window.history,n=i.state;if(n&&n.uri===t)return this;let o=this.createState(t,e);return i[r===!1?"pushState":"replaceState"](o,null,t),this}};var jt=class extends tt{addEvent(){return f.on("hashchange",window,this.callBack),this}removeEvent(){return f.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(t.newURL)}addState(t,e,r){return window.location.hash=t,this}};var Ft=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Wt(t).setup():new jt(t).setup()}};var ne=class extends k{getChildScope(){return this.parent}},Ke=s=>U(s,ne);var $t=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}focus(t){this.setup===!1&&this.create(),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){this.template=this.template(),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(Ke(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)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var Ze=s=>{if(!s.length)return null;let t={};return s.forEach(e=>{t[e]=null}),t},tr=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,i=s.match(r);return i===null||i.forEach(n=>{n&&(n=n.replace(":",""),t.push(n))}),t};var ts=s=>s.replace(/\//g,"/"),es=s=>s.replace(/(\/):[^/(]*?\?/g,t=>t.replace(/\//g,"(?:$|/)")),rs=s=>(s=s.replace(/(\?\/+\*?)/g,"?/*"),s.replace(/(:[^/?&($]+)/g,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),ss=s=>s.replace(/(\*)/g,".*"),is=(s,t)=>s+=t[t.length-1]==="*"?"":"$",er=s=>{if(!s)return"";let t=ts(s);return t=es(t),t=rs(t),t=ss(t),t=is(t,s),t};var ns=0,Vt=class extends M{constructor(t,e){let r=t.baseUri,i=tr(r),n=Ze(i),o=super(n);return this.uri=r,this.paramKeys=i,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setup(){this.stage={},this.id=null,this.uri=null,this.uriQuery=null,this.controller=null,this.paramKeys=[],this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1}setupRoute(t){this.id=t.id||"bs-rte-"+ns++,this.path=null,this.referralPath=null;let e=er(this.uri);this.uriQuery=new RegExp("^"+e),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?se(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:i,parent:n}=t,o={component:e,container:r,persist:i,parent:n},a=Dt(this);this.controller=new $t(a,o)}resume(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 i=this.path;if(!i)return;let n=i.split("#")[1];n&&this.scrollToId(n)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=t.match(this.uriQuery);return r===null?(this.resetParams(),e):(Array.isArray(r)&&(r.shift(),e=r,this.setParams(r)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let r={};e.forEach((i,n)=>{typeof i<"u"&&(r[i]=t[n])}),this.set(r)}getParams(){return this.stage}};var os=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},as=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let[r,i]of Object.entries(e)){let n=new RegExp(":"+r,"gi");s=s.replace(n,i)}return s},cs=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=as(t,s),os(t)),us=(s,t)=>(t!==""&&(s+=" - "+t),s),rr=(s,t,e)=>t&&(t=cs(s,t),us(t,e));var sr={removeSlashes(s){return typeof s!="string"?"":(s.substring(0,1)==="/"&&(s=s.substring(1)),s.substring(-1)==="/"&&(s=s.substring(0,s.length-1)),s)}};var ir=(s,t)=>({attr:s,value:t}),hs=(s,t)=>new RegExp("^"+s+"($|#|/|\\.).*").test(t),zt=class extends k{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,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,i=O.data,n=[];return t&&typeof t=="object"&&n.push(ir("href",t)),e&&typeof e=="object"&&n.push(ir("text",e)),n.push({value:["[[path]]",i],callBack:(o,a)=>{if(typeof a.pathname>"u")return;let c=a.pathname+a.hash,u=r?o===c:hs(a.pathname,o);this.update(u)}}),n}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var ls=()=>typeof window<"u"?window.location:{},oe=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.history=null,this.callBackLink=null,this.location=ls(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new B({path:""})}setupHistory(){this.history=Ft.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new Vt(t,this.updateTitle.bind(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.resume(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){return this.getBasePath()+sr.removeSlashes(t)}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let i=0;i<r;i++){let n=e[i];if(n.uri===t)return n}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let i=0;i<r;i++){let n=e[i];if(n.id===t)return n}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1)}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);return t.forEach(i=>{if(!i)return;let n=this.createRoute(i);r.push(n)}),this.checkGroup(r,this.getPath()),e}resumeSwitch(t,e){let r=this.switchCount++,i=this.getSwitchGroup(r);return t.forEach(n=>{let o=n.component.route;o.resume(e),i.push(o)}),this.checkGroup(i,this.getPath()),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.switches.delete(t)}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),f.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){let e=t.parentNode;for(;e!==null;){if(e.nodeName.toLowerCase()==="a")return e;e=e.parentNode}return!1}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target;if(e?.nodeName.toLowerCase()!=="a"&&(e=this.getParentLink(e),e===!1)||e.target==="_blank"||g.data(e,"cancel-route"))return!0;let r=e.getAttribute("href");if(typeof r<"u"){let i=this.baseURI,n=i!=="/"?r.replace(i,""):r;return this.navigate(n),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let i=t[e];i&&typeof i.deactivate=="function"&&i.deactivate()}return this.routes=[],this.switches=new Map,this.switchCount=0,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;document.title=rr(t,e,this.title)}checkActiveRoutes(t){if(this.lastPath=this.path,t=t||this.getPath(),this.path=t,this.lastMatchedRoute&&this.check(this.lastMatchedRoute,t))this.select(this.lastMatchedRoute);else{let e=this.routes,r=e.length;for(let i=0;i<r;i++){let n=e[i];typeof n>"u"||this.checkRoute(n,t)}}this.checkSwitches(t),this.updatePath()}checkSwitches(t){let e=this.switches;for(let r of e.values())this.checkGroup(r,t)}checkGroup(t,e){if(!t.length)return;let r=t.find(o=>o.get("active"));r&&r.match(e)===!1&&r.deactivate();let i;for(let o of t){if(typeof o>"u")continue;if(i){o.deactivate();continue}o.match(e)!==!1&&i===void 0&&o.controller&&(i=o,this.select(o))}let n=t[0];i||this.select(n)}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){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),t.preventScroll!==!0&&this.checkToScroll())}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("/"),i=t.split("/");if(r.length!==i.length)return!0;let n=r[r.length-1],o=i[i.length-1];return n!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&f.off("click",document,this.callBackLink)}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},O=new oe;d.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&O.removeRoute(t)});var or=(s,t,e)=>{t&&(Array.isArray(t)?t.forEach(r=>{r&&nr(s,r,e)}):nr(s,t,e))},nr=(s,t,e)=>{t.container=s,t.parent=e;let r=O.add(t);fs(s,r)},fs=(s,t)=>{d.add(s,"routes",{route:t})};var ar=(s,t,e)=>{};d.addType("switch",s=>{if(!s)return!1;let t=s.id;O.removeSwitch(t)});var cr=(s,t,e)=>{let r=t[0];t.forEach(n=>{n&&(n.container=s,n.parent=e)});let i=O.addSwitch(t);ds(s,i)},ds=(s,t)=>{d.add(s,"switch",{id:t})};Q.add("cache",He).add("onCreated",Qe).add("onDestroyed",Xe).add("bind",$e).add("data",Re).add("state",ar).add("onSet",Z).add("onState",Ut).add("animateIn",Ae).add("animateOut",De).add("watch",Ge).add("useParent",Le).add("useData",Ue).add("useState",We).add("getId",_e).add("addState",je).add("addEvent",Fe).add("map",Ye).add("for",Je).add("useContext",Be).add("addContext",Ie).add("context",Me).add("role",Ee).add("aria",Pe).add("route",or).add("debug",Ne).add("dataSet",ze).add("dataStateSet",qe).add("switch",cr);D.augment({Ajax:mt,Html:A,dataBinder:v,Data:B,SimpleData:_,Model:J,State:Y,Builder:y,router:O,Component:k});export{mt as Ajax,R as Arrays,vr as Atom,y as Builder,k as Component,B as Data,d as DataTracker,Nr as DateTime,Q as Directives,g as Dom,ut as Encode,Yt as Events,A as Html,se as Import,U as Jot,J as Model,zt as NavLink,b as Objects,Rr as Pod,_ as SimpleData,Y as State,I as Store,S as Strings,h as Types,ht as Unit,D as base,v as dataBinder,O as router};
|
|
2
2
|
//# sourceMappingURL=base.js.map
|