@base-framework/base 3.9.12 → 3.9.14

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{b as T}from"./chunk-AO5L25YQ.js";import{a as mt,b as gt,c as yt,d as xt,e as k,f as x,g as E}from"./chunk-FXJIFTW5.js";import{a as M,b as dt}from"./chunk-ILT4B3VY.js";import{a as ft,c as I,d as pt,f as q}from"./chunk-E3C6NOMV.js";import{b as p,c as m}from"./chunk-R5DHGQZV.js";var N={items:new Map,add(s,t){return this.items.set(s,t),this},get(s){return this.items.get(s)??null}};var St="data-base-hscroll",xe=".overflow-x-auto, .overflow-x-scroll",vt=s=>{if(!s||typeof s.querySelectorAll!="function")return[];let t=[];if(s instanceof Element){let e=s.classList;e&&(e.contains("overflow-x-auto")||e.contains("overflow-x-scroll"))&&t.push(s)}return s.querySelectorAll(xe).forEach(e=>t.push(e)),t},f=class{static snapshotOverflow(t){vt(t).forEach(e=>{let r=e.scrollLeft;r>0&&e.setAttribute(St,String(r))})}static restoreOverflow(t){vt(t).forEach(e=>{let r=Number(e.getAttribute(St));r>0&&(e.scrollLeft=r)})}static detach(t){t&&t.parentNode&&t.parentNode.removeChild(t)}static insert(t,e){if(!(!t||!e)){if(e.nodeType===8){e.after(t);return}e.appendChild(t)}}static emit(t,e){!e||typeof document>"u"||document.dispatchEvent(new CustomEvent(t,{detail:e}))}};p.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Se=0,W=class{constructor(t,e,r){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.layoutRoot=null,this.layout=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let n,i;if(t==null)n={},i=[];else{let o=typeof t;o==="string"||o==="number"?(n={},i=[{tag:"text",textContent:t}]):Array.isArray(t)?(n={},i=t):(n=t||{},i=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(n),this.children=i||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Se++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,n;r!=null&&e!=null?n="pk:"+r+":"+e:r!=null?n="pk:"+r:e!=null?n="pk:"+e:n="pc"+this.persistedCount++;let i=this.persistedChildren[n];return i&&t.unitType===i.unitType&&t.resumeScope(i),t.persistToken=n,this.persistedChildren[n]=t,n}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){p.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(let n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return 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(){if(this.persist===!0){this.detachPersisted();return}this.prepareDestroy();let t=this.panel;t&&q.removeElement(t),this.cleanUpAfterDestroy()}detachPersisted(){let t=this.layoutRoot,e=this.panel;t&&t!==e&&(f.snapshotOverflow(t),f.emit("base:persist-detach",t),f.detach(t)),e&&(f.snapshotOverflow(e),f.emit("base:persist-detach",e),f.detach(e)),this.rendered=!1}reattachPersisted(t){let e=this.panel;if(!e||e.isConnected)return!1;let r=this.container||t;if(!r)return!1;f.insert(e,r);let n=this.layoutRoot;if(n&&n!==e&&!n.isConnected){let i=this.layout&&this.layout.container||r;f.insert(n,i),f.restoreOverflow(n),f.emit("base:persist-reattach",n)}return f.restoreOverflow(e),f.emit("base:persist-reattach",e),this.rendered=!0,!0}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 O=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static _releaseLinks(t,e){!t||t===e||typeof t.unlink!="function"||t.unlink()}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let r=t.getParentContext();if(!r||!r.data)return;let n=r.data.stage,i=e.data.stage,o=null;for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let l=n[a];l!==i[a]&&(o===null&&(o={}),o[a]=l)}o!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(o):e.data.set(o))}static _resumeExternal(t,e){let r=t.setData();if(!r){t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let n=e._retainState||r._retainState,i=!n&&(e._refreshState||r._refreshState),o=this._buildExternalUpdates(e.stage,r.stage,n,i);M.isEmpty(o)||r._silentSet(o)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,n){let i={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(n){Object.prototype.hasOwnProperty.call(e,o)||(i[o]=t[o]);continue}let a=t[o];!r&&a==null||a!==e[o]&&(i[o]=a)}return i}static _resumeOwned(t,e){let r=t.data;if(!r){this._releaseLinks(e),t.data=e;return}if(e&&e._retainState){this._releaseLinks(r,e),this._releaseLinks(e),t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let n=e._refreshState||t.data._refreshState,i=this._buildOwnedUpdates(e.stage,t.data.stage,n);M.isEmpty(i)||t.data._silentSet(i)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(r){Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);continue}let o=t[i];o!=null&&o!==e[i]&&(n[i]=o)}return n}};var F=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let n=t[r];this.on(n[0],n[1],n[2],n[3])}}on(t,e,r,n){m.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){m.off(t,e,r,n);let i,o=this.events;for(let a=0,l=o.length;a<l;a++)if(i=o[a],i.event===t&&i.obj===e&&i.callBack===r&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];m.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];m.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var Q=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,n){return{action:t,state:e,callBack:r,targetId:n,token:null,callBackToken:null}}convertStates(t){let e=[];for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}let n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){for(let r=0,n=t.length;r<n;r++){let i=t[r];if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o)||o==="id")continue;let a=null,l=i[o],c=l!==null?l:void 0;c&&typeof c=="object"&&(a=c.callBack,c=c.state),e.push(this.createState(o,c,a,i.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let r=0,n=e.length;r<n;r++){let i=e[r];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,n=e.length;r<n;r++){let i=e[r];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&T.remove(i.targetId,i.action,i.token)}}restore(t){T.restore(t.id,t);let e=this.callBackStates;if(e)for(let n=0,i=e.length;n<i;n++){let o=e[n];o.callBackToken=t.on(o.action,o.callBack)}let r=this.remoteStates;if(r)for(let n=0,i=r.length;n<i;n++){let o=r[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,r){let n=T.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(let n=0,i=e.length;n<i;n++){let o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&(e.callBackToken=t.on(n,o),this.callBackStates.push(e)),r||null}};var S=class extends W{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){O.resume(this,t)}_refreshData(){O.refresh(this)}_refreshContextData(){O.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=T.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();M.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Q(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)),T.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 F)}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&&this.data.unlink()}};var wt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"},Ct=(s,t)=>typeof s!="function"&&t==="setupStates"?()=>s:s;var st=(s,t)=>{if(!s)return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=wt[i]||i;t[a]=Ct(o,a)}return t},ve=s=>st(s,{}),we=0,kt=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+we++,e},B=(s,t=S)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=ve(s),kt(t,e)):(e={render:r==="function"?s:()=>s},kt(t,e))};var nt=(s,t)=>({attr:s,directive:t});var v=(s,t)=>({key:s,value:t});var Tt=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var bt=null,Ce=()=>bt||(bt=N.get("watch")),w=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(v("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(nt(v(e,E.getWatcherSettings(r,pt(e))),Ce()))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(v("type",n))}}static parse(t,e){let r=[],n=[],i=t.tag||"div";i==="button"&&r.push(v("type",t.type||"button"));let o=[],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 d=0;d<a.length;d++)o.push(a[d]);else o.push(a);continue}if((l=N.get(c))!==null){n.push(nt(v(c,a),l));continue}let h=typeof a;if(h==="object"){if(E.isWatching(a)){this.setTextAsWatcher(n,c,a);continue}o.push(a);continue}if(h==="function"){let d=a,g=function(y){d.call(this,y,e)};g.originalCallback=d,r.push(v(c,g));continue}if(h==="string"&&a.includes("[[")){this.setTextAsWatcher(n,c,a);continue}if(c==="text"){o.push({tag:"text",textContent:a});continue}if(c==="html"||c==="innerHTML"){r.push(v("innerHTML",a));continue}r.push(v(c,a))}return Tt(i,r,n,o)}};var D=class{build(t,e,r){}setupComponent(t,e,r){let n=r?.getChildScope();t.parent=n,n&&n.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&n&&(n[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return t.persist===!0&&typeof t.reattachPersisted=="function"&&t.reattachPersisted(e)||(this.setupComponent(t,e,r),this.buildComponent(t)),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var ke=s=>{for(let e in s)if(e!=="tag"&&e!=="textContent")return!1;let t=s.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},z=class extends D{build(t,e,r){let n=x.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){if(t.tag==="text"&&ke(t)){let c=t.textContent;x.createText(c??"",e);return}let n=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=w.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,r);let a=i.children;for(let c=0,h=a.length;c<h;c++){let d=a[c];d!==null&&this.buildElement(d,o,r)}let l=i.directives;l.length&&this.setDirectives(o,l,n)}createTempComponent(t,e,r){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...st(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(n.setupStateTarget=function(o){this.state=t.state});let i=new S(n);this.createComponent(i,e,r)}setDirectives(t,e,r){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],r)}handleDirective(t,e,r){e.directive(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return x.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return x.createComment(o,e)}return x.create(n,t.attr,e,r)}removeNode(t){x.removeElement(t)}removeAll(t){x.removeAll(t)}};var Te=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),be=/[&<>"]/,it=s=>{let t=typeof s=="string"?s:String(s);return be.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t},_=class{static create(t,e=[],r=""){let n="",i="";for(let o=0,a=e.length;o<a;o++){let l=e[o],c=l.key,h=l.value;if(c==="text"||c==="textContent"){n+=it(h);continue}if(c==="html"||c==="innerHTML"){n+=h;continue}if(typeof h=="function")continue;let d=c+'="'+it(h)+'"';i?i+=" "+d:i=d}return Te.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+r+"</"+t+">"}static createText(t){return it(t)}static createComment(t){return"<!-- "+t+" -->"}};var j=class extends D{build(t,e,r){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],r);return n}return this.buildElement(t,r)}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let r=w.parse(t,e),n=r.children,i="";for(let o=0,a=n.length;o<a;o++){let l=n[o];l!==null&&(i+=this.buildElement(l,e))}return this.createNode(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return _.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return _.createComment(i)}return _.create(r,t.attr,e)}removeAll(t){}};var $=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new z:new j}};var b=$.setup(),Pe=s=>typeof s=="object"&&s.isUnit===!0,Re=s=>{let t=B(s);return t?new t:null},u=class{static render(t,e,r){return!t||(Pe(t)||(t=Re(t)),!t)?null:b.createComponent(t,e,r)}static build(t,e,r){return b.build(t,e,r)}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)}};dt.augment({buildLayout(s,t,e){u.build(s,t,e)}});var ot=[],Ae=s=>ot.indexOf(s)!==-1,Ie=s=>({tag:"script",src:s.src,async:!1,load(t){ot.push(s.src);let e=s.load;e&&e()}}),Ee=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){ot.push(s.src);let e=s.load;e&&e()}}),Y=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=Ee({load:r,src:t}):e=Ie({load:r,src:t}),u.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Ae(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 Oe=s=>s?typeof s?.prototype?.constructor=="function":!1,P=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Oe(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){let n=u.build(t,null,r),i=n.firstChild||t?.panel;return e.after(n),i}};var J=class{static load(t,e,r){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),r&&r(n)})}};var Be=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),R=new mt(100),De=s=>{if(R.has(s)){let r=R.get(s);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof s,e;if(t==="string")e=import(s);else if(t==="function")e=s();else return s;return e.then(r=>{R.set(s,r)}).catch(()=>{R.delete(s)}),R.set(s,e),e},_e=s=>{if(!R.has(s))return null;let t=R.get(s);return t&&typeof t.then=="function"?null:t||null},Pt=B({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return Be({onCreated:s=>{if(this.src){if(this.layout){if(this.layoutRoot&&!this.layoutRoot.isConnected&&this.panel){let e=this.layout.container;f.insert(this.layoutRoot,e||this.panel),f.restoreOverflow(this.layoutRoot),f.emit("base:persist-reattach",this.layoutRoot);return}this.layoutRoot=P.render(this.layout,this.panel,this.parent);return}if(this.depends){new Y(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){let t=this.generation,e=_e(this.src);if(e){this.renderModule(s,e);return}J.load(De(this.src),r=>{t===this.generation&&this.renderModule(s,r)},r=>{t===this.generation&&(this.loaded=!1,this.renderError(s,r))})},renderError(s,t){let e=()=>this.retry(s),r=this.fallback,n=typeof r=="function"?r(t,e):r||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};n&&(this.errorRoot=P.render(n,s,this.parent))},retry(s){this.removeErrorLayout(),this.loadAndRender(s)},removeErrorLayout(){this.errorRoot&&(u.removeNode(this.errorRoot),this.errorRoot=null)},renderModule(s,t){this.loaded=!0;let e=this.layout||P.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.layoutRoot=P.render(e,s,this.parent)},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},destroy(){if(this.generation++,this.removeErrorLayout(),!!this.layoutRoot){if(this.persist===!0){f.snapshotOverflow(this.layoutRoot),f.emit("base:persist-detach",this.layoutRoot),f.detach(this.layoutRoot),this.rendered=!1;return}u.removeNode(this.layoutRoot),this.layoutRoot=null,this.layout=null,this.loaded=!1,this.updateLayout=!1}}});var Rt=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new Pt(s)};var Le=0,L=class{constructor(t){this.router=t,this.locationId="base-app-router-"+Le++,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 It=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,At=()=>{It&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let s=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(s,t)}))},K=class extends L{addEvent(){return m.on("popstate",window,this.callBack),It&&(this.pageShowCallBack=this.onPageShow.bind(this),m.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){return m.off("popstate",window,this.callBack),this.pageShowCallBack&&m.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&At()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let r=e.scrollPosition;r&&this.scrollTo(r),At()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:r,uri:t}}addState(t,e,r=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return this;!r&&i&&i.location===this.locationId&&(i.scrollPosition=this.getScrollPosition(),n.replaceState(i,"",window.location.href));let o=this.createState(t,e);return r||(o.scrollPosition={x:0,y:0}),n[r===!1?"pushState":"replaceState"](o,null,t),this}};var V={removeSlashes(s){return typeof s!="string"?"":(s[0]==="/"&&(s=s.substring(1)),s[s.length-1]==="/"&&(s=s.substring(0,s.length-1)),s)},getHashUri(s){if(typeof s!="string")return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)}};var X=class extends L{addEvent(){return m.on("hashchange",window,this.callBack),this}removeEvent(){return m.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(V.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var Z=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new K(t).setup():new X(t).setup()}};var at=class extends S{getChildScope(){return this.parent}},Et=s=>B(s,at);var tt=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent}focus(t){this.setup===!1&&(this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create()),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){this.template=this.template(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(Et(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;u.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var Ot=s=>{if(!s.length)return null;let t={};for(let e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},Bt=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);if(n===null)return t;for(let i=0,o=n.length;i<o;i++){let a=n[i];a&&t.push(a.replace(":",""))}return t};var He=/(\/):[^/(]*?\?/g,Ue=/\//g,Me=/(\?\/+\*?)/g,qe=/(:[^/?&($]+)/g,Ne=/(\*)/g,Ge=s=>s.replace(He,t=>t.replace(Ue,"(?:$|/)")),We=s=>(s=s.replace(Me,"?/*"),s.replace(qe,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),Fe=s=>s.replace(Ne,".*"),Qe=(s,t)=>s+=t[t.length-1]==="*"?"":"$",Dt=s=>{if(!s)return"";let t=s;return t=Ge(t),t=We(t),t=Fe(t),t=Qe(t,s),t};var ze=0,_t=(s,t="")=>{let e=s||"",r=typeof t=="string"&&t?t:e,n=null,i=[],o=r.match(/#\{([^}]+)\}/);o&&o[1]&&(n=o[1].trim(),r=r.replace(o[0],""),e=e.replace(o[0],""));let a=r.indexOf("?");if(a>-1){let h=r.substring(a+1);if(h.indexOf("=")>-1){let d=h.split("&");for(let y=0,A=d.length;y<A;y++){let U=d[y];if(!U)continue;let[ge,ye=""]=U.split("="),ut=(ge||"").trim();ut&&i.push({key:ut,value:(ye||"").trim()})}r=r.substring(0,a);let g=e.indexOf("?");g>-1&&(e=e.substring(0,g))}}let l=n!==null||i.length>0;return l&&!r&&(e="*"),{uriPath:e,requiredHash:n,requiredQuery:i,hasConditions:l}},je=s=>{if(!s)return"";let t=s.indexOf("?"),e=s.indexOf("#"),r=s.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),s.substring(0,r)},$e=s=>{if(!s)return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)},Ye=s=>{if(!s)return"";let t=s.indexOf("?");if(t===-1)return"";let e=s.indexOf("#",t);return e===-1?s.substring(t+1):s.substring(t+1,e)},et=class extends yt{constructor(t,e){let r=t.baseUri,i=_t(r,t.rawUri).uriPath,o=Bt(i),a=Ot(o),l=super(a);return this.uri=r,this.matchUri=i,this.paramKeys=o,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),l}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+ze++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=_t(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=Dt(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(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?Rt(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:n,parent:i}=t,o={component:e,container:r,persist:n,parent:i},a=gt(this);this.controller=new tt(a,o)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let r=this.controller;r&&r.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];i&&this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=je(t),n=this.uriQuery||/$^/,i=r.match(n);return i===null?(this.resetParams(),e):Array.isArray(i)?this.matchConditions(t)?(this.setParams(i,1),e=i,e):(this.resetParams(),!1):e}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&$e(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=Ye(t);if(!r)return!1;let n=new URLSearchParams(r);for(let i=0,o=e.length;i<o;i++){let a=e[i];if(!n.has(a.key)||n.get(a.key)!==a.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let r=this.paramKeys;if(!r)return;let n={};for(let i=0,o=r.length;i<o;i++){let a=r[i];typeof a<"u"&&(n[a]=t[i+e])}this.set(n)}getParams(){return this.stage}};var Je=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},Ke=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ve=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=new RegExp(":"+Ke(r),"gi");s=s.replace(n,()=>e[r])}return s},Xe=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=Ve(t,s),Je(t)),Ze=(s,t)=>(t!==""&&(s+=" - "+t),s),Lt=(s,t,e)=>t&&(t=Xe(s,t),Ze(t,e));var tr=()=>typeof window<"u"?window.location:{},ct=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.history=null,this.callBackLink=null,this.location=tr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new xt({path:""})}setupHistory(){this.history=Z.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new et(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.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=V.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.routeId===t)return i}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate()}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(let n=0,i=t.length;n<i;n++){let o=t[n];if(!o)continue;let a=this.createRoute(o);r.push(a)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);for(let i=0,o=t.length;i<o;i++){let l=t[i].component.route;l.resumeRoute(e),n.push(l)}return this.checkGroupForRegistration(r,n),r}checkGroupForRegistration(t,e){let r=this.scrollIntent,n=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=n;let i=this.scrollIntent;i&&i.type==="target"&&i.groupId!==null&&i.groupId!==void 0&&(this.lastScrollGroup=i.groupId),this.scrollIntent=r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){this.switches.delete(t)}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),m.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.ctrlKey===!0)return!0;let e=t.target.closest("a");if(!e||e.target==="_blank"||e.dataset.cancelRoute)return!0;let r=e.getAttribute("href");if(r!==null){let n=this.baseURI,i=n!=="/"?r.replace(n,""):r,o=e.dataset.replace==="true";return this.navigate(i,null,o),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let n=t[e];n&&typeof n.deactivate=="function"&&n.deactivate()}return 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=Lt(t,e,this.title),this}checkActiveRoutes(t){if(this.lastPath=this.path,t=t||this.getPath(),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollWaitToken++,this.lastMatchedRoute&&this.check(this.lastMatchedRoute,t))this.select(this.lastMatchedRoute);else{let e=this.routes,r=e.length;for(let n=0;n<r;n++){let i=e[n];typeof i>"u"||this.checkRoute(i,t)}}this.checkSwitches(t),this.applyScrollIntent()}checkSwitches(t){let e=this.switches;for(let[r,n]of e.entries())this.currentGroupId=r,this.checkGroup(n,t);this.currentGroupId=null}checkGroup(t,e){let r=t.length;if(!r)return;let n=null;for(let a=0;a<r;a++)if(t[a].get("active")){n=t[a];break}let i=!1;n&&(i=n.match(e)!==!1);let o;for(let a=0;a<r;a++){let l=t[a];if(typeof l>"u")continue;(l===n?i:l.match(e))!==!1&&o===void 0&&l.controller&&(o=l)}if(!o){n&&n!==t[0]&&n.deactivate(),this.select(t[0],!0);return}this.select(o),n&&n!==o&&n.deactivate();for(let a=0;a<r;a++){let l=t[a];l&&l!==o&&l!==n&&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){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e!==!0&&(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==="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)})}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 y=a.style.position;a.style.position="static",h=a.getBoundingClientRect().top+window.scrollY,a.style.position=y}else h=a.getBoundingClientRect().top+window.scrollY;let d=c&&parseFloat(l.top)||0,g=h-d;window.scrollY>g&&window.scrollTo(0,g)};if(typeof requestAnimationFrame>"u"){let a=document.querySelector(t);a&&e(a);return}let r=++this.scrollWaitToken,n=30,i=0,o=()=>{if(r!==this.scrollWaitToken)return;let a=document.querySelector(t);if(a){e(a);return}++i<n&&requestAnimationFrame(o)};requestAnimationFrame(o)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(r.length!==n.length)return!0;let i=r[r.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&m.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent()}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},C=new ct;var Ht=(s,t)=>({attr:s,value:t}),er=(s,t)=>{if(!t.startsWith(s))return!1;let e=t[s.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},lt=class extends S{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,n=C.data,i=[];t&&typeof t=="object"&&i.push(Ht("href",t)),e&&typeof e=="object"&&i.push(Ht("text",e));let o=null,a="",l="";return i.push({value:["[[path]]",n],callBack:(c,h)=>{if(typeof h.pathname>"u")return;let d=h.getAttribute("href");if(d!==o){o=d;let y=h.pathname+h.search+h.hash;a=y,l=h.hash||h.search?y:h.pathname}let g=r?c===a:er(l,c);this.update(g)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var Ut=(s,t,e=null)=>{if(!s)return;let r=null,n=!1,i=()=>{n||(n=!0,r&&(clearTimeout(r),r=null),m.off("animationend",s,o),s&&s.classList.remove(t),e&&e())},o=a=>{a.target===s&&i()};m.on("animationend",s,o),requestAnimationFrame(()=>{if(!s){i();return}s.classList.add(t);try{let a=window.getComputedStyle(s),l=parseFloat(a.animationDuration)*1e3||1e3,c=parseFloat(a.animationDelay)*1e3||0;r=setTimeout(i,l+c+100)}catch{r=setTimeout(i,1e3)}})},Mt=(s,t,e)=>{Ut(s,t)},qt=(s,t,e)=>{let r=()=>{s&&s.remove&&s.remove()};rr(s,()=>Ut(s,t,r),e)};p.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var rr=(s,t,e)=>{p.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var G=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&G(s,t,n,r)});return}sr(s,t,e,r)},sr=(s,t,e,r)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',s,t);return}let o=nr(s,n,i,r);I.watch(s,t,n,o)},nr=(s,t,e,r)=>typeof e=="object"?n=>{ar(s,e,n)}:n=>{or(s,e,t,n,r)},Nt=new WeakSet,ir=(s,t,e)=>{!s||!s.isUnit&&!s.isComponent||Nt.has(e)||Nt.add(e)},or=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(i===null)break;ir(i,e,s),u.rebuild(i,s,n);break;case"string":let o=ft(s);if(o!=="textContent"){s.setAttribute(o,i);break}q.addHtml(s,i);break}},ar=(s,t,e)=>{let r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];o&&(t[o]===e?s.classList.add(o):s.classList.remove(o))}};var H=(s,t,e)=>{let r=k(e);G(s,r,t,e)};var Gt=(s,t,e)=>{t&&s.setAttribute("role",t)},cr=s=>(t,e)=>{let r=t?"true":"false";e.setAttribute(s,r)},Wt=(s,t,e)=>{if(!t)return;let r=t.role;r&&(s.setAttribute("role",r),t.role=null);let n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],l=t[a];if(l===null)continue;let c="aria-"+a;if(Array.isArray(l)){let h=l.slice();h.push(cr(c)),H(s,h,e)}else s.setAttribute(c,l)}};var Ft=(s,t,e)=>{if(!t)return;let r=w.parse(t,e);x.addAttributes(s,r.attr,e),u.setDirectives(s,r.directives,e)};p.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var ht=s=>s?s.getContext():null,Qt=(s,t,e)=>{if(typeof t!="function")return;let r=ht(e),n=t(r);Ft(s,n,e)},zt=(s,t,e)=>{if(typeof t!="function")return;let r=ht(e);t(r)},jt=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=ht(e),n=t(r);if(!n)return;let i=n[0];i&&(e.addContextBranch(i,n[1]),lr(s,i,e))},lr=(s,t,e)=>{p.add(s,"context",{branch:t,parent:e})};var $t=(s,t,e)=>{};var Yt=(s,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",s),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var Jt=(s,t,e)=>{},Kt=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&u.build(r,s,e)},Vt=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Xt=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&u.build(r,s,e)},Zt=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&u.build(r,s,e)},te=(s,t,e)=>{if(!t||!e)return;let r=e.state,n=t(r);if(!e.state){e.setStateHelper(n);return}e.addState(n)},ee=(s,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let r=t[2];t[2]=n=>{r(n,e)}}e.events.on(t[0],t[1],t[2],t[3])}};var re=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=k(e),!r)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=k(e);if(!o)return;r=o,n=t[0],i=t[1]}else[r,n,i]=t;I.bind(s,r,n,i)};var rt=(s,t,e)=>{G(s,e.state,t,e)};var se=s=>(t,e)=>{let[r,n,i="active"]=s,o=t===n?i:"";e.dataset[r]=o},ne=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(se(n)),H(s,i,e)},ie=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(se(n)),rt(s,i,e)};var oe=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&r.remove()}s.length=0};p.addType("forScopes",s=>{if(!s)return!1;oe(s.scopes)});var ae=(s,t,e)=>{let r,n,i,o;if(typeof t[0]=="string"||t.length<3){let h=k(e);if(!h)return;r=h,[n,i,o]=t}else[r,n,i,o]=t;let a=o!==!1,l=n+"[",c=a?{scopes:[]}:null;c&&p.add(s,"forScopes",c),I.watch(s,r,n,h=>{if(u.removeAll(s),c&&oe(c.scopes),!h||h.length<1)return;let d=[];for(let g=0,y=h.length;g<y;g++){let A=a?r.scope(l+g+"]"):null;A&&c&&c.scopes.push(A);let U=i(h[g],g,A,d);U!==null&&d.push(U)}return u.build(d,s,e)})};var ce=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];for(let o=0,a=r.length;o<a;o++){let l=r[o];if(!l)continue;let c=n(l,o);c!==null&&i.push(c)}u.build(i,s,e)};var le=(s,t,e)=>{t(s,e)};p.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var he=(s,t,e)=>{hr(s,t,e)},hr=(s,t,e)=>{p.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var ue=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,n=t.length;r<n;r++)E.setup(s,t[r],e);else E.setup(s,t,e)};p.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&C.removeRoute(t)});var fe=(s,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&de(s,i,e)}else de(s,t,e)},de=(s,t,e)=>{t.container=s,t.parent=e;let r=C.add(t);ur(s,r)},ur=(s,t)=>{p.add(s,"routes",{route:t})};var pe=(s,t,e)=>{};p.addType("switch",s=>{if(!s)return!1;let t=s.id;C.removeSwitch(t)});var me=(s,t,e)=>{let r=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=s,a.parent=e)}let n=C.addSwitch(t);dr(s,n)},dr=(s,t)=>{p.add(s,"switch",{id:t})};N.add("cache",Jt).add("onCreated",le).add("onDestroyed",he).add("bind",re).add("data",$t).add("state",pe).add("onSet",H).add("onState",rt).add("animateIn",Mt).add("animateOut",qt).add("watch",ue).add("useParent",Kt).add("useData",Xt).add("useState",Zt).add("getId",Vt).add("addState",te).add("addEvent",ee).add("map",ce).add("for",ae).add("useContext",zt).add("addContext",jt).add("context",Qt).add("role",Gt).add("aria",Wt).add("route",fe).add("debug",Yt).add("dataSet",ne).add("dataStateSet",ie).add("switch",me);export{N as a,W as b,S as c,wt as d,Ct as e,B as f,u as g,Rt as h,lt as i,ct as j,C as k};
2
+ //# sourceMappingURL=chunk-PNFTCSB2.js.map
@@ -0,0 +1,2 @@
1
+ import{b as T}from"./chunk-AO5L25YQ.js";import{a as mt,b as gt,c as yt,d as xt,e as k,f as x,g as E}from"./chunk-FXJIFTW5.js";import{a as M,b as dt}from"./chunk-ILT4B3VY.js";import{a as ft,c as I,d as pt,f as q}from"./chunk-E3C6NOMV.js";import{b as p,c as m}from"./chunk-R5DHGQZV.js";var N={items:new Map,add(s,t){return this.items.set(s,t),this},get(s){return this.items.get(s)??null}};var St="data-base-hscroll",xe=".overflow-x-auto, .overflow-x-scroll",vt=s=>{if(!s||typeof s.querySelectorAll!="function")return[];let t=[];if(s instanceof Element){let e=s.classList;e&&(e.contains("overflow-x-auto")||e.contains("overflow-x-scroll"))&&t.push(s)}return s.querySelectorAll(xe).forEach(e=>t.push(e)),t},f=class{static snapshotOverflow(t){vt(t).forEach(e=>{let r=e.scrollLeft;r>0&&e.setAttribute(St,String(r))})}static restoreOverflow(t){vt(t).forEach(e=>{let r=Number(e.getAttribute(St));r>0&&(e.scrollLeft=r)})}static detach(t){t&&t.parentNode&&t.parentNode.removeChild(t)}static insert(t,e){if(!(!t||!e)){if(e.nodeType===8){let r=e.parentNode;r&&r.insertBefore(t,e.nextSibling);return}e.appendChild(t)}}static emit(t,e){!e||typeof document>"u"||document.dispatchEvent(new CustomEvent(t,{detail:e}))}};p.addType("components",s=>{if(!s)return;let t=s.component;!t||!t.isUnit||(t.persistToken&&t.parent&&t.parent.removePersistedChild(t.persistToken),t.rendered===!0&&(t.prepareDestroy(),t.cleanUpAfterDestroy()))});var Se=0,W=class{constructor(t,e,r){this.isUnit=!0,this.data=null,this.persist=null,this.nest=null,this.state=null,this.panel=null,this.layoutRoot=null,this.layout=null,this.parent=null,this.unitType=null,this._classId,this.id="",this.cached=[],this.init();let n,i;if(t==null)n={},i=[];else{let o=typeof t;o==="string"||o==="number"?(n={},i=[{tag:"text",textContent:t}]):Array.isArray(t)?(n={},i=t):(n=t||{},i=typeof e=="string"?[{tag:"text",textContent:e}]:e)}this.setupProps(n),this.children=i||[],this.persistedChildren={},this.persistedCount=0,this.onCreated(),this.rendered=!1,this.container=null}init(){this.id="cp-"+Se++,this.unitType=this._classId||this.constructor.name.toLowerCase()}declareProps(){}addPersistedChild(t){let e=t.key,r=t.cache,n;r!=null&&e!=null?n="pk:"+r+":"+e:r!=null?n="pk:"+r:e!=null?n="pk:"+e:n="pc"+this.persistedCount++;let i=this.persistedChildren[n];return i&&t.unitType===i.unitType&&t.resumeScope(i),t.persistToken=n,this.persistedChildren[n]=t,n}removePersistedChild(t){this.rendered&&(!t||!this.persistedChildren[t]||delete this.persistedChildren[t])}setupProps(t){if(this.declareProps(),!(!t||typeof t!="object"))for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this[e]=t[e],e==="data"&&(this._externalData=!0))}getChildScope(){return this}getParentContext(){return this.parent?this.parent.getContext():null}setupContext(){if(this._contextResumed)return;let t=this.getParentContext(),e=this.setContext(t);if(e){this.context=e;return}this.context=t,this.setupAddingContext()}setupAddingContext(){let t=this.context,e=this.addContext(t);if(!e)return;let r=e[0];r&&(this.addingContext=!0,this.contextBranchName=r,this.addContextBranch(r,e[1]))}addContextBranch(t,e){this.context??={},this.context[t]=e}setContext(t){return null}addContext(t){return null}removeContext(){this.addingContext&&this.removeContextBranch(this.contextBranchName)}removeContextBranch(t){t&&delete this.context[t]}getContext(){return this.context}onCreated(){}render(){return{}}_cacheRoot(t){return t&&(t.id||(t.id=this.getId()),t.cache="panel",t)}_createLayout(){return this.render()}prepareLayout(){let t=this._createLayout();return this._cacheRoot(t)}afterBuild(){p.add(this.panel,"components",{component:this}),this.rendered=!0,this.afterLayout()}afterLayout(){this.afterSetup()}if(t,e){return t?e||t:null}map(t,e){let r=[];if(!t||t.length<1)return r;for(let n=0,i=t.length;n<i;n++){let o=e(t[n],n);r.push(o)}return r}removeAll(t){return 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(){if(this.persist===!0){this.detachPersisted();return}this.prepareDestroy();let t=this.panel;t&&q.removeElement(t),this.cleanUpAfterDestroy()}detachPersisted(){let t=this.layoutRoot,e=this.panel;t&&t!==e&&(f.snapshotOverflow(t),f.emit("base:persist-detach",t),f.detach(t)),e&&(f.snapshotOverflow(e),f.emit("base:persist-detach",e),f.detach(e)),this.rendered=!1}reattachPersisted(t){let e=this.panel;if(!e||e.isConnected)return!1;let r=this.container||t;if(!r)return!1;f.insert(e,r);let n=this.layoutRoot;if(n&&n!==e&&!n.isConnected){let i=this.layout&&this.layout.container||r;f.insert(n,i),f.restoreOverflow(n),f.emit("base:persist-reattach",n)}return f.restoreOverflow(e),f.emit("base:persist-reattach",e),this.rendered=!0,!0}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 O=class{static resume(t,e){if(t._externalData){this._resumeExternal(t,e);return}this._resumeOwned(t,e)}static _releaseLinks(t,e){!t||t===e||typeof t.unlink!="function"||t.unlink()}static refresh(t){let e=t.setData();e&&t.data&&t.data.set(e.stage),this.refreshContext(t)}static refreshContext(t){let e=t.context;if(!e||!e.data)return;let r=t.getParentContext();if(!r||!r.data)return;let n=r.data.stage,i=e.data.stage,o=null;for(let a in n){if(!Object.prototype.hasOwnProperty.call(n,a))continue;let l=n[a];l!==i[a]&&(o===null&&(o={}),o[a]=l)}o!==null&&(typeof e.data._silentSet=="function"?e.data._silentSet(o):e.data.set(o))}static _resumeExternal(t,e){let r=t.setData();if(!r){t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let n=e._retainState||r._retainState,i=!n&&(e._refreshState||r._refreshState),o=this._buildExternalUpdates(e.stage,r.stage,n,i);M.isEmpty(o)||r._silentSet(o)}typeof r.flushPending=="function"&&r.flushPending(),t.data=r}static _buildExternalUpdates(t,e,r,n){let i={};for(let o in t){if(!Object.prototype.hasOwnProperty.call(t,o))continue;if(n){Object.prototype.hasOwnProperty.call(e,o)||(i[o]=t[o]);continue}let a=t[o];!r&&a==null||a!==e[o]&&(i[o]=a)}return i}static _resumeOwned(t,e){let r=t.data;if(!r){this._releaseLinks(e),t.data=e;return}if(e&&e._retainState){this._releaseLinks(r,e),this._releaseLinks(e),t.data=e;return}if(this._releaseLinks(e,r),e&&e.stage){let n=e._refreshState||t.data._refreshState,i=this._buildOwnedUpdates(e.stage,t.data.stage,n);M.isEmpty(i)||t.data._silentSet(i)}t.data&&typeof t.data.flushPending=="function"&&t.data.flushPending()}static _buildOwnedUpdates(t,e,r){let n={};for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(r){Object.prototype.hasOwnProperty.call(e,i)||(n[i]=t[i]);continue}let o=t[i];o!=null&&o!==e[i]&&(n[i]=o)}return n}};var F=class{constructor(){this.events=[]}addEvents(t){let e=t.length;if(!(e<1))for(let r=0;r<e;r++){let n=t[r];this.on(n[0],n[1],n[2],n[3])}}on(t,e,r,n){m.on(t,e,r,n),this.events.push({event:t,obj:e,callBack:r,capture:n})}off(t,e,r,n){m.off(t,e,r,n);let i,o=this.events;for(let a=0,l=o.length;a<l;a++)if(i=o[a],i.event===t&&i.obj===e&&i.callBack===r&&i.capture===n){o.splice(a,1);break}}set(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];m.on(n.event,n.obj,n.callBack,n.capture)}}unset(){let t=this.events;for(let e=0,r=t.length;e<r;e++){let n=t[e];m.off(n.event,n.obj,n.callBack,n.capture)}}reset(){this.unset(),this.events=[]}};var Q=class{constructor(t,e){this.remoteStates=[],this.callBackStates=[];let r=this.convertStates(e);this.addStatesToTarget(t,r)}addStates(t,e){let r=this.convertStates(e);this.addStatesToTarget(t,r)}createState(t,e,r,n){return{action:t,state:e,callBack:r,targetId:n,token:null,callBackToken:null}}convertStates(t){let e=[];for(let r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;if(r==="remotes"){this.setupRemoteStates(t[r],e);continue}let n=null,i=null,o=t[r];o&&typeof o=="object"&&(i=o.callBack,n=o.id||o.targetId,o=o.state),e.push(this.createState(r,o,i,n))}return e}setupRemoteStates(t,e){for(let r=0,n=t.length;r<n;r++){let i=t[r];if(i)for(let o in i){if(!Object.prototype.hasOwnProperty.call(i,o)||o==="id")continue;let a=null,l=i[o],c=l!==null?l:void 0;c&&typeof c=="object"&&(a=c.callBack,c=c.state),e.push(this.createState(o,c,a,i.id))}}}removeRemoteStates(t){let e=this.remoteStates;e&&this.removeActions(t,e)}removeLocalStates(t){let e=this.callBackStates;if(e)for(let r=0,n=e.length;r<n;r++){let i=e[r];i.callBackToken&&(t.off(i.action,i.callBackToken),i.callBackToken=null)}}removeActions(t,e){if(!(e.length<1))for(let r=0,n=e.length;r<n;r++){let i=e[r];i.token&&this.unbindRemoteState(t,i.token),i.targetId&&T.remove(i.targetId,i.action,i.token)}}restore(t){T.restore(t.id,t);let e=this.callBackStates;if(e)for(let n=0,i=e.length;n<i;n++){let o=e[n];o.callBackToken=t.on(o.action,o.callBack)}let r=this.remoteStates;if(r)for(let n=0,i=r.length;n<i;n++){let o=r[n];o.token=this.bindRemoteState(t,o.action,o.targetId)}}bindRemoteState(t,e,r){let n=T.getTarget(r);return t.link(n,e)}unbindRemoteState(t,e){t.unlink(e)}addStatesToTarget(t,e){let r=this.remoteStates;for(let n=0,i=e.length;n<i;n++){let o=e[n],a=this.addAction(t,o);o.targetId&&(o.token=a,r.push(o))}}addAction(t,e){let r,n=e.action,i=e.targetId;i&&(r=this.bindRemoteState(t,n,i)),typeof e.state<"u"&&t.addAction(n,e.state);let o=e.callBack;return typeof o=="function"&&(e.callBackToken=t.on(n,o),this.callBackStates.push(e)),r||null}};var S=class extends W{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){O.resume(this,t)}_refreshData(){O.refresh(this)}_refreshContextData(){O.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=T.attach(String(e))}setupStates(){return{}}addStates(){let t=this.state;if(t){this.stateResumed=!0,this.stateHelper?.restore(t);return}let e=this.setupStates();M.isEmpty(e)||this.setStateHelper(e)}setStateHelper(t={}){this.state||(this.setupStateTarget(),this.stateHelper=new Q(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)),T.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 F)}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&&this.data.unlink()}};var wt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",destroy:"beforeDestroy"},Ct=(s,t)=>typeof s!="function"&&t==="setupStates"?()=>s:s;var st=(s,t)=>{if(!s)return t;let e=Object.keys(s);for(let r=0,n=e.length;r<n;r++){let i=e[r],o=s[i],a=wt[i]||i;t[a]=Ct(o,a)}return t},ve=s=>st(s,{}),we=0,kt=(s,t)=>{class e extends s{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+we++,e},B=(s,t=S)=>{s||(s={});let e,r=typeof s;return r==="object"&&s.render?(e=ve(s),kt(t,e)):(e={render:r==="function"?s:()=>s},kt(t,e))};var nt=(s,t)=>({attr:s,directive:t});var v=(s,t)=>({key:s,value:t});var Tt=(s,t,e,r)=>({tag:s,attr:t,directives:e,children:r});var bt=null,Ce=()=>bt||(bt=N.get("watch")),w=class{static getTag(t){return t.tag||"div"}static setupChildren(t){t.nest&&(t.children=t.nest,delete t.nest)}static setElementContent(t,e,r,n){return t==="text"?(n.push({tag:"text",textContent:e}),!0):t==="html"||t==="innerHTML"?(r.push(v("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(nt(v(e,E.getWatcherSettings(r,pt(e))),Ce()))}static setButtonType(t,e,r){if(t==="button"){let n=e.type||"button";r.push(v("type",n))}}static parse(t,e){let r=[],n=[],i=t.tag||"div";i==="button"&&r.push(v("type",t.type||"button"));let o=[],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 d=0;d<a.length;d++)o.push(a[d]);else o.push(a);continue}if((l=N.get(c))!==null){n.push(nt(v(c,a),l));continue}let h=typeof a;if(h==="object"){if(E.isWatching(a)){this.setTextAsWatcher(n,c,a);continue}o.push(a);continue}if(h==="function"){let d=a,g=function(y){d.call(this,y,e)};g.originalCallback=d,r.push(v(c,g));continue}if(h==="string"&&a.includes("[[")){this.setTextAsWatcher(n,c,a);continue}if(c==="text"){o.push({tag:"text",textContent:a});continue}if(c==="html"||c==="innerHTML"){r.push(v("innerHTML",a));continue}r.push(v(c,a))}return Tt(i,r,n,o)}};var D=class{build(t,e,r){}setupComponent(t,e,r){let n=r?.getChildScope();t.parent=n,n&&n.persist===!0&&t.persist!==!1&&(t.persist=!0,t.parent.addPersistedChild(t)),t.cache&&n&&(n[t.cache]=t),t.setup(e)}buildComponent(t){let e=t.prepareLayout(),r=this.build(e,t.container,t);return t.afterBuild(),t.component&&typeof t.onCreated=="function"&&t.onCreated(t),r}createComponent(t,e,r){return t.persist===!0&&typeof t.reattachPersisted=="function"&&t.reattachPersisted(e)||(this.setupComponent(t,e,r),this.buildComponent(t)),t}setDirectives(t,e,r){}removeNode(t){}removeAll(t){}};var ke=s=>{for(let e in s)if(e!=="tag"&&e!=="textContent")return!1;let t=s.textContent;return typeof t=="string"?t.indexOf("[[")===-1:typeof t!="object"},z=class extends D{build(t,e,r){let n=x.createDocFragment();if(Array.isArray(t))for(let i=0,o=t.length;i<o;i++)this.buildElement(t[i],n,r);else this.buildElement(t,n,r);return e&&typeof e=="object"&&e.appendChild(n),n}buildElement(t,e,r){if(t){if(t.isUnit===!0){this.createComponent(t,e,r);return}this.createElement(t,e,r)}}createElement(t,e,r){if(t.tag==="text"&&ke(t)){let c=t.textContent;x.createText(c??"",e);return}let n=r?.getChildScope();if(t.data||t.state){this.createTempComponent(t,e,n);return}let i=w.parse(t,n),o=this.createNode(i,e,n);this.cache(o,t.cache,r);let a=i.children;for(let c=0,h=a.length;c<h;c++){let d=a[c];d!==null&&this.buildElement(d,o,r)}let l=i.directives;l.length&&this.setDirectives(o,l,n)}createTempComponent(t,e,r){let n={cache:t.cache,key:t.key,persist:t.persist,_externalData:!0,setData:()=>t.data,...st(t.methods||{},{}),render(){return{...t,data:null,state:null,methods:null,key:null,persist:null}}};t.state&&(n.setupStateTarget=function(o){this.state=t.state});let i=new S(n);this.createComponent(i,e,r)}setDirectives(t,e,r){for(let n=0,i=e.length;n<i;n++)this.handleDirective(t,e[n],r)}handleDirective(t,e,r){e.directive(t,e.attr.value,r)}cache(t,e,r){r&&e&&r.cacheEle(t,e)}createNode(t,e,r){let n=t.tag;if(n==="text"){let i=t.attr[0],o=i?i.value:"";return x.createText(o,e)}else if(n==="comment"){let i=t.attr[0],o=i?i.value:"";return x.createComment(o,e)}return x.create(n,t.attr,e,r)}removeNode(t){x.removeElement(t)}removeAll(t){x.removeAll(t)}};var Te=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),be=/[&<>"]/,it=s=>{let t=typeof s=="string"?s:String(s);return be.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t},_=class{static create(t,e=[],r=""){let n="",i="";for(let o=0,a=e.length;o<a;o++){let l=e[o],c=l.key,h=l.value;if(c==="text"||c==="textContent"){n+=it(h);continue}if(c==="html"||c==="innerHTML"){n+=h;continue}if(typeof h=="function")continue;let d=c+'="'+it(h)+'"';i?i+=" "+d:i=d}return Te.has(t)?"<"+t+" "+i+" />":"<"+t+" "+i+">"+n+r+"</"+t+">"}static createText(t){return it(t)}static createComment(t){return"<!-- "+t+" -->"}};var j=class extends D{build(t,e,r){if(Array.isArray(t)){let n="";for(let i=0,o=t.length;i<o;i++)n+=this.buildElement(t[i],r);return n}return this.buildElement(t,r)}createComponent(t,e,r){return this.setupComponent(t,e,r),this.buildComponent(t)}buildElement(t,e){return t?t.isUnit===!0?this.createComponent(t,{},e):this.createElement(t,e):""}createElement(t,e){let r=w.parse(t,e),n=r.children,i="";for(let o=0,a=n.length;o<a;o++){let l=n[o];l!==null&&(i+=this.buildElement(l,e))}return this.createNode(r,i)}createNode(t,e){let r=t.tag;if(r==="text"){let n=t.attr[0],i=n?n.value:"";return _.createText(i)}else if(r==="comment"){let n=t.attr[0],i=n?n.value:"";return _.createComment(i)}return _.create(r,t.attr,e)}removeAll(t){}};var $=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new z:new j}};var b=$.setup(),Pe=s=>typeof s=="object"&&s.isUnit===!0,Re=s=>{let t=B(s);return t?new t:null},u=class{static render(t,e,r){return!t||(Pe(t)||(t=Re(t)),!t)?null:b.createComponent(t,e,r)}static build(t,e,r){return b.build(t,e,r)}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)}};dt.augment({buildLayout(s,t,e){u.build(s,t,e)}});var ot=[],Ae=s=>ot.indexOf(s)!==-1,Ie=s=>({tag:"script",src:s.src,async:!1,load(t){ot.push(s.src);let e=s.load;e&&e()}}),Ee=s=>({tag:"link",rel:"stylesheet",type:"text/css",href:s.src,load(t){ot.push(s.src);let e=s.load;e&&e()}}),Y=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=Ee({load:r,src:t}):e=Ie({load:r,src:t}),u.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Ae(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 Oe=s=>s?typeof s?.prototype?.constructor=="function":!1,P=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Oe(r)?r=new r:r=r(),r.isUnit===!0&&(r.route=e.route,e.persist&&(r.persist=!0)),r):null}static render(t,e,r){let n=u.build(t,null,r),i=n.firstChild||t?.panel;return e.after(n),i}};var J=class{static load(t,e,r){return t.then(n=>(e&&e(n),n)).catch(n=>{console.error("Error loading module:",n),r&&r(n)})}};var Be=s=>({tag:"comment",textContent:"import placeholder",onCreated:s.onCreated}),R=new mt(100),De=s=>{if(R.has(s)){let r=R.get(s);return r&&typeof r.then!="function"?Promise.resolve(r):r}let t=typeof s,e;if(t==="string")e=import(s);else if(t==="function")e=s();else return s;return e.then(r=>{R.set(s,r)}).catch(()=>{R.delete(s)}),R.set(s,e),e},_e=s=>{if(!R.has(s))return null;let t=R.get(s);return t&&typeof t.then=="function"?null:t||null},Pt=B({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return Be({onCreated:s=>{if(this.src){if(this.layout){if(this.layoutRoot&&!this.layoutRoot.isConnected&&this.panel){let e=this.layout.container;f.insert(this.layoutRoot,e||this.panel),f.restoreOverflow(this.layoutRoot),f.emit("base:persist-reattach",this.layoutRoot);return}this.layoutRoot=P.render(this.layout,this.panel,this.parent);return}if(this.depends){new Y(()=>{this.loadAndRender(s)}).addFiles(this.depends);return}this.loadAndRender(s)}}})},loadAndRender(s){let t=this.generation,e=_e(this.src);if(e){this.renderModule(s,e);return}J.load(De(this.src),r=>{t===this.generation&&this.renderModule(s,r)},r=>{t===this.generation&&(this.loaded=!1,this.renderError(s,r))})},renderError(s,t){let e=()=>this.retry(s),r=this.fallback,n=typeof r=="function"?r(t,e):r||{class:"base-import-error",children:[{tag:"span",text:"Failed to load content."},{tag:"button",type:"button",text:"Retry",click:e}]};n&&(this.errorRoot=P.render(n,s,this.parent))},retry(s){this.removeErrorLayout(),this.loadAndRender(s)},removeErrorLayout(){this.errorRoot&&(u.removeNode(this.errorRoot),this.errorRoot=null)},renderModule(s,t){this.loaded=!0;let e=this.layout||P.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.layoutRoot=P.render(e,s,this.parent)},shouldUpdate(s){return this.updateLayout===!0?!0:this.updateLayout=s&&s.isUnit&&typeof s.update=="function"},updateModuleLayout(s){let t=this.layout;this.shouldUpdate(t)&&t&&t.update(s)},update(s){this.loaded===!0&&this.updateModuleLayout(s)},destroy(){if(this.generation++,this.removeErrorLayout(),!!this.layoutRoot){if(this.persist===!0){f.snapshotOverflow(this.layoutRoot),f.emit("base:persist-detach",this.layoutRoot),f.detach(this.layoutRoot),this.rendered=!1;return}u.removeNode(this.layoutRoot),this.layoutRoot=null,this.layout=null,this.loaded=!1,this.updateLayout=!1}}});var Rt=s=>{let t=typeof s;return(t==="string"||t==="function"||s instanceof Promise)&&(s={src:s}),new Pt(s)};var Le=0,L=class{constructor(t){this.router=t,this.locationId="base-app-router-"+Le++,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 It=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,At=()=>{It&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let s=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(s,t)}))},K=class extends L{addEvent(){return m.on("popstate",window,this.callBack),It&&(this.pageShowCallBack=this.onPageShow.bind(this),m.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){return m.off("popstate",window,this.callBack),this.pageShowCallBack&&m.off("pageshow",window,this.pageShowCallBack),this}onPageShow(t){t.persisted&&At()}check(t){let e=t.state;if(!e||e.location!==this.locationId)return!1;t.preventDefault(),t.stopPropagation(),this.router.checkActiveRoutes(e.uri);let r=e.scrollPosition;r&&this.scrollTo(r),At()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,scrollPosition:r,uri:t}}addState(t,e,r=!1){let n=window.history,i=n.state;if(i&&i.uri===t)return this;!r&&i&&i.location===this.locationId&&(i.scrollPosition=this.getScrollPosition(),n.replaceState(i,"",window.location.href));let o=this.createState(t,e);return r||(o.scrollPosition={x:0,y:0}),n[r===!1?"pushState":"replaceState"](o,null,t),this}};var V={removeSlashes(s){return typeof s!="string"?"":(s[0]==="/"&&(s=s.substring(1)),s[s.length-1]==="/"&&(s=s.substring(0,s.length-1)),s)},getHashUri(s){if(typeof s!="string")return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)}};var X=class extends L{addEvent(){return m.on("hashchange",window,this.callBack),this}removeEvent(){return m.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(V.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var Z=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new K(t).setup():new X(t).setup()}};var at=class extends S{getChildScope(){return this.parent}},Et=s=>B(s,at);var tt=class{constructor(t,e){this.route=t,this.template=e.component,this.component=null,this.hasTemplate=!1,this.setup=!1,this.container=e.container,this.persist=e.persist,this.parent=e.parent}focus(t){this.setup===!1&&(this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create()),this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){this.template=this.template(),this.initializeTemplateObject()}transferSettings(t){this.persist=this.persist&&t.persist!==!1,Object.assign(t,{route:this.route,persist:this.persist}),this.component=t}initializeTemplateObject(){let t=this.template;if(!t)return;t.isUnit||(this.template=new(Et(t)));let e=this.template;this.transferSettings(e)}create(){if(this.setupTemplate(),!this.hasTemplate)return;this.setup=!0;let t=this.component;u.render(t,this.container,this.parent)}remove(){if(this.setup!==!0)return;this.setup=!1;let t=this.component;t&&(typeof t.destroy=="function"&&t.destroy(),this.component=null)}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var Ot=s=>{if(!s.length)return null;let t={};for(let e=0,r=s.length;e<r;e++)t[s[e]]=null;return t},Bt=s=>{let t=[];if(!s)return t;let e=/[*?]/g;s=s.replace(e,"");let r=/:(.[^./?&($]+)\?*/g,n=s.match(r);if(n===null)return t;for(let i=0,o=n.length;i<o;i++){let a=n[i];a&&t.push(a.replace(":",""))}return t};var He=/(\/):[^/(]*?\?/g,Ue=/\//g,Me=/(\?\/+\*?)/g,qe=/(:[^/?&($]+)/g,Ne=/(\*)/g,Ge=s=>s.replace(He,t=>t.replace(Ue,"(?:$|/)")),We=s=>(s=s.replace(Me,"?/*"),s.replace(qe,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),Fe=s=>s.replace(Ne,".*"),Qe=(s,t)=>s+=t[t.length-1]==="*"?"":"$",Dt=s=>{if(!s)return"";let t=s;return t=Ge(t),t=We(t),t=Fe(t),t=Qe(t,s),t};var ze=0,_t=(s,t="")=>{let e=s||"",r=typeof t=="string"&&t?t:e,n=null,i=[],o=r.match(/#\{([^}]+)\}/);o&&o[1]&&(n=o[1].trim(),r=r.replace(o[0],""),e=e.replace(o[0],""));let a=r.indexOf("?");if(a>-1){let h=r.substring(a+1);if(h.indexOf("=")>-1){let d=h.split("&");for(let y=0,A=d.length;y<A;y++){let U=d[y];if(!U)continue;let[ge,ye=""]=U.split("="),ut=(ge||"").trim();ut&&i.push({key:ut,value:(ye||"").trim()})}r=r.substring(0,a);let g=e.indexOf("?");g>-1&&(e=e.substring(0,g))}}let l=n!==null||i.length>0;return l&&!r&&(e="*"),{uriPath:e,requiredHash:n,requiredQuery:i,hasConditions:l}},je=s=>{if(!s)return"";let t=s.indexOf("?"),e=s.indexOf("#"),r=s.length;return t>-1&&(r=t),e>-1&&e<r&&(r=e),s.substring(0,r)},$e=s=>{if(!s)return"";let t=s.indexOf("#");return t===-1?"":s.substring(t+1)},Ye=s=>{if(!s)return"";let t=s.indexOf("?");if(t===-1)return"";let e=s.indexOf("#",t);return e===-1?s.substring(t+1):s.substring(t+1,e)},et=class extends yt{constructor(t,e){let r=t.baseUri,i=_t(r,t.rawUri).uriPath,o=Bt(i),a=Ot(o),l=super(a);return this.uri=r,this.matchUri=i,this.paramKeys=o,this.titleCallBack=e,this.setupRoute(t),this.set("active",!1),l}setup(){this.stage={},this.routeId=null,this.uri=null,this.rawUri=null,this.matchUri="",this.uriQuery=/$^/,this.controller=null,this.paramKeys=[],this.requiredHash=null,this.requiredQuery=[],this.hasConditions=!1,this.titleCallBack=()=>{},this.path=null,this.referralPath=null,this.params=null,this.callBack=null,this.title=null,this.preventScroll=!1,this.scrollTo=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+ze++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=_t(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=Dt(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(){this.set("active",!1);let t=this.controller;t&&t.remove()}getLayout(t){if(t.component)return t.component;let e=t.import;return e?Rt(e):null}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:n,parent:i}=t,o={component:e,container:r,persist:n,parent:i},a=gt(this);this.controller=new tt(a,o)}resumeRoute(t){let e=this.controller;e&&(e.container=t)}setPath(t,e){this.path=t,this.referralPath=e}select(){this.set("active",!0);let t=this.stage,e=this.callBack;typeof e=="function"&&e(t);let r=this.controller;r&&r.focus(t);let n=this.path;if(!n)return;let i=n.split("#")[1];i&&this.scrollToId(i)}scrollToId(t){if(!t)return;let e=document.getElementById(t);e&&e.scrollIntoView(!0)}match(t){let e=!1,r=je(t),n=this.uriQuery||/$^/,i=r.match(n);return i===null?(this.resetParams(),e):Array.isArray(i)?this.matchConditions(t)?(this.setParams(i,1),e=i,e):(this.resetParams(),!1):e}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&$e(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=Ye(t);if(!r)return!1;let n=new URLSearchParams(r);for(let i=0,o=e.length;i<o;i++){let a=e[i];if(!n.has(a.key)||n.get(a.key)!==a.value)return!1}}return!0}resetParams(){this.stage={}}setParams(t,e=0){if(!Array.isArray(t))return;let r=this.paramKeys;if(!r)return;let n={};for(let i=0,o=r.length;i<o;i++){let a=r[i];typeof a<"u"&&(n[a]=t[i+e])}this.set(n)}getParams(){return this.stage}};var Je=s=>{let t=/\w\S*/;return s.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},Ke=s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Ve=(s,t)=>{if(s.indexOf(":")===-1)return s;let e=t.stage;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=new RegExp(":"+Ke(r),"gi");s=s.replace(n,()=>e[r])}return s},Xe=(s,t)=>t&&(typeof t=="function"&&(t=t(s.stage)),t=Ve(t,s),Je(t)),Ze=(s,t)=>(t!==""&&(s+=" - "+t),s),Lt=(s,t,e)=>t&&(t=Xe(s,t),Ze(t,e));var tr=()=>typeof window<"u"?window.location:{},ct=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.history=null,this.callBackLink=null,this.location=tr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new xt({path:""})}setupHistory(){this.history=Z.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new et(t,this.updateTitle.bind(this))}add(t){if(typeof t!="object"){let r=arguments;t={uri:r[0],component:r[1],callBack:r[2],title:r[3],id:r[4],container:r[5]}}let e=this.createRoute(t);return this.addRoute(e),e}addRoute(t){this.routes.push(t),this.checkRoute(t,this.getPath())}resume(t,e){t.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=V.removeSlashes(t);return r=r.replace(/^(?:\.\/)+/,""),r==="."&&(r=""),e+r}getRoute(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.uri===t)return i}return null}getRouteById(t){let e=this.routes,r=e.length;if(r>0)for(let n=0;n<r;n++){let i=e[n];if(i.routeId===t)return i}return!1}removeRoute(t){let e=this.routes,r=e.indexOf(t);r>-1&&e.splice(r,1),this.lastMatchedRoute===t&&(this.lastMatchedRoute=null),t&&typeof t.deactivate=="function"&&t.deactivate()}addSwitch(t){let e=this.switchCount++,r=this.getSwitchGroup(e);for(let n=0,i=t.length;n<i;n++){let o=t[n];if(!o)continue;let a=this.createRoute(o);r.push(a)}return this.checkGroupForRegistration(e,r),e}resumeSwitch(t,e){let r=this.switchCount++,n=this.getSwitchGroup(r);for(let i=0,o=t.length;i<o;i++){let l=t[i].component.route;l.resumeRoute(e),n.push(l)}return this.checkGroupForRegistration(r,n),r}checkGroupForRegistration(t,e){let r=this.scrollIntent,n=this.currentGroupId;this.scrollIntent=null,this.currentGroupId=t,this.checkGroup(e,this.getPath()),this.currentGroupId=n;let i=this.scrollIntent;i&&i.type==="target"&&i.groupId!==null&&i.groupId!==void 0&&(this.lastScrollGroup=i.groupId),this.scrollIntent=r}getSwitchGroup(t){let e=this.switches.get(t);if(e)return e;let r=[];return this.switches.set(t,r),r}removeSwitch(t){this.switches.delete(t)}remove(t){t=this.createURI(t);let e=this.getRoute(t);return e&&this.removeRoute(e),this}setup(t,e){this.baseURI=t||"/",this.updateBaseTag(this.baseURI),this.title=typeof e<"u"?e:"",this.setupHistory(),this.data.path=this.getPath(),this.callBackLink=this.checkLink.bind(this),m.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.ctrlKey===!0)return!0;let e=t.target.closest("a");if(!e||e.target==="_blank"||e.dataset.cancelRoute)return!0;let r=e.getAttribute("href");if(r!==null){let n=this.baseURI,i=n!=="/"?r.replace(n,""):r,o=e.dataset.replace==="true";return this.navigate(i,null,o),t.preventDefault(),t.stopPropagation(),!1}}reset(){let t=this.routes;for(let e=0,r=t.length;e<r;e++){let n=t[e];n&&typeof n.deactivate=="function"&&n.deactivate()}return 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=Lt(t,e,this.title),this}checkActiveRoutes(t){if(this.lastPath=this.path,t=t||this.getPath(),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollWaitToken++,this.lastMatchedRoute&&this.check(this.lastMatchedRoute,t))this.select(this.lastMatchedRoute);else{let e=this.routes,r=e.length;for(let n=0;n<r;n++){let i=e[n];typeof i>"u"||this.checkRoute(i,t)}}this.checkSwitches(t),this.applyScrollIntent()}checkSwitches(t){let e=this.switches;for(let[r,n]of e.entries())this.currentGroupId=r,this.checkGroup(n,t);this.currentGroupId=null}checkGroup(t,e){let r=t.length;if(!r)return;let n=null;for(let a=0;a<r;a++)if(t[a].get("active")){n=t[a];break}let i=!1;n&&(i=n.match(e)!==!1);let o;for(let a=0;a<r;a++){let l=t[a];if(typeof l>"u")continue;(l===n?i:l.match(e))!==!1&&o===void 0&&l.controller&&(o=l)}if(!o){n&&n!==t[0]&&n.deactivate(),this.select(t[0],!0);return}this.select(o),n&&n!==o&&n.deactivate();for(let a=0;a<r;a++){let l=t[a];l&&l!==o&&l!==n&&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){t&&(t.setPath(this.path,this.lastPath),t.select(),this.updateTitle(t),e!==!0&&(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==="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)})}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 y=a.style.position;a.style.position="static",h=a.getBoundingClientRect().top+window.scrollY,a.style.position=y}else h=a.getBoundingClientRect().top+window.scrollY;let d=c&&parseFloat(l.top)||0,g=h-d;window.scrollY>g&&window.scrollTo(0,g)};if(typeof requestAnimationFrame>"u"){let a=document.querySelector(t);a&&e(a);return}let r=++this.scrollWaitToken,n=30,i=0,o=()=>{if(r!==this.scrollWaitToken)return;let a=document.querySelector(t);if(a){e(a);return}++i<n&&requestAnimationFrame(o)};requestAnimationFrame(o)}checkToScroll(){this.shouldScrollToTop()&&window.scrollTo(0,0)}cleanPath(t){return t?t.split("?")[0].split("#")[0]:"/"}shouldScrollToTop(){let t=this.cleanPath(this.getPath()),r=this.cleanPath(this.lastPath).split("/"),n=t.split("/");if(r.length!==n.length)return!0;let i=r[r.length-1],o=n[n.length-1];return i!==o}getEndPoint(){return this.getPath().replace(this.baseURI,"")||"/"}destroy(){typeof this.callBackLink=="function"&&m.off("click",document,this.callBackLink);let t=this.history;t&&typeof t.removeEvent=="function"&&t.removeEvent()}getPath(){let t=this.location,e=this.path=t.pathname;return this.history.type==="hash"?t.hash.replace("#",""):e+t.search+t.hash}},C=new ct;var Ht=(s,t)=>({attr:s,value:t}),er=(s,t)=>{if(!t.startsWith(s))return!1;let e=t[s.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},lt=class extends S{beforeSetup(){this.selectedClass=this.activeClass||"active"}render(){let t=this.href,e=this.text,r=this.setupWatchers(t,e);return{tag:"a",class:this.class||this.className||null,onState:["selected",{[this.selectedClass]:!0}],href:this.getString(t),text:this.getString(e),nest:this.nest||this.children,dataStateSet:this.dataSet,"data-replace":this.replace?"true":null,watch:r}}getLinkPath(){return this?.panel?.pathname||null}getString(t){let e=typeof t;return e!=="object"&&e!=="undefined"?t:null}setupWatchers(t,e){let r=this.exact===!0,n=C.data,i=[];t&&typeof t=="object"&&i.push(Ht("href",t)),e&&typeof e=="object"&&i.push(Ht("text",e));let o=null,a="",l="";return i.push({value:["[[path]]",n],callBack:(c,h)=>{if(typeof h.pathname>"u")return;let d=h.getAttribute("href");if(d!==o){o=d;let y=h.pathname+h.search+h.hash;a=y,l=h.hash||h.search?y:h.pathname}let g=r?c===a:er(l,c);this.update(g)}}),i}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var Ut=(s,t,e=null)=>{if(!s)return;let r=null,n=!1,i=()=>{n||(n=!0,r&&(clearTimeout(r),r=null),m.off("animationend",s,o),s&&s.classList.remove(t),e&&e())},o=a=>{a.target===s&&i()};m.on("animationend",s,o),requestAnimationFrame(()=>{if(!s){i();return}s.classList.add(t);try{let a=window.getComputedStyle(s),l=parseFloat(a.animationDuration)*1e3||1e3,c=parseFloat(a.animationDelay)*1e3||0;r=setTimeout(i,l+c+100)}catch{r=setTimeout(i,1e3)}})},Mt=(s,t,e)=>{Ut(s,t)},qt=(s,t,e)=>{let r=()=>{s&&s.remove&&s.remove()};rr(s,()=>Ut(s,t,r),e)};p.addType("manual-destroy",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var rr=(s,t,e)=>{p.add(s,"manual-destroy",{ele:s,callBack:t,parent:e})};var G=(s,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(n=>{n&&G(s,t,n,r)});return}sr(s,t,e,r)},sr=(s,t,e,r)=>{let n,i;if(e.length<3?[n,i]=e:[t,n,i]=e,!t||!n)return;if(typeof t.on!="function"){console.warn('Watcher directive: Data source does not have an "on" method. Make sure your component has data, state, or context.data initialized before using watchers like onSet, watch, or [[prop]] syntax.',s,t);return}let o=nr(s,n,i,r);I.watch(s,t,n,o)},nr=(s,t,e,r)=>typeof e=="object"?n=>{ar(s,e,n)}:n=>{or(s,e,t,n,r)},Nt=new WeakSet,ir=(s,t,e)=>{!s||!s.isUnit&&!s.isComponent||Nt.has(e)||Nt.add(e)},or=(s,t,e,r,n)=>{let i=t(r,s,n);switch(typeof i){case"object":if(i===null)break;ir(i,e,s),u.rebuild(i,s,n);break;case"string":let o=ft(s);if(o!=="textContent"){s.setAttribute(o,i);break}q.addHtml(s,i);break}},ar=(s,t,e)=>{let r=Object.keys(t);for(let n=0,i=r.length;n<i;n++){let o=r[n];o&&(t[o]===e?s.classList.add(o):s.classList.remove(o))}};var H=(s,t,e)=>{let r=k(e);G(s,r,t,e)};var Gt=(s,t,e)=>{t&&s.setAttribute("role",t)},cr=s=>(t,e)=>{let r=t?"true":"false";e.setAttribute(s,r)},Wt=(s,t,e)=>{if(!t)return;let r=t.role;r&&(s.setAttribute("role",r),t.role=null);let n=Object.keys(t);for(let i=0,o=n.length;i<o;i++){let a=n[i],l=t[a];if(l===null)continue;let c="aria-"+a;if(Array.isArray(l)){let h=l.slice();h.push(cr(c)),H(s,h,e)}else s.setAttribute(c,l)}};var Ft=(s,t,e)=>{if(!t)return;let r=w.parse(t,e);x.addAttributes(s,r.attr,e),u.setDirectives(s,r.directives,e)};p.addType("context",s=>{if(!s)return!1;s.parent.removeContextBranch(s.branch)});var ht=s=>s?s.getContext():null,Qt=(s,t,e)=>{if(typeof t!="function")return;let r=ht(e),n=t(r);Ft(s,n,e)},zt=(s,t,e)=>{if(typeof t!="function")return;let r=ht(e);t(r)},jt=(s,t,e)=>{if(typeof t!="function"||!e)return;let r=ht(e),n=t(r);if(!n)return;let i=n[0];i&&(e.addContextBranch(i,n[1]),lr(s,i,e))},lr=(s,t,e)=>{p.add(s,"context",{branch:t,parent:e})};var $t=(s,t,e)=>{};var Yt=(s,t,e)=>{if(!e)return;let r=e._layout?e._layout:e.render();console.log("Debug: ","ele: ",s),console.log("Data: ",t),console.log("Layout: ",r),console.log("parent: ",e)};var Jt=(s,t,e)=>{},Kt=(s,t,e)=>{if(!t||!e)return;let r=t(e,s);r&&u.build(r,s,e)},Vt=(s,t,e)=>{if(!t||!e)return;let r=e.getId(t);s.id=r},Xt=(s,t,e)=>{if(!t||!e)return;let r=t(e.data,s);r&&u.build(r,s,e)},Zt=(s,t,e)=>{if(!t||!e)return;let r=t(e.state,s);r&&u.build(r,s,e)},te=(s,t,e)=>{if(!t||!e)return;let r=e.state,n=t(r);if(!e.state){e.setStateHelper(n);return}e.addState(n)},ee=(s,t,e)=>{if(!(!t||!e)){if(e.events||e.setEventHelper(),t[2]){let r=t[2];t[2]=n=>{r(n,e)}}e.events.on(t[0],t[1],t[2],t[3])}};var re=(s,t,e)=>{let r,n,i;if(typeof t=="string"){if(r=k(e),!r)return;n=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let o=k(e);if(!o)return;r=o,n=t[0],i=t[1]}else[r,n,i]=t;I.bind(s,r,n,i)};var rt=(s,t,e)=>{G(s,e.state,t,e)};var se=s=>(t,e)=>{let[r,n,i="active"]=s,o=t===n?i:"";e.dataset[r]=o},ne=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(se(n)),H(s,i,e)},ie=(s,t,e)=>{if(!t)return;let r=t.length-1,n=t[r],i=t.slice(0,r);i.push(se(n)),rt(s,i,e)};var oe=s=>{for(let t=0,e=s.length;t<e;t++){let r=s[t];r&&r.remove()}s.length=0};p.addType("forScopes",s=>{if(!s)return!1;oe(s.scopes)});var ae=(s,t,e)=>{let r,n,i,o;if(typeof t[0]=="string"||t.length<3){let h=k(e);if(!h)return;r=h,[n,i,o]=t}else[r,n,i,o]=t;let a=o!==!1,l=n+"[",c=a?{scopes:[]}:null;c&&p.add(s,"forScopes",c),I.watch(s,r,n,h=>{if(u.removeAll(s),c&&oe(c.scopes),!h||h.length<1)return;let d=[];for(let g=0,y=h.length;g<y;g++){let A=a?r.scope(l+g+"]"):null;A&&c&&c.scopes.push(A);let U=i(h[g],g,A,d);U!==null&&d.push(U)}return u.build(d,s,e)})};var ce=(s,t,e)=>{let r=t[0];if(!r||r.length<1)return;let n=t[1],i=[];for(let o=0,a=r.length;o<a;o++){let l=r[o];if(!l)continue;let c=n(l,o);c!==null&&i.push(c)}u.build(i,s,e)};var le=(s,t,e)=>{t(s,e)};p.addType("destroyed",s=>{if(!s)return!1;s.callBack(s.ele,s.parent)});var he=(s,t,e)=>{hr(s,t,e)},hr=(s,t,e)=>{p.add(s,"destroyed",{ele:s,callBack:t,parent:e})};var ue=(s,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,n=t.length;r<n;r++)E.setup(s,t[r],e);else E.setup(s,t,e)};p.addType("routes",s=>{if(!s)return!1;let t=s.route;t&&C.removeRoute(t)});var fe=(s,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++){let i=t[r];i&&de(s,i,e)}else de(s,t,e)},de=(s,t,e)=>{t.container=s,t.parent=e;let r=C.add(t);ur(s,r)},ur=(s,t)=>{p.add(s,"routes",{route:t})};var pe=(s,t,e)=>{};p.addType("switch",s=>{if(!s)return!1;let t=s.id;C.removeSwitch(t)});var me=(s,t,e)=>{let r=t[0];for(let i=0,o=t.length;i<o;i++){let a=t[i];a&&(a.container=s,a.parent=e)}let n=C.addSwitch(t);dr(s,n)},dr=(s,t)=>{p.add(s,"switch",{id:t})};N.add("cache",Jt).add("onCreated",le).add("onDestroyed",he).add("bind",re).add("data",$t).add("state",pe).add("onSet",H).add("onState",rt).add("animateIn",Mt).add("animateOut",qt).add("watch",ue).add("useParent",Kt).add("useData",Xt).add("useState",Zt).add("getId",Vt).add("addState",te).add("addEvent",ee).add("map",ce).add("for",ae).add("useContext",zt).add("addContext",jt).add("context",Qt).add("role",Gt).add("aria",Wt).add("route",fe).add("debug",Yt).add("dataSet",ne).add("dataStateSet",ie).add("switch",me);export{N as a,W as b,S as c,wt as d,Ct as e,B as f,u as g,Rt as h,lt as i,ct as j,C as k};
2
+ //# sourceMappingURL=chunk-S44XPFR3.js.map
@@ -0,0 +1,39 @@
1
+ export class PersistDom {
2
+ /**
3
+ * This will snapshot overflow-x offsets before detach.
4
+ *
5
+ * @param {ParentNode|null|undefined} root
6
+ * @returns {void}
7
+ */
8
+ static snapshotOverflow(root: ParentNode | null | undefined): void;
9
+ /**
10
+ * This will restore overflow-x offsets after reattach.
11
+ *
12
+ * @param {ParentNode|null|undefined} root
13
+ * @returns {void}
14
+ */
15
+ static restoreOverflow(root: ParentNode | null | undefined): void;
16
+ /**
17
+ * This will detach a node without walking bindings.
18
+ *
19
+ * @param {Node|null|undefined} node
20
+ * @returns {void}
21
+ */
22
+ static detach(node: Node | null | undefined): void;
23
+ /**
24
+ * This will insert a node into a host. Comment hosts use after().
25
+ *
26
+ * @param {Node|null|undefined} node
27
+ * @param {Node|null|undefined} host
28
+ * @returns {void}
29
+ */
30
+ static insert(node: Node | null | undefined, host: Node | null | undefined): void;
31
+ /**
32
+ * This will notify listeners that a persist tree moved.
33
+ *
34
+ * @param {'base:persist-detach'|'base:persist-reattach'} name
35
+ * @param {Node|null|undefined} root
36
+ * @returns {void}
37
+ */
38
+ static emit(name: "base:persist-detach" | "base:persist-reattach", root: Node | null | undefined): void;
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/base",
3
- "version": "3.9.12",
3
+ "version": "3.9.14",
4
4
  "description": "This is a javascript framework.",
5
5
  "main": "./dist/base.js",
6
6
  "module": "./dist/base.js",