@base-framework/base 3.7.25 → 3.7.26
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,s){return Array.isArray(t)?t.indexOf(e,s):-1}};var l=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 ds=Object.prototype.toString,dt=Object.prototype.hasOwnProperty,y={create(r){return Object.create(r||null)},extendObject(r,t){if(!l.isObject(r)||!l.isObject(t))return!1;for(let e in r)dt.call(r,e)&&!dt.call(t,e)&&(t[e]=r[e]);return t},clone(r){if(!r||!l.isObject(r))return{};try{return structuredClone(r)}catch{return JSON.parse(JSON.stringify(r))}},getClassObject(r){return typeof r=="function"?r.prototype:r},extendClass(r,t){let e=this.getClassObject(r),s=this.getClassObject(t);if(typeof e!="object"||typeof s!="object")return!1;let i=Object.create(e);for(var n in s)i[n]=s[n];return i},hasOwnProp(r,t){return dt.call(r,t)},isPlainObject(r){return!!r&&ds.call(r)==="[object Object]"},isEmpty(r){if(!l.isObject(r))return!0;for(let t in r)if(dt.call(r,t))return!1;return!0}};var rt={types:{},add(r,t){this.types[r]=t},get(r){return this.types[r]||!1},remove(r){delete this.types[r]}};var pt=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 s,i=rt.get(t);if(i){for(var n=0,o=e.length;n<o;n++)s=e[n],s&&(e[n]=null,this.removeByCallBack(i,s));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}this.types.forEach((e,s)=>{s&&this.removeType(s)}),this.types.clear()}};var $=new WeakMap,m=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){if(!t||typeof t!="object")return"";let e=$.get(t);return e||(e=`dt${this.trackingCount++}`,$.set(t,e)),e}static add(t,e,s){let i=this.getTrackingId(t);this.find(i).add(e,s)}static get(t,e){let s=$.get(t),i=this.trackers.get(s);return i?e?i.get(e):i:!1}static has(t,e){let s=this.getTrackingId(t);if(!s)return!1;let i=this.trackers.get(s);return i&&e?i.has(e):!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new pt),this.trackers.get(t)}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let s=$.get(t);if(!s||!this.trackers.has(s))return;let i=this.trackers.get(s);if(!e){i.remove(),this.trackers.delete(s),$.delete(t);return}i.remove(e),this.isEmpty(i.types)&&(this.trackers.delete(s),$.delete(t))}};var Qt=r=>{let t=0;for(let[e,s]of Object.entries(r))t++,typeof r[e]=="object"&&(t+=Qt(r[e]));return t},ce=(r,t)=>{let e=!1;if(typeof r!="object"||typeof t!="object")return e;for(let[s,i]of Object.entries(r)){if(!y.hasOwnProp(t,s))break;let n=t[s];if(typeof i!=typeof n)break;if(typeof i=="object"){if(e=ce(i,n),e!==!0)break}else if(i===n)e=!0;else break}return e},ps=(r,t)=>{let e=Qt(r),s=Qt(t);return e!==s?!1:ce(r,t)},ue=(r,t)=>{let e=typeof r;return e!==typeof t?!1:e==="object"?ps(r,t):r===t};var f={getEvents(r){return l.isObject(r)===!1?[]:m.get(r,"events")},create(r,t,e,s=!1,i=!1,n=null){return i=i===!0,{event:r,obj:t,fn:e,capture:s,swapped:i,originalFn:n}},on(r,t,e,s){return Array.isArray(r)?r.forEach(i=>this.add(i,t,e,s)):this.add(r,t,e,s),this},off(r,t,e,s){if(Array.isArray(r)){var i;r.forEach(n=>this.remove(n,t,e,s))}else this.remove(r,t,e,s);return this},add(r,t,e,s=!1,i=!1,n=null){if(l.isObject(t)===!1)return this;let o=this.create(r,t,e,s,i,n);return m.add(t,"events",o),t.addEventListener(r,e,s),this},remove(r,t,e,s=!1){let i=this.getEvent(r,t,e,s);return i===!1?this:(typeof i=="object"&&this.removeEvent(i),this)},removeEvent(r){return typeof r=="object"&&r.obj.removeEventListener(r.event,r.fn,r.capture),this},getEvent(r,t,e,s){if(typeof t!="object")return!1;let i=this.getEvents(t);if(!i||i.length<1)return!1;let n=this.create(r,t,e,s);return this.search(n,i)},search(r,t){let e,s=this.isSwappable(r.event);for(var i=0,n=t.length;i<n;i++)if(e=t[i],!(e.event!==r.event||e.obj!==r.obj)&&(e.fn===r.fn||s===!0&&e.originalFn===r.fn))return e;return!1},removeEvents(r){return l.isObject(r)===!1?this:(m.remove(r,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(r){this.swap.push(r)},isSwappable(r){return this.swap.includes(r)}};m.addType("events",r=>{f.removeEvent(r)});var Yt={events:f,addListener(r,t,e,s){return this.events.add(r,t,e,s),this},on(r,t,e,s){let i=this.events;return Array.isArray(r)?r.forEach(n=>{i.add(n,t,e,s)}):i.add(r,t,e,s),this},off(r,t,e,s){let i=this.events;return Array.isArray(r)?r.forEach(n=>{i.remove(n,t,e,s)}):i.remove(r,t,e,s),this},removeListener(r,t,e,s){return this.events.remove(r,t,e,s),this},_createEvent(r,t,e,s){let i;switch(t){case"HTMLEvents":i=new Event(r,e);break;case"MouseEvents":i=new MouseEvent(r,e);break;default:i=new CustomEvent(r,s);break}return i},createEvent(r,t,e,s){if(l.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};l.isObject(e)&&(i=Object.assign(i,e));let n=this._getEventType(r);return this._createEvent(r,n,i,s)},_getEventType(r){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[s,i]of Object.entries(t))if(r.match(i)){e=s;break}return e},trigger(r,t,e){if(l.isObject(t)===!1)return this;let s=typeof r=="string"?this.createEvent(r,t,null,e):r;return t.dispatchEvent(s),this},mouseWheelEventType:null,getWheelEventType(){let r=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=r())},onMouseWheel(r,t,e,s=!1){typeof t>"u"&&(t=window);let i=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof r=="function"&&r(a,o),e===!0&&o.preventDefault()},n=this.getWheelEventType();return this.events.add(n,t,i,s,!0,r),this},offMouseWheel(r,t,e=!1){typeof t>"u"&&(t=window);let s=this.getWheelEventType();return this.off(s,t,r,e),this},preventDefault(r){return typeof r.preventDefault=="function"?r.preventDefault():r.returnValue=!1,this},stopPropagation(r){return typeof r.stopPropagation=="function"?r.stopPropagation():r.cancelBubble=!0,this}};var it=class{constructor(){this.errors=[],this.dataTracker=m}augment(t){if(!l.isObject(t))return this;let e=this.constructor.prototype;for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return this}override(t,e,s,i){return(t[e]=s).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,s){if(l.isObject(t)===!1)return"";let i=t[e];return typeof i<"u"?i:typeof s<"u"?s:""}createCallBack(t,e,s=[],i=!1){return typeof e!="function"?!1:(...n)=>(i===!0&&(s=s.concat(n)),e.apply(t,s))}bind(t,e){return e.bind(t)}};it.prototype.extend=(function(){return it.prototype})();var T=new it;T.augment({...y,...Yt,...l,equals:ue});var nt={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 he=()=>{T.augment({xhrSettings:nt,addFixedParams(r){this.xhrSettings.fixedParams=r},beforeSend(r){this.xhrSettings.beforeSend.push(r)},ajaxSettings(r){typeof r=="object"&&(this.xhrSettings=y.extendClass(T.xhrSettings,r))},resetAjaxSettings(){this.xhrSettings=nt}})};var S=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,s=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let 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,s=>s[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let s=/([A-Z]{1,})/g;return t.replace(s,i=>e+i.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())}};var mt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:s,url:i,async:n}=this.settings;e.open(s,i,n),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=nt.beforeSend;if(t.length<1)return;let e=this.xhr,s=this.settings;for(var i=0,n=t.length;i<n;i++){var o=t[i];o&&o(e,s)}}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+encodeURIComponent(t[s]));return e.join("&")}setupParams(t,e=null){let s=typeof t;if(!e)return!(t instanceof FormData)&&s==="object"&&(t=this.objectToString(t)),t;let i=typeof e;if(s==="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 s==="object"&&(t=y.clone(t),t=Object.assign(e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,s=t.params;return s?s=this.setupParams(s,e):e&&(s=this.setupParams(e)),s}getXhrSettings(t){let e=this.settings={...T.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var s=0,i=t.length;s<i;s++){var n=t[s];switch(s){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=y.extendClass(this.settings,t[0]),typeof e.completed=="function"&&(typeof e.failed!="function"&&(e.failed=e.completed),typeof e.aborted!="function"&&(e.aborted=e.failed))}createXHR(){let t=this.settings,e=new XMLHttpRequest;return e.responseType=t.responseType,t.withCredentials===!0&&(e.withCredentials=!0),e}setupHeaders(){let t=this.settings;if(!t||typeof t.headers!="object")return;let e=t.headers;for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.xhr?.setRequestHeader(s,e[s])}update(t,e){let s=this.xhr,i=()=>{f.removeEvents(s?.upload),f.removeEvents(s)},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 s=this.update.bind(this);f.on(["load","error","abort"],e,s),f.on("progress",e.upload,s)}};he();var gt=(...r)=>new mt(r).xhr;var ms=r=>typeof r!="string"?r:le(r),le=r=>[{tag:"text",textContent:r}],yt=()=>({props:{},children:[]}),bt=r=>({props:{},children:le(r)}),xt=r=>({props:{},children:r}),St=r=>({props:r[0]||{},children:ms(r[1])});var vt=class{constructor(){this.connections=new Map}add(t,e,s){let i=this.getOrCreate(t),n=i.get(e);return n?Array.isArray(n)?n.push(s):i.set(e,[n,s]):i.set(e,s),s}get(t,e){let s=this.connections.get(t)?.get(e);return s?Array.isArray(s)?s[s.length-1]||!1:s:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let s=this.connections.get(t);if(s)if(e)this.unsubscribe(s.get(e)),s.delete(e),s.size===0&&this.connections.delete(t);else{for(let i of s.values())this.unsubscribe(i);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,s=t.length;e<s;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var V=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var kt=class extends V{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 z=class{unsubscribe(){}};var Ct=class extends z{constructor(){super(),this.source=null}addSource(t){return this.source=new kt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var q=class extends V{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 wt=class extends q{constructor(t,e,s){super(s),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}unsubscribe(){super.unsubscribe(),this.data=null,this.prop=null}};var J=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 s=document.querySelectorAll(t);return s?s.length===1?s[0]:R.toArray(s):!1}static html(t,e){return l.isObject(t)===!1?!1:l.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return l.isObject(t)===!1||l.isUndefined(e)?this:(e=S.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=S.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let i=null,n=t.currentStyle;if(n&&(i=n[e]))return i;let o=window.getComputedStyle(t,null);return o?o[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return l.isObject(t)&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return l.isObject(t)===!1?!1:typeof s<"u"?(this.setAttr(t,e,s),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,s){e=this.removeDataPrefix(e),e=S.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=S.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return l.isObject(t)===!1?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(l.isObject(t)===!1)return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(l.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 l.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return l.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return l.isObject(t)?t.offsetWidth:!1}static getHeight(t){return l.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return l.isObject(t)===!1?!1:{left:e-(t.clientLeft||0),top:s-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,s=e.documentElement,i=e.getElementsByTagName("body")[0],n=t.innerWidth||s.clientWidth||i.clientWidth,o=t.innerHeight||s.clientHeight||i.clientHeight;return{width:n,height:o}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,i=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:i}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(l.isObject(t)===!1)return s;let i=0;for(;t&&(e===0||i<e);)i++,s.x+=t.offsetLeft+t.clientLeft,s.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return s}static addClass(t,e){if(l.isObject(t)===!1||e==="")return this;if(typeof e=="string"){let n=e.split(" ");for(var s=0,i=n.length;s<i;s++)t.classList.add(e)}return this}static removeClass(t,e){return l.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return l.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return l.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var At=r=>{let t="textContent";if(!r||typeof r!="object")return t;let e=r.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let s=r.type;if(!s)return t="value",t;switch(s){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var gs=(r,t,e)=>{J.setAttr(r,t,e)},ys=(r,t,e)=>{r.checked=r.value==e},bs=(r,t,e)=>{e=e==1,fe(r,t,e)},fe=(r,t,e)=>{r[t]=e},xs=(r,t)=>J.getAttr(r,t),Ss=(r,t)=>r[t],Tt=class extends q{constructor(t,e,s,i){super(i),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=gs,this.getValue=xs,this;this.getValue=Ss;let s=t.type;if(s)switch(s){case"checkbox":this.setValue=bs;return;case"radio":this.setValue=ys;return}return this.setValue=fe,this}getAttrBind(t){return t||At(this.element)}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return s=>t.replace(e,s)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}unsubscribe(){super.unsubscribe(),this.element={},this.attr="",this.filter=null,this.setValue=null,this.getValue=null}};var Dt=class extends z{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new Tt(t,e,s,this.pubSub)}addData(t,e){return this.data=new wt(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 de=-1,Q=class{constructor(){this.callBacks=new Map,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=2e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[]}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,de=-1}on(t,e){let s=(++de).toString();return this.get(t).set(s,e),s}off(t,e){let s=this.callBacks.get(t);s&&(e=String(e),s.delete(e),s.size===0&&this.callBacks.delete(t))}remove(t){this.callBacks.delete(t)}publish(t,e,s){if(!this.batchingEnabled){this.publishImmediate(t,e,s);return}this.updateQueue.set(t,[e,s]),this.debugMode&&console.log("[DataPubSub] Queued update:",t,e),this.scheduleFlush()}scheduleFlush(){this.isFlushing||this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){if(this.updateQueue.size===0){this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete();return}if(this.isFlushing||(this.flushIterations=0),this.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=this.updateQueue;this.updateQueue=new Map;try{for(let[e,s]of t)this.publishImmediate(e,s[0],s[1])}finally{this.debugMode&&console.log("[DataPubSub] Flush complete (iteration",this.flushIterations+")"),this.updateQueue.size>0?(this.debugMode&&console.log("[DataPubSub] New updates queued during flush, re-flushing..."),this.flush()):(this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete())}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}}nextFlush(){return new Promise(t=>{this.flushCompleteResolvers.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>t())})}onFlush(t){if(typeof t!="function"){console.warn("[DataPubSub] onFlush requires a function callback");return}this.flushCallbacks.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>{if(this.flushCallbacks.length>0){let e=this.flushCallbacks;this.flushCallbacks=[];let s=e.length;for(let i=0;i<s;i++)e[i]()}})}flushSync(){this.flush()}publishImmediate(t,e,s){let i=this.callBacks.get(t);if(i){for(let n of i.values())if(n)try{n(e,s)}catch(o){console.error('[DataPubSub] Subscriber error for "'+t+'":',o)}}}};var Xt=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 Q,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,i){let n=s,o=null,a=s.indexOf(":");a!==-1&&(o=s.substring(0,a),n=s.substring(a+1));let c=o??"",u=this.setupConnection(t,e,n,c,i),h=u.element,p=e.get(n);return typeof p<"u"?h.set(p):(p=h.get(),p!==""&&u.data.set(p)),this}setupConnection(t,e,s,i,n){let o=this.getBindId(t),a=new Dt(this.pubSub);a.addData(e,s).subscribe(o);let h=`${e.getDataId()}:${s}`;return a.addElement(t,i,n).subscribe(h),this.addConnection(o,"bind",a),a}addConnection(t,e,s){return this.connections.add(t,e,s),this}setBindId(t){let e="db-"+this.idCount++;return t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){let e=t[this.attr];return e&&this.connections.remove(e),this}watch(t,e,s,i){if(l.isObject(t)===!1)return this;let n=new Ct,o=e.get(s),a=!0,c=d=>{a&&(a=!1,d===o)||i(d)};n.addSource(e).subscribe(s,c);let h=this.getBindId(t),p=e.getDataId()+":"+s;return this.addConnection(h,p,n),i(o),this}unwatch(t,e,s){if(l.isObject(t)===!1)return this;let i=t[this.attr];if(i){let n=e.getDataId()+":"+s;this.connections.remove(i,n)}return this}publish(t,e,s){return this.pubSub.publish(t,e,s),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,s=this.isDataBound(e);if(s!==null){let i=this.connections.get(s,"bind");if(i){let n=i.element.get();this.pubSub.publish(s,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)}},x=new Xt;var D=r=>r.data?r.data:r.context&&r.context.data?r.context.data:r.state?r.state:null;var vs=new Map([["class","className"],["text","textContent"],["for","htmlFor"],["readonly","readOnly"],["maxlength","maxLength"],["cellspacing","cellSpacing"],["rowspan","rowSpan"],["colspan","colSpan"],["tabindex","tabIndex"],["celpadding","cellPadding"],["useMap","useMap"],["frameborder","frameBorder"],["contenteditable","contentEditable"]]),ot=r=>vs.get(r)||r,at=r=>typeof r=="string"&&r.charCodeAt(0)===111&&r.charCodeAt(1)===110?r.substring(2):r,ks=/(?:<[a-z][\s\S]*>)/i,A=class{static create(t,e,s,i){let n=document.createElement(t);return this.addAttributes(n,e),i===!0?this.prepend(s,n):this.append(s,n),n}static addAttributes(t,e){if(!e||typeof e!="object")return;let s=e.type;s!==void 0&&t.setAttribute("type",s);let i=Object.keys(e);for(let n=0,o=i.length;n<o;n++){let a=i[n],c=e[a];a==="innerHTML"?t.innerHTML=c:a.indexOf("-")!==-1?t.setAttribute(a,c):this.addAttr(t,a,c)}}static addHtml(t,e){return typeof e>"u"||e===""?this:(ks.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(s===""||!e)return;if(typeof s==="function")e=at(e),s.originalCallback?f.add(e,t,s,!1,!0,s.originalCallback):f.add(e,t,s);else{let n=ot(e);t[n]=s}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let s=document.createTextNode(t);return e&&this.append(e,s),s}static createComment(t,e){let s=document.createComment(t);return e&&this.append(e,s),s}static setupSelectOptions(t,e,s){if(!t||typeof t!="object"||!Array.isArray(e))return!1;e.forEach(i=>{let n=new Option(i.label,i.value);t.options.add(n),s!==null&&n.value==s&&(n.selected=!0)})}static removeElementData(t){let e=[t];for(;e.length>0;){let s=e.pop(),i=s.childNodes;if(i&&i.length>0)for(let n=i.length-1;n>=0;n--)e.push(i[n]);m.remove(s),s.bindId&&x.unbind(s)}}static removeElement(t){if(!t)return this;let e=m.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!t||typeof t!="object")return this;let e;for(;e=t.firstChild;)this.removeElementData(e),t.removeChild(e);return this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,s){let i=s||t.firstChild;return t.insertBefore(e,i),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var C=class extends A{static create(t,e,s,i){let n=document.createElement(t);return this.addAttributes(n,e,i),s.appendChild(n),n}static addAttributes(t,e,s){if(!(!e||e.length<1))for(let i=0,n=e.length;i<n;i++){let o=e[i];this.addAttr(t,o.key,o.value,s)}}static addAttr(t,e,s,i){if(s===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=s;return}if(typeof s==="function"){if(e=at(e),s.originalCallback)f.add(e,t,s,!1,!0,s.originalCallback);else{let a=s,c=function(u){a.call(this,u,i)};f.add(e,t,c,!1,!0,a)}return}if(e.charCodeAt(4)===45){t.setAttribute(e,s);return}let o=ot(e);t[o]=s}static addContent(t,e){e&&(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var pe=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,me=new Map,w={isWatching(r){if(Array.isArray(r)){let t=r[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(r)},hasParams(r){return typeof r=="string"&&r.includes("[[")},_getWatcherProps(r){let t=me.get(r);if(t!==void 0)return t;let e=r.match(pe),s=e?e.map(i=>i.slice(2,-2)):null;return me.set(r,s),s},updateAttr(r,t,e){switch(t){case"text":case"textContent":r.textContent=e;break;case"disabled":r.disabled=!e;break;case"checked":r.checked=!!e;break;case"required":r.required=!!e;break;case"src":if(r.tagName==="IMG"){r.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}r.src=e;break;default:C.addAttr(r,t,e);break}},replaceParams(r,t,e=!1){let s=0;return r.replace(pe,function(i,n,o){let a=e?t[s]:t;s++;let c=a.get(o);return c??""})},_getWatcherCallBack(r,t,e,s,i){return()=>{let n=this.replaceParams(e,t,i);this.updateAttr(r,s,n)}},getValue(r,t){let e=r.value;return Array.isArray(e)===!1?[e,D(t)]:(e.length<2&&e.push(D(t)),e)},getPropValues(r,t,e){let s=[];for(let i=0,n=t.length;i<n;i++){let a=(e?r[i]:r).get(t[i])??"";s.push(a)}return s},getCallBack(r,t,e,s,i,n){let o=r.attr||"textContent",a=r.callBack;if(typeof a=="function"){let c=n||this._getWatcherProps(s)||[],u=c.length>1;return(h,p)=>{h=u!==!0?h:this.getPropValues(e,c,i);let d=a(h,t,p);typeof d<"u"&&this.updateAttr(t,o,d)}}return this._getWatcherCallBack(t,e,s,o,i)},addDataWatcher(r,t,e){let s=this.getValue(t,e),i=s[1]??e?.data??e?.context?.data??e?.state??null;if(!i)return;let n=s[0],o=Array.isArray(i),a=this._getWatcherProps(n),c=this.getCallBack(t,r,i,n,o,a);if(o)for(let u=0,h=a.length;u<h;u++)this.addWatcher(r,i[u],a[u],c);else for(let u=0,h=a.length;u<h;u++)this.addWatcher(r,i,a[u],c)},getWatcherSettings(r,t=null){if(typeof r=="string")return{attr:t,value:r};if(Array.isArray(r)){let e=r[r.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let s=r[1]&&typeof r[1]=="object"?[r[0],r[1]]:[r[0]];return typeof e=="function"?{attr:t,value:s,callBack:e}:{attr:e||"textContent",value:s}}return r},setup(r,t,e){t&&this.addDataWatcher(r,this.getWatcherSettings(t),e)},addWatcher(r,t,e,s){x.watch(r,t,e,s)}};var Cs=r=>({props:{watch:r},children:[]}),ws=r=>{if(r.length===0)return yt();let t=r[0],e=typeof t;if(e==="string"||e==="number")return bt(t);if(Array.isArray(t))return w.isWatching(t)?Cs(t):xt(t);let s=r[1]??r[0]??[];return s&&Array.isArray(s)&&w.isWatching(s)&&(r[0]=Array.isArray(r[0])?{}:r[0],r[0].watch=s,r[1]=[]),St(r)},As=r=>(...t)=>{let{props:e,children:s}=ws(t);return r(e,s)};var ge=new WeakMap,ye=new WeakMap;function Ts(r,t,e,s){let i=ge.get(r);i||(i=new Map,ge.set(r,i));let n=i.get(e);if(n)return n;let o=new Proxy(r,xe(t,e,s));return i.set(e,o),o}function be(r,t){let e=t.charCodeAt(0),s=e>=48&&e<=57;return r===""?s?"["+t+"]":t:s?r+"["+t+"]":r+"."+t}function xe(r,t="",e=""){return{get(s,i,n){let o=s[i];if(t===""&&i in s){if(typeof o=="function"){let c=ye.get(s);c||(c=new Map,ye.set(s,c));let u=c.get(i);if(u)return u;let h=o.bind(s);return c.set(i,h),h}return o}if(o=(s[e]||s)[i],o!==null&&typeof o=="object"){let c=be(t,i);return Ts(o,r,c,e)}return o},set(s,i,n,o){if(t===""&&i in s)return s[i]=n,!0;let a=be(t,i);return r.set(a,n),!0}}}var Et=(r,t="stage")=>new Proxy(r,xe(r,"",t));var ct=class{static resume(t,e){if(!t)return null;let s,i=localStorage.getItem(t);return i===null?e&&(s=e):s=JSON.parse(i),s}static store(t,e){if(!t||!e)return!1;let s=JSON.stringify(e);return localStorage.setItem(t,s),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Pt=(r={})=>{let t={};if(!l.isObject(r))return t;let e=Object.keys(r);for(let s=0,i=e.length;s<i;s++){let n=e[s],o=r[n];typeof o!="function"&&(t[n]=o)}return t};var Ds=0,Se=new Map,N={CHANGE:"change",DELETE:"delete"},Gt=(r,t)=>{let e=Se.get(r);return e||(e={change:`${r}:change`,delete:`${r}:delete`},Se.set(r,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 Q;let e=Pt(t);return this.set(e),Et(this)}setup(){this.stage={}}_init(){let t=++Ds;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}flushPending(){this.eventSub.flush()}getDataId(){return String(this._id)}remove(){}on(t,e){let s=Gt(t,N.CHANGE);return this.eventSub.on(s,e)}off(t,e){let s=Gt(t,N.CHANGE);this.eventSub.off(s,e)}_setAttr(t,e,s=this,i=!1){let n=this.stage[t];e!==n&&(this.stage[t]=e,this._publish(t,e,s,N.CHANGE))}publishLocalEvent(t,e,s,i){let n=Gt(t,i);this.eventSub.publish(n,e,s)}_publish(t,e,s,i){this.publishLocalEvent(t,e,s,i),s=s||this,x.publish(this._dataId+t,e,s)}set(t,e,s){if(typeof t!="object")return this._setAttr(t,e,s),this;let i=Object.keys(t);for(let n=0;n<i.length;n++){let o=i[n],a=t[o];typeof a!="function"&&this._setAttr(o,a,e,s)}return this}getModelData(){return this.stage}_deleteAttr(t,e,s=this){delete t[e],this.publishLocalEvent(e,null,s,N.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 s=this.get(t);return this.set(t,s+e),this}decrement(t,e=null){if(typeof t>"u")return;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s-e),this}concat(t,e){if(typeof t>"u")return;let s=this.get(t);return this.set(t,s+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t){return this.key=t,this}resume(t){let e=ct.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return ct.store(String(this.key),t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,s){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,s);let i=[];return Object.entries(e).forEach(([n])=>{i.push(this.remoteLink(t,n))}),i}remoteLink(t,e,s){let i=s||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;y.isEmpty(e)||(e.forEach((s,i)=>{this.removeLink(i,!1)}),this.links=new Map)}removeLink(t,e=!0){let s=this.links.get(t);s&&s.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.delete(t),this.cache.set(t,e),this.cache.size>this.maxSize){let s=this.cache.keys().next().value;this.cache.delete(s)}}clear(){this.cache.clear()}},E={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new Kt(1e3),hasDeepData(r){return r.indexOf(".")!==-1||r.indexOf("[")!==-1},getSegments(r){let t=this.segmentCache.get(r);if(t!==void 0)return t;let e=this.deepDataPattern;return t=r.match(e),this.segmentCache.set(r,t),t}};var F=class{static set(t,e,s){if(!E.hasDeepData(e)){t[e]=s;return}let i,n=E.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]=s;break}if(t[u]===void 0){let h=u.charCodeAt(0);t[u]=h<48||h>57?{}:[]}t=t[u]}}static delete(t,e){if(!E.hasDeepData(e)){delete t[e];return}let s=E.getSegments(e);if(!s)return;let i=s.length,n=i-1;for(let o=0;o<i;o++){let a=s[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(!E.hasDeepData(e))return t[e]??void 0;let s=E.getSegments(e);if(!s)return;let i=s.length,n=i-1;for(let o=0;o<i;o++){let a=s[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===n)return t}}};var ve=new Set,ut=class{static MAX_DEPTH=50;static publishDeep(t,e,s,i){if(!E.hasDeepData(e)){this.publish(e,s,i);return}let n,o=E.getSegments(e);if(!o)return;let a=o.length,c=a-1,u="";for(let h=0;h<a;h++){let p=o[h];t=t[p];let d=p.charCodeAt(0);h>0?(d<48||d>57)&&(u+="."+p):u=p;let b;if(h===c)b=s;else{let k=o[h+1],_=k.charCodeAt(0);if(_>=48&&_<=57){u+="["+k+"]";continue}let L={};L[k]=t[k],b=L}this.publish(u,b,i)}}static publish(t,e,s,i=null,n=0){if(t=t||"",s(t,e),!(!e||typeof e!="object"||(i===null&&(ve.clear(),i=ve),!i))){if(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}i.add(e),Array.isArray(e)?this.publishArray(t,e,s,i,n):this.publishObject(t,e,s,i,n)}}static publishArray(t,e,s,i,n){let o=e.length;for(let a=0;a<o;a++){let c=e[a],u=t+"["+a+"]";this._checkPublish(u,c,s,i,n)}}static publishObject(t,e,s,i,n){let o=Object.keys(e);for(let a=0,c=o.length;a<c;a++){let u=o[a],h=e[u],p=t+"."+u;this._checkPublish(p,h,s,i,n)}}static _checkPublish(t,e,s,i,n){if(!e||typeof e!="object"){s(t,e);return}this.publish(t,e,s,i,n+1)}};var O=class extends M{setup(){this.attributes={},this.stage={}}_setAttr(t,e,s,i){typeof e!="object"&&e===this.get(t)||(!s&&i!==!0?F.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),F.set(this.stage,t,e),s=s||this,this._publish(t,e,s,N.CHANGE))}linkAttr(t,e){let s=t.get(e);if(!s)return;let i=Object.keys(s);for(let n=0,o=i.length;n<o;n++){let a=i[n];this.link(t,e+"."+a,a)}}scope(t,e){let s=this.get(t);if(!s)return!1;e=e||this.constructor;let i=new e(s);return i.linkAttr(this,t),i}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.push(e),this.set(t,s),this}concat(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s=s.concat(e),this.set(t,s),this}unshift(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.unshift(e),this.set(t,s),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.shift();return this.set(t,e),s}getIndex(t,e,s){let i=this.get(t);return Array.isArray(i)===!1?-1:typeof i[0]!="object"?i.indexOf(e):i.findIndex(o=>o[e]===s)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.pop();return this.set(t,e),s}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,s,i){this._pubCommitter=s,this._pubEvent=i;let n=this._publishCb||(this._publishCb=(o,a)=>this._publishAttr(o,a,this._pubCommitter,this._pubEvent));ut.publish(t,e,n)}_publishAttr(t,e,s,i){let n=this._dataId+t;x.publish(n,e,s),this.publishLocalEvent(t,e,s,i)}mergeStage(){this.attributes=y.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,s=this){F.delete(t,e),this._delCommitter=s;let i=this._deleteCb||(this._deleteCb=(n,o)=>this.publishLocalEvent(n,o,this._delCommitter,N.DELETE));ut.publish(e,e,i)}_getAttr(t,e){return F.get(t,e)}};var Es={"\n":"\\n","\r":"\\n"," ":"\\t"},Ps=(r,t)=>{typeof r!="string"&&(r=String(r));let e=t?/[\n\r\t]/g:/\t/g;return r.replace(e,s=>Es[s])},ke=(r,t)=>{if(typeof r!="string")return r;r=Ps(r,t),r=encodeURIComponent(r);let e=/%22/g;return r.replace(e,'"')},Zt=(r,t)=>{let e=typeof r;return e==="undefined"?r:e!=="object"?(r=ke(r),r):(Object.entries(r).forEach(([s,i])=>{i!==null&&(r[s]=typeof i=="string"?Zt(i,t):ke(i,t))}),r)};function Ce(r){return typeof r<"u"&&r.length>0?JSON.parse(r):!1}function te(r){return typeof r<"u"?JSON.stringify(r):null}var ht=class{static prepareJsonUrl(t,e=!1){let s=typeof t=="object"?y.clone(t):t,i=Zt(s,e);return te(i)}static json={encode:te,decode:Ce};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var Mt=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 s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+t[s]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=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 s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let s=this.model.get("id"),i="id="+s,n=s?`/${s}`:"",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+"="+ht.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let s=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._put(n,s,t,e)}add(t,e){if(!this.isValid())return;let s=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._post(n,s,t,e)}update(t,e){if(!this.isValid())return;let s=this.setupObjectData(),i=this.model.id,n=i!=null?`/${i}`:"";return this._patch(n,s,t,e)}delete(t,e){let s=this.model.get("id"),i=typeof s<"u"?"id="+s:this.setupObjectData(),n=s!=null?`/${s}`:"";return this._delete(n,i,t,e)}all(t,e,s,i,n=null,o=null){let a=this.model.get();s=isNaN(s)?0:s,i=isNaN(i)?50:i;let c=a.search||"",u=a.filter||"";typeof u=="object"&&(u=JSON.stringify(u));let h=a.dates||"";typeof h=="object"&&(h=JSON.stringify(h));let p=a.orderBy||"";typeof p=="object"&&(p=JSON.stringify(p));let d=a.groupBy||"";Array.isArray(d)&&(d=JSON.stringify(d));let b="&filter="+u+"&offset="+s+"&limit="+i+"&dates="+h+"&orderBy="+p+"&groupBy="+d+"&search="+c+"&lastCursor="+(typeof n<"u"&&n!==null?n:"")+"&since="+(typeof o<"u"&&o!==null?o:"");return this._get("",b,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let s=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(s)}setupRequest(t,e,s,i,n){let o={url:this.getUrl(t),method:e,params:s,completed:(c,u)=>{typeof n=="function"&&n(c),this.getResponse(c,i,u)}};return this._isFormData(s)&&(o.headers={}),gt(o)}setupEventSource(t,e,s,i,n=!0){let o=null,a=null,c=!1,u=!1,h=()=>{a&&(clearTimeout(a),a=null)},p=()=>{if(c||!n||u)return;h(),a=setTimeout(()=>{a=null,d()},3e3)},d=()=>{if(c||u)return;if(o){try{o.close()}catch{}o=null}u=!0;let b=this.getUrl(t),k=e?"?"+e:"";o=new EventSource(b+k,{withCredentials:!0}),o.onopen=()=>{u=!1,h(),i&&i()},o.onerror=()=>{u=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,p())},o.onmessage=_=>{try{let L=JSON.parse(_.data);s&&s(L)}catch{}}};return d(),{get source(){return o},close:()=>{if(c=!0,u=!1,h(),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,s,i){return this._request("","POST",t,e,s,i)}_get(t,e,s,i,n){return e=this.setupParams(e),e=this.addParams(e,s),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",i,n)}_post(t,e,s,i,n){return this._request(t,"POST",e,s,i,n)}_put(t,e,s,i,n){return this._request(t,"PUT",e,s,i,n)}_patch(t,e,s,i,n){return this._request(t,"PATCH",e,s,i,n)}_delete(t,e,s,i,n){return this._request(t,"DELETE",e,s,i,n)}_request(t,e,s,i,n,o){return s=this.setupParams(s),s=this.addParams(s,i),this.setupRequest(t,e,s,n,o)}getResponse(t,e,s){typeof e=="function"&&e(t,s)}static extend(t){if(!t)return!1;let e=this;class s extends e{constructor(n){super(n)}}return Object.assign(s.prototype,t),s}};var Ms=r=>{let t={};if(!l.isObject(r)||!r.defaults)return t;let{defaults:e}=r;return Object.keys(e).forEach(s=>{let i=e[s];typeof i!="function"&&(t[s]=i)}),delete r.defaults,t},Os=r=>{if(!r||typeof r.xhr!="object")return{};let t={...r.xhr};return delete r.xhr,t},Is=0,Y=class extends O{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,s=Os(t),i=e.prototype.service.extend(s),n=Ms(t);class o extends e{constructor(c){let u={...n,...Pt(c)};super(u),this.xhr=new i(this)}dataTypeId=`bm${Is++}`}return Object.assign(o.prototype,t),o.prototype.service=i,o}};Y.prototype.service=Mt;var U=class extends M{};var X=class extends U{setup(){this.stage={}}addAction(t,e){return typeof e<"u"&&this.set(t,e),this}getState(t){return this.get(t)}removeAction(t,e){if(e)return this.off(t,e),this;let s=this.stage;return typeof s[t]<"u"&&delete s[t],this}};var Ot=class extends X{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,s){let i=this.getTarget(t);return e&&i.addAction(e,s),i}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){s&&this.off(t,e,s)}static on(t,e,s){let i=this.getTarget(t);return e?i.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let i=this.targets,n=i.get(t);if(n){if(e){n.off(e,s);return}this.targets.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};var It=class{constructor(){this.events=[]}addEvents(t){t.length<1||t.forEach(s=>{this.on(...s)})}on(t,e,s,i){f.on(t,e,s,i),this.events.push({event:t,obj:e,callBack:s,capture:i})}off(t,e,s,i){f.off(t,e,s,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 s=this.convertStates(e);this.addStatesToTarget(t,s)}addStates(t,e){let s=this.convertStates(e);this.addStatesToTarget(t,s)}createState(t,e,s,i){return{action:t,state:e,callBack:s,targetId:i,token:null}}convertStates(t){let e=[];for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;if(s==="remotes"){this.setupRemoteStates(t[s],e);continue}let i=null,n=null,o=t[s];o&&typeof o=="object"&&(n=o.callBack,i=o.id||o.targetId,o=o.state),e.push(this.createState(s,o,n,i))}return e}setupRemoteStates(t,e){for(let s=0,i=t.length;s<i;s++){let n=t[s];if(n)for(let o in n){if(!Object.prototype.hasOwnProperty.call(n,o)||o==="id")continue;let a=null,c=n[o],u=c!==null?c:void 0;u&&typeof u=="object"&&(a=u.callBack,u=u.state),e.push(this.createState(o,u,a,n.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeActions(t,e){if(!(e.length<1))for(let s=0,i=e.length;s<i;s++){let n=e[s];n.token&&this.unbindRemoteState(t,n.token),n.targetId&&I.remove(n.targetId,n.action,n.token)}}restore(t){I.restore(t.id,t);let e=this.remoteStates;if(e)for(let s=0,i=e.length;s<i;s++){let n=e[s];n.token=this.bindRemoteState(t,n.action,n.targetId)}}bindRemoteState(t,e,s){let i=I.getTarget(s);return t.link(i,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let s=this.remoteStates;for(let i=0,n=e.length;i<n;i++){let o=e[i],a=this.addAction(t,o);o.targetId&&(o.token=a,s.push(o))}}addAction(t,e){let s,i=e.action,n=e.targetId;n&&(s=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),s||null}};var we=r=>{if(!r)return yt();let t=r[0],e=typeof t;return e==="string"||e==="number"?bt(t):Array.isArray(t)?xt(t):St(r)};m.addType("components",r=>{if(!r)return;let t=r.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Bs=0,lt=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._classId,this.cached=[],this.init();let{props:e,children:s}=we(t);this.setupProps(e),this.children=s||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Bs++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=this.persistedCount++,s="pc"+e,n=Object.keys(this.persistedChildren)[e],o=this.persistedChildren[n];return o&&t.unitType===o.unitType&&(s=n,t.resumeScope(o)),t.persistToken=s,this.persistedChildren[s]=t,s}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 s=e[0];s&&(this.addingContext=!0,this.contextBranchName=s,this.addContextBranch(s,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){m.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 s=[];if(!t||t.length<1)return s;for(var i=0,n=t.length;i<n;i++){let o=e(t[i],i);s.push(o)}return s}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 v=class extends lt{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,t.context&&(this.context=t.context),this.id=t.id,this._refreshData()}_refreshData(){let t=this.setData();t&&this.data&&this.data.set(t.stage),this._refreshContextData()}_refreshContextData(){let t=this.context;if(!t||!t.data)return;let e=this.getParentContext();!e||!e.data||t.data.set(e.data.stage)}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();y.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 It)}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 _t={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"};var _s=(r,t)=>typeof r!="function"&&t==="setupStates"?()=>r:r,ee=(r,t)=>(r&&Object.entries(r).forEach(([e,s])=>{let i=_t[e]||e;t[i]=_s(s,i)}),t),Rs=r=>ee(r,{}),Hs=0,Ae=(r,t)=>{class e extends r{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Hs++,e},W=(r,t=v)=>{r||(r={});let e,s=typeof r;return s==="object"&&r.render?(e=Rs(r),Ae(t,e)):(e={render:s==="function"?r:()=>r},Ae(t,e))};var Ls=(r,t)=>(Object.entries(r).forEach(([e,s])=>{let i=_t[e]||e;t.prototype[i]=s}),t),Ns=0,Fs=r=>{let t=class extends r{};return t.prototype._classId="pod"+Ns++,t},Us=(r,t=v)=>{if(!r)return null;let e=Fs(t),s={},i=r(s);return Ls(s,e),e.prototype.render=i,e};var Ws={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(r=new Date().getDay(),t=!1){if(typeof Intl<"u"){let i=new Date(2004,0,4+r);return new Intl.DateTimeFormat(void 0,{weekday:t?"short":"long"}).format(i)}let e=this.dayNames;if(r>e.length)return null;let s=e[r];return t?s.substring(0,3):s},convertJsMonth(r){return this.padNumber(r+1)},convertDate(r,t=!1){r=r?r.replace(/\s/,"T"):"";let e=new Date(r);if(typeof Intl<"u"){let i={weekday:"long",month:"short",day:"2-digit"};return t&&(i.year="numeric"),new Intl.DateTimeFormat(void 0,i).format(e)}let s=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+s},padNumber(r){return r<=9?"0"+r:String(r)},createDate(r){return r?(typeof r=="string"&&r.indexOf("-")>-1&&(r=r.replace(/\s/,"T"),r=r.indexOf(":")>-1?r:r+"T00:00:00"),new Date(r)):new Date},format(r,t){let e=this.createDate(t);return r!=="sql"&&typeof Intl<"u"?new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}).format(e):this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),r)},formatTime(r,t){let e=this.createDate(r);if(t!==24&&typeof Intl<"u")return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",hour12:!0}).format(e);let s=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),s)},getMeridian(r){return r=Number(r),r>=12?"PM":"AM"},convert24To12(r){return r=Number(r),r>12&&(r=r-12),r},convert12To24(r,t){return r=Number(r),t.toLowerCase()==="pm"&&(r=r+12),r},renderDate(r,t,e,s="sql"){return t=Number(t),e=Number(e),s==="sql"?`${r}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${r}`},renderTime(r,t,e=0,s="sql"){if(s==="sql")return`${this.padNumber(r)}:${this.padNumber(t)}:${this.padNumber(e)}`;let i=this.getMeridian(r);return r=this.convert24To12(r),`${r}:${this.padNumber(t)} ${i}`},leapYear(r){return r%400===0||r%100!==0&&r%4===0},getMonthName(r=new Date().getMonth(),t=!1){if(typeof Intl<"u"){let i=new Date(2e3,r,1);return new Intl.DateTimeFormat(void 0,{month:t?"short":"long"}).format(i)}let e=this.monthNames;if(r>e.length)return"";let s=e[r];return s?t?s.substring(0,3):s:""},getMonthLength(r,t){let e=new Date;return r=typeof r<"u"?r:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[r]},getMonthsLength(r=new Date().getFullYear()){return this.leapYear(r)===!0?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31]},getLocalDate(r,t="America/Denver"){let e=new Date(r);if(Number.isNaN(e.getMonth())===!0){let n=/[- :]/,o=r.split(n);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let s=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),i=e.getTime()-s.getTime();return new Date(e.getTime()+i)},getLocalTime(r,t=!1,e=!1,s="America/Denver"){if(!r)return"";let i=this.getLocalDate(r,s);if(!t&&typeof Intl<"u"){let c={hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0};return e===!1&&(c.year="numeric",c.month="2-digit",c.day="2-digit"),new Intl.DateTimeFormat(void 0,c).format(i)}let 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(r,t=!1){r=r.replace(/\s/,"T");let e=new Date(r),s=new Date;return t===!0&&s.setHours(0,0,0,0),s.getTime()-e.getTime()},getAge(r){let t=this.getDiffFromNow(r),e,s;switch(!0){case t<864e5:e="1 day";break;case t<6048e5:s=this.toDays(t),e=s+" days";break;case t<12096e5:e="1 week";break;case t<2592e6:s=this.toDays(t);var i=Math.floor(s/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(r){let t=this.getDiffFromNow(r);return this.convertToEstimate(t)},convertToEstimate(r){let t="",e,s,i,n,o,a,c;if(r<=0)switch(!0){case r<-63072e6:i=this.toYears(Math.abs(r)),t="in "+i+" y";break;case r<-31536e6:t="in 1y";break;case r<-5184e6:n=this.toMonths(Math.abs(r)),t="in "+n+"mo";break;case r<-2592e6:t="in 1mo";break;case r<-12096e5:e=this.toDays(Math.abs(r)),s=Math.floor(e/7),t="in "+s+"w";break;case r<-6048e5:t="in 1w";break;case r<-1728e5:e=this.toDays(Math.abs(r)),t="in "+e+"d";break;case r<-864e5:t="tomorrow";break;case r<-72e5:o=this.toHours(Math.abs(r)),t="in "+o+" h";break;case r<=-36e5:t="in 1h";break;case r<-12e4:a=this.toMinutes(Math.abs(r)),t="in "+a+"m";break;case r<-6e4:t="in 1m";break;case r<-2e3:c=this.toSeconds(Math.abs(r)),t="in "+c+"s";break;case r<-1:t="in 1s";break;default:t="now"}else switch(!0){case r<1e3:t="1s ago";break;case r<6e4:c=this.toSeconds(r),t=c+"s ago";break;case r<12e4:t="1m ago";break;case r<36e5:a=this.toMinutes(r),t=a+"m ago";break;case r<72e5:t="1h ago";break;case r<864e5:o=this.toHours(r),t=o+"h ago";break;case r<1728e5:t="yesterday";break;case r<6048e5:e=this.toDays(r),t=e+"d ago";break;case r<12096e5:t="1w ago";break;case r<2592e6:e=this.toDays(r),s=Math.floor(e/7),t=s+"w ago";break;case r<5184e6:t="1mo ago";break;case r<31536e6:n=this.toMonths(r),t=n+"mo ago";break;case r<63072e6:t="1y ago";break;default:i=this.toYears(r),t=i+"y ago"}return t},toYears(r){return typeof r!="number"?0:Math.floor(r/31558464e3)},toMonths(r){return typeof r=="number"?Math.floor(r/2592e6):0},toDays(r){return typeof r!="number"?0:Math.floor(r/864e5*1)},toHours(r){return typeof r!="number"?0:Math.floor(r%864e5/36e5*1)},toMinutes(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5/6e4*1)},toSeconds(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5%6e4/1e3*1)},getDifference(r,t){let e=new Date(r),s=new Date(t),i=s.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 G={items:new Map,add(r,t){return this.items.set(r,t),this},get(r){return this.items.get(r)??null}};var se=(r,t)=>({attr:r,directive:t});var B=(r,t)=>({key:r,value:t});var Te=(r,t,e,s)=>({tag:r,attr:t,directives:e,children:s});var De=null,js=()=>De||(De=G.get("watch")),H=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,s,i){return t==="text"?(i.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(s.push(B("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,s){t.push(se(B(e,w.getWatcherSettings(s,ot(e))),js()))}static setButtonType(t,e,s){if(t==="button"){let i=e.type||"button";s.push(B("type",i))}}static parse(t,e){let s=[],i=[],n=t.tag||"div";n==="button"&&s.push(B("type",t.type||"button"));let o=[],a,c,u=Object.keys(t);for(let h=0,p=u.length;h<p;h++){let d=u[h];if(d==="tag"||(a=t[d],a==null))continue;if(d==="children"||d==="nest"){if(Array.isArray(a))for(let k=0;k<a.length;k++)o.push(a[k]);else o.push(a);continue}if((c=G.get(d))!==null){i.push(se(B(d,a),c));continue}let b=typeof a;if(b==="object"){if(w.isWatching(a)){this.setTextAsWatcher(i,d,a);continue}o.push(a);continue}if(b==="function"){let k=a,_=function(L){k.call(this,L,e)};_.originalCallback=k,s.push(B(d,_));continue}if(b==="string"&&a.includes("[[")){this.setTextAsWatcher(i,d,a);continue}if(d==="text"){o.push({tag:"text",textContent:a});continue}if(d==="html"||d==="innerHTML"){s.push(B("innerHTML",a));continue}s.push(B(d,a))}return Te(n,s,i,o)}};var K=class{build(t,e,s){}setupComponent(t,e,s){let i=s?.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(),s=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),s}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t),t}setDirectives(t,e,s){}removeNode(t){}removeAll(t){}};var Rt=class extends K{build(t,e,s){let i=C.createDocFragment();if(Array.isArray(t))for(let n=0,o=t.length;n<o;n++)this.buildElement(t[n],i,s);else this.buildElement(t,i,s);return e&&typeof e=="object"&&e.appendChild(i),i}buildElement(t,e,s){if(t){if(t.isUnit===!0){this.createComponent(t,e,s);return}this.createElement(t,e,s)}}createElement(t,e,s){let i=s?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,i);return}let n=H.parse(t,i),o=this.createNode(n,e,i);this.cache(o,t.cache,s);let a=n.children;for(let u=0,h=a.length;u<h;u++){let p=a[u];p!==null&&this.buildElement(p,o,s)}let c=n.directives;c&&c.length&&this.setDirectives(o,c,i)}createTempComponent(t,e,s){let i={cache:t.cache,setData:()=>t.data,...ee(t.methods||{},{}),render(){return{...t,data:null,state:null}}};t.state&&(i.setupStateTarget=function(o){this.state=t.state});let n=new v(i);this.createComponent(n,e,s)}setDirectives(t,e,s){for(let i=0,n=e.length;i<n;i++)this.handleDirective(t,e[i],s)}handleDirective(t,e,s){e.directive(t,e.attr.value,s)}cache(t,e,s){s&&e&&s.cacheEle(t,e)}createNode(t,e,s){let 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,s)}removeNode(t){C.removeElement(t)}removeAll(t){C.removeAll(t)}};var $s=["area","base","br","col","embed","hr","img","input","link","meta","source"],Z=class{static create(t,e=[],s=""){let i=this.getInnerContent(e);i+=this.getInnerHtml(e);let n=this.createAttributes(e);return $s.includes(t)?`<${t} ${n} />`:`<${t} ${n}>`+i+s+`</${t}>`}static getInnerContent(t){let e="";return t.forEach(({key:s,value:i},n)=>{if(s!=="text"&&s!=="textContent")return"";t.splice(n,1),e+=i}),e}static getInnerHtml(t){let e="";return t.forEach(({key:s,value:i},n)=>{if(s!=="html"&&s!=="innerHTML")return"";t.splice(n,1),e+=i}),e}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:s,value:i}=e;return typeof i=="function"&&(s="on"+at(s)),`${s}="${i}"`}).join(" ")}static createText(t){return t}static createComment(t){return`<!-- ${t} -->`}};var Ht=class extends K{build(t,e,s){return(Array.isArray(t)?t:[t]).map(n=>this.buildElement(n,s)).join("")}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let s=H.parse(t,e),i=s.children.map(n=>n!==null?this.buildElement(n,e):"").join("");return this.createNode(s,i)}createNode(t,e){let s=t.tag;if(s==="text"){let i=t.attr[0],n=i?i.value:"";return Z.createText(n)}else if(s==="comment"){let i=t.attr[0],n=i?i.value:"";return Z.createComment(n)}return Z.create(s,t.attr,e)}removeAll(t){}};var Lt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Rt:new Ht}};var j=Lt.setup(),Vs=r=>typeof r=="object"&&r.isUnit===!0,zs=r=>{let t=W(r);return t?new t:null},g=class{static render(t,e,s){return!t||(Vs(t)||(t=zs(t)),!t)?null:j.createComponent(t,e,s)}static build(t,e,s){return j.build(t,e,s)}static rebuild(t,e,s){return j.removeAll(e),this.build(t,e,s)}static setDirectives(t,e,s){j.setDirectives(t,e,s)}static createNode(t,e,s){return j.createNode(t,e,s)}static removeNode(t){j.removeNode(t)}static removeAll(t){j.removeAll(t)}};T.augment({buildLayout(r,t,e){g.build(r,t,e)}});var re=[],qs=r=>re.indexOf(r)!==-1,Js=r=>({tag:"script",src:r.src,async:!1,load(t){re.push(r.src);let e=r.load;e&&e()}}),Qs=r=>({tag:"link",rel:"stylesheet",type:"text/css",href:r.src,load(t){re.push(r.src);let e=r.load;e&&e()}}),Nt=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,s=this.update.bind(this);t.indexOf(".css")!==-1?e=Qs({load:s,src:t}):e=Js({load:s,src:t}),g.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{qs(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 Ys=r=>r?typeof r?.prototype?.constructor=="function":!1,tt=class{static process(t,e){let s=t.default;return s?e.callback?e.callback(s):(Ys(s)?s=new s:s=s(),s.isUnit===!0&&(s.route=e.route,e.persist&&(s.persist=!0)),s):null}static render(t,e,s){let i=g.build(t,null,s),n=i.firstChild||t?.panel;return e.after(i),n}};var Ft=class{static load(t,e,s){return t.then(i=>(e&&e(i),i)).catch(i=>{console.error("Error loading module:",i),s&&s(i)})}};var Xs=r=>({tag:"comment",textContent:"import placeholder",onCreated:r.onCreated}),Ut=new Map,Gs=r=>{if(Ut.has(r)){let s=Ut.get(r);return s&&typeof s.then!="function"?Promise.resolve(s):s}let t=typeof r,e;if(t==="string")e=import(r);else if(t==="function")e=r();else return r;return e.then(s=>{Ut.set(r,s)}),Ut.set(r,e),e},Ee=W({declareProps(){this.loaded=!1,this.generation=0},render(){return Xs({onCreated:r=>{if(this.src){if(this.layout){this.layoutRoot=tt.render(this.layout,this.panel,this.parent);return}if(this.depends){new Nt(()=>{this.loadAndRender(r)}).addFiles(this.depends);return}this.loadAndRender(r)}}})},loadAndRender(r){let t=this.generation;Ft.load(Gs(this.src),e=>{if(t!==this.generation)return;this.loaded=!0;let s=this.layout||tt.process(e,{callback:this.callback,route:this.route,persist:this.persist});this.layout=s,this.layoutRoot=tt.render(s,r,this.parent)},e=>{t===this.generation&&(this.loaded=!1)})},shouldUpdate(r){return this.updateLayout===!0?!0:this.updateLayout=r&&r.isUnit&&typeof r.update=="function"},updateModuleLayout(r){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(r)},update(r){this.loaded===!0&&this.updateModuleLayout(r)},destroy(){this.generation++,this.layoutRoot&&(g.removeNode(this.layoutRoot),this.persist!==!0&&(this.layoutRoot=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var ie=r=>{let t=typeof r;return(t==="string"||t==="function"||r instanceof Promise)&&(r={src:r}),new Ee(r)};var Pe=(r,t,e=null)=>{if(!r)return;let s=null,i=!1,n=()=>{i||(i=!0,s&&(clearTimeout(s),s=null),f.off("animationend",r,o),r&&r.classList.remove(t),e&&e())},o=a=>{a.target===r&&n()};f.on("animationend",r,o),requestAnimationFrame(()=>{if(!r){n();return}r.classList.add(t);try{let a=window.getComputedStyle(r),c=parseFloat(a.animationDuration)*1e3||1e3,u=parseFloat(a.animationDelay)*1e3||0;s=setTimeout(n,c+u+100)}catch{s=setTimeout(n,1e3)}})},Me=(r,t,e)=>{Pe(r,t)},Oe=(r,t,e)=>{let s=()=>{r&&r.remove&&r.remove()};Ks(r,()=>Pe(r,t,s),e)};m.addType("manual-destroy",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var Ks=(r,t,e)=>{m.add(r,"manual-destroy",{ele:r,callBack:t,parent:e})};var ft=(r,t,e,s)=>{if(Array.isArray(e[0])){e.forEach(i=>{i&&ft(r,t,i,s)});return}Zs(r,t,e,s)},Zs=(r,t,e,s)=>{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.',r,t);return}let o=tr(r,i,n,s);x.watch(r,t,i,o)},tr=(r,t,e,s)=>typeof e=="object"?i=>{sr(r,e,i)}:i=>{er(r,e,t,i,s)},er=(r,t,e,s,i)=>{let n=t(s,r,i);switch(typeof n){case"object":g.rebuild(n,r,i);break;case"string":let o=At(r);if(o!=="textContent"){r.setAttribute(o,n);break}A.addHtml(r,n);break}},sr=(r,t,e)=>{let s=Object.keys(t);for(let i=0,n=s.length;i<n;i++){let o=s[i];o&&(t[o]===e?r.classList.add(o):r.classList.remove(o))}};var et=(r,t,e)=>{let s=D(e);ft(r,s,t,e)};var Ie=(r,t,e)=>{t&&r.setAttribute("role",t)},rr=r=>(t,e)=>{let s=t?"true":"false";e.setAttribute(r,s)},Be=(r,t,e)=>{if(!t)return;let s=t.role;s&&(r.setAttribute("role",s),t.role=null);let i=Object.keys(t);for(let n=0,o=i.length;n<o;n++){let a=i[n],c=t[a];if(c===null)continue;let u="aria-"+a;if(Array.isArray(c)){let h=c.slice();h.push(rr(u)),et(r,h,e)}else r.setAttribute(u,c)}};var _e=(r,t,e)=>{if(!t)return;let s=H.parse(t,e);C.addAttributes(r,s.attr,e),g.setDirectives(r,s.directives,e)};m.addType("context",r=>{if(!r)return!1;r.parent.removeContextBranch(r.branch)});var ne=r=>r?r.getContext():null,Re=(r,t,e)=>{if(typeof t!="function")return;let s=ne(e),i=t(s);_e(r,i,e)},He=(r,t,e)=>{if(typeof t!="function")return;let s=ne(e);t(s)},Le=(r,t,e)=>{if(typeof t!="function"||!e)return;let s=ne(e),i=t(s);i&&e.addContextBranch(i[0],i[1])};var Ne=(r,t,e)=>{};var Fe=(r,t,e)=>{if(!e)return;let s=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",r),console.log("Data: ",t),console.log("Layout: ",s),console.log("parent: ",e)};var Ue=(r,t,e)=>{},We=(r,t,e)=>{if(!t||!e)return;let s=t(e,r);s&&g.build(s,r,e)},je=(r,t,e)=>{if(!t||!e)return;let s=e.getId(t);r.id=s},$e=(r,t,e)=>{if(!t||!e)return;let s=t(e.data,r);s&&g.build(s,r,e)},Ve=(r,t,e)=>{if(!t||!e)return;let s=t(e.state,r);s&&g.build(s,r,e)},ze=(r,t,e)=>{if(!t||!e)return;let s=e.state,i=t(s);if(!e.state){e.setStateHelper(i);return}e.addState(i)},qe=(r,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let s=t[2];t[2]=i=>{s(i,e)}}e.events.on(t[0],t[1],t[2],t[3])}};var Je=(r,t,e)=>{let s,i,n;if(typeof t=="string"){if(s=D(e),!s)return;i=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=D(e);if(!o)return;s=o,i=t[0],n=t[1]}else[s,i,n]=t;x.bind(r,s,i,n)};var Wt=(r,t,e)=>{ft(r,e.state,t,e)};var Qe=r=>(t,e)=>{let[s,i,n="active"]=r,o=t===i?n:"";e.dataset[s]=o},Ye=(r,t,e)=>{if(!t)return;let s=t.length-1,i=t[s],n=t.slice(0,s);n.push(Qe(i)),et(r,n,e)},Xe=(r,t,e)=>{if(!t)return;let s=t.length-1,i=t[s],n=t.slice(0,s);n.push(Qe(i)),Wt(r,n,e)};var Ge=(r,t,e)=>{let s,i,n,o;if(t.length<3){let c=D(e);if(!c)return;s=c,[i,n,o]=t}else[s,i,n,o]=t;let a=o!==!1;x.watch(r,s,i,c=>{if(g.removeAll(r),!c||c.length<1)return;let u=[];for(let h=0,p=c.length;h<p;h++){let d=a?s.scope(i+"["+h+"]"):null,b=n(c[h],h,d,u);b!==null&&u.push(b)}return g.build(u,r,e)})};var Ke=(r,t,e)=>{let s=t[0];if(!s||s.length<1)return;let i=t[1],n=[];for(let o=0,a=s.length;o<a;o++){let c=s[o];if(!c)continue;let u=i(c,o);u!==null&&n.push(u)}g.build(n,r,e)};var Ze=(r,t,e)=>{t(r,e)};m.addType("destroyed",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var ts=(r,t,e)=>{ir(r,t,e)},ir=(r,t,e)=>{m.add(r,"destroyed",{ele:r,callBack:t,parent:e})};var es=(r,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let s=0,i=t.length;s<i;s++)w.setup(r,t[s],e);else w.setup(r,t,e)};var nr=0,st=class{constructor(t){this.router=t,this.locationId="base-app-router-"+nr++,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 jt=class extends st{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 s=e.scrollPosition;s&&this.scrollTo(s)}createState(t,e={}){let s=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:s,uri:t}}addState(t,e,s=!1){let i=window.history,n=i.state;if(n&&n.uri===t)return this;let o=this.createState(t,e);return i[s===!1?"pushState":"replaceState"](o,null,t),this}};var $t=class extends st{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,s){return window.location.hash=t,this}};var Vt=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new jt(t).setup():new $t(t).setup()}};var oe=class extends v{getChildScope(){return this.parent}},ss=r=>W(r,oe);var zt=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.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),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(ss(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 rs=r=>{if(!r.length)return null;let t={};return r.forEach(e=>{t[e]=null}),t},is=r=>{let t=[];if(!r)return t;let e=/[*?]/g;r=r.replace(e,"");let s=/:(.[^./?&($]+)\?*/g,i=r.match(s);return i===null||i.forEach(n=>{n&&(n=n.replace(":",""),t.push(n))}),t};var or=r=>r.replace(/\//g,"/"),ar=r=>r.replace(/(\/):[^/(]*?\?/g,t=>t.replace(/\//g,"(?:$|/)")),cr=r=>(r=r.replace(/(\?\/+\*?)/g,"?/*"),r.replace(/(:[^/?&($]+)/g,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),ur=r=>r.replace(/(\*)/g,".*"),hr=(r,t)=>r+=t[t.length-1]==="*"?"":"$",ns=r=>{if(!r)return"";let t=or(r);return t=ar(t),t=cr(t),t=ur(t),t=hr(t,r),t};var lr=0,qt=class extends M{constructor(t,e){let s=t.baseUri,i=is(s),n=rs(i),o=super(n);return this.uri=s,this.paramKeys=i,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setup(){this.stage={},this.routeId=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.routeId=t.id||"bs-rte-"+lr++,this.path=null,this.referralPath=null;let e=ns(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?ie(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:s,persist:i,parent:n}=t,o={component:e,container:s,persist:i,parent:n},a=Et(this);this.controller=new zt(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 s=this.controller;s&&s.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,s=t.match(this.uriQuery);return s===null?(this.resetParams(),e):(Array.isArray(s)&&(s.shift(),e=s,this.setParams(s)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let s={};e.forEach((i,n)=>{typeof i<"u"&&(s[i]=t[n])}),this.set(s)}getParams(){return this.stage}};var fr=r=>{let t=/\w\S*/;return r.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},dr=(r,t)=>{if(r.indexOf(":")===-1)return r;let e=t.stage;for(let[s,i]of Object.entries(e)){let n=new RegExp(":"+s,"gi");r=r.replace(n,i)}return r},pr=(r,t)=>t&&(typeof t=="function"&&(t=t(r.stage)),t=dr(t,r),fr(t)),mr=(r,t)=>(t!==""&&(r+=" - "+t),r),os=(r,t,e)=>t&&(t=pr(r,t),mr(t,e));var as={removeSlashes(r){return typeof r!="string"?"":(r.substring(0,1)==="/"&&(r=r.substring(1)),r.substring(-1)==="/"&&(r=r.substring(0,r.length-1)),r)}};var cs=(r,t)=>({attr:r,value:t}),gr=(r,t)=>new RegExp("^"+r+"($|#|/|\\.).*").test(t),Jt=class extends v{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,s=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,watch:s}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let s=this.exact===!0,i=P.data,n=[];return t&&typeof t=="object"&&n.push(cs("href",t)),e&&typeof e=="object"&&n.push(cs("text",e)),n.push({value:["[[path]]",i],callBack:(o,a)=>{if(typeof a.pathname>"u")return;let c=a.pathname+a.hash,u=s?o===c:gr(a.pathname,o);this.update(u)}}),n}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var yr=()=>typeof window<"u"?window.location:{},ae=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=yr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new O({path:""})}setupHistory(){this.history=Vt.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new qt(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let s=arguments;t={uri:s[0],component:s[1],callBack:s[2],title:s[3],id:s[4],container:s[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.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()+as.removeSlashes(t)}getRoute(t){let e=this.routes,s=e.length;if(s>0)for(let i=0;i<s;i++){let n=e[i];if(n.uri===t)return n}return null}getRouteById(t){let e=this.routes,s=e.length;if(s>0)for(let i=0;i<s;i++){let n=e[i];if(n.routeId===t)return n}return!1}removeRoute(t){let e=this.routes,s=e.indexOf(t);s>-1&&e.splice(s,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null)}addSwitch(t){let e=this.switchCount++,s=this.getSwitchGroup(e);return t.forEach(i=>{if(!i)return;let n=this.createRoute(i);s.push(n)}),this.checkGroup(s,this.getPath()),e}resumeSwitch(t,e){let s=this.switchCount++,i=this.getSwitchGroup(s);return t.forEach(n=>{let o=n.component.route;o.resume(e),i.push(o)}),this.checkGroup(i,this.getPath()),s}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let s=[];return this.switches.set(t,s),s}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 s=this.getEndPoint();return this.navigate(s,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target.closest("a");if(!e||e.target==="_blank"||e.dataset.cancelRoute)return!0;let s=e.getAttribute("href");if(s!==null){let i=this.baseURI,n=i!=="/"?s.replace(i,""):s;return this.navigate(n),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,s=t.length;e<s;e++){let i=t[e];i&&typeof i.deactivate=="function"&&i.deactivate()}return this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,s){return t=this.createURI(t),this.history.addState(t,e,s),this.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=os(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,s=e.length;for(let i=0;i<s;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 s of e.values())this.checkGroup(s,t)}checkGroup(t,e){if(!t.length)return;let s=t.find(o=>o.get("active"));s&&s.match(e)===!1&&s.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 s=this.check(t,e);return s!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),s}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t){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()),s=this.cleanPath(this.lastPath).split("/"),i=t.split("/");if(s.length!==i.length)return!0;let n=s[s.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 ae;m.addType("routes",r=>{if(!r)return!1;let t=r.route;t&&P.removeRoute(t)});var hs=(r,t,e)=>{if(t)if(Array.isArray(t))for(let s=0,i=t.length;s<i;s++){let n=t[s];n&&us(r,n,e)}else us(r,t,e)},us=(r,t,e)=>{t.container=r,t.parent=e;let s=P.add(t);br(r,s)},br=(r,t)=>{m.add(r,"routes",{route:t})};var ls=(r,t,e)=>{};m.addType("switch",r=>{if(!r)return!1;let t=r.id;P.removeSwitch(t)});var fs=(r,t,e)=>{let s=t[0];for(let n=0,o=t.length;n<o;n++){let a=t[n];a&&(a.container=r,a.parent=e)}let i=P.addSwitch(t);xr(r,i)},xr=(r,t)=>{m.add(r,"switch",{id:t})};G.add("cache",Ue).add("onCreated",Ze).add("onDestroyed",ts).add("bind",Je).add("data",Ne).add("state",ls).add("onSet",et).add("onState",Wt).add("animateIn",Me).add("animateOut",Oe).add("watch",es).add("useParent",We).add("useData",$e).add("useState",Ve).add("getId",je).add("addState",ze).add("addEvent",qe).add("map",Ke).add("for",Ge).add("useContext",He).add("addContext",Le).add("context",Re).add("role",Ie).add("aria",Be).add("route",hs).add("debug",Fe).add("dataSet",Ye).add("dataStateSet",Xe).add("switch",fs);T.augment({Ajax:gt,Html:A,dataBinder:x,Data:O,SimpleData:U,Model:Y,State:X,Builder:g,router:P,Component:v});export{gt as Ajax,R as Arrays,As as Atom,g as Builder,v as Component,O as Data,m as DataTracker,Ws as DateTime,G as Directives,J as Dom,ht as Encode,Yt as Events,A as Html,ie as Import,W as Jot,Y as Model,Jt as NavLink,y as Objects,Us as Pod,U as SimpleData,X as State,I as Store,S as Strings,l as Types,lt as Unit,T as base,x as dataBinder,P as router};
|
|
1
|
+
var R=class{static toArray(t){return Array.from(t)}static inArray(t,e,s){return Array.isArray(t)?t.indexOf(e,s):-1}};var l=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 fs=Object.prototype.toString,dt=Object.prototype.hasOwnProperty,b={create(r){return Object.create(r||null)},extendObject(r,t){if(!l.isObject(r)||!l.isObject(t))return!1;for(let e in r)dt.call(r,e)&&!dt.call(t,e)&&(t[e]=r[e]);return t},clone(r){if(!r||!l.isObject(r))return{};try{return structuredClone(r)}catch{return JSON.parse(JSON.stringify(r))}},getClassObject(r){return typeof r=="function"?r.prototype:r},extendClass(r,t){let e=this.getClassObject(r),s=this.getClassObject(t);if(typeof e!="object"||typeof s!="object")return!1;let n=Object.create(e);for(var i in s)n[i]=s[i];return n},hasOwnProp(r,t){return dt.call(r,t)},isPlainObject(r){return!!r&&fs.call(r)==="[object Object]"},isEmpty(r){if(!l.isObject(r))return!0;for(let t in r)if(dt.call(r,t))return!1;return!0}};var rt={types:{},add(r,t){this.types[r]=t},get(r){return this.types[r]||!1},remove(r){delete this.types[r]}};var pt=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 s,n=rt.get(t);if(n){for(var i=0,o=e.length;i<o;i++)s=e[i],s&&(e[i]=null,this.removeByCallBack(n,s));this.types.delete(t)}}remove(t){if(t){this.removeType(t);return}this.types.forEach((e,s)=>{s&&this.removeType(s)}),this.types.clear()}};var $=new WeakMap,m=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){if(!t||typeof t!="object")return"";let e=$.get(t);return e||(e=`dt${this.trackingCount++}`,$.set(t,e)),e}static add(t,e,s){let n=this.getTrackingId(t);this.find(n).add(e,s)}static get(t,e){let s=$.get(t),n=this.trackers.get(s);return n?e?n.get(e):n:!1}static has(t,e){let s=this.getTrackingId(t);if(!s)return!1;let n=this.trackers.get(s);return n&&e?n.has(e):!1}static find(t){return this.trackers.has(t)||this.trackers.set(t,new pt),this.trackers.get(t)}static isEmpty(t){return!t||typeof t!="object"?!0:t.size===0}static remove(t,e){let s=$.get(t);if(!s||!this.trackers.has(s))return;let n=this.trackers.get(s);if(!e){n.remove(),this.trackers.delete(s),$.delete(t);return}n.remove(e),this.isEmpty(n.types)&&(this.trackers.delete(s),$.delete(t))}};var Vt=r=>{let t=0;for(let[e,s]of Object.entries(r))t++,typeof r[e]=="object"&&(t+=Vt(r[e]));return t},ne=(r,t)=>{let e=!1;if(typeof r!="object"||typeof t!="object")return e;for(let[s,n]of Object.entries(r)){if(!b.hasOwnProp(t,s))break;let i=t[s];if(typeof n!=typeof i)break;if(typeof n=="object"){if(e=ne(n,i),e!==!0)break}else if(n===i)e=!0;else break}return e},ds=(r,t)=>{let e=Vt(r),s=Vt(t);return e!==s?!1:ne(r,t)},ie=(r,t)=>{let e=typeof r;return e!==typeof t?!1:e==="object"?ds(r,t):r===t};var f={getEvents(r){return l.isObject(r)===!1?[]:m.get(r,"events")},create(r,t,e,s=!1,n=!1,i=null){return n=n===!0,{event:r,obj:t,fn:e,capture:s,swapped:n,originalFn:i}},on(r,t,e,s){return Array.isArray(r)?r.forEach(n=>this.add(n,t,e,s)):this.add(r,t,e,s),this},off(r,t,e,s){if(Array.isArray(r)){var n;r.forEach(i=>this.remove(i,t,e,s))}else this.remove(r,t,e,s);return this},add(r,t,e,s=!1,n=!1,i=null){if(l.isObject(t)===!1)return this;let o=this.create(r,t,e,s,n,i);return m.add(t,"events",o),t.addEventListener(r,e,s),this},remove(r,t,e,s=!1){let n=this.getEvent(r,t,e,s);return n===!1?this:(typeof n=="object"&&this.removeEvent(n),this)},removeEvent(r){return typeof r=="object"&&r.obj.removeEventListener(r.event,r.fn,r.capture),this},getEvent(r,t,e,s){if(typeof t!="object")return!1;let n=this.getEvents(t);if(!n||n.length<1)return!1;let i=this.create(r,t,e,s);return this.search(i,n)},search(r,t){let e,s=this.isSwappable(r.event);for(var n=0,i=t.length;n<i;n++)if(e=t[n],!(e.event!==r.event||e.obj!==r.obj)&&(e.fn===r.fn||s===!0&&e.originalFn===r.fn))return e;return!1},removeEvents(r){return l.isObject(r)===!1?this:(m.remove(r,"events"),this)},swap:["DOMMouseScroll","wheel","mousewheel","mousemove","popstate"],addSwapped(r){this.swap.push(r)},isSwappable(r){return this.swap.includes(r)}};m.addType("events",r=>{f.removeEvent(r)});var zt={events:f,addListener(r,t,e,s){return this.events.add(r,t,e,s),this},on(r,t,e,s){let n=this.events;return Array.isArray(r)?r.forEach(i=>{n.add(i,t,e,s)}):n.add(r,t,e,s),this},off(r,t,e,s){let n=this.events;return Array.isArray(r)?r.forEach(i=>{n.remove(i,t,e,s)}):n.remove(r,t,e,s),this},removeListener(r,t,e,s){return this.events.remove(r,t,e,s),this},_createEvent(r,t,e,s){let n;switch(t){case"HTMLEvents":n=new Event(r,e);break;case"MouseEvents":n=new MouseEvent(r,e);break;default:n=new CustomEvent(r,s);break}return n},createEvent(r,t,e,s){if(l.isObject(t)===!1)return!1;let n={pointerX:0,pointerY:0,button:0,view:window,detail:1,screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,bubbles:!0,cancelable:!0,relatedTarget:null};l.isObject(e)&&(n=Object.assign(n,e));let i=this._getEventType(r);return this._createEvent(r,i,n,s)},_getEventType(r){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[s,n]of Object.entries(t))if(r.match(n)){e=s;break}return e},trigger(r,t,e){if(l.isObject(t)===!1)return this;let s=typeof r=="string"?this.createEvent(r,t,null,e):r;return t.dispatchEvent(s),this},mouseWheelEventType:null,getWheelEventType(){let r=()=>{let t="wheel";return"onmousewheel"in self?t="mousewheel":"DOMMouseScroll"in self&&(t="DOMMouseScroll"),t};return this.mouseWheelEventType||(this.mouseWheelEventType=r())},onMouseWheel(r,t,e,s=!1){typeof t>"u"&&(t=window);let n=o=>{let a=Math.max(-1,Math.min(1,-o.deltaY||o.wheelDelta||-o.detail));typeof r=="function"&&r(a,o),e===!0&&o.preventDefault()},i=this.getWheelEventType();return this.events.add(i,t,n,s,!0,r),this},offMouseWheel(r,t,e=!1){typeof t>"u"&&(t=window);let s=this.getWheelEventType();return this.off(s,t,r,e),this},preventDefault(r){return typeof r.preventDefault=="function"?r.preventDefault():r.returnValue=!1,this},stopPropagation(r){return typeof r.stopPropagation=="function"?r.stopPropagation():r.cancelBubble=!0,this}};var nt=class{constructor(){this.errors=[],this.dataTracker=m}augment(t){if(!l.isObject(t))return this;let e=this.constructor.prototype;for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return this}override(t,e,s,n){return(t[e]=s).apply(t,R.toArray(n))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,s){if(l.isObject(t)===!1)return"";let n=t[e];return typeof n<"u"?n:typeof s<"u"?s:""}createCallBack(t,e,s=[],n=!1){return typeof e!="function"?!1:(...i)=>(n===!0&&(s=s.concat(i)),e.apply(t,s))}bind(t,e){return e.bind(t)}};nt.prototype.extend=(function(){return nt.prototype})();var A=new nt;A.augment({...b,...zt,...l,equals:ie});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 oe=()=>{A.augment({xhrSettings:it,addFixedParams(r){this.xhrSettings.fixedParams=r},beforeSend(r){this.xhrSettings.beforeSend.push(r)},ajaxSettings(r){typeof r=="object"&&(this.xhrSettings=b.extendClass(A.xhrSettings,r))},resetAjaxSettings(){this.xhrSettings=it}})};var v=class{static limit(t,e=1e6){return typeof t!="string"?"":t.substring(0,e)}static parseQueryString(t,e,s=!0){typeof t!="string"&&(t=window.location.search),t=this.limit(t);let n={},i=/([^?=&]+)(=([^&]*))?/g;return t.replace(i,function(o,a,c,u){n[a]=e!==!1?decodeURIComponent(u):u}),n}static camelCase(t){t=this.limit(t);let e=/(-|\s|_)+\w{1}/g;return t.replace(e,s=>s[1].toUpperCase())}static uncamelCase(t,e="-"){t=this.limit(t);let s=/([A-Z]{1,})/g;return t.replace(s,n=>e+n.toLowerCase()).toLowerCase()}static titleCase(t){if(!t)return"";t=this.limit(t);let e=/\w\S*/;return t.replace(e,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())}};var mt=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:s,url:n,async:i}=this.settings;e.open(s,n,i),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=it.beforeSend;if(t.length<1)return;let e=this.xhr,s=this.settings;for(var n=0,i=t.length;n<i;n++){var o=t[n];o&&o(e,s)}}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+encodeURIComponent(t[s]));return e.join("&")}setupParams(t,e=null){let s=typeof t;if(!e)return!(t instanceof FormData)&&s==="object"&&(t=this.objectToString(t)),t;let n=typeof e;if(s==="string")return n!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(n==="string"&&(e=v.parseQueryString(e,!1)),t instanceof FormData)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.append(i,e[i]);else s==="object"&&(t=b.clone(t),t=Object.assign(e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,s=t.params;return s?s=this.setupParams(s,e):e&&(s=this.setupParams(e)),s}getXhrSettings(t){let e=this.settings={...A.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var s=0,n=t.length;s<n;s++){var i=t[s];switch(s){case 0:e.url=i;break;case 1:e.params=i;break;case 2:e.completed=i,e.failed=i;break;case 3:e.responseType=i||"json";break;case 4:e.method=i?i.toUpperCase():"POST";break;case 5:e.async=typeof i<"u"?i:!0;break}}else e=this.settings=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 s in e)Object.prototype.hasOwnProperty.call(e,s)&&this.xhr?.setRequestHeader(s,e[s])}update(t,e){let s=this.xhr,n=()=>{f.removeEvents(s?.upload),f.removeEvents(s)},i=this.settings;if(!i)return!1;switch(e||t.type){case"load":if(typeof i.completed=="function"){let a=this.getResponseData();i.completed(a,this.xhr)}n();break;case"error":typeof i.failed=="function"&&i.failed(!1,this.xhr),n();break;case"progress":typeof i.progress=="function"&&i.progress(t);break;case"abort":typeof i.aborted=="function"&&i.aborted(!1,this.xhr),n();break}}getResponseData(){let t=this.xhr;if(!t)return null;let e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let e=this.xhr;if(!e)return;let s=this.update.bind(this);f.on(["load","error","abort"],e,s),f.on("progress",e.upload,s)}};oe();var gt=(...r)=>new mt(r).xhr;var ps=r=>typeof r!="string"?r:ae(r),ae=r=>[{tag:"text",textContent:r}],ce=()=>({props:{},children:[]}),ue=r=>({props:{},children:ae(r)}),he=r=>({props:{},children:r}),le=r=>({props:r[0]||{},children:ps(r[1])});var yt=class{constructor(){this.connections=new Map}add(t,e,s){let n=this.getOrCreate(t),i=n.get(e);return i?Array.isArray(i)?i.push(s):n.set(e,[i,s]):n.set(e,s),s}get(t,e){let s=this.connections.get(t)?.get(e);return s?Array.isArray(s)?s[s.length-1]||!1:s:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let s=this.connections.get(t);if(s)if(e)this.unsubscribe(s.get(e)),s.delete(e),s.size===0&&this.connections.delete(t);else{for(let n of s.values())this.unsubscribe(n);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,s=t.length;e<s;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var V=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var bt=class extends V{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 z=class{unsubscribe(){}};var xt=class extends z{constructor(){super(),this.source=null}addSource(t){return this.source=new bt(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var q=class extends V{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 vt=class extends q{constructor(t,e,s){super(s),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}unsubscribe(){super.unsubscribe(),this.data=null,this.prop=null}};var J=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 s=document.querySelectorAll(t);return s?s.length===1?s[0]:R.toArray(s):!1}static html(t,e){return l.isObject(t)===!1?!1:l.isUndefined(e)===!1?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return l.isObject(t)===!1||l.isUndefined(e)?this:(e=v.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=v.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let n=null,i=t.currentStyle;if(i&&(n=i[e]))return n;let o=window.getComputedStyle(t,null);return o?o[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return l.isObject(t)&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return l.isObject(t)===!1?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=v.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,s){e=this.removeDataPrefix(e),e=v.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=v.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return l.isObject(t)===!1?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(l.isObject(t)===!1)return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(l.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 l.isObject(t)===!1?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return l.isObject(t)===!1?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return l.isObject(t)?t.offsetWidth:!1}static getHeight(t){return l.isObject(t)?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return l.isObject(t)===!1?!1:{left:e-(t.clientLeft||0),top:s-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,s=e.documentElement,n=e.getElementsByTagName("body")[0],i=t.innerWidth||s.clientWidth||n.clientWidth,o=t.innerHeight||s.clientHeight||n.clientHeight;return{width:i,height:o}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,n=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:n}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(l.isObject(t)===!1)return s;let n=0;for(;t&&(e===0||n<e);)n++,s.x+=t.offsetLeft+t.clientLeft,s.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return s}static addClass(t,e){if(l.isObject(t)===!1||e==="")return this;if(typeof e=="string"){let i=e.split(" ");for(var s=0,n=i.length;s<n;s++)t.classList.add(e)}return this}static removeClass(t,e){return l.isObject(t)===!1||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return l.isObject(t)===!1||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return l.isObject(t)===!1?this:(t.classList.toggle(e),this)}};var St=r=>{let t="textContent";if(!r||typeof r!="object")return t;let e=r.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let s=r.type;if(!s)return t="value",t;switch(s){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var ms=(r,t,e)=>{J.setAttr(r,t,e)},gs=(r,t,e)=>{r.checked=r.value==e},ys=(r,t,e)=>{e=e==1,fe(r,t,e)},fe=(r,t,e)=>{r[t]=e},bs=(r,t)=>J.getAttr(r,t),xs=(r,t)=>r[t],kt=class extends q{constructor(t,e,s,n){super(n),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=ms,this.getValue=bs,this;this.getValue=xs;let s=t.type;if(s)switch(s){case"checkbox":this.setValue=ys;return;case"radio":this.setValue=gs;return}return this.setValue=fe,this}getAttrBind(t){return t||St(this.element)}setupFilter(t){let e=/(\[\[[^\]]+\]\])/;return s=>t.replace(e,s)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}unsubscribe(){super.unsubscribe(),this.element={},this.attr="",this.filter=null,this.setValue=null,this.getValue=null}};var Ct=class extends z{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new kt(t,e,s,this.pubSub)}addData(t,e){return this.data=new vt(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 de=-1,Q=class{constructor(){this.callBacks=new Map,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=2e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[]}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,de=-1}on(t,e){let s=(++de).toString();return this.get(t).set(s,e),s}off(t,e){let s=this.callBacks.get(t);s&&(e=String(e),s.delete(e),s.size===0&&this.callBacks.delete(t))}remove(t){this.callBacks.delete(t)}publish(t,e,s){if(!this.batchingEnabled){this.publishImmediate(t,e,s);return}this.updateQueue.set(t,[e,s]),this.debugMode&&console.log("[DataPubSub] Queued update:",t,e),this.scheduleFlush()}scheduleFlush(){this.isFlushing||this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){if(this.updateQueue.size===0){this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete();return}if(this.isFlushing||(this.flushIterations=0),this.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=this.updateQueue;this.updateQueue=new Map;try{for(let[e,s]of t)this.publishImmediate(e,s[0],s[1])}finally{this.debugMode&&console.log("[DataPubSub] Flush complete (iteration",this.flushIterations+")"),this.updateQueue.size>0?(this.debugMode&&console.log("[DataPubSub] New updates queued during flush, re-flushing..."),this.flush()):(this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete())}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}}nextFlush(){return new Promise(t=>{this.flushCompleteResolvers.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>t())})}onFlush(t){if(typeof t!="function"){console.warn("[DataPubSub] onFlush requires a function callback");return}this.flushCallbacks.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>{if(this.flushCallbacks.length>0){let e=this.flushCallbacks;this.flushCallbacks=[];let s=e.length;for(let n=0;n<s;n++)e[n]()}})}flushSync(){this.flush()}publishImmediate(t,e,s){let n=this.callBacks.get(t);if(n){for(let i of n.values())if(i)try{i(e,s)}catch(o){console.error('[DataPubSub] Subscriber error for "'+t+'":',o)}}}};var qt=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new yt,this.pubSub=new Q,this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,n){let i=s,o=null,a=s.indexOf(":");a!==-1&&(o=s.substring(0,a),i=s.substring(a+1));let c=o??"",u=this.setupConnection(t,e,i,c,n),h=u.element,p=e.get(i);return typeof p<"u"?h.set(p):(p=h.get(),p!==""&&u.data.set(p)),this}setupConnection(t,e,s,n,i){let o=this.getBindId(t),a=new Ct(this.pubSub);a.addData(e,s).subscribe(o);let h=`${e.getDataId()}:${s}`;return a.addElement(t,n,i).subscribe(h),this.addConnection(o,"bind",a),a}addConnection(t,e,s){return this.connections.add(t,e,s),this}setBindId(t){let e="db-"+this.idCount++;return t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){let e=t[this.attr];return e&&this.connections.remove(e),this}watch(t,e,s,n){if(l.isObject(t)===!1)return this;let i=new xt,o=e.get(s),a=!0,c=d=>{a&&(a=!1,d===o)||n(d)};i.addSource(e).subscribe(s,c);let h=this.getBindId(t),p=e.getDataId()+":"+s;return this.addConnection(h,p,i),n(o),this}unwatch(t,e,s){if(l.isObject(t)===!1)return this;let n=t[this.attr];if(n){let i=e.getDataId()+":"+s;this.connections.remove(n,i)}return this}publish(t,e,s){return this.pubSub.publish(t,e,s),this}isDataBound(t){if(!t)return null;let e=t[this.attr];return e||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.has(t.keyCode)}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,s=this.isDataBound(e);if(s!==null){let n=this.connections.get(s,"bind");if(n){let i=n.element.get();this.pubSub.publish(s,i,e)}}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)}},x=new qt;var D=r=>r.data?r.data:r.context&&r.context.data?r.context.data:r.state?r.state:null;var vs=new Map([["class","className"],["text","textContent"],["for","htmlFor"],["readonly","readOnly"],["maxlength","maxLength"],["cellspacing","cellSpacing"],["rowspan","rowSpan"],["colspan","colSpan"],["tabindex","tabIndex"],["celpadding","cellPadding"],["useMap","useMap"],["frameborder","frameBorder"],["contenteditable","contentEditable"]]),ot=r=>vs.get(r)||r,at=r=>typeof r=="string"&&r.charCodeAt(0)===111&&r.charCodeAt(1)===110?r.substring(2):r,Ss=/(?:<[a-z][\s\S]*>)/i,T=class{static create(t,e,s,n){let i=document.createElement(t);return this.addAttributes(i,e),n===!0?this.prepend(s,i):this.append(s,i),i}static addAttributes(t,e){if(!e||typeof e!="object")return;let s=e.type;s!==void 0&&t.setAttribute("type",s);let n=Object.keys(e);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=e[a];a==="innerHTML"?t.innerHTML=c:a.indexOf("-")!==-1?t.setAttribute(a,c):this.addAttr(t,a,c)}}static addHtml(t,e){return typeof e>"u"||e===""?this:(Ss.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(s===""||!e)return;if(typeof s==="function")e=at(e),s.originalCallback?f.add(e,t,s,!1,!0,s.originalCallback):f.add(e,t,s);else{let i=ot(e);t[i]=s}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let s=document.createTextNode(t);return e&&this.append(e,s),s}static createComment(t,e){let s=document.createComment(t);return e&&this.append(e,s),s}static setupSelectOptions(t,e,s){if(!t||typeof t!="object"||!Array.isArray(e))return!1;e.forEach(n=>{let i=new Option(n.label,n.value);t.options.add(i),s!==null&&i.value==s&&(i.selected=!0)})}static removeElementData(t){let e=[t];for(;e.length>0;){let s=e.pop(),n=s.childNodes;if(n&&n.length>0)for(let i=n.length-1;i>=0;i--)e.push(n[i]);m.remove(s),s.bindId&&x.unbind(s)}}static removeElement(t){if(!t)return this;let e=m.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!t||typeof t!="object")return this;let e;for(;e=t.firstChild;)this.removeElementData(e),t.removeChild(e);return this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,s){let n=s||t.firstChild;return t.insertBefore(e,n),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};var C=class extends T{static create(t,e,s,n){let i=document.createElement(t);return this.addAttributes(i,e,n),s.appendChild(i),i}static addAttributes(t,e,s){if(!(!e||e.length<1))for(let n=0,i=e.length;n<i;n++){let o=e[n];this.addAttr(t,o.key,o.value,s)}}static addAttr(t,e,s,n){if(s===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=s;return}if(typeof s==="function"){if(e=at(e),s.originalCallback)f.add(e,t,s,!1,!0,s.originalCallback);else{let a=s,c=function(u){a.call(this,u,n)};f.add(e,t,c,!1,!0,a)}return}if(e.charCodeAt(4)===45){t.setAttribute(e,s);return}let o=ot(e);t[o]=s}static addContent(t,e){e&&(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var pe=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,me=new Map,w={isWatching(r){if(Array.isArray(r)){let t=r[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(r)},hasParams(r){return typeof r=="string"&&r.includes("[[")},_getWatcherProps(r){let t=me.get(r);if(t!==void 0)return t;let e=r.match(pe),s=e?e.map(n=>n.slice(2,-2)):null;return me.set(r,s),s},updateAttr(r,t,e){switch(t){case"text":case"textContent":r.textContent=e;break;case"disabled":r.disabled=!e;break;case"checked":r.checked=!!e;break;case"required":r.required=!!e;break;case"src":if(r.tagName==="IMG"){r.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}r.src=e;break;default:C.addAttr(r,t,e);break}},replaceParams(r,t,e=!1){let s=0;return r.replace(pe,function(n,i,o){let a=e?t[s]:t;s++;let c=a.get(o);return c??""})},_getWatcherCallBack(r,t,e,s,n){return()=>{let i=this.replaceParams(e,t,n);this.updateAttr(r,s,i)}},getValue(r,t){let e=r.value;return Array.isArray(e)===!1?[e,D(t)]:(e.length<2&&e.push(D(t)),e)},getPropValues(r,t,e){let s=[];for(let n=0,i=t.length;n<i;n++){let a=(e?r[n]:r).get(t[n])??"";s.push(a)}return s},getCallBack(r,t,e,s,n,i){let o=r.attr||"textContent",a=r.callBack;if(typeof a=="function"){let c=i||this._getWatcherProps(s)||[],u=c.length>1;return(h,p)=>{h=u!==!0?h:this.getPropValues(e,c,n);let d=a(h,t,p);typeof d<"u"&&this.updateAttr(t,o,d)}}return this._getWatcherCallBack(t,e,s,o,n)},addDataWatcher(r,t,e){let s=this.getValue(t,e),n=s[1]??e?.data??e?.context?.data??e?.state??null;if(!n)return;let i=s[0],o=Array.isArray(n),a=this._getWatcherProps(i),c=this.getCallBack(t,r,n,i,o,a);if(o)for(let u=0,h=a.length;u<h;u++)this.addWatcher(r,n[u],a[u],c);else for(let u=0,h=a.length;u<h;u++)this.addWatcher(r,n,a[u],c)},getWatcherSettings(r,t=null){if(typeof r=="string")return{attr:t,value:r};if(Array.isArray(r)){let e=r[r.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let s=r[1]&&typeof r[1]=="object"?[r[0],r[1]]:[r[0]];return typeof e=="function"?{attr:t,value:s,callBack:e}:{attr:e||"textContent",value:s}}return r},setup(r,t,e){t&&this.addDataWatcher(r,this.getWatcherSettings(t),e)},addWatcher(r,t,e,s){x.watch(r,t,e,s)}};var ks=r=>({props:{watch:r},children:[]}),Cs=r=>{if(r.length===0)return ce();let t=r[0],e=typeof t;if(e==="string"||e==="number")return ue(t);if(Array.isArray(t))return w.isWatching(t)?ks(t):he(t);let s=r[1]??r[0]??[];return s&&Array.isArray(s)&&w.isWatching(s)&&(r[0]=Array.isArray(r[0])?{}:r[0],r[0].watch=s,r[1]=[]),le(r)},ws=r=>(...t)=>{let{props:e,children:s}=Cs(t);return r(e,s)};var ge=new WeakMap,ye=new WeakMap;function Ts(r,t,e,s){let n=ge.get(r);n||(n=new Map,ge.set(r,n));let i=n.get(e);if(i)return i;let o=new Proxy(r,xe(t,e,s));return n.set(e,o),o}function be(r,t){let e=t.charCodeAt(0),s=e>=48&&e<=57;return r===""?s?"["+t+"]":t:s?r+"["+t+"]":r+"."+t}function xe(r,t="",e=""){return{get(s,n,i){let o=s[n];if(t===""&&n in s){if(typeof o=="function"){let c=ye.get(s);c||(c=new Map,ye.set(s,c));let u=c.get(n);if(u)return u;let h=o.bind(s);return c.set(n,h),h}return o}if(o=(s[e]||s)[n],o!==null&&typeof o=="object"){let c=be(t,n);return Ts(o,r,c,e)}return o},set(s,n,i,o){if(t===""&&n in s)return s[n]=i,!0;let a=be(t,n);return r.set(a,i),!0}}}var wt=(r,t="stage")=>new Proxy(r,xe(r,"",t));var ct=class{static resume(t,e){if(!t)return null;let s,n=localStorage.getItem(t);return n===null?e&&(s=e):s=JSON.parse(n),s}static store(t,e){if(!t||!e)return!1;let s=JSON.stringify(e);return localStorage.setItem(t,s),!0}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var Tt=(r={})=>{let t={};if(!l.isObject(r))return t;let e=Object.keys(r);for(let s=0,n=e.length;s<n;s++){let i=e[s],o=r[i];typeof o!="function"&&(t[i]=o)}return t};var As=0,ve=new Map,N={CHANGE:"change",DELETE:"delete"},Jt=(r,t)=>{let e=ve.get(r);return e||(e={change:`${r}:change`,delete:`${r}:delete`},ve.set(r,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 Q;let e=Tt(t);return this.set(e),wt(this)}setup(){this.stage={}}_init(){let t=++As;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}flushPending(){this.eventSub.flush()}getDataId(){return String(this._id)}remove(){}on(t,e){let s=Jt(t,N.CHANGE);return this.eventSub.on(s,e)}off(t,e){let s=Jt(t,N.CHANGE);this.eventSub.off(s,e)}_setAttr(t,e,s=this,n=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,s,N.CHANGE))}publishLocalEvent(t,e,s,n){let i=Jt(t,n);this.eventSub.publish(i,e,s)}_publish(t,e,s,n){this.publishLocalEvent(t,e,s,n),s=s||this,x.publish(this._dataId+t,e,s)}set(t,e,s){if(typeof t!="object")return this._setAttr(t,e,s),this;let n=Object.keys(t);for(let i=0;i<n.length;i++){let o=n[i],a=t[o];typeof a!="function"&&this._setAttr(o,a,e,s)}return this}getModelData(){return this.stage}_deleteAttr(t,e,s=this){delete t[e],this.publishLocalEvent(e,null,s,N.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 s=this.get(t);return this.set(t,s+e),this}decrement(t,e=null){if(typeof t>"u")return;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s-e),this}concat(t,e){if(typeof t>"u")return;let s=this.get(t);return this.set(t,s+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t){return this.key=t,this}resume(t){let e=ct.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return ct.store(String(this.key),t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,s){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,s);let n=[];return Object.entries(e).forEach(([i])=>{n.push(this.remoteLink(t,i))}),n}remoteLink(t,e,s){let n=s||e,i=t.get(e);typeof i<"u"&&this.get(e)!==i&&this.set(e,i);let o=t.on(e,(c,u)=>{if(u===this)return!1;this.set(n,c,t)});this.addLink(o,t);let a=this.on(n,(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((s,n)=>{this.removeLink(n,!1)}),this.links=new Map)}removeLink(t,e=!0){let s=this.links.get(t);s&&s.off(t),e!==!1&&this.links.delete(t)}};M.prototype.isData=!0;var Qt=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t}get(t){return this.cache.get(t)}set(t,e){if(this.cache.delete(t),this.cache.set(t,e),this.cache.size>this.maxSize){let s=this.cache.keys().next().value;this.cache.delete(s)}}clear(){this.cache.clear()}},E={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new Qt(1e3),hasDeepData(r){return r.indexOf(".")!==-1||r.indexOf("[")!==-1},getSegments(r){let t=this.segmentCache.get(r);if(t!==void 0)return t;let e=this.deepDataPattern;return t=r.match(e),this.segmentCache.set(r,t),t}};var F=class{static set(t,e,s){if(!E.hasDeepData(e)){t[e]=s;return}let n,i=E.getSegments(e);if(!i)return;let o=i.length,a=o-1;for(let c=0;c<o;c++){let u=i[c];if(c===a){t[u]=s;break}if(t[u]===void 0){let h=u.charCodeAt(0);t[u]=h<48||h>57?{}:[]}t=t[u]}}static delete(t,e){if(!E.hasDeepData(e)){delete t[e];return}let s=E.getSegments(e);if(!s)return;let n=s.length,i=n-1;for(let o=0;o<n;o++){let a=s[o],c=t[a];if(c===void 0)break;if(o===i){if(Array.isArray(t)){t.splice(Number(a),1);break}delete t[a];break}t=c}}static get(t,e){if(!E.hasDeepData(e))return t[e]??void 0;let s=E.getSegments(e);if(!s)return;let n=s.length,i=n-1;for(let o=0;o<n;o++){let a=s[o],c=t[a]??void 0;if(c===void 0)break;if(t=c,o===i)return t}}};var Se=new Set,ut=class{static MAX_DEPTH=50;static publishDeep(t,e,s,n){if(!E.hasDeepData(e)){this.publish(e,s,n);return}let i,o=E.getSegments(e);if(!o)return;let a=o.length,c=a-1,u="";for(let h=0;h<a;h++){let p=o[h];t=t[p];let d=p.charCodeAt(0);h>0?(d<48||d>57)&&(u+="."+p):u=p;let y;if(h===c)y=s;else{let k=o[h+1],_=k.charCodeAt(0);if(_>=48&&_<=57){u+="["+k+"]";continue}let L={};L[k]=t[k],y=L}this.publish(u,y,n)}}static publish(t,e,s,n=null,i=0){if(t=t||"",s(t,e),!(!e||typeof e!="object"||(n===null&&(Se.clear(),n=Se),!n))){if(n.has(e)){console.warn("[Publisher] Circular reference detected at path:",t);return}if(i>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion");return}n.add(e),Array.isArray(e)?this.publishArray(t,e,s,n,i):this.publishObject(t,e,s,n,i)}}static publishArray(t,e,s,n,i){let o=e.length;for(let a=0;a<o;a++){let c=e[a],u=t+"["+a+"]";this._checkPublish(u,c,s,n,i)}}static publishObject(t,e,s,n,i){let o=Object.keys(e);for(let a=0,c=o.length;a<c;a++){let u=o[a],h=e[u],p=t+"."+u;this._checkPublish(p,h,s,n,i)}}static _checkPublish(t,e,s,n,i){if(!e||typeof e!="object"){s(t,e);return}this.publish(t,e,s,n,i+1)}};var O=class extends M{setup(){this.attributes={},this.stage={}}_setAttr(t,e,s,n){typeof e!="object"&&e===this.get(t)||(!s&&n!==!0?F.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),F.set(this.stage,t,e),s=s||this,this._publish(t,e,s,N.CHANGE))}linkAttr(t,e){let s=t.get(e);if(!s)return;let n=Object.keys(s);for(let i=0,o=n.length;i<o;i++){let a=n[i];this.link(t,e+"."+a,a)}}scope(t,e){let s=this.get(t);if(!s)return!1;e=e||this.constructor;let n=new e(s);return n.linkAttr(this,t),n}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.push(e),this.set(t,s),this}concat(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s=s.concat(e),this.set(t,s),this}unshift(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.unshift(e),this.set(t,s),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.shift();return this.set(t,e),s}getIndex(t,e,s){let n=this.get(t);return Array.isArray(n)===!1?-1:typeof n[0]!="object"?n.indexOf(e):n.findIndex(o=>o[e]===s)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.pop();return this.set(t,e),s}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,s,n){this._pubCommitter=s,this._pubEvent=n;let i=this._publishCb||(this._publishCb=(o,a)=>this._publishAttr(o,a,this._pubCommitter,this._pubEvent));ut.publish(t,e,i)}_publishAttr(t,e,s,n){let i=this._dataId+t;x.publish(i,e,s),this.publishLocalEvent(t,e,s,n)}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,s=this){F.delete(t,e),this._delCommitter=s;let n=this._deleteCb||(this._deleteCb=(i,o)=>this.publishLocalEvent(i,o,this._delCommitter,N.DELETE));ut.publish(e,e,n)}_getAttr(t,e){return F.get(t,e)}};var Ds={"\n":"\\n","\r":"\\n"," ":"\\t"},Es=(r,t)=>{typeof r!="string"&&(r=String(r));let e=t?/[\n\r\t]/g:/\t/g;return r.replace(e,s=>Ds[s])},ke=(r,t)=>{if(typeof r!="string")return r;r=Es(r,t),r=encodeURIComponent(r);let e=/%22/g;return r.replace(e,'"')},Yt=(r,t)=>{let e=typeof r;return e==="undefined"?r:e!=="object"?(r=ke(r),r):(Object.entries(r).forEach(([s,n])=>{n!==null&&(r[s]=typeof n=="string"?Yt(n,t):ke(n,t))}),r)};function Ce(r){return typeof r<"u"&&r.length>0?JSON.parse(r):!1}function Xt(r){return typeof r<"u"?JSON.stringify(r):null}var ht=class{static prepareJsonUrl(t,e=!1){let s=typeof t=="object"?b.clone(t):t,n=Yt(s,e);return Xt(n)}static json={encode:Xt,decode:Ce};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var At=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 s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+t[s]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=v.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=v.parseQueryString(e,!1)),this._isFormData(t))for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let s=this.model.get("id"),n="id="+s,i=s?`/${s}`:"",o=this.model;return this._get(i,n,t,e,a=>{if(a){let c=this.getObject(a);c&&o.set(c)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+ht.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let s=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._put(i,s,t,e)}add(t,e){if(!this.isValid())return;let s=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._post(i,s,t,e)}update(t,e){if(!this.isValid())return;let s=this.setupObjectData(),n=this.model.id,i=n!=null?`/${n}`:"";return this._patch(i,s,t,e)}delete(t,e){let s=this.model.get("id"),n=typeof s<"u"?"id="+s:this.setupObjectData(),i=s!=null?`/${s}`:"";return this._delete(i,n,t,e)}all(t,e,s,n,i=null,o=null){let a=this.model.get();s=isNaN(s)?0:s,n=isNaN(n)?50:n;let c=a.search||"",u=a.filter||"";typeof u=="object"&&(u=JSON.stringify(u));let h=a.dates||"";typeof h=="object"&&(h=JSON.stringify(h));let p=a.orderBy||"";typeof p=="object"&&(p=JSON.stringify(p));let d=a.groupBy||"";Array.isArray(d)&&(d=JSON.stringify(d));let y="&filter="+u+"&offset="+s+"&limit="+n+"&dates="+h+"&orderBy="+p+"&groupBy="+d+"&search="+c+"&lastCursor="+(typeof i<"u"&&i!==null?i:"")+"&since="+(typeof o<"u"&&o!==null?o:"");return this._get("",y,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let s=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(s)}setupRequest(t,e,s,n,i){let o={url:this.getUrl(t),method:e,params:s,completed:(c,u)=>{typeof i=="function"&&i(c),this.getResponse(c,n,u)}};return this._isFormData(s)&&(o.headers={}),gt(o)}setupEventSource(t,e,s,n,i=!0){let o=null,a=null,c=!1,u=!1,h=()=>{a&&(clearTimeout(a),a=null)},p=()=>{if(c||!i||u)return;h(),a=setTimeout(()=>{a=null,d()},3e3)},d=()=>{if(c||u)return;if(o){try{o.close()}catch{}o=null}u=!0;let y=this.getUrl(t),k=e?"?"+e:"";o=new EventSource(y+k,{withCredentials:!0}),o.onopen=()=>{u=!1,h(),n&&n()},o.onerror=()=>{u=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,p())},o.onmessage=_=>{try{let L=JSON.parse(_.data);s&&s(L)}catch{}}};return d(),{get source(){return o},close:()=>{if(c=!0,u=!1,h(),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,s,n){return this._request("","POST",t,e,s,n)}_get(t,e,s,n,i){return e=this.setupParams(e),e=this.addParams(e,s),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",n,i)}_post(t,e,s,n,i){return this._request(t,"POST",e,s,n,i)}_put(t,e,s,n,i){return this._request(t,"PUT",e,s,n,i)}_patch(t,e,s,n,i){return this._request(t,"PATCH",e,s,n,i)}_delete(t,e,s,n,i){return this._request(t,"DELETE",e,s,n,i)}_request(t,e,s,n,i,o){return s=this.setupParams(s),s=this.addParams(s,n),this.setupRequest(t,e,s,i,o)}getResponse(t,e,s){typeof e=="function"&&e(t,s)}static extend(t){if(!t)return!1;let e=this;class s extends e{constructor(i){super(i)}}return Object.assign(s.prototype,t),s}};var Ps=r=>{let t={};if(!l.isObject(r)||!r.defaults)return t;let{defaults:e}=r;return Object.keys(e).forEach(s=>{let n=e[s];typeof n!="function"&&(t[s]=n)}),delete r.defaults,t},Ms=r=>{if(!r||typeof r.xhr!="object")return{};let t={...r.xhr};return delete r.xhr,t},Os=0,Y=class extends O{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,s=Ms(t),n=e.prototype.service.extend(s),i=Ps(t);class o extends e{constructor(c){let u={...i,...Tt(c)};super(u),this.xhr=new n(this)}dataTypeId=`bm${Os++}`}return Object.assign(o.prototype,t),o.prototype.service=n,o}};Y.prototype.service=At;var U=class extends M{};var X=class extends U{setup(){this.stage={}}addAction(t,e){return typeof e<"u"&&this.set(t,e),this}getState(t){return this.get(t)}removeAction(t,e){if(e)return this.off(t,e),this;let s=this.stage;return typeof s[t]<"u"&&delete s[t],this}};var Dt=class extends X{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 Dt(t)),this.targets.get(t)}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,s){let n=this.getTarget(t);return e&&n.addAction(e,s),n}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){s&&this.off(t,e,s)}static on(t,e,s){let n=this.getTarget(t);return e?n.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let n=this.targets,i=n.get(t);if(i){if(e){i.off(e,s);return}this.targets.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};var Et=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let s=0;s<e;s++){let n=t[s];this.on(n[0],n[1],n[2],n[3])}}on(t,e,s,n){f.on(t,e,s,n),this.events.push({event:t,obj:e,callBack:s,capture:n})}off(t,e,s,n){f.off(t,e,s,n);let i,o=this.events;for(let a=0,c=o.length;a<c;a++)if(i=o[a],i.event===t&&i.obj===e){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,s=t.length;e<s;e++){let n=t[e];f.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,s=t.length;e<s;e++){let n=t[e];f.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var Pt=class{constructor(t,e){this.remoteStates=[];let s=this.convertStates(e);this.addStatesToTarget(t,s)}addStates(t,e){let s=this.convertStates(e);this.addStatesToTarget(t,s)}createState(t,e,s,n){return{action:t,state:e,callBack:s,targetId:n,token:null}}convertStates(t){let e=[];for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;if(s==="remotes"){this.setupRemoteStates(t[s],e);continue}let n=null,i=null,o=t[s];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(s,o,i,n))}return e}setupRemoteStates(t,e){for(let s=0,n=t.length;s<n;s++){let i=t[s];if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o)||o==="id")continue;let a=null,c=i[o],u=c!==null?c:void 0;u&&typeof u=="object"&&(a=u.callBack,u=u.state),e.push(this.createState(o,u,a,i.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeActions(t,e){if(!(e.length<1))for(let s=0,n=e.length;s<n;s++){let i=e[s];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&I.remove(i.targetId,i.action,i.token)}}restore(t){I.restore(t.id,t);let e=this.remoteStates;if(e)for(let s=0,n=e.length;s<n;s++){let i=e[s];i.token=this.bindRemoteState(t,i.action,i.targetId)}}bindRemoteState(t,e,s){let n=I.getTarget(s);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let s=this.remoteStates;for(let n=0,i=e.length;n<i;n++){let o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,s.push(o))}}addAction(t,e){let s,n=e.action,i=e.targetId;i&&(s=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&t.on(n,o),s||null}};m.addType("components",r=>{if(!r)return;let t=r.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Is=0,lt=class{constructor(t,e,s){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.cached=[],this.init();let n,i;if(t==null)n={},i=[];else{let o=typeof t;o==="string"||o==="number"?(n={},i=[{tag:"text",textContent:t}]):Array.isArray(t)?(n={},i=t):(n=t||{},i=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(n),this.children=i||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Is++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=this.persistedCount++,s="pc"+e,i=Object.keys(this.persistedChildren)[e],o=this.persistedChildren[i];return o&&t.unitType===o.unitType&&(s=i,t.resumeScope(o)),t.persistToken=s,this.persistedChildren[s]=t,s}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e])}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 s=e[0];s&&(this.addingContext=!0,this.contextBranchName=s,this.addContextBranch(s,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){m.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 s=[];if(!t||t.length<1)return s;for(let n=0,i=t.length;n<i;n++){let o=e(t[n],n);s.push(o)}return s}removeAll(t){return T.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy(),this.removeContext();let t=this.panel;t&&T.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,s=t.length;e<s;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1,this.beforeDestroy(),this.data&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var S=class extends lt{constructor(t,e,s){super(t,e,s),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,t.context&&(this.context=t.context),this.id=t.id,this._refreshData()}_refreshData(){let t=this.setData();t&&this.data&&this.data.set(t.stage),this._refreshContextData()}_refreshContextData(){let t=this.context;if(!t||!t.data)return;let e=this.getParentContext();!e||!e.data||t.data.set(e.data.stage)}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();!e||Object.keys(e).length===0||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Pt(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 Et)}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 Mt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"};var Bs=(r,t)=>typeof r!="function"&&t==="setupStates"?()=>r:r,Gt=(r,t)=>{if(!r)return t;let e=Object.keys(r);for(let s=0,n=e.length;s<n;s++){let i=e[s],o=r[i],a=Mt[i]||i;t[a]=Bs(o,a)}return t},_s=r=>Gt(r,{}),Rs=0,we=(r,t)=>{class e extends r{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Rs++,e},W=(r,t=S)=>{r||(r={});let e,s=typeof r;return s==="object"&&r.render?(e=_s(r),we(t,e)):(e={render:s==="function"?r:()=>r},we(t,e))};var Hs=(r,t)=>{let e=Object.keys(r);for(let s=0,n=e.length;s<n;s++){let i=e[s],o=r[i],a=Mt[i]||i;t.prototype[a]=o}return t},Ls=0,Ns=r=>{let t=class extends r{};return t.prototype._classId="pod"+Ls++,t},Fs=(r,t=S)=>{if(!r)return null;let e=Ns(t),s={},n=r(s);return Hs(s,e),e.prototype.render=n,e};var Us={monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],getDayName(r=new Date().getDay(),t=!1){if(typeof Intl<"u"){let n=new Date(2004,0,4+r);return new Intl.DateTimeFormat(void 0,{weekday:t?"short":"long"}).format(n)}let e=this.dayNames;if(r>e.length)return null;let s=e[r];return t?s.substring(0,3):s},convertJsMonth(r){return this.padNumber(r+1)},convertDate(r,t=!1){r=r?r.replace(/\s/,"T"):"";let e=new Date(r);if(typeof Intl<"u"){let n={weekday:"long",month:"short",day:"2-digit"};return t&&(n.year="numeric"),new Intl.DateTimeFormat(void 0,n).format(e)}let s=t===!0?" "+e.getFullYear():"";return this.getDayName(e.getDay())+", "+this.getMonthName(e.getMonth(),!0)+" "+this.padNumber(e.getDate())+s},padNumber(r){return r<=9?"0"+r:String(r)},createDate(r){return r?(typeof r=="string"&&r.indexOf("-")>-1&&(r=r.replace(/\s/,"T"),r=r.indexOf(":")>-1?r:r+"T00:00:00"),new Date(r)):new Date},format(r,t){let e=this.createDate(t);return r!=="sql"&&typeof Intl<"u"?new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit"}).format(e):this.renderDate(e.getFullYear(),e.getMonth()+1,e.getDate(),r)},formatTime(r,t){let e=this.createDate(r);if(t!==24&&typeof Intl<"u")return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",hour12:!0}).format(e);let s=t===24?"sql":"standard";return this.renderTime(e.getHours(),e.getMinutes(),e.getSeconds(),s)},getMeridian(r){return r=Number(r),r>=12?"PM":"AM"},convert24To12(r){return r=Number(r),r>12&&(r=r-12),r},convert12To24(r,t){return r=Number(r),t.toLowerCase()==="pm"&&(r=r+12),r},renderDate(r,t,e,s="sql"){return t=Number(t),e=Number(e),s==="sql"?`${r}-${this.padNumber(t)}-${this.padNumber(e)}`:`${this.padNumber(t)}/${this.padNumber(e)}/${r}`},renderTime(r,t,e=0,s="sql"){if(s==="sql")return`${this.padNumber(r)}:${this.padNumber(t)}:${this.padNumber(e)}`;let n=this.getMeridian(r);return r=this.convert24To12(r),`${r}:${this.padNumber(t)} ${n}`},leapYear(r){return r%400===0||r%100!==0&&r%4===0},getMonthName(r=new Date().getMonth(),t=!1){if(typeof Intl<"u"){let n=new Date(2e3,r,1);return new Intl.DateTimeFormat(void 0,{month:t?"short":"long"}).format(n)}let e=this.monthNames;if(r>e.length)return"";let s=e[r];return s?t?s.substring(0,3):s:""},getMonthLength(r,t){let e=new Date;return r=typeof r<"u"?r:e.getMonth(),t=typeof t<"u"?t:e.getFullYear(),this.getMonthsLength(t)[r]},getMonthsLength(r=new Date().getFullYear()){return this.leapYear(r)===!0?[31,29,31,30,31,30,31,31,30,31,30,31]:[31,28,31,30,31,30,31,31,30,31,30,31]},getLocalDate(r,t="America/Denver"){let e=new Date(r);if(Number.isNaN(e.getMonth())===!0){let i=/[- :]/,o=r.split(i);e=new Date(o[0],o[1]-1,o[2],o[3],o[4],o[5])}let s=new Date(Date.parse(e.toLocaleString("en-US",{timeZone:t}))),n=e.getTime()-s.getTime();return new Date(e.getTime()+n)},getLocalTime(r,t=!1,e=!1,s="America/Denver"){if(!r)return"";let n=this.getLocalDate(r,s);if(!t&&typeof Intl<"u"){let c={hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0};return e===!1&&(c.year="numeric",c.month="2-digit",c.day="2-digit"),new Intl.DateTimeFormat(void 0,c).format(n)}let i=n.getMonth()+1,o=t===!0?"sql":"standard",a="";return e===!1&&(a+=this.renderDate(n.getFullYear(),i,n.getDate(),o)+" "),a+this.renderTime(n.getHours(),n.getMinutes(),n.getSeconds(),o)},getDiffFromNow(r,t=!1){r=r.replace(/\s/,"T");let e=new Date(r),s=new Date;return t===!0&&s.setHours(0,0,0,0),s.getTime()-e.getTime()},getAge(r){let t=this.getDiffFromNow(r),e,s;switch(!0){case t<864e5:e="1 day";break;case t<6048e5:s=this.toDays(t),e=s+" days";break;case t<12096e5:e="1 week";break;case t<2592e6:s=this.toDays(t);var n=Math.floor(s/7);e=n+" weeks";break;case t<5184e6:e="1 month";break;case t<31104e6:var i=this.toMonths(t);e=i+" months";break;default:var o=this.toYears(t);e=o}return String(e)},getTimeFrame(r){let t=this.getDiffFromNow(r);return this.convertToEstimate(t)},convertToEstimate(r){let t="",e,s,n,i,o,a,c;if(r<=0)switch(!0){case r<-63072e6:n=this.toYears(Math.abs(r)),t="in "+n+" y";break;case r<-31536e6:t="in 1y";break;case r<-5184e6:i=this.toMonths(Math.abs(r)),t="in "+i+"mo";break;case r<-2592e6:t="in 1mo";break;case r<-12096e5:e=this.toDays(Math.abs(r)),s=Math.floor(e/7),t="in "+s+"w";break;case r<-6048e5:t="in 1w";break;case r<-1728e5:e=this.toDays(Math.abs(r)),t="in "+e+"d";break;case r<-864e5:t="tomorrow";break;case r<-72e5:o=this.toHours(Math.abs(r)),t="in "+o+" h";break;case r<=-36e5:t="in 1h";break;case r<-12e4:a=this.toMinutes(Math.abs(r)),t="in "+a+"m";break;case r<-6e4:t="in 1m";break;case r<-2e3:c=this.toSeconds(Math.abs(r)),t="in "+c+"s";break;case r<-1:t="in 1s";break;default:t="now"}else switch(!0){case r<1e3:t="1s ago";break;case r<6e4:c=this.toSeconds(r),t=c+"s ago";break;case r<12e4:t="1m ago";break;case r<36e5:a=this.toMinutes(r),t=a+"m ago";break;case r<72e5:t="1h ago";break;case r<864e5:o=this.toHours(r),t=o+"h ago";break;case r<1728e5:t="yesterday";break;case r<6048e5:e=this.toDays(r),t=e+"d ago";break;case r<12096e5:t="1w ago";break;case r<2592e6:e=this.toDays(r),s=Math.floor(e/7),t=s+"w ago";break;case r<5184e6:t="1mo ago";break;case r<31536e6:i=this.toMonths(r),t=i+"mo ago";break;case r<63072e6:t="1y ago";break;default:n=this.toYears(r),t=n+"y ago"}return t},toYears(r){return typeof r!="number"?0:Math.floor(r/31558464e3)},toMonths(r){return typeof r=="number"?Math.floor(r/2592e6):0},toDays(r){return typeof r!="number"?0:Math.floor(r/864e5*1)},toHours(r){return typeof r!="number"?0:Math.floor(r%864e5/36e5*1)},toMinutes(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5/6e4*1)},toSeconds(r){return typeof r!="number"?0:Math.floor(r%864e5%36e5%6e4/1e3*1)},getDifference(r,t){let e=new Date(r),s=new Date(t),n=s.getTime()-e.getTime();return{years:this.toYears(n),days:this.toDays(n),hours:this.toHours(n),minutes:this.toMinutes(n),seconds:this.toSeconds(n)}}};var G={items:new Map,add(r,t){return this.items.set(r,t),this},get(r){return this.items.get(r)??null}};var Kt=(r,t)=>({attr:r,directive:t});var B=(r,t)=>({key:r,value:t});var Te=(r,t,e,s)=>({tag:r,attr:t,directives:e,children:s});var Ae=null,Ws=()=>Ae||(Ae=G.get("watch")),H=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,s,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(s.push(B("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,s){t.push(Kt(B(e,w.getWatcherSettings(s,ot(e))),Ws()))}static setButtonType(t,e,s){if(t==="button"){let n=e.type||"button";s.push(B("type",n))}}static parse(t,e){let s=[],n=[],i=t.tag||"div";i==="button"&&s.push(B("type",t.type||"button"));let o=[],a,c,u=Object.keys(t);for(let h=0,p=u.length;h<p;h++){let d=u[h];if(d==="tag"||(a=t[d],a==null))continue;if(d==="children"||d==="nest"){if(Array.isArray(a))for(let k=0;k<a.length;k++)o.push(a[k]);else o.push(a);continue}if((c=G.get(d))!==null){n.push(Kt(B(d,a),c));continue}let y=typeof a;if(y==="object"){if(w.isWatching(a)){this.setTextAsWatcher(n,d,a);continue}o.push(a);continue}if(y==="function"){let k=a,_=function(L){k.call(this,L,e)};_.originalCallback=k,s.push(B(d,_));continue}if(y==="string"&&a.includes("[[")){this.setTextAsWatcher(n,d,a);continue}if(d==="text"){o.push({tag:"text",textContent:a});continue}if(d==="html"||d==="innerHTML"){s.push(B("innerHTML",a));continue}s.push(B(d,a))}return Te(i,s,n,o)}};var K=class{build(t,e,s){}setupComponent(t,e,s){let n=s?.getChildScope();t.parent=n,n&&n.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&n&&(n[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),s=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),s}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t),t}setDirectives(t,e,s){}removeNode(t){}removeAll(t){}};var Ot=class extends K{build(t,e,s){let n=C.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,s);else this.buildElement(t,n,s);return e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,s){if(t){if(t.isUnit===!0){this.createComponent(t,e,s);return}this.createElement(t,e,s)}}createElement(t,e,s){let n=s?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=H.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,s);let a=i.children;for(let u=0,h=a.length;u<h;u++){let p=a[u];p!==null&&this.buildElement(p,o,s)}let c=i.directives;c&&c.length&&this.setDirectives(o,c,n)}createTempComponent(t,e,s){let n={cache:t.cache,setData:()=>t.data,...Gt(t.methods||{},{}),render(){return{...t,data:null,state:null}}};t.state&&(n.setupStateTarget=function(o){this.state=t.state});let i=new S(n);this.createComponent(i,e,s)}setDirectives(t,e,s){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],s)}handleDirective(t,e,s){e.directive(t,e.attr.value,s)}cache(t,e,s){s&&e&&s.cacheEle(t,e)}createNode(t,e,s){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return C.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return C.createComment(o,e)}return C.create(n,t.attr,e,s)}removeNode(t){C.removeElement(t)}removeAll(t){C.removeAll(t)}};var js=["area","base","br","col","embed","hr","img","input","link","meta","source"],Z=class{static create(t,e=[],s=""){let n=this.getInnerContent(e);n+=this.getInnerHtml(e);let i=this.createAttributes(e);return js.includes(t)?`<${t} ${i} />`:`<${t} ${i}>`+n+s+`</${t}>`}static getInnerContent(t){let e="";return t.forEach(({key:s,value:n},i)=>{if(s!=="text"&&s!=="textContent")return"";t.splice(i,1),e+=n}),e}static getInnerHtml(t){let e="";return t.forEach(({key:s,value:n},i)=>{if(s!=="html"&&s!=="innerHTML")return"";t.splice(i,1),e+=n}),e}static createAttributes(t=[]){return!t||t.length<1?"":t.map(e=>{let{key:s,value:n}=e;return typeof n=="function"&&(s="on"+at(s)),`${s}="${n}"`}).join(" ")}static createText(t){return t}static createComment(t){return`<!-- ${t} -->`}};var It=class extends K{build(t,e,s){return(Array.isArray(t)?t:[t]).map(i=>this.buildElement(i,s)).join("")}createComponent(t,e,s){return this.setupComponent(t,e,s),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let s=H.parse(t,e),n=s.children.map(i=>i!==null?this.buildElement(i,e):"").join("");return this.createNode(s,n)}createNode(t,e){let s=t.tag;if(s==="text"){let n=t.attr[0],i=n?n.value:"";return Z.createText(i)}else if(s==="comment"){let n=t.attr[0],i=n?n.value:"";return Z.createComment(i)}return Z.create(s,t.attr,e)}removeAll(t){}};var Bt=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Ot:new It}};var j=Bt.setup(),$s=r=>typeof r=="object"&&r.isUnit===!0,Vs=r=>{let t=W(r);return t?new t:null},g=class{static render(t,e,s){return!t||($s(t)||(t=Vs(t)),!t)?null:j.createComponent(t,e,s)}static build(t,e,s){return j.build(t,e,s)}static rebuild(t,e,s){return j.removeAll(e),this.build(t,e,s)}static setDirectives(t,e,s){j.setDirectives(t,e,s)}static createNode(t,e,s){return j.createNode(t,e,s)}static removeNode(t){j.removeNode(t)}static removeAll(t){j.removeAll(t)}};A.augment({buildLayout(r,t,e){g.build(r,t,e)}});var Zt=[],zs=r=>Zt.indexOf(r)!==-1,qs=r=>({tag:"script",src:r.src,async:!1,load(t){Zt.push(r.src);let e=r.load;e&&e()}}),Js=r=>({tag:"link",rel:"stylesheet",type:"text/css",href:r.src,load(t){Zt.push(r.src);let e=r.load;e&&e()}}),_t=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,s=this.update.bind(this);t.indexOf(".css")!==-1?e=Js({load:s,src:t}):e=qs({load:s,src:t}),g.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{zs(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 Qs=r=>r?typeof r?.prototype?.constructor=="function":!1,tt=class{static process(t,e){let s=t.default;return s?e.callback?e.callback(s):(Qs(s)?s=new s:s=s(),s.isUnit===!0&&(s.route=e.route,e.persist&&(s.persist=!0)),s):null}static render(t,e,s){let n=g.build(t,null,s),i=n.firstChild||t?.panel;return e.after(n),i}};var Rt=class{static load(t,e,s){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),s&&s(n)})}};var Ys=r=>({tag:"comment",textContent:"import placeholder",onCreated:r.onCreated}),Ht=new Map,Xs=r=>{if(Ht.has(r)){let s=Ht.get(r);return s&&typeof s.then!="function"?Promise.resolve(s):s}let t=typeof r,e;if(t==="string")e=import(r);else if(t==="function")e=r();else return r;return e.then(s=>{Ht.set(r,s)}),Ht.set(r,e),e},De=W({declareProps(){this.loaded=!1,this.generation=0},render(){return Ys({onCreated:r=>{if(this.src){if(this.layout){this.layoutRoot=tt.render(this.layout,this.panel,this.parent);return}if(this.depends){new _t(()=>{this.loadAndRender(r)}).addFiles(this.depends);return}this.loadAndRender(r)}}})},loadAndRender(r){let t=this.generation;Rt.load(Xs(this.src),e=>{if(t!==this.generation)return;this.loaded=!0;let s=this.layout||tt.process(e,{callback:this.callback,route:this.route,persist:this.persist});this.layout=s,this.layoutRoot=tt.render(s,r,this.parent)},e=>{t===this.generation&&(this.loaded=!1)})},shouldUpdate(r){return this.updateLayout===!0?!0:this.updateLayout=r&&r.isUnit&&typeof r.update=="function"},updateModuleLayout(r){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(r)},update(r){this.loaded===!0&&this.updateModuleLayout(r)},destroy(){this.generation++,this.layoutRoot&&(g.removeNode(this.layoutRoot),this.persist!==!0&&(this.layoutRoot=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var te=r=>{let t=typeof r;return(t==="string"||t==="function"||r instanceof Promise)&&(r={src:r}),new De(r)};var Ee=(r,t,e=null)=>{if(!r)return;let s=null,n=!1,i=()=>{n||(n=!0,s&&(clearTimeout(s),s=null),f.off("animationend",r,o),r&&r.classList.remove(t),e&&e())},o=a=>{a.target===r&&i()};f.on("animationend",r,o),requestAnimationFrame(()=>{if(!r){i();return}r.classList.add(t);try{let a=window.getComputedStyle(r),c=parseFloat(a.animationDuration)*1e3||1e3,u=parseFloat(a.animationDelay)*1e3||0;s=setTimeout(i,c+u+100)}catch{s=setTimeout(i,1e3)}})},Pe=(r,t,e)=>{Ee(r,t)},Me=(r,t,e)=>{let s=()=>{r&&r.remove&&r.remove()};Gs(r,()=>Ee(r,t,s),e)};m.addType("manual-destroy",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var Gs=(r,t,e)=>{m.add(r,"manual-destroy",{ele:r,callBack:t,parent:e})};var ft=(r,t,e,s)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&ft(r,t,n,s)});return}Ks(r,t,e,s)},Ks=(r,t,e,s)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',r,t);return}let o=Zs(r,n,i,s);x.watch(r,t,n,o)},Zs=(r,t,e,s)=>typeof e=="object"?n=>{er(r,e,n)}:n=>{tr(r,e,t,n,s)},tr=(r,t,e,s,n)=>{let i=t(s,r,n);switch(typeof i){case"object":g.rebuild(i,r,n);break;case"string":let o=St(r);if(o!=="textContent"){r.setAttribute(o,i);break}T.addHtml(r,i);break}},er=(r,t,e)=>{let s=Object.keys(t);for(let n=0,i=s.length;n<i;n++){let o=s[n];o&&(t[o]===e?r.classList.add(o):r.classList.remove(o))}};var et=(r,t,e)=>{let s=D(e);ft(r,s,t,e)};var Oe=(r,t,e)=>{t&&r.setAttribute("role",t)},sr=r=>(t,e)=>{let s=t?"true":"false";e.setAttribute(r,s)},Ie=(r,t,e)=>{if(!t)return;let s=t.role;s&&(r.setAttribute("role",s),t.role=null);let n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],c=t[a];if(c===null)continue;let u="aria-"+a;if(Array.isArray(c)){let h=c.slice();h.push(sr(u)),et(r,h,e)}else r.setAttribute(u,c)}};var Be=(r,t,e)=>{if(!t)return;let s=H.parse(t,e);C.addAttributes(r,s.attr,e),g.setDirectives(r,s.directives,e)};m.addType("context",r=>{if(!r)return!1;r.parent.removeContextBranch(r.branch)});var ee=r=>r?r.getContext():null,_e=(r,t,e)=>{if(typeof t!="function")return;let s=ee(e),n=t(s);Be(r,n,e)},Re=(r,t,e)=>{if(typeof t!="function")return;let s=ee(e);t(s)},He=(r,t,e)=>{if(typeof t!="function"||!e)return;let s=ee(e),n=t(s);n&&e.addContextBranch(n[0],n[1])};var Le=(r,t,e)=>{};var Ne=(r,t,e)=>{if(!e)return;let s=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",r),console.log("Data: ",t),console.log("Layout: ",s),console.log("parent: ",e)};var Fe=(r,t,e)=>{},Ue=(r,t,e)=>{if(!t||!e)return;let s=t(e,r);s&&g.build(s,r,e)},We=(r,t,e)=>{if(!t||!e)return;let s=e.getId(t);r.id=s},je=(r,t,e)=>{if(!t||!e)return;let s=t(e.data,r);s&&g.build(s,r,e)},$e=(r,t,e)=>{if(!t||!e)return;let s=t(e.state,r);s&&g.build(s,r,e)},Ve=(r,t,e)=>{if(!t||!e)return;let s=e.state,n=t(s);if(!e.state){e.setStateHelper(n);return}e.addState(n)},ze=(r,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let s=t[2];t[2]=n=>{s(n,e)}}e.events.on(t[0],t[1],t[2],t[3])}};var qe=(r,t,e)=>{let s,n,i;if(typeof t=="string"){if(s=D(e),!s)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=D(e);if(!o)return;s=o,n=t[0],i=t[1]}else[s,n,i]=t;x.bind(r,s,n,i)};var Lt=(r,t,e)=>{ft(r,e.state,t,e)};var Je=r=>(t,e)=>{let[s,n,i="active"]=r,o=t===n?i:"";e.dataset[s]=o},Qe=(r,t,e)=>{if(!t)return;let s=t.length-1,n=t[s],i=t.slice(0,s);i.push(Je(n)),et(r,i,e)},Ye=(r,t,e)=>{if(!t)return;let s=t.length-1,n=t[s],i=t.slice(0,s);i.push(Je(n)),Lt(r,i,e)};var Xe=(r,t,e)=>{let s,n,i,o;if(t.length<3){let c=D(e);if(!c)return;s=c,[n,i,o]=t}else[s,n,i,o]=t;let a=o!==!1;x.watch(r,s,n,c=>{if(g.removeAll(r),!c||c.length<1)return;let u=[];for(let h=0,p=c.length;h<p;h++){let d=a?s.scope(n+"["+h+"]"):null,y=i(c[h],h,d,u);y!==null&&u.push(y)}return g.build(u,r,e)})};var Ge=(r,t,e)=>{let s=t[0];if(!s||s.length<1)return;let n=t[1],i=[];for(let o=0,a=s.length;o<a;o++){let c=s[o];if(!c)continue;let u=n(c,o);u!==null&&i.push(u)}g.build(i,r,e)};var Ke=(r,t,e)=>{t(r,e)};m.addType("destroyed",r=>{if(!r)return!1;r.callBack(r.ele,r.parent)});var Ze=(r,t,e)=>{rr(r,t,e)},rr=(r,t,e)=>{m.add(r,"destroyed",{ele:r,callBack:t,parent:e})};var ts=(r,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let s=0,n=t.length;s<n;s++)w.setup(r,t[s],e);else w.setup(r,t,e)};var nr=0,st=class{constructor(t){this.router=t,this.locationId="base-app-router-"+nr++,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 Nt=class extends st{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 s=e.scrollPosition;s&&this.scrollTo(s)}createState(t,e={}){let s=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:s,uri:t}}addState(t,e,s=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return this;let o=this.createState(t,e);return n[s===!1?"pushState":"replaceState"](o,null,t),this}};var Ft=class extends st{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,s){return window.location.hash=t,this}};var Ut=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Nt(t).setup():new Ft(t).setup()}};var se=class extends S{getChildScope(){return this.parent}},es=r=>W(r,se);var Wt=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.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),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(es(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 ss=r=>{if(!r.length)return null;let t={};return r.forEach(e=>{t[e]=null}),t},rs=r=>{let t=[];if(!r)return t;let e=/[*?]/g;r=r.replace(e,"");let s=/:(.[^./?&($]+)\?*/g,n=r.match(s);return n===null||n.forEach(i=>{i&&(i=i.replace(":",""),t.push(i))}),t};var ir=r=>r.replace(/\//g,"/"),or=r=>r.replace(/(\/):[^/(]*?\?/g,t=>t.replace(/\//g,"(?:$|/)")),ar=r=>(r=r.replace(/(\?\/+\*?)/g,"?/*"),r.replace(/(:[^/?&($]+)/g,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),cr=r=>r.replace(/(\*)/g,".*"),ur=(r,t)=>r+=t[t.length-1]==="*"?"":"$",ns=r=>{if(!r)return"";let t=ir(r);return t=or(t),t=ar(t),t=cr(t),t=ur(t,r),t};var hr=0,jt=class extends M{constructor(t,e){let s=t.baseUri,n=rs(s),i=ss(n),o=super(i);return this.uri=s,this.paramKeys=n,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),o}setup(){this.stage={},this.routeId=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.routeId=t.id||"bs-rte-"+hr++,this.path=null,this.referralPath=null;let e=ns(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?te(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:s,persist:n,parent:i}=t,o={component:e,container:s,persist:n,parent:i},a=wt(this);this.controller=new Wt(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 s=this.controller;s&&s.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];i&&this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,s=t.match(this.uriQuery);return s===null?(this.resetParams(),e):(Array.isArray(s)&&(s.shift(),e=s,this.setParams(s)),e)}resetParams(){this.stage={}}setParams(t){if(!Array.isArray(t))return;let e=this.paramKeys;if(!e)return;let s={};e.forEach((n,i)=>{typeof n<"u"&&(s[n]=t[i])}),this.set(s)}getParams(){return this.stage}};var lr=r=>{let t=/\w\S*/;return r.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},fr=(r,t)=>{if(r.indexOf(":")===-1)return r;let e=t.stage;for(let[s,n]of Object.entries(e)){let i=new RegExp(":"+s,"gi");r=r.replace(i,n)}return r},dr=(r,t)=>t&&(typeof t=="function"&&(t=t(r.stage)),t=fr(t,r),lr(t)),pr=(r,t)=>(t!==""&&(r+=" - "+t),r),is=(r,t,e)=>t&&(t=dr(r,t),pr(t,e));var os={removeSlashes(r){return typeof r!="string"?"":(r.substring(0,1)==="/"&&(r=r.substring(1)),r.substring(-1)==="/"&&(r=r.substring(0,r.length-1)),r)}};var as=(r,t)=>({attr:r,value:t}),mr=(r,t)=>new RegExp("^"+r+"($|#|/|\\.).*").test(t),$t=class extends S{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,s=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,watch:s}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let s=this.exact===!0,n=P.data,i=[];return t&&typeof t=="object"&&i.push(as("href",t)),e&&typeof e=="object"&&i.push(as("text",e)),i.push({value:["[[path]]",n],callBack:(o,a)=>{if(typeof a.pathname>"u")return;let c=a.pathname+a.hash,u=s?o===c:mr(a.pathname,o);this.update(u)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var gr=()=>typeof window<"u"?window.location:{},re=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=gr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new O({path:""})}setupHistory(){this.history=Ut.setup(this)}createRoute(t){let e=t.uri||"*";return t.baseUri=this.createURI(e),new jt(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let s=arguments;t={uri:s[0],component:s[1],callBack:s[2],title:s[3],id:s[4],container:s[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.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()+os.removeSlashes(t)}getRoute(t){let e=this.routes,s=e.length;if(s>0)for(let n=0;n<s;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,s=e.length;if(s>0)for(let n=0;n<s;n++){let i=e[n];if(i.routeId===t)return i}return!1}removeRoute(t){let e=this.routes,s=e.indexOf(t);s>-1&&e.splice(s,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null)}addSwitch(t){let e=this.switchCount++,s=this.getSwitchGroup(e);return t.forEach(n=>{if(!n)return;let i=this.createRoute(n);s.push(i)}),this.checkGroup(s,this.getPath()),e}resumeSwitch(t,e){let s=this.switchCount++,n=this.getSwitchGroup(s);return t.forEach(i=>{let o=i.component.route;o.resume(e),n.push(o)}),this.checkGroup(n,this.getPath()),s}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let s=[];return this.switches.set(t,s),s}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 s=this.getEndPoint();return this.navigate(s,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.ctrlKey===!0)return!0;let e=t.target.closest("a");if(!e||e.target==="_blank"||e.dataset.cancelRoute)return!0;let s=e.getAttribute("href");if(s!==null){let n=this.baseURI,i=n!=="/"?s.replace(n,""):s;return this.navigate(i),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,s=t.length;e<s;e++){let n=t[e];n&&typeof n.deactivate=="function"&&n.deactivate()}return this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,s){return t=this.createURI(t),this.history.addState(t,e,s),this.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=is(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,s=e.length;for(let n=0;n<s;n++){let i=e[n];typeof i>"u"||this.checkRoute(i,t)}}this.checkSwitches(t),this.updatePath()}checkSwitches(t){let e=this.switches;for(let s of e.values())this.checkGroup(s,t)}checkGroup(t,e){if(!t.length)return;let s=t.find(o=>o.get("active"));s&&s.match(e)===!1&&s.deactivate();let n;for(let o of t){if(typeof o>"u")continue;if(n){o.deactivate();continue}o.match(e)!==!1&&n===void 0&&o.controller&&(n=o,this.select(o))}let i=t[0];n||this.select(i)}checkRoute(t,e){let s=this.check(t,e);return s!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),s}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t){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()),s=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(s.length!==n.length)return!0;let i=s[s.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&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 re;m.addType("routes",r=>{if(!r)return!1;let t=r.route;t&&P.removeRoute(t)});var us=(r,t,e)=>{if(t)if(Array.isArray(t))for(let s=0,n=t.length;s<n;s++){let i=t[s];i&&cs(r,i,e)}else cs(r,t,e)},cs=(r,t,e)=>{t.container=r,t.parent=e;let s=P.add(t);yr(r,s)},yr=(r,t)=>{m.add(r,"routes",{route:t})};var hs=(r,t,e)=>{};m.addType("switch",r=>{if(!r)return!1;let t=r.id;P.removeSwitch(t)});var ls=(r,t,e)=>{let s=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=r,a.parent=e)}let n=P.addSwitch(t);br(r,n)},br=(r,t)=>{m.add(r,"switch",{id:t})};G.add("cache",Fe).add("onCreated",Ke).add("onDestroyed",Ze).add("bind",qe).add("data",Le).add("state",hs).add("onSet",et).add("onState",Lt).add("animateIn",Pe).add("animateOut",Me).add("watch",ts).add("useParent",Ue).add("useData",je).add("useState",$e).add("getId",We).add("addState",Ve).add("addEvent",ze).add("map",Ge).add("for",Xe).add("useContext",Re).add("addContext",He).add("context",_e).add("role",Oe).add("aria",Ie).add("route",us).add("debug",Ne).add("dataSet",Qe).add("dataStateSet",Ye).add("switch",ls);A.augment({Ajax:gt,Html:T,dataBinder:x,Data:O,SimpleData:U,Model:Y,State:X,Builder:g,router:P,Component:S});export{gt as Ajax,R as Arrays,ws as Atom,g as Builder,S as Component,O as Data,m as DataTracker,Us as DateTime,G as Directives,J as Dom,ht as Encode,zt as Events,T as Html,te as Import,W as Jot,Y as Model,$t as NavLink,b as Objects,Fs as Pod,U as SimpleData,X as State,I as Store,v as Strings,l as Types,lt as Unit,A as base,x as dataBinder,P as router};
|
|
2
2
|
//# sourceMappingURL=base.js.map
|