@base-framework/base 3.9.17 → 3.9.18

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.
@@ -0,0 +1,2 @@
1
+ import{a as D,d as E,f as I}from"./chunk-VSCHM2ZB.js";import{b as G,c as g,d as P,e as J,f as $}from"./chunk-LY736NR2.js";import{a as O,c as j,d as U}from"./chunk-7ZHUXJZT.js";var m=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t,this.evictCount=t>=8?t>>3:1}get(t){let e=this.cache.get(t);if(e!==void 0)return e.used=!0,e.value}has(t){return this.cache.has(t)}set(t,e){let r=this.cache,s=r.get(t);if(s!==void 0){s.value=e,s.used=!0;return}r.set(t,{value:e,used:!1}),r.size>this.maxSize&&this.evict()}evict(){let t=this.cache,e=this.maxSize-this.evictCount+1;for(let r=0;r<2&&t.size>e;r++){let s=t.keys(),i=t.size;for(;i-- >0&&t.size>e;){let o=s.next().value,c=t.get(o);if(c!==void 0&&c.used){c.used=!1;continue}t.delete(o)}}}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}};var R=new WeakMap,W=new WeakMap;function Q(n){if(!n||typeof n!="object")return n;let t=W.get(n);return t!==void 0?t:n}var K=new WeakMap;function ct(n,t,e,r){let s=R.get(n);s||(s=new Map,R.set(n,s));let i=s.get(e);if(i)return i;let o=new Proxy(n,Y(t,e,r));return s.set(e,o),W.set(o,n),o}function ut(n){n&&typeof n=="object"&&R.delete(n)}function X(n,t){let e=t.charCodeAt(0),r=e>=48&&e<=57;return n===""?r?"["+t+"]":t:r?n+"["+t+"]":n+"."+t}function Y(n,t="",e=""){return{get(r,s,i){let o=r[s];if(t===""&&s in r){if(typeof o=="function"){let u=K.get(r);u||(u=new Map,K.set(r,u));let l=u.get(s);if(l)return l;let h=o.bind(r);return u.set(s,h),h}return o}if(o=(r[e]||r)[s],o!==null&&typeof o=="object"){let u=X(t,s);return ct(o,n,u,e)}return o},set(r,s,i,o){if(t===""&&s in r)return r[s]=i,!0;let u=(r[e]||r)[s],l=X(t,s);return n.set(l,i),u!==i&&u!==null&&typeof u=="object"&&ut(u),!0}}}var Z=(n,t="stage")=>{let e=new Proxy(n,Y(n,"",t));return W.set(e,n),e};var k=class{static resume(t,e){if(!t)return null;let r=localStorage.getItem(t);if(r===null)return e!==void 0?e:void 0;try{let s=JSON.parse(r);return s===null&&e!==void 0?e:s}catch(s){return console.warn('[LocalData] Failed to parse stored value for key "'+t+'". Removing corrupted entry.',s),localStorage.removeItem(t),e!==void 0?e:void 0}}static store(t,e){if(!t||!e)return!1;try{let r=JSON.stringify(e);return localStorage.setItem(t,r),!0}catch(r){return console.error('[LocalData] Failed to store data for key "'+t+'".',r),!1}}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var w=(n={})=>{let t={};if(!O.isObject(n))return t;let e=Object.keys(n);for(let r=0,s=e.length;r<s;r++){let i=e[r],o=n[i];typeof o!="function"&&(t[i]=o)}return t};var lt=0,tt=new m(2e3),b={CHANGE:"change",DELETE:"delete"},H=(n,t)=>{let e=tt.get(n);return e||(e={change:`${n}:change`,delete:`${n}:delete`},tt.set(n,e)),t==="change"?e.change:e.delete},A=class{constructor(t={}){this.dirty=!1,this._retainState=!1,this._refreshState=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=new G;let e=w(t);this.set(e);let r=Z(this);return this._proxy=r,r}retainState(){return this._retainState=!0,this._proxy||this}refreshState(){return this._refreshState=!0,this._proxy||this}setup(){this.stage={}}_init(){let t=++lt;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}flushPending(){this.eventSub.flush()}getDataId(){return String(this._id)}remove(){this.unlink(),this.eventSub.reset()}on(t,e){let r=H(t,b.CHANGE);return this.eventSub.on(r,e)}off(t,e){let r=H(t,b.CHANGE);this.eventSub.off(r,e)}_setAttr(t,e,r=this,s=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,r,b.CHANGE))}publishLocalEvent(t,e,r,s){let i=H(t,s);this.eventSub.publish(i,e,r)}_publish(t,e,r,s){this.publishLocalEvent(t,e,r,s),r=r||this,g.publish(this._dataId+t,e,r)}set(t,e,r){if(typeof t!="object")return this._setAttr(t,e,r),this;let s=Object.keys(t);for(let i=0;i<s.length;i++){let o=s[i],c=t[o];typeof c!="function"&&this._setAttr(o,c,e,r)}return this}_silentSet(t){let e=this.stage,r=Object.keys(t);for(let s=0,i=r.length;s<i;s++){let o=r[s];e[o]=t[o]}}getModelData(){return this.stage}_deleteAttr(t,e,r=this){delete t[e],this.publishLocalEvent(e,null,r,b.DELETE)}toggle(t){return typeof t>"u"?this:(this.set(t,!this.get(t)),this)}increment(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let r=this.get(t);return this.set(t,r+e),this}decrement(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let r=this.get(t);return this.set(t,r-e),this}concat(t,e){if(typeof t>"u")return this;let r=this.get(t);return this.set(t,r+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t,e){return this.key=e!=null?t+":v"+e:t,this}resume(t){let e=k.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return k.store(String(this.key),t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,r){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,r);let s=[];return Object.entries(e).forEach(([i])=>{s.push(this.remoteLink(t,i))}),s}remoteLink(t,e,r){let s=r||e,i=t.get(e);typeof i<"u"&&this.get(s)!==i&&this.set(s,i);let o=t.on(e,(u,l)=>{if(l===this)return!1;this.set(s,u,t)}),c=this.on(s,(u,l)=>{if(l===t)return!1;t.set(e,u,this)});return this.addLink(o,t,e,c),t.addLink(c,this,s,o),o}addLink(t,e,r,s){this.links.set(t,{data:e,attr:r,pair:s})}unlink(t){if(t){this.removeLink(t);return}let e=this.links;e.size!==0&&(e.forEach((r,s)=>{this.removeLink(s,!1)}),e.clear())}removeLink(t,e=!0){let r=this.links.get(t);if(r){let s=r.data;r.attr&&s.off(r.attr,t);let i=r.pair,o=i&&s.links;if(o){let c=o.get(i);c&&(o.delete(i),c.attr&&this.off(c.attr,i))}}e!==!1&&this.links.delete(t)}};A.prototype.isData=!0;var et=new Set(["__proto__","prototype","constructor"]),ht=n=>{let t=[],e=n.length,r=0;for(let s=0;s<e;s++){let i=n.charCodeAt(s);i!==46&&i!==91&&i!==93||(s>r&&t.push(n.substring(r,s)),r=s+1)}return e>r&&t.push(n.substring(r)),t.length>0?t:null},p={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new m(1e3),hasDeepData(n){return n.indexOf(".")!==-1||n.indexOf("[")!==-1},isSafeAttr(n){return!et.has(n)},getSegments(n){let t=this.segmentCache.get(n);if(t!==void 0)return t;if(t=ht(n),t){for(let e=0,r=t.length;e<r;e++)if(et.has(t[e])){console.warn("[Data] Blocked unsafe path segment in: "+n),t=null;break}}return this.segmentCache.set(n,t),t}};var x=class{static set(t,e,r){if(!p.hasDeepData(e)){if(!p.isSafeAttr(e))return;t[e]=r;return}let s,i=p.getSegments(e);if(!i)return;let o=i.length,c=o-1;for(let u=0;u<o;u++){let l=i[u];if(u===c){t[l]=r;break}if(t[l]===void 0){let h=l.charCodeAt(0);t[l]=h<48||h>57?{}:[]}t=t[l]}}static delete(t,e){if(!p.hasDeepData(e)){if(!p.isSafeAttr(e))return;delete t[e];return}let r=p.getSegments(e);if(!r)return;let s=r.length,i=s-1;for(let o=0;o<s;o++){let c=r[o],u=t[c];if(u===void 0)break;if(o===i){if(Array.isArray(t)){let l=Number(c);Number.isInteger(l)&&l>=0&&l<t.length&&t.splice(l,1);break}delete t[c];break}t=u}}static get(t,e){if(!p.hasDeepData(e))return t[e]??void 0;let r=p.getSegments(e);if(!r)return;let s=r.length,i=s-1;for(let o=0;o<s;o++){let c=r[o],u=t[c]??void 0;if(u===void 0)break;if(t=u,o===i)return t}}};var rt=new Set,T=class{static MAX_DEPTH=50;static publishDeep(t,e,r,s){if(!p.hasDeepData(e)){this.publish(e,r,s);return}let i,o=p.getSegments(e);if(!o)return;let c=o.length,u=c-1,l="";for(let h=0;h<c;h++){let a=o[h];t=t[a];let f=a.charCodeAt(0);h>0?(f<48||f>57)&&(l+="."+a):l=a;let d;if(h===u)d=r;else{let y=o[h+1],_=y.charCodeAt(0);if(_>=48&&_<=57){l+="["+y+"]";continue}let C={};C[y]=t[y],d=C}this.publish(l,d,s)}}static publish(t,e,r,s=null,i=0){if(t=t||"",r(t,e),!(!e||typeof e!="object"||(e=Q(e),s===null&&(rt.clear(),s=rt),!s))){if(s.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}s.add(e),Array.isArray(e)?this.publishArray(t,e,r,s,i):this.publishObject(t,e,r,s,i)}}static publishArray(t,e,r,s,i){let o=e.length;for(let c=0;c<o;c++){let u=e[c],l=t+"["+c+"]";this._checkPublish(l,u,r,s,i)}}static publishObject(t,e,r,s,i){let o=Object.keys(e);for(let c=0,u=o.length;c<u;c++){let l=o[c],h=e[l],a=t+"."+l;this._checkPublish(a,h,r,s,i)}}static _checkPublish(t,e,r,s,i){if(!e||typeof e!="object"){r(t,e);return}this.publish(t,e,r,s,i+1)}};var S=class extends A{setup(){this.attributes={},this.stage={}}_setAttr(t,e,r,s){typeof e!="object"&&e===this.get(t)||(!r&&s!==!0?x.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),x.set(this.stage,t,e),r=r||this,this._publish(t,e,r,b.CHANGE))}_silentSet(t){let e=this.stage,r=this.attributes,s=Object.keys(t);for(let i=0,o=s.length;i<o;i++){let c=s[i],u=t[c];e[c]=u,r[c]=u}}linkAttr(t,e){let r=t.get(e);if(!r)return;let s=Object.keys(r);for(let i=0,o=s.length;i<o;i++){let c=s[i];this.link(t,e+"."+c,c)}}scope(t,e){let r=this.get(t);if(!r)return!1;e=e||this.constructor;let s=new e(r);return s.linkAttr(this,t),s}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.push(e),this.set(t,r),this}concat(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r=r.concat(e),this.set(t,r),this}unshift(t,e){let r=this.get(t);return Array.isArray(r)===!1&&(r=[]),r.unshift(e),this.set(t,r),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.shift();return this.set(t,e),r}getIndex(t,e,r){let s=this.get(t);return Array.isArray(s)===!1?-1:typeof s[0]!="object"?s.indexOf(e):s.findIndex(o=>o[e]===r)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let r=e.pop();return this.set(t,e),r}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,r,s){if(this._publishAttr(t,e,r,s),!e||typeof e!="object")return;let i=t.length,o=s===b.CHANGE?":change":":"+s,c=o.length,u=i+c;for(let h of this.eventSub.getMessages()){if(h.length<=u||!h.endsWith(o)||!h.startsWith(t))continue;let a=h.charCodeAt(i);if(a!==46&&a!==91)continue;let f=h.slice(0,h.length-c);this._publishAttr(f,this.get(f),r,s)}let l=g.getPrefixMessages(this._dataId);if(l){let h=this._dataId.length;for(let a of l){if(a.length-h<=i||!a.startsWith(t,h))continue;let d=a.charCodeAt(h+i);if(d!==46&&d!==91)continue;let y=a.slice(h);g.publish(a,this.get(y),r)}}}_publishAttr(t,e,r,s){let i=this._dataId+t;g.publish(i,e,r),this.publishLocalEvent(t,e,r,s)}mergeStage(){this.attributes=D.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,r=this){x.delete(t,e),this._delCommitter=r;let s=this._deleteCb||(this._deleteCb=i=>this._publishAttr(i,null,this._delCommitter,b.DELETE));T.publish(e,null,s)}_getAttr(t,e){return x.get(t,e)}};var at={"\n":"\\n","\r":"\\n"," ":"\\t"},ft=(n,t)=>{typeof n!="string"&&(n=String(n));let e=t?/[\n\r\t]/g:/\t/g;return n.replace(e,r=>at[r])},st=(n,t)=>{if(typeof n!="string")return n;n=ft(n,t),n=encodeURIComponent(n);let e=/%22/g;return n.replace(e,'"')},q=(n,t)=>{let e=typeof n;if(e==="undefined")return n;if(e!=="object")return n=st(n),n;let r=Array.isArray(n)?[...n]:{...n};return Object.keys(r).forEach(s=>{let i=r[s];i!==null&&(r[s]=typeof i=="string"?q(i,t):st(i,t))}),r};function nt(n){if(typeof n>"u"||n.length<1)return!1;try{return JSON.parse(n)}catch(t){return console.warn("[Encode] Failed to parse JSON.",t),!1}}function B(n){return typeof n<"u"?JSON.stringify(n):null}var L=class{static prepareJsonUrl(t,e=!1){let r=typeof t=="object"?D.clone(t):t,s=q(r,e);return B(s)}static json={encode:B,decode:nt};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var V=n=>n?n.data?n.data:n.context&&n.context.data?n.context.data:n.state?n.state:null:null;var N=class extends ${static create(t,e,r,s){let i=document.createElement(t);return this.addAttributes(i,e,s),r.appendChild(i),i}static addAttributes(t,e,r){if(!(!e||e.length<1))for(let s=0,i=e.length;s<i;s++){let o=e[s];this.addAttr(t,o.key,o.value,r)}}static addAttr(t,e,r,s){if(r===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=r;return}if(typeof r==="function"){if(e=J(e),r.originalCallback)j.add(e,t,r,!1,!0,r.originalCallback);else{let c=r,u=function(l){c.call(this,l,s)};j.add(e,t,u,!1,!0,c)}return}if(e.charCodeAt(4)===45){t.setAttribute(e,r);return}let o=P(e);t[o]=r}static addContent(t,e){e&&(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var it=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,ot=new m(1e3),dt=new Set(["disabled","checked","required","selected","hidden","readonly","readOnly","multiple","open","autofocus","inert"]),pt=n=>typeof n=="string"?n!==""&&n!=="false":!!n,gt=(n,t)=>{if(t.charCodeAt(4)===45){n.removeAttribute(t);return}let e=P(t);if(e in n){n[e]="";return}n.removeAttribute(t)},z={isWatching(n){if(Array.isArray(n)){let t=n[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(n)},hasParams(n){return typeof n=="string"&&n.includes("[[")},_getWatcherProps(n){let t=ot.get(n);if(t!==void 0)return t;let e=n.match(it),r=e?e.map(s=>s.slice(2,-2)):null;return ot.set(n,r),r},updateAttr(n,t,e){switch(t){case"text":case"textContent":n.textContent=e;break;case"disabled":case"checked":case"required":case"selected":case"hidden":case"readonly":case"readOnly":case"multiple":case"open":case"autofocus":case"inert":n[t==="readonly"?"readOnly":t]=pt(e);break;case"src":if(n.tagName==="IMG"){n.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}n.src=e;break;default:if(e===""&&t){gt(n,t);break}N.addAttr(n,t,e);break}},replaceParams(n,t,e=!1){let r=0;return n.replace(it,function(s,i,o){let c=e?t[r]:t;r++;let u=c.get(o);return u??""})},_getWatcherCallBack(n,t,e,r,s){let i=this._getWatcherProps(e);if(i&&i.length===1&&e.length===i[0].length+4){let o=i[0],c=s?t[0]:t;return dt.has(r)?()=>{this.updateAttr(n,r,c.get(o))}:()=>{let u=c.get(o);this.updateAttr(n,r,u!=null?String(u):"")}}return()=>{let o=this.replaceParams(e,t,s);this.updateAttr(n,r,o)}},getValue(n,t){let e=n.value;return Array.isArray(e)===!1?[e,V(t)]:e.length<2?[e[0],V(t)]:e},getPropValues(n,t,e){let r=[];for(let s=0,i=t.length;s<i;s++){let c=(e?n[s]:n).get(t[s])??"";r.push(c)}return r},getCallBack(n,t,e,r,s,i){let o=n.attr||"textContent",c=n.callBack;if(typeof c=="function"){let u=i||this._getWatcherProps(r)||[],l=u.length>1;return(h,a)=>{h=l!==!0?h:this.getPropValues(e,u,s);let f=c(h,t,a);typeof f<"u"&&this.updateAttr(t,o,f)}}return this._getWatcherCallBack(t,e,r,o,s)},addDataWatcher(n,t,e){let r=this.getValue(t,e),s=r[1]??e?.data??e?.context?.data??e?.state??null;if(!s)return;let i=r[0],o=Array.isArray(s),c=this._getWatcherProps(i);if(!c)return;let u=this.getCallBack(t,n,s,i,o,c);if(!o)c.length>1?g.watchMany(n,s,c,u):this.addWatcher(n,s,c[0],u);else for(let l=0,h=c.length;l<h;l++)this.addWatcher(n,s[l],c[l],u)},getWatcherSettings(n,t=null){if(typeof n=="string")return{attr:t,value:n};if(Array.isArray(n)){let e=n[n.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let r=n[1]&&typeof n[1]=="object"?[n[0],n[1]]:[n[0]];return typeof e=="function"?{attr:t,value:r,callBack:e}:{attr:e||"textContent",value:r}}return n},setup(n,t,e){t&&this.addDataWatcher(n,this.getWatcherSettings(t),e)},addWatcher(n,t,e,r){g.watch(n,t,e,r)}};var M=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=null,this.requestOptions=null,this.init()}init(){let t=this.model;t&&t.url&&(this.url=t.url)}isValid(){let t=this.validate();if(t!==!1){let e=this.validateCallBack;typeof e=="function"&&e(t)}return t}validate(){return!0}getDefaultParams(){return""}setupParams(t){let e=this.getDefaultParams();return t=this.addParams(t,e),t}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r+"="+t[r]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=U.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=U.parseQueryString(e,!1)),this._isFormData(t))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.append(r,e[r]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let r=this.model.get("id"),s="id="+r,i=r?`/${r}`:"",o=this.model;return this._get(i,s,t,e,c=>{if(c){let u=this.getObject(c);u&&o.set(u)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+L.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let r=this.setupObjectData(),s=this.model.id,i=s!=null?`/${s}`:"";return this._put(i,r,t,e)}add(t,e){if(!this.isValid())return;let r=this.setupObjectData(),s=this.model.id,i=s!=null?`/${s}`:"";return this._post(i,r,t,e)}update(t,e){if(!this.isValid())return;let r=this.setupObjectData(),s=this.model.id,i=s!=null?`/${s}`:"";return this._patch(i,r,t,e)}delete(t,e){let r=this.model.get("id"),s=typeof r<"u"?"id="+r:this.setupObjectData(),i=r!=null?`/${r}`:"";return this._delete(i,s,t,e)}getAllParams(t,e,r,s){let i=this.model.get();t=isNaN(Number(t))?0:t,e=isNaN(Number(e))?50:e;let o=i.search||"",c=f=>{try{return JSON.stringify(f)}catch(d){return console.error("[ModelService] Failed to serialize request param.",d),""}},u=i.filter||"";typeof u=="object"&&(u=c(u));let l=i.dates||"";typeof l=="object"&&(l=c(l));let h=i.orderBy||"";typeof h=="object"&&(h=c(h));let a=i.groupBy||"";return Array.isArray(a)&&(a=c(a)),"&filter="+encodeURIComponent(u)+"&offset="+t+"&limit="+e+"&dates="+encodeURIComponent(l)+"&orderBy="+encodeURIComponent(h)+"&groupBy="+encodeURIComponent(a)+"&search="+encodeURIComponent(o)+"&lastCursor="+(typeof r<"u"&&r!==null?encodeURIComponent(r):"")+"&since="+(typeof s<"u"&&s!==null?encodeURIComponent(s):"")}all(t,e,r,s,i=null,o=null){let c=this.getAllParams(r,s,i,o);return this._get("",c,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let r=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(r)}withOptions(t){return Object.create(this,{requestOptions:{value:t||null,writable:!0}})}withCache(t=!0){return this.withOptions({...this.requestOptions,cache:t})}setupRequest(t,e,r,s,i,o){o=o||this.requestOptions||null;let c=(a,f)=>{typeof i=="function"&&i(a),this.getResponse(a,s,f)},u={url:this.getUrl(t),method:e,params:r,completed:c},l=this._isFormData(r);if(l&&(u.headers={}),!o)return E(u);o.invalidate&&(u.completed=(a,f)=>{a!==!1&&a!=null&&I.invalidate(o.invalidate),c(a,f)});let h=o.cache;return!h||!this.isCacheableMethod(e)||l?E(u):this.cachedRequest(u,h===!0?{}:h)}isCacheableMethod(t){let e=String(t||"").toUpperCase();return e==="GET"||e==="HEAD"}getCacheKey(t){let e=t.params||"";if(typeof e=="object")try{e=JSON.stringify(e)}catch{e=""}return t.method.toUpperCase()+" "+t.url+(e?" "+e:"")}cachedRequest(t,e){let r=e.key||this.getCacheKey(t),s=t.completed,i=o=>E({...t,completed:(c,u)=>o(c!=null,c,u),failed:(c,u)=>o(!1,!1,u),aborted:(c,u)=>o(!1,!1,u)});return I.resolve(r,i,{ttl:e.ttl,swr:e.swr},(o,c)=>s(o,c))}setupEventSource(t,e,r,s,i=!0){let o=null,c,u=!1,l=!1,h=()=>{c&&(clearTimeout(c),c=void 0)},a=()=>{if(u||!i||l)return;h(),c=setTimeout(()=>{c=void 0,f()},3e3)},f=()=>{if(u||l)return;if(o){try{o.close()}catch{}o=null}l=!0;let d=this.getUrl(t),y=e?"?"+e:"";o=new EventSource(d+y,{withCredentials:!0}),o.onopen=()=>{l=!1,h(),s&&s()},o.onerror=()=>{l=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,a())},o.onmessage=_=>{try{let C=JSON.parse(_.data);r&&r(C)}catch{}}};return f(),{get source(){return o},close:()=>{if(u=!0,l=!1,h(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return z.isWatching(t)&&(t=z.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,r,s,i){return this._request("","POST",t,e,r,s,i)}_get(t,e,r,s,i,o){return e=this.setupParams(e),e=this.addParams(e,r),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",s,i,o)}_post(t,e,r,s,i,o){return this._request(t,"POST",e,r,s,i,o)}_put(t,e,r,s,i,o){return this._request(t,"PUT",e,r,s,i,o)}_patch(t,e,r,s,i,o){return this._request(t,"PATCH",e,r,s,i,o)}_delete(t,e,r,s,i,o){return this._request(t,"DELETE",e,r,s,i,o)}_request(t,e,r,s,i,o,c){return r=this.setupParams(r),r=this.addParams(r,s),this.setupRequest(t,e,r,i,o,c)}getResponse(t,e,r){typeof e=="function"&&e(t,r)}static extend(t){if(!t)return{};let e=this;class r extends e{constructor(i){super(i)}}return Object.assign(r.prototype,t),r}};var yt=n=>{let t={};if(!O.isObject(n)||!n.defaults)return t;let{defaults:e}=n;return Object.keys(e).forEach(r=>{let s=e[r];typeof s!="function"&&(t[r]=s)}),delete n.defaults,t},mt=n=>{if(!n||typeof n.xhr!="object")return{};let t={...n.xhr};return delete n.xhr,t},bt=0,v=class extends S{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,r=mt(t),s=e.prototype.service.extend(r),i=yt(t);class o extends e{constructor(u){let l={...i,...w(u)};super(l),this.xhr=new s(this)}dataTypeId=`bm${bt++}`}return Object.assign(o.prototype,t),o.prototype.service=s,o}};v.prototype.service=M;var F=class extends A{};export{m as a,Z as b,A as c,S as d,V as e,N as f,z as g,v as h,F as i};
2
+ //# sourceMappingURL=chunk-HBL2JSVL.js.map
@@ -0,0 +1,2 @@
1
+ import{a as C,b as D,c as g,d as p}from"./chunk-7ZHUXJZT.js";var M=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 b=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var w=class extends b{constructor(t){super(),this.data=t}subscribe(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribe - data source is null or does not have an "on" method. Make sure your component has data, state, or context.data initialized.',t,this.data);return}this.msg=t,this.token=this.data.on(t,e)}subscribeMany(t,e){if(!this.data||typeof this.data.on!="function"){console.warn('OneWaySource: Cannot subscribeMany - data source is null or does not have an "on" method.',t,this.data);return}let s=t.length,i=new Array(s);for(let n=0;n<s;n++){let u=t[n];i[n]={msg:u,token:this.data.on(u,e)}}this.subscriptions=i}unsubscribe(){if(this.data){let t=this.subscriptions;if(t){for(let e=0,s=t.length;e<s;e++)this.data.off(t[e].msg,t[e].token);this.subscriptions=null}else this.msg&&this.token&&this.data.off(this.msg,this.token)}this.data=null,this.msg=null,this.token=null}};var m=class{unsubscribe(){}};var x=class extends m{constructor(){super(),this.source=null}addSource(t){return this.source=new w(t)}unsubscribe(){this.source.unsubscribe(),this.source=null}};var y=class extends b{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 A=class extends y{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 S=class{static getById(t){return typeof t!="string"?!1:document.getElementById(t)||!1}static getByName(t){if(typeof t!="string")return!1;let e=document.getElementsByName(t);return e?Array.from(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let s=document.querySelectorAll(t);return s?s.length===1?s[0]:Array.from(s):!1}static html(t,e){return!t||typeof t!="object"?!1:typeof e<"u"?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return!t||typeof t!="object"||typeof e>"u"?this:(e=p.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=p.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 u=window.getComputedStyle(t,null);return u?u[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return typeof t=="object"&&t!==null&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=p.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=p.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=p.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(!t||typeof t!="object")return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(!t||typeof t!="object")return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return!t||typeof t!="object"?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return!t||typeof t!="object"?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return typeof t=="object"&&t!==null?t.offsetWidth:!1}static getHeight(t){return typeof t=="object"&&t!==null?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return!t||typeof t!="object"?!1:{left:e-(t.clientLeft||0),top:s-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,s=e.documentElement,i=e.getElementsByTagName("body")[0],n=t.innerWidth||s.clientWidth||i.clientWidth,u=t.innerHeight||s.clientHeight||i.clientHeight;return{width:n,height:u}}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(!t||typeof t!="object")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(!t||typeof t!="object"||e==="")return this;if(typeof e=="string"){let s=e.split(" ");for(let i=0,n=s.length;i<n;i++)t.classList.add(s[i])}return this}static removeClass(t,e){return!t||typeof t!="object"||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return!t||typeof t!="object"||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return!t||typeof t!="object"?this:(t.classList.toggle(e),this)}};var P=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 z=(r,t,e)=>{S.setAttr(r,t,e)},W=(r,t,e)=>{r.checked=r.value==e},_=(r,t,e)=>{e=e==1,H(r,t,e)},H=(r,t,e)=>{r[t]=e},N=(r,t)=>S.getAttr(r,t),R=(r,t)=>r[t],I=class extends y{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=z,this.getValue=N,this;this.getValue=R;let s=t.type;if(s)switch(s){case"checkbox":return this.setValue=_,this;case"radio":return this.setValue=W,this}return this.setValue=H,this}getAttrBind(t){return t||P(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 v=class extends m{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new I(t,e,s,this.pubSub)}addData(t,e){return this.data=new A(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 q=0,B=class{constructor(t=!1){this.callBacks=new Map,this.prefixIndex=t?new Map:null,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=2e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[],this.deliveringMessage=null,this.reentrantMessages=null,this.suppressQueue=!1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.prefixIndex?.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.reentrantMessages=null}on(t,e){let s=++q,i=this.callBacks.get(t);return i||(i=new Map,this.callBacks.set(t,i),this.prefixIndex&&this._indexMessage(t)),i.set(s,e),s}_indexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),i=this.prefixIndex.get(s);i||(i=new Set,this.prefixIndex.set(s,i)),i.add(t)}_unindexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),i=this.prefixIndex.get(s);i&&(i.delete(t),i.size===0&&this.prefixIndex.delete(s))}getPrefixMessages(t){return this.prefixIndex&&this.prefixIndex.get(t)||null}getMessages(){return this.callBacks.keys()}off(t,e){let s=this.callBacks.get(t);s&&(s.delete(e),s.size===0&&(this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t)))}remove(t){this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t)}publish(t,e,s){if(!this.batchingEnabled){this.publishImmediate(t,e,s);return}this.suppressQueue||(t===this.deliveringMessage&&(this.reentrantMessages??=new Set).add(t),this.callBacks.has(t)&&(this.updateQueue.set(t,[e,s]),this.debugMode&&console.log("[DataPubSub] Queued update:",t,e),this.scheduleFlush()))}scheduleFlush(){this.isFlushing||this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){if(this.updateQueue.size===0){this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete();return}if(this.isFlushing||(this.flushIterations=0,this.reentrantMessages=null),this.isFlushing=!0,this.flushScheduled=!1,this.flushIterations++,this.flushIterations>this.maxFlushIterations){console.error("[DataPubSub] Infinite loop detected! Flush iterations exceeded",this.maxFlushIterations,"- Breaking to prevent memory exhaustion."),console.error("[DataPubSub] Queue size:",this.updateQueue.size),console.error("[DataPubSub] Queued messages:",Array.from(this.updateQueue.keys())),this._breakCascade(),this.flushScheduled=!1,this.isFlushing=!1,this._resolveFlushComplete(),this.flushIterations=0;return}this.debugMode&&console.log("[DataPubSub] Flushing",this.updateQueue.size,"updates (iteration",this.flushIterations+")");let t=this.updateQueue;this.updateQueue=new Map;try{for(let[e,s]of t)this.publishImmediate(e,s[0],s[1])}finally{this.debugMode&&console.log("[DataPubSub] Flush complete (iteration",this.flushIterations+")"),this.updateQueue.size>0?(this.debugMode&&console.log("[DataPubSub] New updates queued during flush, re-flushing..."),this.flush()):(this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete())}}_breakCascade(){let t=this.updateQueue;this.updateQueue=new Map;let e=this.reentrantMessages;this.suppressQueue=!0;try{for(let[s,i]of t)e&&e.has(s)||this.publishImmediate(s,i[0],i[1])}finally{this.suppressQueue=!1,this.reentrantMessages=null,this.updateQueue.clear()}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}}nextFlush(){return new Promise(t=>{this.flushCompleteResolvers.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>t())})}onFlush(t){if(typeof t!="function"){console.warn("[DataPubSub] onFlush requires a function callback");return}this.flushCallbacks.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>{if(this.flushCallbacks.length>0){let e=this.flushCallbacks;this.flushCallbacks=[];let s=e.length;for(let i=0;i<s;i++)e[i]()}})}flushSync(){this.flush()}publishImmediate(t,e,s){let i=this.callBacks.get(t);if(!i)return;let n=this.deliveringMessage;this.deliveringMessage=t;for(let u of i.values())if(u)try{u(e,s)}catch(a){console.error('[DataPubSub] Subscriber error for "'+t+'":',a)}this.deliveringMessage=n}};var F=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new M,this.pubSub=new B(!0),this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,i){let n=s,u=null,a=s.indexOf(":");a!==-1&&(u=s.substring(0,a),n=s.substring(a+1));let l=u??"",f=this.setupConnection(t,e,n,l,i),c=f.element,h=e.get(n);return typeof h<"u"?c.set(h):(h=c.get(),h!==""&&f.data.set(h)),this}setupConnection(t,e,s,i,n){let u=this.getBindId(t),a=new v(this.pubSub);a.addData(e,s).subscribe(u);let c=`${e.getDataId()}:${s}`;return a.addElement(t,i,n).subscribe(c),this.addConnection(u,"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(C.isObject(t)===!1)return this;let n=new x,u=e.get(s),a=!0,l=d=>{a&&(a=!1,d===u&&(d===null||typeof d!="object"))||i(d)};n.addSource(e).subscribe(s,l);let c=this.getBindId(t),h=e.getDataId()+":"+s;return this.addConnection(c,h,n),i(u),this}watchMany(t,e,s,i){if(C.isObject(t)===!1)return this;let n=s?s.length:0;if(n===0)return this;if(n===1)return this.watch(t,e,s[0],i);let u=new x,a=u.addSource(e),l=new Array(n),f=new Array(n);for(let o=0;o<n;o++)l[o]=e.get(s[o]),f[o]=!0;let c=new Array(n);for(let o=0;o<n;o++){let E=o,O=l[o];c[o]=k=>{f[E]&&(f[E]=!1,k===O&&(k===null||typeof k!="object"))||i(k)}}if(typeof e.on!="function")return console.warn('DataBinder.watchMany: data source has no "on" method.',e),this;let h=new Array(n);for(let o=0;o<n;o++)h[o]={msg:s[o],token:e.on(s[o],c[o])};a.subscriptions=h;let d=this.getBindId(t),Q=e.getDataId()+":"+s.join(",");return this.addConnection(d,Q,u),i(l[0]),this}unwatch(t,e,s){if(C.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}getPrefixMessages(t){return this.pubSub.getPrefixMessages(t)}isDataBound(t){if(!t)return null;let e=t[this.attr];return e||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.has(t.keyCode)}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,s=this.isDataBound(e);if(s!==null){let i=this.connections.get(s,"bind");if(i){let n=i.element.get();this.pubSub.publish(s,n,e)}}}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&g.on(["change","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&g.off(["change","input"],document,this.changeHandler,!1)}},T=new F;var V=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"]]),U=r=>V.get(r)||r,G=r=>typeof r=="string"&&r.charCodeAt(0)===111&&r.charCodeAt(1)===110?r.substring(2):r,K=/(?:<[a-z][\s\S]*>)/i,L=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,u=i.length;n<u;n++){let a=i[n],l=e[a];a==="innerHTML"?t.innerHTML=l:a.indexOf("-")!==-1?t.setAttribute(a,l):this.addAttr(t,a,l)}}static addHtml(t,e){return typeof e>"u"||e===""?this:(K.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(s===""||!e)return;if(typeof s==="function")e=G(e),s.originalCallback?g.add(e,t,s,!1,!0,s.originalCallback):g.add(e,t,s);else{let n=U(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--){let u=i[n];(u.nodeType!==3||u.bindId)&&e.push(u)}D.remove(s),s.bindId&&T.unbind(s)}}static removeElement(t){if(!t)return this;let e=D.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!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)}};export{P as a,B as b,T as c,U as d,G as e,L as f};
2
+ //# sourceMappingURL=chunk-LY736NR2.js.map
@@ -0,0 +1,2 @@
1
+ import{b as R}from"./chunk-6YJAZHX6.js";import{a as _,b as At,c as Pt,d as Et,e as T,f as S,g as D}from"./chunk-HBL2JSVL.js";import{a as W,b as Tt}from"./chunk-VSCHM2ZB.js";import{a as Rt,c as I,d as bt,f as q}from"./chunk-LY736NR2.js";import{b as f,c as p}from"./chunk-7ZHUXJZT.js";var F={items:new Map,add(n,t){return this.items.set(n,t),this},get(n){return this.items.get(n)??null}};var y=[],G=0,lt=!1,Le=typeof queueMicrotask=="function"?queueMicrotask:n=>Promise.resolve().then(n),Oe=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||n.container||null},Be=n=>{n._mountPending=!1;try{n.afterMount()}catch(t){console.error("Error in afterMount:",t)}},It=()=>{lt=!1;let n=y;if(n.length===0)return;y=[];let t=[];for(let e=0,r=n.length;e<r;e++){let s=n[e];if(s.rendered!==!0||s._mountPending!==!0){s._mountPending=!1;continue}let o=Oe(s);if(o&&o.isConnected===!0){Be(s);continue}t.push(s)}t.length&&(y=y.length?t.concat(y):t),y.length&&G===0&&y.length!==t.length&&ct()},ct=()=>{lt||(lt=!0,Le(It))},v={add(n){n._mountPending!==!0&&(n._mountPending=!0,y.push(n))},enter(){G++},leave(){--G>0||(G=0,y.length&&ct())},schedule(){y.length&&ct()},flush(){It()},get size(){return y.length}};f.addType("components",n=>{if(!n)return;let t=n.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken,t),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Me=0,z=class{constructor(t,e,r){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let s,o;if(t==null)s={},o=[];else{let i=typeof t;i==="string"||i==="number"?(s={},o=[{tag:"text",textContent:t}]):Array.isArray(t)?(s={},o=t):(s=t||{},o=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(s),this.children=o||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Me++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,s;r!=null&&e!=null?s="pk:"+r+":"+e:r!=null?s="pk:"+r:e!=null?s="pk:"+e:s="pc"+this.persistedCount++;let o=this.persistedChildren[s];return o&&t.unitType===o.unitType&&t.resumeScope(o),t.persistToken=s,this.persistedChildren[s]=t,s}removePersistedChild(t,e){if(!this.rendered)return;let r=t?this.persistedChildren[t]:null;r&&(e&&r!==e||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){f.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout(),typeof this.afterMount=="function"&&v.add(this)}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(let s=0,o=t.length;s<o;s++){let i=e(t[s],s);r.push(i)}return r}removeAll(t){return q.removeAll(t)}getId(t){let e=this.id;return typeof t=="string"&&(e+="-"+t),e}cacheEle(t,e){e&&(this[e]=t,this.cached.push(e))}initialize(){this.setupContext(),this.beforeSetup()}beforeSetup(){}afterSetup(){}setup(t){this.setContainer(t),this.initialize()}setContainer(t){this.container=t}_remove(){this.prepareDestroy();let t=this.panel;t&&q.removeElement(t),this.cleanUpAfterDestroy()}cleanUpAfterDestroy(){this.panel=null,this.container=null;let t=this.cached;for(let e=0,r=t.length;e<r;e++)this[t[e]]=null;this.cached=[],this.persist!==!0&&(this.persistedChildren={},this.persistToken=null)}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}beforeDestroy(){}destroy(){this._remove()}};var L=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static _releaseLinks(t,e){!t||t===e||typeof t.unlink!="function"||t.unlink()}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let r=t.getParentContext();if(!r||!r.data)return;let s=r.data.stage,o=e.data.stage,i=null;for(let a in s){if(!Object.prototype.hasOwnProperty.call(s,a))continue;let l=s[a];l!==o[a]&&(i===null&&(i={}),i[a]=l)}i!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(i):e.data.set(i))}static _resumeExternal(t,e){let r=t.setData();if(!r){t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let s=e._retainState||r._retainState,o=!s&&(e._refreshState||r._refreshState),i=this._buildExternalUpdates(e.stage,r.stage,s,o);W.isEmpty(i)||r._silentSet(i)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,s){let o={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(s){Object.prototype.hasOwnProperty.call(e,i)||(o[i]=t[i]);continue}let a=t[i];!r&&a==null||a!==e[i]&&(o[i]=a)}return o}static _resumeOwned(t,e){let r=t.data;if(!r){this._releaseLinks(e),t.data=e;return}if(e&&e._retainState){this._releaseLinks(r,e),this._releaseLinks(e),t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let s=e._refreshState||t.data._refreshState,o=this._buildOwnedUpdates(e.stage,t.data.stage,s);W.isEmpty(o)||t.data._silentSet(o)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let s={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(r){Object.prototype.hasOwnProperty.call(e,o)||(s[o]=t[o]);continue}let i=t[o];i!=null&&i!==e[o]&&(s[o]=i)}return s}};var Q=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let s=t[r];this.on(s[0],s[1],s[2],s[3])}}on(t,e,r,s){p.on(t,e,r,s),this.events.push({event:t,obj:e,callBack:r,capture:s})}off(t,e,r,s){p.off(t,e,r,s);let o,i=this.events;for(let a=0,l=i.length;a<l;a++)if(o=i[a],o.event===t&&o.obj===e&&o.callBack===r&&o.capture===s){i.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let s=t[e];p.on(s.event,s.obj,s.callBack,s.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let s=t[e];p.off(s.event,s.obj,s.callBack,s.capture)}}reset(){this.unset(),this.events=[]}};var j=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,s){return{action:t,state:e,callBack:r,targetId:s,token:null,callBackToken:null}}convertStates(t){let e=[];for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}let s=null,o=null,i=t[r];i&&typeof i=="object"&&(o=i.callBack,s=i.id||i.targetId,i=i.state),e.push(this.createState(r,i,o,s))}return e}setupRemoteStates(t,e){for(let r=0,s=t.length;r<s;r++){let o=t[r];if(o)for(let i in o){if(!Object.prototype.hasOwnProperty.call(o,i)||i==="id")continue;let a=null,l=o[i],c=l!==null?l:void 0;c&&typeof c=="object"&&(a=c.callBack,c=c.state),e.push(this.createState(i,c,a,o.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let r=0,s=e.length;r<s;r++){let o=e[r];o.callBackToken&&(t.off(o.action,o.callBackToken),o.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,s=e.length;r<s;r++){let o=e[r];o.token&&this.unbindRemoteState(t,o.token),o.targetId&&R.remove(o.targetId,o.action,o.token)}}restore(t){R.restore(t.id,t);let e=this.callBackStates;if(e)for(let s=0,o=e.length;s<o;s++){let i=e[s];i.callBackToken=t.on(i.action,i.callBack)}let r=this.remoteStates;if(r)for(let s=0,o=r.length;s<o;s++){let i=r[s];i.token=this.bindRemoteState(t,i.action,i.targetId)}}bindRemoteState(t,e,r){let s=R.getTarget(r);return t.link(s,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(let s=0,o=e.length;s<o;s++){let i=e[s],a=this.addAction(t,i);i.targetId&&(i.token=a,r.push(i))}}addAction(t,e){let r,s=e.action,o=e.targetId;o&&(r=this.bindRemoteState(t,s,o)),typeof e.state<"u"&&t.addAction(s,e.state);let i=e.callBack;return typeof i=="function"&&(e.callBackToken=t.on(s,i),this.callBackStates.push(e)),r||null}};var x=class extends z{constructor(t,e,r){super(t,e,r),this.isComponent=!0,this.stateResumed=!1,this.stateTargetId=null,this._externalData=this._externalData??!1,this._setupData()}setData(){return null}_setupData(){if(this.data)return;let t=this.setData();t&&(this.data=t)}resumeScope(t){if(this._resumeData(t.data),this.state=t.state,this.stateHelper=t.stateHelper,this.persistedChildren=t.persistedChildren,t.context){let e=t.context.data;e&&e._refreshState===!0&&e._retainState!==!0||(this.context=t.context,this._contextResumed=!0)}this.id=t.id,this._refreshContextData()}_resumeData(t){L.resume(this,t)}_refreshData(){L.refresh(this)}_refreshContextData(){L.refreshContext(this)}initialize(){this.setupContext(),this.addStates(),this.beforeSetup()}afterLayout(){this.addEvents(),this.afterSetup()}setupStateTarget(t){let e=t||this.stateTargetId||this.id;this.state=R.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();W.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new j(this.state??{},t))}addState(t){!this.stateHelper||this.stateResumed===!0||this.stateHelper.addStates(this.state,t)}removeStates(){let t=this.state;if(!t)return;let e=this.stateHelper;e&&(e.removeRemoteStates(t),e.removeLocalStates(t)),R.detach(String(t.id)),this.stateResumed=!1}onFlush(t){let e=this.data??this?.context?.data??null;e&&e.onFlush(t)}setEventHelper(){this.events||(this.events=new Q)}setupEvents(){return[]}addEvents(){let t=this.setupEvents();t.length<1||(this.setEventHelper(),this.events&&this.events.addEvents(t))}removeEvents(){let t=this.events;t&&t.reset()}prepareDestroy(){this.persistedCount=0,this.rendered=!1;try{this.beforeDestroy()}catch(t){console.error("Error in beforeDestroy:",t)}this.removeEvents(),this.removeStates(),this.removeContext(),this.data&&this.persist!==!0&&typeof this.data.unlink=="function"&&this.data.unlink()}};var _t={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},Dt=(n,t)=>typeof n!="function"&&t==="setupStates"?()=>n:n;var ht=(n,t)=>{if(!n)return t;let e=Object.keys(n);for(let r=0,s=e.length;r<s;r++){let o=e[r],i=n[o],a=_t[o]||o;t[a]=Dt(i,a)}return t},Ue=n=>ht(n,{}),He=0,Lt=(n,t)=>{class e extends n{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+He++,e},O=(n,t=x)=>{n||(n={});let e,r=typeof n;return r==="object"&&n.render?(e=Ue(n),Lt(t,e)):(e={render:r==="function"?n:()=>n},Lt(t,e))};var ut=(n,t)=>({attr:n,directive:t});var k=(n,t)=>({key:n,value:t});var Ot=(n,t,e,r)=>({tag:n,attr:t,directives:e,children:r});var Bt=null,Ne=()=>Bt||(Bt=F.get("watch")),C=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,s){return t==="text"?(s.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(k("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(ut(k(e,D.getWatcherSettings(r,bt(e))),Ne()))}static setButtonType(t,e,r){if(t==="button"){let s=e.type||"button";r.push(k("type",s))}}static parse(t,e){let r=[],s=[],o=t.tag||"div";o==="button"&&r.push(k("type",t.type||"button"));let i=[],a,l;for(let c in t){if(!Object.prototype.hasOwnProperty.call(t,c)||c==="tag"||(a=t[c],a==null))continue;if(c==="children"||c==="nest"){if(Array.isArray(a))for(let u=0;u<a.length;u++)i.push(a[u]);else i.push(a);continue}if((l=F.get(c))!==null){s.push(ut(k(c,a),l));continue}let h=typeof a;if(h==="object"){if(D.isWatching(a)){this.setTextAsWatcher(s,c,a);continue}i.push(a);continue}if(h==="function"){let u=a,m=function(g){u.call(this,g,e)};m.originalCallback=u,r.push(k(c,m));continue}if(h==="string"&&a.includes("[[")){this.setTextAsWatcher(s,c,a);continue}if(c==="text"){i.push({tag:"text",textContent:a});continue}if(c==="html"||c==="innerHTML"){r.push(k("innerHTML",a));continue}r.push(k(c,a))}return Ot(o,r,s,i)}};var B=class{build(t,e,r){}setupComponent(t,e,r){let s=r?.getChildScope();t.parent=s,s&&s.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&s&&(s[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var We=n=>{for(let e in n)if(e!=="tag"&&e!=="textContent")return!1;let t=n.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},V=class extends B{build(t,e,r){let s=S.createDocFragment();if(Array.isArray(t))for(let o=0,i=t.length;o<i;o++)this.buildElement(t[o],s,r);else this.buildElement(t,s,r);return e&&typeof e=="object"&&e.appendChild(s),s}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){if(t.tag==="text"&&We(t)){let c=t.textContent;S.createText(c??"",e);return}let s=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,s);return}let o=C.parse(t,s),i=this.createNode(o,e,s);this.cache(i,t.cache,r);let a=o.children;for(let c=0,h=a.length;c<h;c++){let u=a[c];u!==null&&this.buildElement(u,i,r)}let l=o.directives;l.length&&this.setDirectives(i,l,s)}createTempComponent(t,e,r){let s={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...ht(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(s.setupStateTarget=function(i){this.state=t.state});let o=new x(s);this.createComponent(o,e,r)}setDirectives(t,e,r){for(let s=0,o=e.length;s<o;s++)this.handleDirective(t,e[s],r)}handleDirective(t,e,r){e.directive(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let s=t.tag;if(s==="text"){let o=t.attr[0],i=o?o.value:"";return S.createText(i,e)}else if(s==="comment"){let o=t.attr[0],i=o?o.value:"";return S.createComment(i,e)}return S.create(s,t.attr,e,r)}removeNode(t){S.removeElement(t)}removeAll(t){S.removeAll(t)}};var qe=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),Fe=/[&<>"]/,dt=n=>{let t=typeof n=="string"?n:String(n);return Fe.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t},M=class{static create(t,e=[],r=""){let s="",o="";for(let i=0,a=e.length;i<a;i++){let l=e[i],c=l.key,h=l.value;if(c==="text"||c==="textContent"){s+=dt(h);continue}if(c==="html"||c==="innerHTML"){s+=h;continue}if(typeof h=="function")continue;let u=c+'="'+dt(h)+'"';o?o+=" "+u:o=u}return qe.has(t)?"<"+t+" "+o+" />":"<"+t+" "+o+">"+s+r+"</"+t+">"}static createText(t){return dt(t)}static createComment(t){return"<!-- "+t+" -->"}};var Y=class extends B{build(t,e,r){if(Array.isArray(t)){let s="";for(let o=0,i=t.length;o<i;o++)s+=this.buildElement(t[o],r);return s}return this.buildElement(t,r)}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let r=C.parse(t,e),s=r.children,o="";for(let i=0,a=s.length;i<a;i++){let l=s[i];l!==null&&(o+=this.buildElement(l,e))}return this.createNode(r,o)}createNode(t,e){let r=t.tag;if(r==="text"){let s=t.attr[0],o=s?s.value:"";return M.createText(o)}else if(r==="comment"){let s=t.attr[0],o=s?s.value:"";return M.createComment(o)}return M.create(r,t.attr,e)}removeAll(t){}};var $=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new V:new Y}};var b=$.setup(),Ke=n=>typeof n=="object"&&n.isUnit===!0,Mt=new WeakMap,Ge=n=>{let t=Mt.get(n);if(!t){if(t=O(n),!t)return null;Mt.set(n,t)}return new t},d=class{static render(t,e,r){if(!t||(Ke(t)||(t=Ge(t)),!t))return null;v.enter();try{return b.createComponent(t,e,r)}finally{v.leave()}}static build(t,e,r){v.enter();try{return b.build(t,e,r)}finally{v.leave()}}static rebuild(t,e,r){return b.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){b.setDirectives(t,e,r)}static createNode(t,e,r){return b.createNode(t,e,r)}static removeNode(t){b.removeNode(t)}static removeAll(t){b.removeAll(t)}};Tt.augment({buildLayout(n,t,e){d.build(n,t,e)}});var ft=[],ze=n=>ft.indexOf(n)!==-1,Qe=n=>({tag:"script",src:n.src,async:!1,load(t){ft.push(n.src);let e=n.load;e&&e()}}),je=n=>({tag:"link",rel:"stylesheet",type:"text/css",href:n.src,load(t){ft.push(n.src);let e=n.load;e&&e()}}),J=class{constructor(t){this.percent=0,this.loaded=0,this.total=0,this.callBack=t||null}add(t){this.total++;let e,r=this.update.bind(this);t.indexOf(".css")!==-1?e=je({load:r,src:t}):e=Qe({load:r,src:t}),d.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{ze(e)||this.add(e)})}update(){if(this.updateProgress()<100)return;let e=this.callBack;e&&e()}updateProgress(){return++this.loaded,this.percent=Math.floor(this.loaded/this.total*100)}};var Ve=n=>n?typeof n?.prototype?.constructor=="function":!1,A=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Ve(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){return this.renderNodes(t,e,r)[0]||null}static renderNodes(t,e,r){let s=d.build(t,null,r),o=Array.from(s.childNodes);return o.length===0&&t?.panel&&o.push(t.panel),e.after(s),o}};var X=class{static load(t,e,r){return t.then(s=>(e&&e(s),s)).catch(s=>{console.error("Error loading module:",s),r&&r(s)})}};var Ye=n=>({tag:"comment",textContent:"import placeholder",onCreated:n.onCreated}),P=new _(100),$e=n=>{if(P.has(n)){let r=P.get(n);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof n,e;if(t==="string")e=import(n);else if(t==="function")e=n();else return n;return e.then(r=>{P.set(n,r)}).catch(()=>{P.delete(n)}),P.set(n,e),e},Je=n=>{if(!P.has(n))return null;let t=P.get(n);return t&&typeof t.then=="function"?null:t||null},Ut=n=>{for(let t=0,e=n.length;t<e;t++){let r=n[t];r&&d.removeNode(r)}},Ht=O({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return Ye({onCreated:n=>{if(this.src){if(this.layout){this.setLayoutRoots(A.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){new J(()=>{this.loadAndRender(n)}).addFiles(this.depends);return}this.loadAndRender(n)}}})},loadAndRender(n){let t=this.generation,e=Je(this.src);if(e){this.renderModule(n,e);return}X.load($e(this.src),r=>{t===this.generation&&this.renderModule(n,r)},r=>{t===this.generation&&(this.loaded=!1,this.renderError(n,r))})},renderError(n,t){let e=()=>this.retry(n),r=this.fallback,s=typeof r=="function"?r(t,e):r||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};if(!s)return;let o=A.renderNodes(s,n,this.parent);this.errorRoots=o,this.errorRoot=o[0]||null},setLayoutRoots(n){this.layoutRoots=n,this.layoutRoot=n[0]||null},retry(n){this.removeErrorLayout(),this.loadAndRender(n)},removeErrorLayout(){this.errorRoot&&(Ut(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(n,t){this.loaded=!0;let e=this.layout||A.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(A.renderNodes(e,n,this.parent)),typeof this.onModuleRender=="function"&&this.onModuleRender(e)},shouldUpdate(n){return this.updateLayout===!0?!0:this.updateLayout=n&&n.isUnit&&typeof n.update=="function"},updateModuleLayout(n){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(n)},update(n){this.loaded===!0&&this.updateModuleLayout(n)},destroy(){this.generation++,this.removeErrorLayout(),this.layoutRoot&&(Ut(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Nt=n=>{let t=typeof n;return(t==="string"||t==="function"||n instanceof Promise)&&(n={src:n}),new Ht(n)};var Xe=0,U=class{constructor(t){this.router=t,this.locationId="base-app-router-"+Xe++,this.callBack=this.check.bind(this)}setup(){return this.addEvent(),this}check(t){}getScrollPosition(){return{x:window.scrollX,y:window.scrollY}}scrollTo(t){window.scrollTo(t.x,t.y)}addEvent(){return this}};var Ze=0,tr=()=>Date.now().toString(36)+"-"+(Ze++).toString(36)+"-"+Math.random().toString(36).substring(2,8),qt=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Wt=()=>{qt&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let n=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(n,t)}))},Z=class extends U{constructor(t){super(t),this.currentKey=null,this.positions=new _(200)}saveCurrentPosition(){let t=this.getScrollPosition(),e=this.currentKey;return e&&this.positions.set(e,t),t}addEvent(){p.on("popstate",window,this.callBack);let t=window.history;return t&&"scrollRestoration"in t&&(this.previousScrollRestoration=t.scrollRestoration,t.scrollRestoration="manual"),qt&&(this.pageShowCallBack=this.onPageShow.bind(this),p.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){p.off("popstate",window,this.callBack);let t=window.history;return this.previousScrollRestoration&&t&&"scrollRestoration"in t&&(t.scrollRestoration=this.previousScrollRestoration,this.previousScrollRestoration=null),this.pageShowCallBack&&p.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&Wt()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.saveCurrentPosition();let r=e.key||null;this.currentKey=r;let s=r&&this.positions.get(r)||e.scrollPosition,o=this.router;o.checkActiveRoutes(e.uri,!!s),s&&(typeof o.restoreScrollPosition=="function"?o.restoreScrollPosition(s):this.scrollTo(s)),Wt()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:tr(),scrollPosition:r,uri:t}}addState(t,e,r=!1){let s=window.history,o=s.state;if(o&&o.uri===t)return o.key&&o.location===this.locationId&&(this.currentKey=o.key),this;!r&&o&&o.location===this.locationId&&(o.scrollPosition=this.saveCurrentPosition(),s.replaceState(o,"",window.location.href));let i=this.createState(t,e);return r||(i.scrollPosition={x:0,y:0}),s[r===!1?"pushState":"replaceState"](i,null,t),this.currentKey=i.key,this.positions.set(i.key,i.scrollPosition),this}};var tt={removeSlashes(n){return typeof n!="string"?"":(n[0]==="/"&&(n=n.substring(1)),n[n.length-1]==="/"&&(n=n.substring(0,n.length-1)),n)},getHashUri(n){if(typeof n!="string")return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)}};var et=class extends U{addEvent(){return p.on("hashchange",window,this.callBack),this}removeEvent(){return p.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(tt.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var rt=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new Z(t).setup():new et(t).setup()}};var pt=5,er=200,nt=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new _(er),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:pt}get size(){return this.pages.size}add(t){let e=this.pages;e.delete(t),e.add(t),this.trim()}delete(t){this.pages.delete(t)}trim(){let t=this.pages,e=this.getMax();for(;t.size>e;){let r=t.values().next().value;t.delete(r),r.evict()}}clear(){let t=Array.from(this.pages);this.pages.clear();for(let e=0,r=t.length;e<r;e++)t[e].evict()}saveScroll(t,e){if(e){this.scrollMemory.set(t,e);return}this.scrollMemory.has(t)&&this.scrollMemory.delete(t)}getScroll(t){return this.scrollMemory.get(t)||null}};var mt=class extends x{getChildScope(){return this.parent}},Ft=n=>O(n,mt);var gt="data-scroll-key",rr="["+gt+"]",Kt=(n,t)=>{for(let e=0,r=n.length;e<r;e++){let s=n[e];if(!s||s.nodeType!==1)continue;let o=s.getAttribute(gt);o!==null&&t(s,o);let i=s.querySelectorAll(rr);for(let a=0,l=i.length;a<l;a++){let c=i[a];t(c,c.getAttribute(gt))}}},yt=n=>{let t=null;return Kt(n,(e,r)=>{let s=e.scrollTop||0,o=e.scrollLeft||0;s===0&&o===0||(t=t||{},t[r]=[s,o])}),t},St=(n,t)=>{if(!t)return!0;let e={},r=0;for(let s in t)e[s]=!0,r++;return Kt(n,(s,o)=>{let i=t[o];if(!i)return;let a=i[0],l=i[1];s.scrollTop=a,s.scrollLeft=l,Math.abs((s.scrollTop||0)-a)<1&&Math.abs((s.scrollLeft||0)-l)<1&&e[o]&&(e[o]=!1,r--)}),r<=0};var nr=n=>/^class[\s{]/.test(Function.prototype.toString.call(n)),sr=1500,Gt=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),or=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},xt=(n,t,e)=>{if(!(!n||typeof n[t]!="function"))try{n[t](...e)}catch(r){console.error("Error in "+t+":",r)}},st=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent,this.keepAlive=typeof e.keepAlive=="boolean"?e.keepAlive:null,this.pageCache=e.pageCache||null,this.detachedNodes=null,this.savedScroll=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let r=t.layout;if(r&&r.isUnit===!0&&typeof r.keepAlive=="boolean")return r.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}isDetached(){return this.detachedNodes!==null}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=nr(t)?new t:t(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(Ft(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;d.render(t,this.container,this.parent)}afterCreate(t){let e=this.component;!e||this.pageCache===null||(e.loaded===!1&&e.src&&(e.onModuleRender=()=>this.onModuleRender(e)),this.isKeepAlive(e)&&this.callPageHook("onActivate",[t,{restored:!1}]),this.pageCache.historyNavigation===!0&&this.restoreHistoryScroll())}onModuleRender(t){if(this.setup!==!0||this.component!==t)return;let e=t.layout;e&&e.isUnit===!0&&this.isKeepAlive(t)&&xt(e,"onActivate",[this.params,{restored:!1}])}getScrollKey(){let t=this.route||{};return(t.routeId||"")+"|"+(t.path||"")}getRootNodes(t){let e=[],r=or(t);r&&e.push(r);let s=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),o=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),i=[s,o];for(let a=0;a<2;a++){let l=i[a];if(l)for(let c=0,h=l.length;c<h;c++){let u=l[c];u&&e.indexOf(u)===-1&&e.push(u)}}return e}callPageHook(t,e){let r=this.component;if(!r)return;xt(r,t,e);let s=r.layout;s&&s!==r&&s.isUnit===!0&&xt(s,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,s=()=>St(this.getRootNodes(r),t);if(s()||typeof requestAnimationFrame>"u")return;let o=Gt(),i=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||s()||Gt()-o>sr||requestAnimationFrame(i)};requestAnimationFrame(i)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null,!(!t||!this.component)&&St(this.getRootNodes(this.component),t)}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let r=yt(e);this.savedScroll=r,this.pageCache.saveScroll(this.getScrollKey(),r);for(let s=0,o=e.length;s<o;s++){let i=e[s],a=i.parentNode;a&&a.removeChild(i)}return this.detachedNodes=e,this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.component,r=this.container;if(!e||e.rendered!==!0||!r||typeof r.appendChild!="function")return this.savedScroll=null,this.releaseComponent(),!1;let s=this.getRootNodes(e);if(s.length===1)r.appendChild(s[0]);else{let o=document.createDocumentFragment();for(let i=0,a=s.length;i<a;i++)o.appendChild(s[i]);r.appendChild(o)}return this.setup=!0,v.schedule(),!0}evict(){if(this.detachedNodes===null)return;let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null,this.savedScroll=null,this.releaseComponent()}releaseComponent(){let t=this.component;this.component=null,t&&typeof t.destroy=="function"&&t.destroy()}remove(t){if(this.setup!==!0){t===!0&&this.evict();return}this.setup=!1,this.scrollToken++;let e=this.component;if(!e)return;let r=this.pageCache;if(t!==!0&&r!==null){if(this.isKeepAlive(e)&&this.detach(e))return;r.saveScroll(this.getScrollKey(),yt(this.getRootNodes(e)))}this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var zt=n=>{if(!n.length)return null;let t={};for(let e=0,r=n.length;e<r;e++)t[n[e]]=null;return t},Qt=n=>{let t=[];if(!n)return t;let e=/[*?]/g;n=n.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,s=n.match(r);if(s===null)return t;for(let o=0,i=s.length;o<i;o++){let a=s[o];a&&t.push(a.replace(":",""))}return t};var ir=/(\/):[^/(]*?\?/g,ar=/\//g,lr=/(\?\/+\*?)/g,cr=/(:[^/?&($]+)/g,hr=/(\*)/g,ur=n=>n.replace(ir,t=>t.replace(ar,"(?:$|/)")),dr=n=>(n=n.replace(lr,"?/*"),n.replace(cr,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),fr=n=>n.replace(hr,".*"),pr=(n,t)=>n+=t[t.length-1]==="*"?"":"$",jt=n=>{if(!n)return"";let t=n;return t=ur(t),t=dr(t),t=fr(t),t=pr(t,n),t};var mr=0,Vt=(n,t="")=>{let e=n||"",r=typeof t=="string"&&t?t:e,s=null,o=[],i=r.match(/#\{([^}]+)\}/);i&&i[1]&&(s=i[1].trim(),r=r.replace(i[0],""),e=e.replace(i[0],""));let a=r.indexOf("?");if(a>-1){let h=r.substring(a+1);if(h.indexOf("=")>-1){let u=h.split("&");for(let g=0,E=u.length;g<E;g++){let N=u[g];if(!N)continue;let[_e,De=""]=N.split("="),wt=(_e||"").trim();wt&&o.push({key:wt,value:(De||"").trim()})}r=r.substring(0,a);let m=e.indexOf("?");m>-1&&(e=e.substring(0,m))}}let l=s!==null||o.length>0;return l&&!r&&(e="*"),{uriPath:e,requiredHash:s,requiredQuery:o,hasConditions:l}},gr=n=>{if(!n)return"";let t=n.indexOf("?"),e=n.indexOf("#"),r=n.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),n.substring(0,r).replace(/\/\.(?:\/|$)/g,"/")},yr=n=>{if(!n)return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)},Sr=n=>{if(!n)return"";let t=n.indexOf("?");if(t===-1)return"";let e=n.indexOf("#",t);return e===-1?n.substring(t+1):n.substring(t+1,e)},ot=class extends Pt{constructor(t,e,r=null){let s=t.baseUri,i=Vt(s,t.rawUri).uriPath,a=Qt(i),l=zt(a),c=super(l);return this.uri=s,this.matchUri=i,this.paramKeys=a,this.titleCallBack=e,this.pageCache=r,this.setupRoute(t),this.set("active",!1),c}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null,this.pageCache=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+mr++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=Vt(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=jt(this.matchUri);this.uriQuery=new RegExp("^"+r),this.params=null,this.setupComponentHelper(t),this.callBack=t.callBack,this.title=t.title,this.preventScroll=t.preventScroll||!1,this.scrollTo=t.scrollTo||null}setTitle(t){this.title=t,this.titleCallBack(this,t)}deactivate(t){this.set("active",!1);let e=this.controller;e&&e.remove(t===!0)}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return!!e&&e.isConnected===!1}getLayout(t){if(t.component)return t.component;let e=t.import;return e?Nt(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:s,parent:o,keepAlive:i}=t,a={component:e,container:r,persist:s,parent:o,keepAlive:i,pageCache:this.pageCache},l=At(this);this.controller=new st(l,a)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let r=this.controller;r&&r.focus(t);let s=this.path;if(!s)return;let o=s.split("#")[1];o&&this.scrollToId(o)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=gr(t),s=this.uriQuery||/$^/,o=r.match(s);return o===null?(this.resetParams(),e):Array.isArray(o)?this.matchConditions(t)?(this.setParams(o,1),e=o,e):(this.resetParams(),!1):e}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&yr(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=Sr(t);if(!r)return!1;let s=new URLSearchParams(r);for(let o=0,i=e.length;o<i;o++){let a=e[o];if(!s.has(a.key)||s.get(a.key)!==a.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let r=this.paramKeys;if(!r)return;let s={};for(let o=0,i=r.length;o<i;o++){let a=r[o];typeof a<"u"&&(s[a]=t[o+e])}this.set(s)}getParams(){return this.stage}};var xr=n=>{let t=/\w\S*/;return n.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},vr=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),kr=(n,t)=>{if(n.indexOf(":")===-1)return n;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let s=new RegExp(":"+vr(r),"gi");n=n.replace(s,()=>e[r])}return n},Cr=(n,t)=>t&&(typeof t=="function"&&(t=t(n.stage)),t=kr(t,n),xr(t)),wr=(n,t)=>(t!==""&&(n+=" - "+t),n),Yt=(n,t,e)=>t&&(t=Cr(n,t),wr(t,e));var Tr=()=>typeof window<"u"?window.location:{},Rr=n=>{if(!n)return"";let t=n.indexOf("#");return t>-1?n.substring(t+1):""},br=1500,it=["wheel","touchstart","keydown","pointerdown"],$t=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),vt=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=pt,this.pageCache=new nt(this),this.history=null,this.callBackLink=null,this.location=Tr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new Et({path:""})}setupHistory(){this.history=rt.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new ot(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let r=e?e.max:void 0;return typeof r=="number"&&r>=0&&(this.keepAliveMax=r),this.pageCache.trim(),this}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.resumeRoute(e),this.addRoute(t)}getBasePath(){if(!this.basePath){let t=this.baseURI||"";t[t.length-1]!=="/"&&(t+="/"),this.basePath=t}return this.basePath}createURI(t){let e=this.getBasePath(),r=tt.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let s=0;s<r;s++){let o=e[s];if(o.uri===t)return o}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let s=0;s<r;s++){let o=e[s];if(o.routeId===t)return o}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate(!0)}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(let s=0,o=t.length;s<o;s++){let i=t[s];if(!i)continue;let a=this.createRoute(i);r.push(a)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,s=this.getSwitchGroup(r);for(let o=0,i=t.length;o<i;o++){let l=t[o].component.route;l.resumeRoute(e),s.push(l)}return this.checkGroupForRegistration(r,s),r}checkGroupForRegistration(t,e){let r=this.scrollIntent,s=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=s;let o=this.scrollIntent;o&&o.type==="target"&&o.groupId!==null&&o.groupId!==void 0&&(this.lastScrollGroup=o.groupId),this.scrollIntent=r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,s=e.length;r<s;r++){let o=e[r];o&&typeof o.deactivate=="function"&&o.deactivate(!0)}}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),p.on("click",document,this.callBackLink);let r=this.getEndPoint();return this.navigate(r,null,!0),this}updateBaseTag(t){let e=document.getElementsByTagName("base");e.length&&(e[0].href=t)}getParentLink(t){return t.closest("a")}checkLink(t){if(t.defaultPrevented===!0||t.ctrlKey===!0||t.metaKey===!0||t.shiftKey===!0||t.altKey===!0||typeof t.button=="number"&&t.button!==0)return!0;let e=t.target&&t.target.closest?t.target.closest("a"):null;if(!e||e.dataset.cancelRoute||e.hasAttribute("download"))return!0;let r=e.getAttribute("target");if(r&&r!=="_self")return!0;let s=e.getAttribute("href");if(s===null)return!0;let o=this.getLinkPath(s);if(o===null)return!0;let i=e.dataset.replace==="true";return this.navigate(o,null,i),t.preventDefault(),t.stopPropagation(),!1}getLinkPath(t){let e=t;if(e.substring(0,2)==="//"||/^[a-z][a-z0-9+.-]*:/i.test(e)){let s=this.location;if(!s||!s.origin||typeof URL>"u")return null;let o;try{o=new URL(e,s.href)}catch{return null}if(o.origin!==s.origin)return null;e=o.pathname+o.search+o.hash}let r=this.baseURI;return r!=="/"&&e.indexOf(r)===0&&(e=e.substring(r.length)),e}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let s=t[e];s&&typeof s.deactivate=="function"&&s.deactivate(!0)}return this.pageCache.clear(),this.routes=[],this.switches=new Map,this.switchCount=0,this.lastMatchedRoute=null,this}activate(){return this.checkActiveRoutes(),this}navigate(t,e,r){return t=this.createURI(t),this.history.addState(t,e,r),this.updatePath(),this.activate(),this}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=Yt(t,e,this.title),this}checkActiveRoutes(t,e){t=t||this.getPath(),t!==this.path&&(this.lastPath=this.path),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollWaitToken++;let r=this.pageCache;r.historyNavigation=e===!0;let s=this.routes;for(let o=0,i=s.length;o<i;o++){let a=s[o];typeof a>"u"||r.size>0&&a.isDormant()||this.checkRoute(a,t)}if(this.checkSwitches(t,!0),r.historyNavigation=!1,e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}checkSwitches(t,e){let r=this.switches;for(let[s,o]of r.entries())e===!0&&this.pageCache.size>0&&o.length&&o[0].isDormant()||(this.currentGroupId=s,this.checkGroup(o,t));this.currentGroupId=null}checkGroup(t,e){let r=t.length;if(!r)return;let s=null;for(let a=0;a<r;a++)if(t[a].get("active")){s=t[a];break}let o=!1;s&&(o=s.match(e)!==!1);let i;for(let a=0;a<r;a++){let l=t[a];if(typeof l>"u")continue;(l===s?o:l.match(e))!==!1&&i===void 0&&l.controller&&(i=l)}if(!i){s&&s!==t[0]&&s.deactivate(),this.select(t[0],!0);return}this.select(i),s&&s!==i&&s.deactivate();for(let a=0;a<r;a++){let l=t[a];l&&l!==i&&l!==s&&l.deactivate()}}checkRoute(t,e){let r=this.check(t,e);return r!==!1?(this.select(t),this.lastMatchedRoute=t):t.deactivate(),r}check(t,e){return t?(e=e||this.getPath(),t.match(e)!==!1):!1}select(t,e){if(!t||(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e===!0))return;let r=this.scrollIntent;if(r&&r.type==="hash")return;let s=Rr(this.path);if(s){this.scrollIntent={type:"hash",hash:s};return}t.scrollTo?this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId}:t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,r=e&&this.lastScrollGroup===t.groupId;r||(typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()),this.lastScrollGroup=e?t.groupId:null,r&&this.scrollToTarget(t.selector)}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let r=t.x||0,s=t.y||0;if(typeof requestAnimationFrame>"u"||this.canReachScroll(r,s)){window.scrollTo(r,s);return}let o=()=>{e===this.scrollWaitToken&&this.scrollWaitToken++,this.clearScrollWait()},i={capture:!0,passive:!0};for(let c=0,h=it.length;c<h;c++)window.addEventListener(it[c],o,i);this.cancelScrollWait=()=>{for(let c=0,h=it.length;c<h;c++)window.removeEventListener(it[c],o,i)};let a=$t(),l=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,s)||$t()-a>=br){this.clearScrollWait(),window.scrollTo(r,s);return}requestAnimationFrame(l)};requestAnimationFrame(l)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){let r=document.documentElement;if(!r)return!0;let s=(r.scrollHeight||0)-(window.innerHeight||0),o=(r.scrollWidth||0)-(window.innerWidth||0);return(e<=0||e<=s+1)&&(t<=0||t<=o+1)}scrollToHash(t){if(!t||typeof document>"u")return;let e=()=>{let l=document.getElementById(t);if(l)return l;try{return document.getElementById(decodeURIComponent(t))}catch{return null}},r=e();if(r){r.scrollIntoView(!0);return}if(typeof requestAnimationFrame>"u")return;let s=++this.scrollWaitToken,o=30,i=0,a=()=>{if(s!==this.scrollWaitToken)return;let l=e();if(l){l.scrollIntoView(!0);return}++i<o&&requestAnimationFrame(a)};requestAnimationFrame(a)}scrollToTarget(t){if(typeof t!="string"||typeof document>"u")return;let e=a=>{let l=window.getComputedStyle(a),c=l.position==="sticky",h;if(c){let g=a.style.position;a.style.position="static",h=a.getBoundingClientRect().top+window.scrollY,a.style.position=g}else h=a.getBoundingClientRect().top+window.scrollY;let u=c&&parseFloat(l.top)||0,m=h-u;window.scrollY>m&&window.scrollTo(0,m)};if(typeof requestAnimationFrame>"u"){let a=document.querySelector(t);a&&e(a);return}let r=++this.scrollWaitToken,s=30,o=0,i=()=>{if(r!==this.scrollWaitToken)return;let a=document.querySelector(t);if(a){e(a);return}++o<s&&requestAnimationFrame(i)};requestAnimationFrame(i)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),s=t.split("/");if(r.length!==s.length)return!0;let o=r[r.length-1],i=s[s.length-1];return o!==i}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&p.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent(),this.clearScrollWait(),this.pageCache.clear()}getPath(){let t=this.location,e=this.history;return e&&e.type==="hash"?t.hash.replace("#",""):t.pathname+t.search+t.hash}},w=new vt;var Jt=(n,t)=>({attr:n,value:t}),Ar=(n,t)=>{if(!t.startsWith(n))return!1;let e=t[n.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},kt=class extends x{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,s=w.data,o=[];t&&typeof t=="object"&&o.push(Jt("href",t)),e&&typeof e=="object"&&o.push(Jt("text",e));let i=null,a="",l="";return o.push({value:["[[path]]",s],callBack:(c,h)=>{if(typeof h.pathname>"u")return;let u=h.getAttribute("href");if(u!==i){i=u;let g=h.pathname+h.search+h.hash;a=g,l=h.hash||h.search?g:h.pathname}let m=r?c===a:Ar(l,c);this.update(m)}}),o}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var Xt=(n,t,e=null)=>{if(!n)return;let r=null,s=!1,o=()=>{s||(s=!0,r&&(clearTimeout(r),r=null),p.off("animationend",n,i),n&&n.classList.remove(t),e&&e())},i=l=>{l.target===n&&o()};p.on("animationend",n,i),n.classList.add(t);let a=()=>{if(!s)try{let l=window.getComputedStyle(n),c=parseFloat(l.animationDuration)*1e3||1e3,h=parseFloat(l.animationDelay)*1e3||0;r=setTimeout(o,c+h+100)}catch{r=setTimeout(o,1e3)}};if(typeof requestAnimationFrame>"u"){r=setTimeout(o,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(a))},Zt=(n,t,e)=>{Xt(n,t)},te=(n,t,e)=>{let r=()=>{n&&n.remove&&n.remove()};Pr(n,()=>Xt(n,t,r),e)};f.addType("manual-destroy",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Pr=(n,t,e)=>{f.add(n,"manual-destroy",{ele:n,callBack:t,parent:e})};var K=(n,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(s=>{s&&K(n,t,s,r)});return}Er(n,t,e,r)},Er=(n,t,e,r)=>{let s,o;if(e.length<3?[s,o]=e:[t,s,o]=e,!t||!s)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',n,t);return}let i=Ir(n,s,o,r);I.watch(n,t,s,i)},Ir=(n,t,e,r)=>typeof e=="object"?s=>{Lr(n,e,s)}:s=>{Dr(n,e,t,s,r)},ee=new WeakSet,_r=(n,t,e)=>{!n||!n.isUnit&&!n.isComponent||ee.has(e)||ee.add(e)},Dr=(n,t,e,r,s)=>{let o=t(r,n,s);switch(typeof o){case"object":if(o===null)break;_r(o,e,n),d.rebuild(o,n,s);break;case"string":let i=Rt(n);if(i!=="textContent"){n.setAttribute(i,o);break}q.addHtml(n,o);break}},Lr=(n,t,e)=>{let r=Object.keys(t);for(let s=0,o=r.length;s<o;s++){let i=r[s];i&&(t[i]===e?n.classList.add(i):n.classList.remove(i))}};var H=(n,t,e)=>{let r=T(e);K(n,r,t,e)};var re=(n,t,e)=>{t&&n.setAttribute("role",t)},Or=n=>(t,e)=>{let r=t?"true":"false";e.setAttribute(n,r)},ne=(n,t,e)=>{if(!t)return;let r=t.role;r&&(n.setAttribute("role",r),t.role=null);let s=Object.keys(t);for(let o=0,i=s.length;o<i;o++){let a=s[o],l=t[a];if(l===null)continue;let c="aria-"+a;if(Array.isArray(l)){let h=l.slice();h.push(Or(c)),H(n,h,e)}else n.setAttribute(c,l)}};var se=(n,t,e)=>{if(!t)return;let r=C.parse(t,e);S.addAttributes(n,r.attr,e),d.setDirectives(n,r.directives,e)};f.addType("context",n=>{if(!n)return!1;n.parent.removeContextBranch(n.branch)});var Ct=n=>n?n.getContext():null,oe=(n,t,e)=>{if(typeof t!="function")return;let r=Ct(e),s=t(r);se(n,s,e)},ie=(n,t,e)=>{if(typeof t!="function")return;let r=Ct(e);t(r)},ae=(n,t,e)=>{if(typeof t!="function"||!e)return;let r=Ct(e),s=t(r);if(!s)return;let o=s[0];o&&(e.addContextBranch(o,s[1]),Br(n,o,e))},Br=(n,t,e)=>{f.add(n,"context",{branch:t,parent:e})};var le=(n,t,e)=>{};var ce=(n,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",n),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var he=(n,t,e)=>{},ue=(n,t,e)=>{if(!t||!e)return;let r=t(e,n);r&&d.build(r,n,e)},de=(n,t,e)=>{if(!t||!e)return;let r=e.getId(t);n.id=r},fe=(n,t,e)=>{if(!t||!e)return;let r=t(e.data,n);r&&d.build(r,n,e)},pe=(n,t,e)=>{if(!t||!e)return;let r=t(e.state,n);r&&d.build(r,n,e)},me=(n,t,e)=>{if(!t||!e)return;let r=e.state,s=t(r);if(!e.state){e.setStateHelper(s);return}e.addState(s)},ge=(n,t,e)=>{if(!t||!e)return;e.events||e.setEventHelper();let r=t[2];if(r){let s=r;r=o=>{s(o,e)}}e.events.on(t[0],t[1],r,t[3])};var ye=(n,t,e)=>{let r,s,o;if(typeof t=="string"){if(r=T(e),!r)return;s=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let i=T(e);if(!i)return;r=i,s=t[0],o=t[1]}else[r,s,o]=t;I.bind(n,r,s,o)};var at=(n,t,e)=>{K(n,e.state,t,e)};var Se=n=>(t,e)=>{let[r,s,o="active"]=n,i=t===s?o:"";e.dataset[r]=i},xe=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Se(s)),H(n,o,e)},ve=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Se(s)),at(n,o,e)};var ke=n=>{for(let t=0,e=n.length;t<e;t++){let r=n[t];r&&r.remove()}n.length=0};f.addType("forScopes",n=>{if(!n)return!1;ke(n.scopes)});var Ce=(n,t,e)=>{let r,s,o,i;if(typeof t[0]=="string"||t.length<3){let h=T(e);if(!h)return;r=h,[s,o,i]=t}else[r,s,o,i]=t;let a=i!==!1,l=s+"[",c=a?{scopes:[]}:null;c&&f.add(n,"forScopes",c),I.watch(n,r,s,h=>{if(d.removeAll(n),c&&ke(c.scopes),!h||h.length<1)return;let u=[];for(let m=0,g=h.length;m<g;m++){let E=a?r.scope(l+m+"]"):null;E&&c&&c.scopes.push(E);let N=o(h[m],m,E,u);N!==null&&u.push(N)}return d.build(u,n,e)})};var we=(n,t,e)=>{let r=t[0];if(!r||r.length<1)return;let s=t[1],o=[];for(let i=0,a=r.length;i<a;i++){let l=r[i];if(!l)continue;let c=s(l,i);c!==null&&o.push(c)}d.build(o,n,e)};var Te=(n,t,e)=>{t(n,e)};f.addType("destroyed",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Re=(n,t,e)=>{Mr(n,t,e)},Mr=(n,t,e)=>{f.add(n,"destroyed",{ele:n,callBack:t,parent:e})};var be=(n,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,s=t.length;r<s;r++)D.setup(n,t[r],e);else D.setup(n,t,e)};f.addType("routes",n=>{if(!n)return!1;let t=n.route;t&&w.removeRoute(t)});var Pe=(n,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&Ae(n,o,e)}else Ae(n,t,e)},Ae=(n,t,e)=>{t.container=n,t.parent=e;let r=w.add(t);Ur(n,r)},Ur=(n,t)=>{f.add(n,"routes",{route:t})};var Ee=(n,t,e)=>{};f.addType("switch",n=>{if(!n)return!1;let t=n.id;w.removeSwitch(t)});var Ie=(n,t,e)=>{let r=t[0];for(let o=0,i=t.length;o<i;o++){let a=t[o];a&&(a.container=n,a.parent=e)}let s=w.addSwitch(t);Hr(n,s)},Hr=(n,t)=>{f.add(n,"switch",{id:t})};F.add("cache",he).add("onCreated",Te).add("onDestroyed",Re).add("bind",ye).add("data",le).add("state",Ee).add("onSet",H).add("onState",at).add("animateIn",Zt).add("animateOut",te).add("watch",be).add("useParent",ue).add("useData",fe).add("useState",pe).add("getId",de).add("addState",me).add("addEvent",ge).add("map",we).add("for",Ce).add("useContext",ie).add("addContext",ae).add("context",oe).add("role",re).add("aria",ne).add("route",Pe).add("debug",ce).add("dataSet",xe).add("dataStateSet",ve).add("switch",Ie);export{F as a,z as b,x as c,_t as d,Dt as e,O as f,d as g,Nt as h,kt as i,vt as j,w as k};
2
+ //# sourceMappingURL=chunk-PIAMX2DB.js.map
@@ -0,0 +1,2 @@
1
+ import{a as v,b as w,c as h,d as O}from"./chunk-7ZHUXJZT.js";var m=class{static toArray(t){return Array.from(t)}static inArray(t,e,r){return Array.isArray(t)?t.indexOf(e,r):-1}};var T=Object.prototype.toString,x=Object.prototype.hasOwnProperty,g={create(n){return Object.create(n||null)},extendObject(n,t){if(!n||typeof n!="object"||!t||typeof t!="object")return!1;for(let e in n)x.call(n,e)&&!x.call(t,e)&&(t[e]=n[e]);return t},clone(n){if(!n||typeof n!="object")return{};try{return structuredClone(n)}catch{return JSON.parse(JSON.stringify(n))}},getClassObject(n){return typeof n=="function"?n.prototype:n},extendClass(n,t){let e=this.getClassObject(n),r=this.getClassObject(t);if(typeof e!="object"||typeof r!="object")return!1;let i=Object.create(e);for(let s in r)i[s]=r[s];return i},hasOwnProp(n,t){return x.call(n,t)},isPlainObject(n){return!!n&&T.call(n)==="[object Object]"},isEmpty(n){if(!n||typeof n!="object"||Array.isArray(n))return!0;if(n instanceof Map||n instanceof Set)return n.size===0;for(let t in n)if(x.call(n,t))return!1;return!0}};var p=class{constructor(){this.errors=[],this.dataTracker=w}augment(t){if(!v.isObject(t))return this;let e=this.constructor.prototype;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return this}override(t,e,r,i){return(t[e]=r).apply(t,m.toArray(i))}getLastError(){let t=this.errors;return t.length?t.pop():!1}addError(t){this.errors.push(t)}getProperty(t,e,r){if(v.isObject(t)===!1)return"";let i=t[e];return typeof i<"u"?i:typeof r<"u"?r:""}createCallBack(t,e,r=[],i=!1){return typeof e!="function"?!1:(...s)=>(i===!0&&(r=r.concat(s)),e.apply(t,r))}bind(t,e){return e.bind(t)}};p.prototype.extend=(function(){return p.prototype})();var d=new p;var y={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 b=class{constructor(t){this.settings=null,this.xhr=null,this.setup(t)}setup(t){this.getXhrSettings(t);let e=this.xhr=this.createXHR(),{method:r,url:i,async:s}=this.settings;e.open(r,i,s),this.setupHeaders(),this.addXhrEvents(),this.beforeSend(),e.send(this.getParams())}beforeSend(){let t=y.beforeSend;if(t.length<1)return;let e=this.xhr,r=this.settings;for(var i=0,s=t.length;i<s;i++){var o=t[i];o&&o(e,r)}}objectToString(t){let e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e.join("&")}setupParams(t,e=null){let r=typeof t;if(!e)return!(t instanceof FormData)&&r==="object"&&(t=this.objectToString(t)),t;let i=typeof e;if(r==="string")return i!=="string"&&(e=this.objectToString(e)),t+=(t===""?"?":"&")+e,t;if(i==="string"&&(e=O.parseQueryString(e,!1)),t instanceof FormData)for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else r==="object"&&(t=Object.assign({},e,t),t=this.objectToString(t));return t}getParams(){let t=this.settings,e=t.fixedParams,r=t.params;return r?r=this.setupParams(r,e):e&&(r=this.setupParams(e)),r}getXhrSettings(t){let e=this.settings={...d.xhrSettings};if(t.length>=2&&typeof t[0]!="object")for(var r=0,i=t.length;r<i;r++){var s=t[r];switch(r){case 0:e.url=s;break;case 1:e.params=s;break;case 2:e.completed=s,e.failed=s;break;case 3:e.responseType=s||"json";break;case 4:e.method=s?s.toUpperCase():"POST";break;case 5:e.async=typeof s<"u"?s:!0;break}}else e=this.settings=g.extendClass(this.settings,t[0]),typeof e.completed=="function"&&(typeof e.failed!="function"&&(e.failed=e.completed),typeof e.aborted!="function"&&(e.aborted=e.failed))}createXHR(){let t=this.settings,e=new XMLHttpRequest;return e.responseType=t.responseType,t.withCredentials===!0&&(e.withCredentials=!0),e}setupHeaders(){let t=this.settings;if(!t||typeof t.headers!="object")return;let e=t.headers;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.xhr?.setRequestHeader(r,e[r])}update(t,e){let r=this.xhr,i=()=>{h.removeEvents(r?.upload),h.removeEvents(r)},s=this.settings;if(!s)return!1;switch(e||t.type){case"load":{if((r?.status??0)>=400){typeof s.failed=="function"&&s.failed(!1,this.xhr),i();break}if(typeof s.completed=="function"){let a=this.getResponseData();s.completed(a,this.xhr)}i();break}case"error":typeof s.failed=="function"&&s.failed(!1,this.xhr),i();break;case"progress":typeof s.progress=="function"&&s.progress(t);break;case"abort":typeof s.aborted=="function"&&s.aborted(!1,this.xhr),i();break}}getResponseData(){let t=this.xhr;if(!t)return null;let e=t.responseType;return!e||e==="text"?t.responseText:t.response}addXhrEvents(){if(!this.settings)return;let e=this.xhr;if(!e)return;let r=this.update.bind(this);h.on(["load","error","abort"],e,r),h.on("progress",e.upload,r)}};var j=()=>{d.augment({xhrSettings:y,addFixedParams(n){this.xhrSettings.fixedParams=n},beforeSend(n){this.xhrSettings.beforeSend.push(n)},ajaxSettings(n){typeof n=="object"&&(this.xhrSettings=g.extendClass(d.xhrSettings,n))},resetAjaxSettings(){this.xhrSettings=y}})};j();var L=(...n)=>new b(n).xhr;var E=(n,t)=>{if(n===t)return!1;try{return JSON.stringify(n)!==JSON.stringify(t)}catch{return!0}},S=class{constructor({max:t=100,ttl:e=3e4}={}){this.entries=new Map,this.max=t,this.defaultTtl=e}get size(){return this.entries.size}setMax(t){this.max=Math.max(1,Number(t)||1),this.evict()}getEntry(t){let e=this.entries.get(t);return e?(this.entries.delete(t),this.entries.set(t,e),e):null}createEntry(t){let e={value:void 0,meta:null,time:0,ttl:this.defaultTtl,hasValue:!1,promise:null};return this.entries.delete(t),this.entries.set(t,e),this.evict(),e}evict(){let t=Math.max(1,this.max);for(;this.entries.size>t;){let e=this.entries.keys().next().value;this.entries.delete(e)}}isFresh(t){return!!t&&t.hasValue&&Date.now()-t.time<t.ttl}has(t){return this.isFresh(this.entries.get(t)||null)}get(t){let e=this.getEntry(t);return this.isFresh(e)?e.value:void 0}set(t,e,r,i=null){let s=this.getEntry(t)||this.createEntry(t);s.value=e,s.meta=i,s.time=Date.now(),s.ttl=typeof r=="number"?r:this.defaultTtl,s.hasValue=!0}invalidate(t){if(Array.isArray(t))return t.reduce((i,s)=>i+this.invalidate(s),0);let e=null;if(typeof t=="string"?e=i=>i.startsWith(t):t instanceof RegExp?e=i=>t.test(i):typeof t=="function"&&(e=t),!e)return 0;let r=0;for(let[i,s]of Array.from(this.entries))e(i,s)&&(this.entries.delete(i),r++);return r}clear(){this.entries.clear()}fetch(t,e,r,i){let s,o=e.promise=new Promise(f=>s=f),l=!1,a=(f,u,c)=>{l||(l=!0,s({ok:f===!0,value:u,meta:c}))};o.then(f=>{if(e.promise===o&&(e.promise=null),this.entries.get(t)===e){if(f.ok){e.value=f.value,e.meta=f.meta,e.time=Date.now(),e.ttl=i,e.hasValue=!0;return}e.hasValue||this.entries.delete(t)}});try{return r(a)}catch(f){return a(!1,void 0,f),null}}resolve(t,e,r,i){r=r||{};let s=typeof r.ttl=="number"?r.ttl:this.defaultTtl,o=this.getEntry(t);if(o&&o.hasValue){if(this.isFresh(o)){let{value:a,meta:f}=o;return queueMicrotask(()=>i(a,f,!0)),null}if(r.swr===!0){let{value:a,meta:f}=o;queueMicrotask(()=>i(a,f,!0));let u=o.promise?null:this.fetch(t,o,e,s);return o.promise.then(c=>{c.ok&&E(a,c.value)&&i(c.value,c.meta,!0)}),u}}if(o&&o.promise)return o.promise.then(a=>i(a.value,a.meta,a.ok)),null;o=o||this.createEntry(t);let l=this.fetch(t,o,e,s);return o.promise.then(a=>i(a.value,a.meta,a.ok)),l}load(t,e,r={}){return new Promise((i,s)=>{let o=!0,l=a=>{Promise.resolve().then(e).then(f=>a(!0,f,null),f=>a(!1,void 0,f))};this.resolve(t,l,r,(a,f,u)=>{if(o)return o=!1,u?i(a):s(f);typeof r.onUpdate=="function"&&r.onUpdate(a)})})}},W=new S;export{g as a,d as b,b as c,L as d,S as e,W as f};
2
+ //# sourceMappingURL=chunk-VSCHM2ZB.js.map
@@ -1,2 +1,2 @@
1
- import{c as e,d as r}from"../chunks/chunk-ILT4B3VY.js";import"../chunks/chunk-R5DHGQZV.js";export{r as Ajax,e as XhrRequest};
1
+ import{c as e,d as r,e as o,f as c}from"../chunks/chunk-VSCHM2ZB.js";import"../chunks/chunk-7ZHUXJZT.js";export{r as Ajax,c as ResourceCache,o as ResourceCacheStore,e as XhrRequest};
2
2
  //# sourceMappingURL=ajax.js.map
@@ -1,2 +1,2 @@
1
- import{a,b as A,c as i,d as f,e as d,f as P,g as C,h as S}from"../chunks/chunk-IKBATT4B.js";import"../chunks/chunk-AO5L25YQ.js";import{g as s}from"../chunks/chunk-FXJIFTW5.js";import"../chunks/chunk-ILT4B3VY.js";import"../chunks/chunk-E3C6NOMV.js";import"../chunks/chunk-R5DHGQZV.js";var D=r=>typeof r!="string"?r:m(r),m=r=>[{tag:"text",textContent:r}],l=()=>({props:{},children:[]}),h=r=>({props:{},children:m(r)}),u=r=>({props:{},children:r}),x=r=>({props:r[0]||{},children:D(r[1])});var O=r=>({props:{watch:r},children:[]}),b=r=>{if(r.length===0)return l();let t=r[0],e=typeof t;if(e==="string"||e==="number")return h(t);if(Array.isArray(t))return s.isWatching(t)?O(t):u(t);let o=r[1]??r[0]??[];return o&&Array.isArray(o)&&s.isWatching(o)&&(r[0]=Array.isArray(r[0])?{}:r[0],r[0].watch=o,r[1]=[]),x(r)},H=r=>(...t)=>{let{props:e,children:o}=b(t);return r(e,o)};var T=(r,t)=>{let e=Object.keys(r);for(let o=0,n=e.length;o<n;o++){let p=e[o],y=r[p],c=f[p]||p;t.prototype[c]=d(y,c)}return t},W=0,j=r=>{let t=class extends r{};return t.prototype._classId="pod"+W++,t},I=(r,t=i)=>{if(!r)return null;let e=j(t),o={},n=r(o);return T(o,e),e.prototype.render=n,e};export{H as Atom,C as Builder,i as Component,a as Directives,S as Import,P as Jot,I as Pod,A as Unit};
1
+ import{a,b as A,c,d as f,e as m,f as P,g as C,h as S}from"../chunks/chunk-PIAMX2DB.js";import"../chunks/chunk-6YJAZHX6.js";import{g as s}from"../chunks/chunk-HBL2JSVL.js";import"../chunks/chunk-VSCHM2ZB.js";import"../chunks/chunk-LY736NR2.js";import"../chunks/chunk-7ZHUXJZT.js";var b=r=>{let t=typeof r;return t!=="string"&&t!=="number"?r:d(r)},d=r=>[{tag:"text",textContent:r}],l=()=>({props:{},children:[]}),h=r=>({props:{},children:d(r)}),u=r=>({props:{},children:r}),y=r=>({props:r[0]||{},children:b(r[1])});var D=r=>({props:{watch:r},children:[]}),O=r=>{if(r.length===0)return l();let t=r[0],e=typeof t;if(e==="string"||e==="number")return h(t);if(Array.isArray(t))return s.isWatching(t)?D(t):u(t);let o=r[1]??r[0]??[];if(o&&Array.isArray(o)&&s.isWatching(o)){let n=r[0]&&!Array.isArray(r[0])?r[0]:{};r[0]={...n,watch:o},r[1]=[]}return y(r)},H=r=>(...t)=>{let{props:e,children:o}=O(t);return r(e,o)};var T=(r,t)=>{let e=Object.keys(r);for(let o=0,n=e.length;o<n;o++){let p=e[o],x=r[p],i=f[p]||p;t.prototype[i]=m(x,i)}return t},W=0,j=r=>{let t=class extends r{};return t.prototype._classId="pod"+W++,t},I=(r,t=c)=>{if(!r)return null;let e=j(t),o={},n=r(o);return T(o,e),e.prototype.render=n,e};export{H as Atom,C as Builder,c as Component,a as Directives,S as Import,P as Jot,I as Pod,A as Unit};
2
2
  //# sourceMappingURL=component.js.map
@@ -1,2 +1,2 @@
1
- import{d as a,h as e,i as o}from"../chunks/chunk-FXJIFTW5.js";import"../chunks/chunk-ILT4B3VY.js";import"../chunks/chunk-E3C6NOMV.js";import"../chunks/chunk-R5DHGQZV.js";export{a as Data,e as Model,o as SimpleData};
1
+ import{d as a,h as e,i as o}from"../chunks/chunk-HBL2JSVL.js";import"../chunks/chunk-VSCHM2ZB.js";import"../chunks/chunk-LY736NR2.js";import"../chunks/chunk-7ZHUXJZT.js";export{a as Data,e as Model,o as SimpleData};
2
2
  //# sourceMappingURL=data.js.map
@@ -1,2 +1,2 @@
1
- import{f as m}from"../chunks/chunk-E3C6NOMV.js";import"../chunks/chunk-R5DHGQZV.js";export{m as Html};
1
+ import{f as m}from"../chunks/chunk-LY736NR2.js";import"../chunks/chunk-7ZHUXJZT.js";export{m as Html};
2
2
  //# sourceMappingURL=html.js.map
@@ -1,2 +1,2 @@
1
- import{i as r,j as o,k as t}from"../chunks/chunk-IKBATT4B.js";import"../chunks/chunk-AO5L25YQ.js";import"../chunks/chunk-FXJIFTW5.js";import"../chunks/chunk-ILT4B3VY.js";import"../chunks/chunk-E3C6NOMV.js";import"../chunks/chunk-R5DHGQZV.js";export{r as NavLink,o as Router,t as router};
1
+ import{i as r,j as o,k as t}from"../chunks/chunk-PIAMX2DB.js";import"../chunks/chunk-6YJAZHX6.js";import"../chunks/chunk-HBL2JSVL.js";import"../chunks/chunk-VSCHM2ZB.js";import"../chunks/chunk-LY736NR2.js";import"../chunks/chunk-7ZHUXJZT.js";export{r as NavLink,o as Router,t as router};
2
2
  //# sourceMappingURL=router.js.map
@@ -1,2 +1,2 @@
1
- import{a as r,b as t}from"../chunks/chunk-AO5L25YQ.js";import"../chunks/chunk-FXJIFTW5.js";import"../chunks/chunk-ILT4B3VY.js";import"../chunks/chunk-E3C6NOMV.js";import"../chunks/chunk-R5DHGQZV.js";export{r as State,t as Store};
1
+ import{a as r,b as t}from"../chunks/chunk-6YJAZHX6.js";import"../chunks/chunk-HBL2JSVL.js";import"../chunks/chunk-VSCHM2ZB.js";import"../chunks/chunk-LY736NR2.js";import"../chunks/chunk-7ZHUXJZT.js";export{r as State,t as Store};
2
2
  //# sourceMappingURL=state.js.map
@@ -24,6 +24,7 @@ import { Model } from './modules/data/data.js';
24
24
  import { NavLink } from './modules/router/router.js';
25
25
  import { Objects } from './shared/objects.js';
26
26
  import { Pod } from './modules/component/pod.js';
27
+ import { ResourceCache } from './modules/ajax/resource-cache.js';
27
28
  import { router } from './modules/router/router.js';
28
29
  import { SimpleData } from './modules/data/data.js';
29
30
  import { State } from './modules/state/state.js';
@@ -31,4 +32,4 @@ import { StateTracker as Store } from './modules/state/state-tracker.js';
31
32
  import { Strings } from './shared/strings.js';
32
33
  import { Types } from './shared/types.js';
33
34
  import { Unit } from './modules/component/unit.js';
34
- export { Ajax, Arrays, Atom, base, Builder, Component, Data, dataBinder, DataTracker, DateTime, Directives, Dom, Encode, EventMethods as Events, Html, Import, Jot, Model, NavLink, Objects, Pod, router, SimpleData, State, Store, Strings, Types, Unit };
35
+ export { Ajax, Arrays, Atom, base, Builder, Component, Data, dataBinder, DataTracker, DateTime, Directives, Dom, Encode, EventMethods as Events, Html, Import, Jot, Model, NavLink, Objects, Pod, ResourceCache, router, SimpleData, State, Store, Strings, Types, Unit };
@@ -1 +1,2 @@
1
1
  export { Ajax, XhrRequest } from "../modules/ajax/ajax.js";
2
+ export { ResourceCache, ResourceCacheStore } from "../modules/ajax/resource-cache.js";
@@ -0,0 +1,214 @@
1
+ /**
2
+ * ResourceCacheStore
3
+ *
4
+ * This is a small LRU cache for request results. Each key holds
5
+ * the last value, the time it was stored, its ttl, and the shared
6
+ * in-flight promise so identical requests can be deduped.
7
+ *
8
+ * @class
9
+ */
10
+ export class ResourceCacheStore {
11
+ /**
12
+ * This will create a resource cache.
13
+ *
14
+ * @constructor
15
+ * @param {object} [settings]
16
+ * @param {number} [settings.max=100] The max number of entries.
17
+ * @param {number} [settings.ttl=30000] The default ttl in ms.
18
+ */
19
+ constructor({ max, ttl }?: {
20
+ max?: number;
21
+ ttl?: number;
22
+ });
23
+ /**
24
+ * @type {Map<string, CacheEntry>} entries
25
+ */
26
+ entries: Map<string, CacheEntry>;
27
+ /**
28
+ * @type {number} max
29
+ */
30
+ max: number;
31
+ /**
32
+ * @type {number} defaultTtl
33
+ */
34
+ defaultTtl: number;
35
+ /**
36
+ * This will get the number of entries.
37
+ *
38
+ * @returns {number}
39
+ */
40
+ get size(): number;
41
+ /**
42
+ * This will set the max number of entries and evict the
43
+ * oldest entries if the cache is over the cap.
44
+ *
45
+ * @param {number} max
46
+ * @returns {void}
47
+ */
48
+ setMax(max: number): void;
49
+ /**
50
+ * This will get an entry and mark it as recently used.
51
+ *
52
+ * @param {string} key
53
+ * @returns {CacheEntry|null}
54
+ */
55
+ getEntry(key: string): CacheEntry | null;
56
+ /**
57
+ * This will create an empty entry.
58
+ *
59
+ * @protected
60
+ * @param {string} key
61
+ * @returns {CacheEntry}
62
+ */
63
+ protected createEntry(key: string): CacheEntry;
64
+ /**
65
+ * This will remove the least recently used entries
66
+ * until the cache is under the cap.
67
+ *
68
+ * @protected
69
+ * @returns {void}
70
+ */
71
+ protected evict(): void;
72
+ /**
73
+ * This will check if an entry has a fresh value.
74
+ *
75
+ * @param {CacheEntry|null} entry
76
+ * @returns {boolean}
77
+ */
78
+ isFresh(entry: CacheEntry | null): boolean;
79
+ /**
80
+ * This will check if the key has a fresh value.
81
+ *
82
+ * @param {string} key
83
+ * @returns {boolean}
84
+ */
85
+ has(key: string): boolean;
86
+ /**
87
+ * This will get a fresh value from the cache.
88
+ *
89
+ * @param {string} key
90
+ * @returns {*} The value or undefined if missing or expired.
91
+ */
92
+ get(key: string): any;
93
+ /**
94
+ * This will set a value in the cache.
95
+ *
96
+ * @param {string} key
97
+ * @param {*} value
98
+ * @param {number} [ttl]
99
+ * @param {*} [meta]
100
+ * @returns {void}
101
+ */
102
+ set(key: string, value: any, ttl?: number, meta?: any): void;
103
+ /**
104
+ * This will remove entries by key, key prefix, regular
105
+ * expression, predicate, or an array of any of these.
106
+ *
107
+ * @param {CacheMatch} match
108
+ * @returns {number} The number of removed entries.
109
+ */
110
+ invalidate(match: CacheMatch): number;
111
+ /**
112
+ * This will remove all entries.
113
+ *
114
+ * @returns {void}
115
+ */
116
+ clear(): void;
117
+ /**
118
+ * This will start a request for an entry and share its
119
+ * promise with every caller that asks for the same key.
120
+ *
121
+ * @protected
122
+ * @param {string} key
123
+ * @param {CacheEntry} entry
124
+ * @param {function} start
125
+ * @param {number} ttl
126
+ * @returns {*} The value returned by start.
127
+ */
128
+ protected fetch(key: string, entry: CacheEntry, start: Function, ttl: number): any;
129
+ /**
130
+ * This will resolve a key from the cache or by starting a
131
+ * request. The deliver callback is called asynchronously with
132
+ * the result. With swr it can be called a second time when a
133
+ * background refresh changes the value.
134
+ *
135
+ * @param {string} key
136
+ * @param {function(function(boolean, *, *):void):*} start Starts the request and calls settle(ok, value, meta).
137
+ * @param {CacheOptions} options
138
+ * @param {function(*, *, boolean):void} deliver Called with (value, meta, ok).
139
+ * @returns {*} The value returned by start, or null if no new request was started for this caller.
140
+ */
141
+ resolve(key: string, start: (arg0: (arg0: boolean, arg1: any, arg2: any) => void) => any, options: CacheOptions, deliver: (arg0: any, arg1: any, arg2: boolean) => void): any;
142
+ /**
143
+ * This will load a value using a promise fetcher. Identical keys
144
+ * share one fetch, fresh values skip the fetcher, and stale values
145
+ * with swr resolve right away and refresh in the background.
146
+ *
147
+ * @param {string} key
148
+ * @param {function(): (Promise<*>|*)} fetcher
149
+ * @param {CacheOptions} [options]
150
+ * @returns {Promise<*>}
151
+ */
152
+ load(key: string, fetcher: () => (Promise<any> | any), options?: CacheOptions): Promise<any>;
153
+ }
154
+ /**
155
+ * The shared resource cache used by model requests.
156
+ *
157
+ * @type {ResourceCacheStore}
158
+ */
159
+ export const ResourceCache: ResourceCacheStore;
160
+ export type CacheEntry = {
161
+ /**
162
+ * The cached value.
163
+ */
164
+ value: any;
165
+ /**
166
+ * Extra data stored with the value (e.g. the xhr).
167
+ */
168
+ meta: any;
169
+ /**
170
+ * The time the value was stored.
171
+ */
172
+ time: number;
173
+ /**
174
+ * How long the value is fresh in ms.
175
+ */
176
+ ttl: number;
177
+ /**
178
+ * Whether a value has been stored.
179
+ */
180
+ hasValue: boolean;
181
+ /**
182
+ * The shared in-flight request.
183
+ */
184
+ promise: Promise<CacheResult> | null;
185
+ };
186
+ export type CacheResult = {
187
+ /**
188
+ * Whether the request succeeded.
189
+ */
190
+ ok: boolean;
191
+ /**
192
+ * The response value.
193
+ */
194
+ value: any;
195
+ /**
196
+ * Extra data returned by the request.
197
+ */
198
+ meta: any;
199
+ };
200
+ export type CacheOptions = {
201
+ /**
202
+ * How long a value stays fresh in ms.
203
+ */
204
+ ttl?: number;
205
+ /**
206
+ * Serve stale values while revalidating.
207
+ */
208
+ swr?: boolean;
209
+ /**
210
+ * Called when a swr refresh changes the value.
211
+ */
212
+ onUpdate?: Function;
213
+ };
214
+ export type CacheMatch = string | RegExp | ((arg0: string, arg1: CacheEntry) => boolean | Array<string | RegExp | Function>);
@@ -0,0 +1,6 @@
1
+ /**
2
+ * MountQueue
3
+ *
4
+ * @type {object}
5
+ */
6
+ export const MountQueue: object;
@@ -111,10 +111,16 @@ export class Unit {
111
111
  /**
112
112
  * This will remove a persisted child by its token.
113
113
  *
114
+ * When the child is passed, the slot is only removed if it still
115
+ * holds that child. A newer child can take over the same token
116
+ * (e.g. a keyed rebuild), and removing the old child must not
117
+ * drop the newer one.
118
+ *
114
119
  * @param {string} token
120
+ * @param {object} [child]
115
121
  * @returns {void}
116
122
  */
117
- removePersistedChild(token: string): void;
123
+ removePersistedChild(token: string, child?: object): void;
118
124
  /**
119
125
  * This will setup the component props.
120
126
  *
@@ -313,6 +319,36 @@ export class Unit {
313
319
  * @returns {void}
314
320
  */
315
321
  protected afterSetup(): void;
322
+ /**
323
+ * Optional lifecycle method: define `afterMount()` on a unit,
324
+ * component, Jot or Pod to run code once the component panel is
325
+ * connected to the document (e.g. to measure layout, focus an
326
+ * input or start an observer).
327
+ *
328
+ * `afterSetup()` runs while the layout is still inside the
329
+ * detached build fragment, so measurements read 0 there.
330
+ * `afterMount()` is called exactly once per render of the
331
+ * instance, in a microtask after the outermost build returns and
332
+ * the panel is connected. Content built detached and inserted
333
+ * later is mounted by the next flush after it is connected. A
334
+ * unit destroyed before it is connected is never called.
335
+ *
336
+ * It is intentionally not defined on the prototype so units
337
+ * that do not use it pay nothing.
338
+ *
339
+ * @name Unit#afterMount
340
+ * @function
341
+ * @returns {void}
342
+ *
343
+ * @example
344
+ * class Chart extends Component
345
+ * {
346
+ * afterMount()
347
+ * {
348
+ * this.width = this.panel.offsetWidth;
349
+ * }
350
+ * }
351
+ */
316
352
  /**
317
353
  * This will setup and render the component.
318
354
  *