@base-framework/base 3.9.21 → 3.9.23

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 R}from"./chunk-6YJAZHX6.js";import{a as I,b as bt,c as At,d as Et,e as T,f as S,g as _}from"./chunk-HBL2JSVL.js";import{a as W,b as Tt}from"./chunk-VSCHM2ZB.js";import{a as Rt,c as E,d as Pt,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 g=[],K=0,lt=!1,Le=typeof queueMicrotask=="function"?queueMicrotask:n=>Promise.resolve().then(n),De=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=g;if(n.length===0)return;g=[];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=De(s);if(o&&o.isConnected===!0){Be(s);continue}t.push(s)}t.length&&(g=g.length?t.concat(g):t),g.length&&K===0&&g.length!==t.length&&ct()},ct=()=>{lt||(lt=!0,Le(It))},v={add(n){n._mountPending!==!0&&(n._mountPending=!0,g.push(n))},enter(){K++},leave(){--K>0||(K=0,g.length&&ct())},schedule(){g.length&&ct()},flush(){It()},get size(){return g.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 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 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){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=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"},Ot=(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]=Ot(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},L=(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 w=(n,t)=>({key:n,value:t});var Dt=(n,t,e,r)=>({tag:n,attr:t,directives:e,children:r});var Bt=null,Ne=()=>Bt||(Bt=F.get("watch")),k=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(w("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(ut(w(e,_.getWatcherSettings(r,Pt(e))),Ne()))}static setButtonType(t,e,r){if(t==="button"){let s=e.type||"button";r.push(w("type",s))}}static parse(t,e){let r=[],s=[],o=t.tag||"div";o==="button"&&r.push(w("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(w(c,a),l));continue}let h=typeof a;if(h==="object"){if(_.isWatching(a)){this.setTextAsWatcher(s,c,a);continue}i.push(a);continue}if(h==="function"){let u=a,m=function(y){u.call(this,y,e)};m.originalCallback=u,r.push(w(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(w("innerHTML",a));continue}r.push(w(c,a))}return Dt(o,r,s,i)}};var D=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 D{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=k.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},B=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 D{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=k.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 B.createText(o)}else if(r==="comment"){let s=t.attr[0],o=s?s.value:"";return B.createComment(o)}return B.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 P=$.setup(),Ge=n=>typeof n=="object"&&n.isUnit===!0,Mt=new WeakMap,Ke=n=>{let t=Mt.get(n);if(!t){if(t=L(n),!t)return null;Mt.set(n,t)}return new t},d=class{static render(t,e,r){if(!t||(Ge(t)||(t=Ke(t)),!t))return null;v.enter();try{return P.createComponent(t,e,r)}finally{v.leave()}}static build(t,e,r){v.enter();try{return P.build(t,e,r)}finally{v.leave()}}static rebuild(t,e,r){return P.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){P.setDirectives(t,e,r)}static createNode(t,e,r){return P.createNode(t,e,r)}static removeNode(t){P.removeNode(t)}static removeAll(t){P.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,b=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}),A=new I(100),$e=n=>{if(A.has(n)){let r=A.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=>{A.set(n,r)}).catch(()=>{A.delete(n)}),A.set(n,e),e},Je=n=>{if(!A.has(n))return null;let t=A.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=L({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return Ye({onCreated:n=>{if(this.src){if(this.layout){this.setLayoutRoots(b.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=b.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||b.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(b.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,M=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 M{constructor(t){super(t),this.currentKey=null,this.positions=new I(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 M{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 I(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=>L(n,mt);var gt="data-scroll-key",rr="["+gt+"]",Gt=(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 Gt(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 Gt(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=>{for(let t=0;t<n.length;t++){let e=n[t],r=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(r)||r.length===0)continue;let s=[];for(let o=0,i=r.length;o<i;o++){let a=r[o];a&&n.indexOf(a)===-1&&s.indexOf(a)===-1&&s.push(a)}n.splice(t+1,0,...s)}},sr=n=>/^class[\s{]/.test(Function.prototype.toString.call(n)),or=1500,Kt=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),ir=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.detachedParents=null,this.detachedPath=null,this.savedScroll=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let r=t.layout;if(r&&r.isUnit===!0&&typeof r.keepAlive=="boolean")return r.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}isDetached(){return this.detachedNodes!==null}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.detachedPath!==this.getPagePath()&&this.evict(),this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=sr(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||"")}getPagePath(){let e=(this.route||{}).path||"",r=e.indexOf("#");return r>-1?e.substring(0,r):e}getRootNodes(t){let e=[],r=ir(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 nr(e),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=Kt(),i=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||s()||Kt()-o>or||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);let s=new WeakMap;for(let o=0,i=e.length;o<i;o++){let a=e[o],l=a.parentNode;l&&(s.set(a,l),l.removeChild(a))}return this.detachedNodes=e,this.detachedParents=s,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.component,s=this.container;if(!r||r.rendered!==!0||!s||typeof s.appendChild!="function")return this.savedScroll=null,this.releaseComponent(),!1;let o=this.getRootNodes(r);for(let i=0,a=o.length;i<a;i++){let l=o[i],c=e?e.get(l):null;(c&&c.isConnected?c:s).appendChild(l)}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 ar=/(\/):[^/(]*?\?/g,lr=/\//g,cr=/(\?\/+\*?)/g,hr=/(:[^/?&($]+)/g,ur=/(\*)/g,dr=n=>n.replace(ar,t=>t.replace(lr,"(?:$|/)")),fr=n=>(n=n.replace(cr,"?/*"),n.replace(hr,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),pr=n=>n.replace(ur,".*"),mr=(n,t)=>n+=t[t.length-1]==="*"?"":"$",jt=n=>{if(!n)return"";let t=n;return t=dr(t),t=fr(t),t=pr(t),t=mr(t,n),t};var gr=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 y=0,H=u.length;y<H;y++){let N=u[y];if(!N)continue;let[_e,Oe=""]=N.split("="),Ct=(_e||"").trim();Ct&&o.push({key:Ct,value:(Oe||"").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}},yr=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,"/")},Sr=n=>{if(!n)return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)},xr=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 At{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-"+gr++,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=bt(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=yr(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&&Sr(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=xr(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 vr=n=>{let t=/\w\S*/;return n.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},wr=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(":"+wr(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),vr(t)),Tr=(n,t)=>(t!==""&&(n+=" - "+t),n),Yt=(n,t,e)=>t&&(t=Cr(n,t),Tr(t,e));var Rr=()=>typeof window<"u"?window.location:{},Pr=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.activeScrollGroups=new Set,this.scrollGroupsReady=new Set,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=Rr(),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.activeScrollGroups.add(o.groupId),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){this.activeScrollGroups.delete(t),this.lastScrollGroup===t&&(this.lastScrollGroup=null);let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,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.scrollGroupsReady=new Set(this.activeScrollGroups),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=Pr(this.path);if(s){this.scrollIntent={type:"hash",hash:s};return}t.scrollTo?(this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId},this.currentGroupId!==null&&this.currentGroupId!==void 0&&this.activeScrollGroups.add(this.currentGroupId)):t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,r=e&&this.scrollGroupsReady.has(t.groupId);if(this.lastScrollGroup=e?t.groupId:null,r){this.scrollToTarget(t.selector,t.groupId);return}typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let r=t.x||0,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)}findScrollTarget(t,e){if(typeof document>"u")return null;let r=this.findScopedScrollTarget(t,e);if(r)return r;let s=document.querySelectorAll(t);for(let o=0,i=s.length;o<i;o++){let a=s[o];if(a&&a.isConnected!==!1)return a}return null}findScopedScrollTarget(t,e){if(e==null||!this.switches)return null;let r=this.switches.get(e),s=r&&r[0],o=s&&s.controller&&s.controller.container;if(!o||o.nodeType!==1)return null;let i=o;for(let a=0;a<8;a++){let l=i.parentElement;if(!l||l===document.body||l===document.documentElement)break;let c=l.querySelector(t);if(c)return c;i=l}return null}readScrollTarget(t){let e=window.getComputedStyle(t),r=e.position==="sticky",s=r&&parseFloat(e.top)||0,o=(t.offsetWidth||0)>0||(t.offsetHeight||0)>0,i;if(r){let a=t.style.position;t.style.position="static",i=t.getBoundingClientRect().top+window.scrollY,t.style.position=a}else i=t.getBoundingClientRect().top+window.scrollY;return{sized:o,targetScroll:i-s}}scrollToTarget(t,e){if(typeof t!="string"||typeof document>"u")return;let r=c=>{window.scrollY>c&&window.scrollTo(0,Math.max(0,c))};if(typeof requestAnimationFrame>"u"){let c=this.findScrollTarget(t,e);if(c){let h=this.readScrollTarget(c);h.sized&&r(h.targetScroll)}return}let s=++this.scrollWaitToken,o=30,i=0,a=null,l=()=>{if(s!==this.scrollWaitToken)return;let c=this.findScrollTarget(t,e);if(c){let h=this.readScrollTarget(c);if(h.sized){if(a!==null&&Math.abs(a-h.targetScroll)<1){r(h.targetScroll);return}a=h.targetScroll}}if(++i<o){requestAnimationFrame(l);return}a!==null&&r(a)};requestAnimationFrame(l)}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}},C=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==="?"},wt=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=C.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 y=h.pathname+h.search+h.hash;a=y,l=h.hash||h.search?y: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()};Er(n,()=>Xt(n,t,r),e)};f.addType("manual-destroy",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Er=(n,t,e)=>{f.add(n,"manual-destroy",{ele:n,callBack:t,parent:e})};var G=(n,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(s=>{s&&G(n,t,s,r)});return}Ir(n,t,e,r)},Ir=(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=_r(n,s,o,r);E.watch(n,t,s,i)},_r=(n,t,e,r)=>typeof e=="object"?s=>{Dr(n,e,s)}:s=>{Lr(n,e,t,s,r)},ee=new WeakSet,Or=(n,t,e)=>{!n||!n.isUnit&&!n.isComponent||ee.has(e)||ee.add(e)},Lr=(n,t,e,r,s)=>{let o=t(r,n,s);switch(typeof o){case"object":if(o===null)break;Or(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}},Dr=(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 U=(n,t,e)=>{let r=T(e);G(n,r,t,e)};var re=(n,t,e)=>{t&&n.setAttribute("role",t)},Br=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(Br(c)),U(n,h,e)}else n.setAttribute(c,l)}};var se=(n,t,e)=>{if(!t)return;let r=k.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 kt=n=>n?n.getContext():null,oe=(n,t,e)=>{if(typeof t!="function")return;let r=kt(e),s=t(r);se(n,s,e)},ie=(n,t,e)=>{if(typeof t!="function")return;let r=kt(e);t(r)},ae=(n,t,e)=>{if(typeof t!="function"||!e)return;let r=kt(e),s=t(r);if(!s)return;let o=s[0];o&&(e.addContextBranch(o,s[1]),Mr(n,o,e))},Mr=(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;E.bind(n,r,s,o)};var at=(n,t,e)=>{G(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)),U(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 we=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;we(n.scopes)});var ke=(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),E.watch(n,r,s,h=>{if(d.removeAll(n),c&&we(c.scopes),!h||h.length<1)return;let u=[];for(let m=0,y=h.length;m<y;m++){let H=a?r.scope(l+m+"]"):null;H&&c&&c.scopes.push(H);let N=o(h[m],m,H,u);N!==null&&u.push(N)}return d.build(u,n,e)})};var Ce=(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)=>{Ur(n,t,e)},Ur=(n,t,e)=>{f.add(n,"destroyed",{ele:n,callBack:t,parent:e})};var Pe=(n,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,s=t.length;r<s;r++)_.setup(n,t[r],e);else _.setup(n,t,e)};f.addType("routes",n=>{if(!n)return!1;let t=n.route;t&&C.removeRoute(t)});var Ae=(n,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&be(n,o,e)}else be(n,t,e)},be=(n,t,e)=>{t.container=n,t.parent=e;let r=C.add(t);Hr(n,r)},Hr=(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;C.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=C.addSwitch(t);Nr(n,s)},Nr=(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",U).add("onState",at).add("animateIn",Zt).add("animateOut",te).add("watch",Pe).add("useParent",ue).add("useData",fe).add("useState",pe).add("getId",de).add("addState",me).add("addEvent",ge).add("map",Ce).add("for",ke).add("useContext",ie).add("addContext",ae).add("context",oe).add("role",re).add("aria",ne).add("route",Ae).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,Ot as e,L as f,d as g,Nt as h,wt as i,vt as j,C as k};
2
+ //# sourceMappingURL=chunk-5CC4UQ7G.js.map
@@ -0,0 +1,2 @@
1
+ import{b}from"./chunk-6YJAZHX6.js";import{a as I,b as At,c as Et,d as It,e as P,f as S,g as L}from"./chunk-HBL2JSVL.js";import{a as W,b as Rt}from"./chunk-VSCHM2ZB.js";import{a as Pt,c as E,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 g=[],K=0,lt=!1,Ue=typeof queueMicrotask=="function"?queueMicrotask:n=>Promise.resolve().then(n),He=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||n.container||null},Ne=n=>{n._mountPending=!1;try{n.afterMount()}catch(t){console.error("Error in afterMount:",t)}},Lt=()=>{lt=!1;let n=g;if(n.length===0)return;g=[];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=He(s);if(o&&o.isConnected===!0){Ne(s);continue}t.push(s)}t.length&&(g=g.length?t.concat(g):t),g.length&&K===0&&g.length!==t.length&&ct()},ct=()=>{lt||(lt=!0,Ue(Lt))},v={add(n){n._mountPending!==!0&&(n._mountPending=!0,g.push(n))},enter(){K++},leave(){--K>0||(K=0,g.length&&ct())},schedule(){g.length&&ct()},flush(){Lt()},get size(){return g.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 We=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-"+We++,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 _=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&&b.remove(o.targetId,o.action,o.token)}}restore(t){b.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=b.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){_.resume(this,t)}_refreshData(){_.refresh(this)}_refreshContextData(){_.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=b.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)),b.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"},Ot=(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]=Ot(i,a)}return t},qe=n=>ht(n,{}),Fe=0,Dt=(n,t)=>{class e extends n{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Fe++,e},O=(n,t=x)=>{n||(n={});let e,r=typeof n;return r==="object"&&n.render?(e=qe(n),Dt(t,e)):(e={render:r==="function"?n:()=>n},Dt(t,e))};var ut=(n,t)=>({attr:n,directive:t});var k=(n,t)=>({key:n,value:t});var Bt=(n,t,e,r)=>({tag:n,attr:t,directives:e,children:r});var Mt=null,Ge=()=>Mt||(Mt=F.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,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,L.getWatcherSettings(r,bt(e))),Ge()))}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(L.isWatching(a)){this.setTextAsWatcher(s,c,a);continue}i.push(a);continue}if(h==="function"){let u=a,m=function(y){u.call(this,y,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 Bt(o,r,s,i)}};var D=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 Ke=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 D{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"&&Ke(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=w.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 ze=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),Qe=/[&<>"]/,dt=n=>{let t=typeof n=="string"?n:String(n);return Qe.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t},B=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 ze.has(t)?"<"+t+" "+o+" />":"<"+t+" "+o+">"+s+r+"</"+t+">"}static createText(t){return dt(t)}static createComment(t){return"<!-- "+t+" -->"}};var Y=class extends D{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=w.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 B.createText(o)}else if(r==="comment"){let s=t.attr[0],o=s?s.value:"";return B.createComment(o)}return B.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 A=$.setup(),je=n=>typeof n=="object"&&n.isUnit===!0,Ut=new WeakMap,Ve=n=>{let t=Ut.get(n);if(!t){if(t=O(n),!t)return null;Ut.set(n,t)}return new t},d=class{static render(t,e,r){if(!t||(je(t)||(t=Ve(t)),!t))return null;v.enter();try{return A.createComponent(t,e,r)}finally{v.leave()}}static build(t,e,r){v.enter();try{return A.build(t,e,r)}finally{v.leave()}}static rebuild(t,e,r){return A.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){A.setDirectives(t,e,r)}static createNode(t,e,r){return A.createNode(t,e,r)}static removeNode(t){A.removeNode(t)}static removeAll(t){A.removeAll(t)}};Rt.augment({buildLayout(n,t,e){d.build(n,t,e)}});var ft=[],Ye=n=>ft.indexOf(n)!==-1,$e=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=$e({load:r,src:t}),d.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{Ye(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 Xe=n=>n?typeof n?.prototype?.constructor=="function":!1,C=class{static process(t,e){let r=t.default;return r?e.callback?e.callback(r):(Xe(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 Ze=n=>({tag:"comment",textContent:"import placeholder",onCreated:n.onCreated}),T=new I(100),Ht=n=>{if(T.has(n)){let r=T.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=>{T.set(n,r)}).catch(()=>{T.delete(n)}),T.set(n,e),e},Nt=n=>{if(!T.has(n))return null;let t=T.get(n);return t&&typeof t.then=="function"?null:t||null},Wt=n=>{let t=typeof n;if(t!=="string"&&t!=="function")return null;if(Nt(n))return Promise.resolve(T.get(n));let e;try{e=Ht(n)}catch{return null}return e.catch(()=>null)},pt=n=>{for(let t=0,e=n.length;t<e;t++){let r=n[t];r&&d.removeNode(r)}},qt=O({declareProps(){this.loaded=!1,this.errorRoot=null,this.loadingRoots=null,this.generation=0},render(){return Ze({onCreated:n=>{if(this.src){if(this.layout){this.setLayoutRoots(C.renderNodes(this.layout,this.panel,this.parent));return}if(this.depends){this.renderLoading(n),new J(()=>{this.loadAndRender(n)}).addFiles(this.depends);return}this.loadAndRender(n)}}})},loadAndRender(n){let t=this.generation,e=Nt(this.src);if(e){this.renderModule(n,e);return}this.renderLoading(n),X.load(Ht(this.src),r=>{t===this.generation&&this.renderModule(n,r)},r=>{t===this.generation&&(this.loaded=!1,this.removeLoadingLayout(),this.renderError(n,r))})},renderLoading(n){let t=this.loading;if(!t||this.loadingRoots)return;let e=typeof t=="function"?t():t;e&&(this.loadingRoots=C.renderNodes(e,n,this.parent))},removeLoadingLayout(){let n=this.loadingRoots;return n?(this.loadingRoots=null,pt(n),!0):!1},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=C.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&&(pt(this.errorRoots||[this.errorRoot]),this.errorRoot=null,this.errorRoots=null)},renderModule(n,t){this.loaded=!0;let e=this.layout||C.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(C.renderNodes(e,n,this.parent)),this.removeLoadingLayout()&&typeof this.onReplaceLoading=="function"&&this.onReplaceLoading(this.layoutRoots,e),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.removeLoadingLayout(),this.layoutRoot&&(pt(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Ft=n=>{let t=typeof n;return(t==="string"||t==="function"||n instanceof Promise)&&(n={src:n}),new qt(n)};var tr=0,M=class{constructor(t){this.router=t,this.locationId="base-app-router-"+tr++,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 er=0,rr=()=>Date.now().toString(36)+"-"+(er++).toString(36)+"-"+Math.random().toString(36).substring(2,8),Kt=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,Gt=()=>{Kt&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let n=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(n,t)}))},Z=class extends M{constructor(t){super(t),this.currentKey=null,this.positions=new I(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"),Kt&&(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&&Gt()}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)),Gt()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:rr(),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 M{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 mt=5,nr=200,nt=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new I(nr),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:mt}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 gt=class extends x{getChildScope(){return this.parent}},zt=n=>O(n,gt);var yt="data-scroll-key",sr="["+yt+"]",Qt=(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(yt);o!==null&&t(s,o);let i=s.querySelectorAll(sr);for(let a=0,l=i.length;a<l;a++){let c=i[a];t(c,c.getAttribute(yt))}}},St=n=>{let t=null;return Qt(n,(e,r)=>{let s=e.scrollTop||0,o=e.scrollLeft||0;s===0&&o===0||(t=t||{},t[r]=[s,o])}),t},xt=(n,t)=>{if(!t)return!0;let e={},r=0;for(let s in t)e[s]=!0,r++;return Qt(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 or=n=>{for(let t=0;t<n.length;t++){let e=n[t],r=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(r)||r.length===0)continue;let s=[];for(let o=0,i=r.length;o<i;o++){let a=r[o];a&&n.indexOf(a)===-1&&s.indexOf(a)===-1&&s.push(a)}n.splice(t+1,0,...s)}},ir=n=>/^class[\s{]/.test(Function.prototype.toString.call(n)),ar=1500,jt=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),lr=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},vt=(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.detachedParents=null,this.detachedPath=null,this.savedScroll=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let r=t.layout;if(r&&r.isUnit===!0&&typeof r.keepAlive=="boolean")return r.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}isDetached(){return this.detachedNodes!==null}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.detachedPath!==this.getPagePath()&&this.evict(),this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=ir(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(zt(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)&&vt(e,"onActivate",[this.params,{restored:!1}])}getScrollKey(){let t=this.route||{};return(t.routeId||"")+"|"+(t.path||"")}getPagePath(){let e=(this.route||{}).path||"",r=e.indexOf("#");return r>-1?e.substring(0,r):e}getRootNodes(t){let e=[],r=lr(t);r&&e.push(r);let s=t.layoutRoots||(t.layoutRoot?[t.layoutRoot]:null),o=t.errorRoots||(t.errorRoot?[t.errorRoot]:null),i=t.loadingRoots||null,a=[s,o,i];for(let l=0;l<3;l++){let c=a[l];if(c)for(let h=0,u=c.length;h<u;h++){let m=c[h];m&&e.indexOf(m)===-1&&e.push(m)}}return or(e),e}callPageHook(t,e){let r=this.component;if(!r)return;vt(r,t,e);let s=r.layout;s&&s!==r&&s.isUnit===!0&&vt(s,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,s=()=>xt(this.getRootNodes(r),t);if(s()||typeof requestAnimationFrame>"u")return;let o=jt(),i=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||s()||jt()-o>ar||requestAnimationFrame(i)};requestAnimationFrame(i)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null,!(!t||!this.component)&&xt(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=St(e);this.savedScroll=r,this.pageCache.saveScroll(this.getScrollKey(),r);let s=new WeakMap;for(let o=0,i=e.length;o<i;o++){let a=e[o],l=a.parentNode;l&&(s.set(a,l),l.removeChild(a))}return this.detachedNodes=e,this.detachedParents=s,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.component,s=this.container;if(!r||r.rendered!==!0||!s||typeof s.appendChild!="function")return this.savedScroll=null,this.releaseComponent(),!1;let o=this.getRootNodes(r);for(let i=0,a=o.length;i<a;i++){let l=o[i],c=e?e.get(l):null;(c&&c.isConnected?c:s).appendChild(l)}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(),St(this.getRootNodes(e)))}this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var Vt=n=>{if(!n.length)return null;let t={};for(let e=0,r=n.length;e<r;e++)t[n[e]]=null;return t},Yt=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 cr=/(\/):[^/(]*?\?/g,hr=/\//g,ur=/(\?\/+\*?)/g,dr=/(:[^/?&($]+)/g,fr=/(\*)/g,pr=n=>n.replace(cr,t=>t.replace(hr,"(?:$|/)")),mr=n=>(n=n.replace(ur,"?/*"),n.replace(dr,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),gr=n=>n.replace(fr,".*"),yr=(n,t)=>n+=t[t.length-1]==="*"?"":"$",$t=n=>{if(!n)return"";let t=n;return t=pr(t),t=mr(t),t=gr(t),t=yr(t,n),t};var Sr=0,Jt=(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 y=0,H=u.length;y<H;y++){let N=u[y];if(!N)continue;let[Be,Me=""]=N.split("="),Tt=(Be||"").trim();Tt&&o.push({key:Tt,value:(Me||"").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}},Xt=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,"/")},xr=n=>{if(!n)return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)},vr=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 Et{constructor(t,e,r=null){let s=t.baseUri,i=Jt(s,t.rawUri).uriPath,a=Yt(i),l=Vt(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,this.importSrc=null}setupRoute(t){this.routeId=t.id||"bs-rte-"+Sr++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=Jt(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=$t(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;if(!e)return null;let r=e&&typeof e=="object"&&!(e instanceof Promise)?e.src:e;return this.importSrc=typeof r=="string"||typeof r=="function"?r:null,Ft(e)}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=Xt(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}matches(t){return(this.uriQuery||/$^/).test(Xt(t))&&this.matchConditions(t)}prefetch(){let t=this.importSrc;return t?Wt(t):null}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&xr(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=vr(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 kr=n=>{let t=/\w\S*/;return n.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},wr=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Cr=(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(":"+wr(r),"gi");n=n.replace(s,()=>e[r])}return n},Tr=(n,t)=>t&&(typeof t=="function"&&(t=t(n.stage)),t=Cr(t,n),kr(t)),Rr=(n,t)=>(t!==""&&(n+=" - "+t),n),Zt=(n,t,e)=>t&&(t=Tr(n,t),Rr(t,e));var Pr=()=>typeof window<"u"?window.location:{},br=n=>{if(!n)return"";let t=n.indexOf("#");return t>-1?n.substring(t+1):""},Ar=1500,it=["wheel","touchstart","keydown","pointerdown"],te=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),kt=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.activeScrollGroups=new Set,this.scrollGroupsReady=new Set,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=mt,this.pageCache=new nt(this),this.history=null,this.callBackLink=null,this.location=Pr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new It({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.activeScrollGroups.add(o.groupId),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){this.activeScrollGroups.delete(t),this.lastScrollGroup===t&&(this.lastScrollGroup=null);let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,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}prefetch(t){if(typeof t!="string"||!t)return Promise.resolve([]);let e=this.getLinkPath(t);if(e===null)return Promise.resolve([]);let r=this.createURI(e),s=[],o=a=>{if(!a||!a.controller||typeof a.matches!="function"||!a.matches(r))return!1;let l=a.prefetch();return l&&s.push(l),!0},i=this.routes;for(let a=0,l=i.length;a<l;a++)o(i[a]);for(let a of this.switches.values())for(let l=0,c=a.length;l<c&&!o(a[l]);l++);return Promise.all(s)}updatePath(){let t=this.getPath();this.data.path=t}updateTitle(t){if(!t||!t.title)return this;let e=t.title;return document.title=Zt(t,e,this.title),this}checkActiveRoutes(t,e){t=t||this.getPath(),t!==this.path&&(this.lastPath=this.path),this.path=t,this.updatePath(),this.scrollIntent=null,this.scrollGroupsReady=new Set(this.activeScrollGroups),this.scrollWaitToken++;let r=this.pageCache;r.historyNavigation=e===!0;let 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=br(this.path);if(s){this.scrollIntent={type:"hash",hash:s};return}t.scrollTo?(this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId},this.currentGroupId!==null&&this.currentGroupId!==void 0&&this.activeScrollGroups.add(this.currentGroupId)):t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,r=e&&this.scrollGroupsReady.has(t.groupId);if(this.lastScrollGroup=e?t.groupId:null,r){this.scrollToTarget(t.selector,t.groupId);return}typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let r=t.x||0,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=te(),l=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,s)||te()-a>=Ar){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)}findScrollTarget(t,e){if(typeof document>"u")return null;let r=this.findScopedScrollTarget(t,e);if(r)return r;let s=document.querySelectorAll(t);for(let o=0,i=s.length;o<i;o++){let a=s[o];if(a&&a.isConnected!==!1)return a}return null}findScopedScrollTarget(t,e){if(e==null||!this.switches)return null;let r=this.switches.get(e),s=r&&r[0],o=s&&s.controller&&s.controller.container;if(!o||o.nodeType!==1)return null;let i=o;for(let a=0;a<8;a++){let l=i.parentElement;if(!l||l===document.body||l===document.documentElement)break;let c=l.querySelector(t);if(c)return c;i=l}return null}readScrollTarget(t){let e=window.getComputedStyle(t),r=e.position==="sticky",s=r&&parseFloat(e.top)||0,o=(t.offsetWidth||0)>0||(t.offsetHeight||0)>0,i;if(r){let a=t.style.position;t.style.position="static",i=t.getBoundingClientRect().top+window.scrollY,t.style.position=a}else i=t.getBoundingClientRect().top+window.scrollY;return{sized:o,targetScroll:i-s}}scrollToTarget(t,e){if(typeof t!="string"||typeof document>"u")return;let r=c=>{window.scrollY>c&&window.scrollTo(0,Math.max(0,c))};if(typeof requestAnimationFrame>"u"){let c=this.findScrollTarget(t,e);if(c){let h=this.readScrollTarget(c);h.sized&&r(h.targetScroll)}return}let s=++this.scrollWaitToken,o=30,i=0,a=null,l=()=>{if(s!==this.scrollWaitToken)return;let c=this.findScrollTarget(t,e);if(c){let h=this.readScrollTarget(c);if(h.sized){if(a!==null&&Math.abs(a-h.targetScroll)<1){r(h.targetScroll);return}a=h.targetScroll}}if(++i<o){requestAnimationFrame(l);return}a!==null&&r(a)};requestAnimationFrame(l)}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}},R=new kt;var ee=(n,t)=>({attr:n,value:t}),Er=(n,t)=>{if(!t.startsWith(n))return!1;let e=t[n.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},wt=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=R.data,o=[];t&&typeof t=="object"&&o.push(ee("href",t)),e&&typeof e=="object"&&o.push(ee("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 y=h.pathname+h.search+h.hash;a=y,l=h.hash||h.search?y:h.pathname}let m=r?c===a:Er(l,c);this.update(m)}}),o}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var re=(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))},ne=(n,t,e)=>{re(n,t)},se=(n,t,e)=>{let r=()=>{n&&n.remove&&n.remove()};Ir(n,()=>re(n,t,r),e)};f.addType("manual-destroy",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Ir=(n,t,e)=>{f.add(n,"manual-destroy",{ele:n,callBack:t,parent:e})};var G=(n,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(s=>{s&&G(n,t,s,r)});return}Lr(n,t,e,r)},Lr=(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=_r(n,s,o,r);E.watch(n,t,s,i)},_r=(n,t,e,r)=>typeof e=="object"?s=>{Br(n,e,s)}:s=>{Dr(n,e,t,s,r)},oe=new WeakSet,Or=(n,t,e)=>{!n||!n.isUnit&&!n.isComponent||oe.has(e)||oe.add(e)},Dr=(n,t,e,r,s)=>{let o=t(r,n,s);switch(typeof o){case"object":if(o===null)break;Or(o,e,n),d.rebuild(o,n,s);break;case"string":let i=Pt(n);if(i!=="textContent"){n.setAttribute(i,o);break}q.addHtml(n,o);break}},Br=(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 U=(n,t,e)=>{let r=P(e);G(n,r,t,e)};var ie=(n,t,e)=>{t&&n.setAttribute("role",t)},Mr=n=>(t,e)=>{let r=t?"true":"false";e.setAttribute(n,r)},ae=(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(Mr(c)),U(n,h,e)}else n.setAttribute(c,l)}};var le=(n,t,e)=>{if(!t)return;let r=w.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,ce=(n,t,e)=>{if(typeof t!="function")return;let r=Ct(e),s=t(r);le(n,s,e)},he=(n,t,e)=>{if(typeof t!="function")return;let r=Ct(e);t(r)},ue=(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]),Ur(n,o,e))},Ur=(n,t,e)=>{f.add(n,"context",{branch:t,parent:e})};var de=(n,t,e)=>{};var fe=(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 pe=(n,t,e)=>{},me=(n,t,e)=>{if(!t||!e)return;let r=t(e,n);r&&d.build(r,n,e)},ge=(n,t,e)=>{if(!t||!e)return;let r=e.getId(t);n.id=r},ye=(n,t,e)=>{if(!t||!e)return;let r=t(e.data,n);r&&d.build(r,n,e)},Se=(n,t,e)=>{if(!t||!e)return;let r=t(e.state,n);r&&d.build(r,n,e)},xe=(n,t,e)=>{if(!t||!e)return;let r=e.state,s=t(r);if(!e.state){e.setStateHelper(s);return}e.addState(s)},ve=(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 ke=(n,t,e)=>{let r,s,o;if(typeof t=="string"){if(r=P(e),!r)return;s=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let i=P(e);if(!i)return;r=i,s=t[0],o=t[1]}else[r,s,o]=t;E.bind(n,r,s,o)};var at=(n,t,e)=>{G(n,e.state,t,e)};var we=n=>(t,e)=>{let[r,s,o="active"]=n,i=t===s?o:"";e.dataset[r]=i},Ce=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(we(s)),U(n,o,e)},Te=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(we(s)),at(n,o,e)};var Re=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;Re(n.scopes)});var Pe=(n,t,e)=>{let r,s,o,i;if(typeof t[0]=="string"||t.length<3){let h=P(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),E.watch(n,r,s,h=>{if(d.removeAll(n),c&&Re(c.scopes),!h||h.length<1)return;let u=[];for(let m=0,y=h.length;m<y;m++){let H=a?r.scope(l+m+"]"):null;H&&c&&c.scopes.push(H);let N=o(h[m],m,H,u);N!==null&&u.push(N)}return d.build(u,n,e)})};var be=(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 Ae=(n,t,e)=>{t(n,e)};f.addType("destroyed",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Ee=(n,t,e)=>{Hr(n,t,e)},Hr=(n,t,e)=>{f.add(n,"destroyed",{ele:n,callBack:t,parent:e})};var Ie=(n,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,s=t.length;r<s;r++)L.setup(n,t[r],e);else L.setup(n,t,e)};f.addType("routes",n=>{if(!n)return!1;let t=n.route;t&&R.removeRoute(t)});var _e=(n,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&Le(n,o,e)}else Le(n,t,e)},Le=(n,t,e)=>{t.container=n,t.parent=e;let r=R.add(t);Nr(n,r)},Nr=(n,t)=>{f.add(n,"routes",{route:t})};var Oe=(n,t,e)=>{};f.addType("switch",n=>{if(!n)return!1;let t=n.id;R.removeSwitch(t)});var De=(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=R.addSwitch(t);Wr(n,s)},Wr=(n,t)=>{f.add(n,"switch",{id:t})};F.add("cache",pe).add("onCreated",Ae).add("onDestroyed",Ee).add("bind",ke).add("data",de).add("state",Oe).add("onSet",U).add("onState",at).add("animateIn",ne).add("animateOut",se).add("watch",Ie).add("useParent",me).add("useData",ye).add("useState",Se).add("getId",ge).add("addState",xe).add("addEvent",ve).add("map",be).add("for",Pe).add("useContext",he).add("addContext",ue).add("context",ce).add("role",ie).add("aria",ae).add("route",_e).add("debug",fe).add("dataSet",Ce).add("dataStateSet",Te).add("switch",De);export{F as a,z as b,x as c,_t as d,Ot as e,O as f,d as g,Ft as h,wt as i,kt as j,R as k};
2
+ //# sourceMappingURL=chunk-I6YSM7G4.js.map
@@ -0,0 +1,2 @@
1
+ import{b as R}from"./chunk-6YJAZHX6.js";import{a as I,b as bt,c as At,d as Et,e as T,f as S,g as _}from"./chunk-HBL2JSVL.js";import{a as W,b as Tt}from"./chunk-VSCHM2ZB.js";import{a as Rt,c as E,d as Pt,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 g=[],K=0,lt=!1,Le=typeof queueMicrotask=="function"?queueMicrotask:n=>Promise.resolve().then(n),De=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=g;if(n.length===0)return;g=[];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=De(s);if(o&&o.isConnected===!0){Be(s);continue}t.push(s)}t.length&&(g=g.length?t.concat(g):t),g.length&&K===0&&g.length!==t.length&&ct()},ct=()=>{lt||(lt=!0,Le(It))},v={add(n){n._mountPending!==!0&&(n._mountPending=!0,g.push(n))},enter(){K++},leave(){--K>0||(K=0,g.length&&ct())},schedule(){g.length&&ct()},flush(){It()},get size(){return g.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 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 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){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=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"},Ot=(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]=Ot(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},L=(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 w=(n,t)=>({key:n,value:t});var Dt=(n,t,e,r)=>({tag:n,attr:t,directives:e,children:r});var Bt=null,Ne=()=>Bt||(Bt=F.get("watch")),k=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(w("innerHTML",e)),!0):!1}static setTextAsWatcher(t,e,r){t.push(ut(w(e,_.getWatcherSettings(r,Pt(e))),Ne()))}static setButtonType(t,e,r){if(t==="button"){let s=e.type||"button";r.push(w("type",s))}}static parse(t,e){let r=[],s=[],o=t.tag||"div";o==="button"&&r.push(w("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(w(c,a),l));continue}let h=typeof a;if(h==="object"){if(_.isWatching(a)){this.setTextAsWatcher(s,c,a);continue}i.push(a);continue}if(h==="function"){let u=a,m=function(y){u.call(this,y,e)};m.originalCallback=u,r.push(w(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(w("innerHTML",a));continue}r.push(w(c,a))}return Dt(o,r,s,i)}};var D=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 D{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=k.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},B=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 D{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=k.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 B.createText(o)}else if(r==="comment"){let s=t.attr[0],o=s?s.value:"";return B.createComment(o)}return B.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 P=$.setup(),Ge=n=>typeof n=="object"&&n.isUnit===!0,Mt=new WeakMap,Ke=n=>{let t=Mt.get(n);if(!t){if(t=L(n),!t)return null;Mt.set(n,t)}return new t},d=class{static render(t,e,r){if(!t||(Ge(t)||(t=Ke(t)),!t))return null;v.enter();try{return P.createComponent(t,e,r)}finally{v.leave()}}static build(t,e,r){v.enter();try{return P.build(t,e,r)}finally{v.leave()}}static rebuild(t,e,r){return P.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){P.setDirectives(t,e,r)}static createNode(t,e,r){return P.createNode(t,e,r)}static removeNode(t){P.removeNode(t)}static removeAll(t){P.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,b=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}),A=new I(100),$e=n=>{if(A.has(n)){let r=A.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=>{A.set(n,r)}).catch(()=>{A.delete(n)}),A.set(n,e),e},Je=n=>{if(!A.has(n))return null;let t=A.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=L({declareProps(){this.loaded=!1,this.errorRoot=null,this.generation=0},render(){return Ye({onCreated:n=>{if(this.src){if(this.layout){this.setLayoutRoots(b.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=b.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||b.process(t,{callback:this.callback,route:this.route,persist:this.persist});this.layout=e,this.setLayoutRoots(b.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,M=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 M{constructor(t){super(t),this.currentKey=null,this.positions=new I(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 M{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 I(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=>L(n,mt);var gt="data-scroll-key",rr="["+gt+"]",Gt=(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 Gt(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 Gt(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=>{for(let t=0;t<n.length;t++){let e=n[t],r=e&&e.nodeType===8?e._prevNodes:null;if(!Array.isArray(r)||r.length===0)continue;let s=[];for(let o=0,i=r.length;o<i;o++){let a=r[o];a&&n.indexOf(a)===-1&&s.indexOf(a)===-1&&s.push(a)}n.splice(t+1,0,...s)}},sr=n=>/^class[\s{]/.test(Function.prototype.toString.call(n)),or=1500,Kt=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),ir=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.detachedParents=null,this.detachedPath=null,this.savedScroll=null,this.params=null,this.scrollToken=0}isKeepAlive(t){if(this.keepAlive!==null)return this.keepAlive;if(t=t||this.component,t){if(typeof t.keepAlive=="boolean")return t.keepAlive;let r=t.layout;if(r&&r.isUnit===!0&&typeof r.keepAlive=="boolean")return r.keepAlive}let e=this.pageCache;return e!==null&&e.isEnabled()}isDetached(){return this.detachedNodes!==null}focus(t){if(this.params=t,this.setup===!1){if(this.detachedNodes!==null&&this.detachedPath!==this.getPagePath()&&this.evict(),this.detachedNodes!==null&&this.reattach()){this.update(t),this.restoreDetachedScroll(),this.callPageHook("onActivate",[t,{restored:!0}]);return}this.route&&typeof this.route.flushPending=="function"&&this.route.flushPending(),this.create(),this.update(t),this.afterCreate(t);return}this.update(t)}setupTemplate(){let e=typeof this.template;e==="function"?this.initializeComponent():e==="object"&&this.initializeTemplateObject(),this.hasTemplate=!0}initializeComponent(){let t=this.template;this.template=sr(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||"")}getPagePath(){let e=(this.route||{}).path||"",r=e.indexOf("#");return r>-1?e.substring(0,r):e}getRootNodes(t){let e=[],r=ir(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 nr(e),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=Kt(),i=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||s()||Kt()-o>or||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);let s=new WeakMap;for(let o=0,i=e.length;o<i;o++){let a=e[o],l=a.parentNode;l&&(s.set(a,l),l.removeChild(a))}return this.detachedNodes=e,this.detachedParents=s,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.component,s=this.container;if(!r||r.rendered!==!0||!s||typeof s.appendChild!="function")return this.savedScroll=null,this.releaseComponent(),!1;let o=this.getRootNodes(r);for(let i=0,a=o.length;i<a;i++){let l=o[i],c=e?e.get(l):null;(c&&c.isConnected?c:s).appendChild(l)}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 ar=/(\/):[^/(]*?\?/g,lr=/\//g,cr=/(\?\/+\*?)/g,hr=/(:[^/?&($]+)/g,ur=/(\*)/g,dr=n=>n.replace(ar,t=>t.replace(lr,"(?:$|/)")),fr=n=>(n=n.replace(cr,"?/*"),n.replace(hr,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),pr=n=>n.replace(ur,".*"),mr=(n,t)=>n+=t[t.length-1]==="*"?"":"$",jt=n=>{if(!n)return"";let t=n;return t=dr(t),t=fr(t),t=pr(t),t=mr(t,n),t};var gr=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 y=0,H=u.length;y<H;y++){let N=u[y];if(!N)continue;let[_e,Oe=""]=N.split("="),Ct=(_e||"").trim();Ct&&o.push({key:Ct,value:(Oe||"").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}},yr=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,"/")},Sr=n=>{if(!n)return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)},xr=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 At{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-"+gr++,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=bt(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=yr(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&&Sr(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=xr(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 vr=n=>{let t=/\w\S*/;return n.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},wr=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(":"+wr(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),vr(t)),Tr=(n,t)=>(t!==""&&(n+=" - "+t),n),Yt=(n,t,e)=>t&&(t=Cr(n,t),Tr(t,e));var Rr=()=>typeof window<"u"?window.location:{},Pr=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.activeScrollGroups=new Set,this.scrollGroupsReady=new Set,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=Rr(),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.activeScrollGroups.add(o.groupId),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){this.activeScrollGroups.delete(t),this.lastScrollGroup===t&&(this.lastScrollGroup=null);let e=this.switches.get(t);if(this.switches.delete(t),!!e)for(let r=0,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.scrollGroupsReady=new Set(this.activeScrollGroups),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=Pr(this.path);if(s){this.scrollIntent={type:"hash",hash:s};return}t.scrollTo?(this.scrollIntent={type:"target",selector:t.scrollTo,groupId:this.currentGroupId},this.currentGroupId!==null&&this.currentGroupId!==void 0&&this.activeScrollGroups.add(this.currentGroupId)):t.preventScroll!==!0&&!this.scrollIntent&&(this.scrollIntent={type:"top"})}applyScrollIntent(){let t=this.scrollIntent;if(this.scrollIntent=null,!t)return;if(t.type==="hash"){this.lastScrollGroup=null,this.scrollToHash(t.hash);return}if(t.type==="top"){this.lastScrollGroup=null,this.checkToScroll(),this.reassertScrollTop();return}if(t.type!=="target")return;let e=t.groupId!==null&&t.groupId!==void 0,r=e&&this.scrollGroupsReady.has(t.groupId);if(this.lastScrollGroup=e?t.groupId:null,r){this.scrollToTarget(t.selector,t.groupId);return}typeof window<"u"&&window.scrollTo(0,0),this.reassertScrollTop()}reassertScrollTop(){if(typeof window>"u"||typeof requestAnimationFrame>"u")return;let t=++this.scrollWaitToken;requestAnimationFrame(()=>{t===this.scrollWaitToken&&(window.scrollY>0||window.pageYOffset>0)&&window.scrollTo(0,0)})}restoreScrollPosition(t){if(!t||typeof window>"u")return;let e=++this.scrollWaitToken;this.clearScrollWait();let r=t.x||0,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)}findScrollTarget(t,e){if(typeof document>"u")return null;let r=this.findScopedScrollTarget(t,e);if(r)return r;let s=document.querySelectorAll(t);for(let o=0,i=s.length;o<i;o++){let a=s[o];if(a&&a.isConnected!==!1)return a}return null}findScopedScrollTarget(t,e){if(e==null||!this.switches)return null;let r=this.switches.get(e),s=r&&r[0],o=s&&s.controller&&s.controller.container;if(!o||o.nodeType!==1)return null;let i=o;for(let a=0;a<8;a++){let l=i.parentElement;if(!l||l===document.body||l===document.documentElement)break;let c=l.querySelector(t);if(c)return c;i=l}return null}readScrollTarget(t){let e=window.getComputedStyle(t),r=e.position==="sticky",s=r&&parseFloat(e.top)||0,o=(t.offsetWidth||0)>0||(t.offsetHeight||0)>0,i;if(r){let a=t.style.position;t.style.position="static",i=t.getBoundingClientRect().top+window.scrollY,t.style.position=a}else i=t.getBoundingClientRect().top+window.scrollY;return{sized:o,targetScroll:i-s}}scrollToTarget(t,e){if(typeof t!="string"||typeof document>"u")return;let r=c=>{window.scrollY>c&&window.scrollTo(0,Math.max(0,c))};if(typeof requestAnimationFrame>"u"){let c=this.findScrollTarget(t,e);if(c){let h=this.readScrollTarget(c);h.sized&&r(h.targetScroll)}return}let s=++this.scrollWaitToken,o=30,i=0,a=null,l=()=>{if(s!==this.scrollWaitToken)return;let c=this.findScrollTarget(t,e);if(c){let h=this.readScrollTarget(c);if(h.sized){if(a!==null&&Math.abs(a-h.targetScroll)<1){r(h.targetScroll);return}a=h.targetScroll}}if(++i<o){requestAnimationFrame(l);return}a!==null&&r(a)};requestAnimationFrame(l)}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}},C=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==="?"},wt=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=C.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 y=h.pathname+h.search+h.hash;a=y,l=h.hash||h.search?y: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()};Er(n,()=>Xt(n,t,r),e)};f.addType("manual-destroy",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Er=(n,t,e)=>{f.add(n,"manual-destroy",{ele:n,callBack:t,parent:e})};var G=(n,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(s=>{s&&G(n,t,s,r)});return}Ir(n,t,e,r)},Ir=(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=_r(n,s,o,r);E.watch(n,t,s,i)},_r=(n,t,e,r)=>typeof e=="object"?s=>{Dr(n,e,s)}:s=>{Lr(n,e,t,s,r)},ee=new WeakSet,Or=(n,t,e)=>{!n||!n.isUnit&&!n.isComponent||ee.has(e)||ee.add(e)},Lr=(n,t,e,r,s)=>{let o=t(r,n,s);switch(typeof o){case"object":if(o===null)break;Or(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}},Dr=(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 U=(n,t,e)=>{let r=T(e);G(n,r,t,e)};var re=(n,t,e)=>{t&&n.setAttribute("role",t)},Br=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(Br(c)),U(n,h,e)}else n.setAttribute(c,l)}};var se=(n,t,e)=>{if(!t)return;let r=k.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 kt=n=>n?n.getContext():null,oe=(n,t,e)=>{if(typeof t!="function")return;let r=kt(e),s=t(r);se(n,s,e)},ie=(n,t,e)=>{if(typeof t!="function")return;let r=kt(e);t(r)},ae=(n,t,e)=>{if(typeof t!="function"||!e)return;let r=kt(e),s=t(r);if(!s)return;let o=s[0];o&&(e.addContextBranch(o,s[1]),Mr(n,o,e))},Mr=(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;E.bind(n,r,s,o)};var at=(n,t,e)=>{G(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)),U(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 we=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;we(n.scopes)});var ke=(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),E.watch(n,r,s,h=>{if(d.removeAll(n),c&&we(c.scopes),!h||h.length<1)return;let u=[];for(let m=0,y=h.length;m<y;m++){let H=a?r.scope(l+m+"]"):null;H&&c&&c.scopes.push(H);let N=o(h[m],m,H,u);N!==null&&u.push(N)}return d.build(u,n,e)})};var Ce=(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)=>{Ur(n,t,e)},Ur=(n,t,e)=>{f.add(n,"destroyed",{ele:n,callBack:t,parent:e})};var Pe=(n,t,e)=>{if(t)if(Array.isArray(t)&&typeof t[0]!="string")for(let r=0,s=t.length;r<s;r++)_.setup(n,t[r],e);else _.setup(n,t,e)};f.addType("routes",n=>{if(!n)return!1;let t=n.route;t&&C.removeRoute(t)});var Ae=(n,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&be(n,o,e)}else be(n,t,e)},be=(n,t,e)=>{t.container=n,t.parent=e;let r=C.add(t);Hr(n,r)},Hr=(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;C.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=C.addSwitch(t);Nr(n,s)},Nr=(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",U).add("onState",at).add("animateIn",Zt).add("animateOut",te).add("watch",Pe).add("useParent",ue).add("useData",fe).add("useState",pe).add("getId",de).add("addState",me).add("addEvent",ge).add("map",Ce).add("for",ke).add("useContext",ie).add("addContext",ae).add("context",oe).add("role",re).add("aria",ne).add("route",Ae).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,Ot as e,L as f,d as g,Nt as h,wt as i,vt as j,C as k};
2
+ //# sourceMappingURL=chunk-NLDTREN3.js.map
@@ -1,2 +1,2 @@
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-HH7TRCMU.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};
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-I6YSM7G4.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{i as r,j as o,k as t}from"../chunks/chunk-HH7TRCMU.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};
1
+ import{i as r,j as o,k as t}from"../chunks/chunk-I6YSM7G4.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
@@ -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 { preloadImport } from './modules/import/import-wrapper.js';
27
28
  import { ResourceCache } from './modules/ajax/resource-cache.js';
28
29
  import { router } from './modules/router/router.js';
29
30
  import { SimpleData } from './modules/data/data.js';
@@ -32,4 +33,4 @@ import { StateTracker as Store } from './modules/state/state-tracker.js';
32
33
  import { Strings } from './shared/strings.js';
33
34
  import { Types } from './shared/types.js';
34
35
  import { Unit } from './modules/component/unit.js';
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 };
36
+ export { Ajax, Arrays, Atom, base, Builder, Component, Data, dataBinder, DataTracker, DateTime, Directives, Dom, Encode, EventMethods as Events, Html, Import, Jot, Model, NavLink, Objects, Pod, preloadImport, ResourceCache, router, SimpleData, State, Store, Strings, Types, Unit };
@@ -1,3 +1,4 @@
1
+ export function preloadImport(src: string | Function): Promise<unknown> | null;
1
2
  /**
2
3
  * ImportWrapper
3
4
  *
@@ -28,14 +28,28 @@ export class Router {
28
28
  lastMatchedRoute: object | null;
29
29
  /**
30
30
  * Identifier of the switch group that owned the most recently
31
- * applied scroll-target intent. When the next target intent
32
- * comes from the same group it is treated as a sibling-tab
33
- * switch (snap-to-sticky); when it comes from a different group
34
- * (or no group) it is treated as a fresh page navigation and
35
- * the page is reset to the top first.
31
+ * applied scroll-target intent.
36
32
  * @type {*}
37
33
  */
38
34
  lastScrollGroup: any;
35
+ /**
36
+ * Switch groups that have selected a scrollTo route and are
37
+ * still mounted. A tab click snaps to the sticky target when
38
+ * its group was already in this set before the navigation
39
+ * started. Every mounted group is tracked so a nested switch
40
+ * cannot steal the signal from the nav the user actually
41
+ * clicked. Groups created during the current navigation are
42
+ * not treated as siblings, so opening a page still starts
43
+ * at the top.
44
+ * @type {Set<*>}
45
+ */
46
+ activeScrollGroups: Set<any>;
47
+ /**
48
+ * Snapshot of `activeScrollGroups` taken at the start of
49
+ * `checkActiveRoutes`.
50
+ * @type {Set<*>}
51
+ */
52
+ scrollGroupsReady: Set<any>;
39
53
  /**
40
54
  * Transient field set by `checkGroup` so `select` knows which
41
55
  * switch group is currently asking for selection. Cleared after
@@ -299,6 +313,21 @@ export class Router {
299
313
  * @returns {this} a reference to the router object.
300
314
  */
301
315
  navigate(uri: string, data?: object | null, replace?: boolean): this;
316
+ /**
317
+ * This will start loading the imported pages of the routes that
318
+ * match a uri, so navigating there later renders without waiting
319
+ * for the chunk. It does not navigate or change any route.
320
+ *
321
+ * Accepts the same uri as navigate() or a link href. Each switch
322
+ * group prefetches only its first matching route, like a switch
323
+ * would select it. Routes inside switches that are not mounted yet
324
+ * are not known and are skipped.
325
+ *
326
+ * @param {string} uri
327
+ * @returns {Promise<Array<unknown>>} resolves when every started
328
+ * load settles. Failed loads resolve to null.
329
+ */
330
+ prefetch(uri: string): Promise<Array<unknown>>;
302
331
  /**
303
332
  * This will update the data path.
304
333
  * @protected
@@ -430,16 +459,56 @@ export class Router {
430
459
  * @returns {void}
431
460
  */
432
461
  scrollToHash(hash: string): void;
462
+ /**
463
+ * This will find the scrollTo element for a switch.
464
+ * The selector is shared by every sticky nav (`.sticky.top-header-safe`),
465
+ * so a document-wide query can hit a hidden or background page.
466
+ * Prefer the nav in the same page as the switch that was clicked.
467
+ *
468
+ * @protected
469
+ * @param {string} selector
470
+ * @param {*} [groupId]
471
+ * @returns {Element|null}
472
+ */
473
+ protected findScrollTarget(selector: string, groupId?: any): Element | null;
474
+ /**
475
+ * This will walk up from the switch container to the page that
476
+ * owns it and return the first matching nav inside that page.
477
+ *
478
+ * @protected
479
+ * @param {string} selector
480
+ * @param {*} groupId
481
+ * @returns {Element|null}
482
+ */
483
+ protected findScopedScrollTarget(selector: string, groupId: any): Element | null;
484
+ /**
485
+ * This will read the scroll offset that puts a sticky element at
486
+ * its stuck position. The element is only "sized" once it has a
487
+ * box, so a nav that has not been laid out yet is not committed.
488
+ *
489
+ * @protected
490
+ * @param {Element} element
491
+ * @returns {{ sized: boolean, targetScroll: number }}
492
+ */
493
+ protected readScrollTarget(element: Element): {
494
+ sized: boolean;
495
+ targetScroll: number;
496
+ };
433
497
  /**
434
498
  * This will scroll to a target element by CSS selector.
435
499
  * For sticky elements, it scrolls to the position where the
436
500
  * element reaches its stuck point (natural position minus CSS top).
437
501
  * If the user is above the target, no scrolling occurs.
438
502
  *
503
+ * The first frame after a tab click can measure the nav before
504
+ * the cover above it has height, which looks like a scroll to the
505
+ * top. The offset has to agree across two frames before it is used.
506
+ *
439
507
  * @param {string} selector
508
+ * @param {*} [groupId]
440
509
  * @returns {void}
441
510
  */
442
- scrollToTarget(selector: string): void;
511
+ scrollToTarget(selector: string, groupId?: any): void;
443
512
  /**
444
513
  * This will check to scroll to the top of the page.
445
514
  *