@base-framework/base 3.9.27 → 3.9.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.js +1 -1
- package/dist/chunks/chunk-4WQU37H7.js +2 -0
- package/dist/chunks/chunk-6EAE4I3C.js +2 -0
- package/dist/chunks/chunk-76NP53O5.js +2 -0
- package/dist/chunks/chunk-EBXFAKPV.js +2 -0
- package/dist/chunks/chunk-FRII433W.js +2 -0
- package/dist/chunks/chunk-KV6FLEYW.js +2 -0
- package/dist/modules/component.js +1 -1
- package/dist/modules/data.js +1 -1
- package/dist/modules/html.js +1 -1
- package/dist/modules/router.js +1 -1
- package/dist/modules/state.js +1 -1
- package/dist/types/modules/component/data-resume-helper.d.ts +6 -1
- package/dist/types/modules/router/history/history.d.ts +19 -0
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as A}from"./chunk-CKS4W2H6.js";import{a as I,b as Lt,c as Mt,d as P,e as S,f as L}from"./chunk-R7IRTCS2.js";import{a as W,b as At}from"./chunk-6N533MOU.js";import{b as bt,c as Et,f as E,g as It,i as q}from"./chunk-UBJO7NXL.js";import{b as f,c as p}from"./chunk-ZUB7I6Z4.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=[],z=0,ut=!1,qe=typeof queueMicrotask=="function"?queueMicrotask:n=>Promise.resolve().then(n),Fe=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||n.container||null},Ge=n=>{n._mountPending=!1;try{n.afterMount()}catch(t){console.error("Error in afterMount:",t)}},_t=()=>{ut=!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=Fe(s);if(o&&o.isConnected===!0){Ge(s);continue}t.push(s)}t.length&&(g=g.length?t.concat(g):t),g.length&&z===0&&g.length!==t.length&&dt()},dt=()=>{ut||(ut=!0,qe(_t))},v={add(n){n._mountPending!==!0&&(n._mountPending=!0,g.push(n))},enter(){z++},leave(){--z>0||(z=0,g.length&&dt())},schedule(){g.length&&dt()},flush(){_t()},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 Ke=0,Q=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-"+Ke++,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 M=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 j=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 V=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&&A.remove(o.targetId,o.action,o.token)}}restore(t){A.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=A.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 Q{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){M.resume(this,t)}_refreshData(){M.refresh(this)}_refreshContextData(){M.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=A.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 V(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)),A.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 j)}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 Dt={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 ft=(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=Dt[o]||o;t[a]=Ot(i,a)}return t},ze=n=>ft(n,{}),Qe=0,Bt=(n,t)=>{class e extends n{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Qe++,e},_=(n,t=x)=>{n||(n={});let e,r=typeof n;return r==="object"&&n.render?(e=ze(n),Bt(t,e)):(e={render:r==="function"?n:()=>n},Bt(t,e))};var pt=(n,t)=>({attr:n,directive:t});var k=(n,t)=>({key:n,value:t});var Ut=(n,t,e,r)=>({tag:n,attr:t,directives:e,children:r});var Ht=null,je=()=>Ht||(Ht=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(pt(k(e,L.getWatcherSettings(r,It(e))),je()))}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(pt(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 Ut(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 Ve=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"},Y=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"&&Ve(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,...ft(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 Ye=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),$e=/[&<>"]/,mt=n=>{let t=typeof n=="string"?n:String(n);return $e.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t},O=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+=mt(h);continue}if(c==="html"||c==="innerHTML"){s+=h;continue}if(typeof h=="function")continue;let u=c+'="'+mt(h)+'"';o?o+=" "+u:o=u}return Ye.has(t)?"<"+t+" "+o+" />":"<"+t+" "+o+">"+s+r+"</"+t+">"}static createText(t){return mt(t)}static createComment(t){return"<!-- "+t+" -->"}};var $=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 O.createText(o)}else if(r==="comment"){let s=t.attr[0],o=s?s.value:"";return O.createComment(o)}return O.create(r,t.attr,e)}removeAll(t){}};var J=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new Y:new $}};var b=J.setup(),Je=n=>typeof n=="object"&&n.isUnit===!0,Nt=new WeakMap,Xe=n=>{let t=Nt.get(n);if(!t){if(t=_(n),!t)return null;Nt.set(n,t)}return new t},d=class{static render(t,e,r){if(!t||(Je(t)||(t=Xe(t)),!t))return null;v.enter();try{return b.createComponent(t,e,r)}finally{v.leave()}}static build(t,e,r){v.enter();try{return b.build(t,e,r)}finally{v.leave()}}static rebuild(t,e,r){return b.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){b.setDirectives(t,e,r)}static createNode(t,e,r){return b.createNode(t,e,r)}static removeNode(t){b.removeNode(t)}static removeAll(t){b.removeAll(t)}};At.augment({buildLayout(n,t,e){d.build(n,t,e)}});var gt=[],Ze=n=>gt.indexOf(n)!==-1,tr=n=>({tag:"script",src:n.src,async:!1,load(t){gt.push(n.src);let e=n.load;e&&e()}}),er=n=>({tag:"link",rel:"stylesheet",type:"text/css",href:n.src,load(t){gt.push(n.src);let e=n.load;e&&e()}}),X=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=er({load:r,src:t}):e=tr({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 rr=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):(rr(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 Z=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 nr=n=>({tag:"comment",textContent:"import placeholder",onCreated:n.onCreated}),T=new I(100),Wt=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},qt=n=>{if(!T.has(n))return null;let t=T.get(n);return t&&typeof t.then=="function"?null:t||null},Ft=n=>{let t=typeof n;if(t!=="string"&&t!=="function")return null;if(qt(n))return Promise.resolve(T.get(n));let e;try{e=Wt(n)}catch{return null}return e.catch(()=>null)},yt=n=>{for(let t=0,e=n.length;t<e;t++){let r=n[t];r&&d.removeNode(r)}},Gt=_({declareProps(){this.loaded=!1,this.errorRoot=null,this.loadingRoots=null,this.generation=0},render(){return nr({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 X(()=>{this.loadAndRender(n)}).addFiles(this.depends);return}this.loadAndRender(n)}}})},loadAndRender(n){let t=this.generation,e=qt(this.src);if(e){this.renderModule(n,e);return}this.renderLoading(n),Z.load(Wt(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,yt(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&&(yt(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&&(yt(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Kt=n=>{let t=typeof n;return(t==="string"||t==="function"||n instanceof Promise)&&(n={src:n}),new Gt(n)};var sr=0,B=class{constructor(t){this.router=t,this.locationId="base-app-router-"+sr++,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 or=0,ir=()=>Date.now().toString(36)+"-"+(or++).toString(36)+"-"+Math.random().toString(36).substring(2,8),Qt=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,zt=()=>{Qt&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let n=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(n,t)}))},tt=class extends B{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&&zt()}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)),zt()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:ir(),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 et={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 rt=class extends B{addEvent(){return p.on("hashchange",window,this.callBack),this}removeEvent(){return p.off("hashchange",window,this.callBack),this}check(t){this.router.checkActiveRoutes(et.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var nt=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new tt(t).setup():new rt(t).setup()}};var St=5,ar=200,st=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new I(ar),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMode(){let t=this.owner;return t!==null&&t.keepAliveMode==="hide"?"hide":"detach"}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:St}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 vt=class extends x{getChildScope(){return this.parent}},jt=n=>_(n,vt);var xt="data-scroll-key",lr="["+xt+"]",cr="[data-route-dormant]",Vt=n=>typeof n.closest=="function"&&n.closest(cr)!==null,Yt=(n,t)=>{for(let e=0,r=n.length;e<r;e++){let s=n[e];if(!s||s.nodeType!==1||Vt(s))continue;let o=s.getAttribute(xt);o!==null&&t(s,o);let i=s.querySelectorAll(lr);for(let a=0,l=i.length;a<l;a++){let c=i[a];Vt(c)||t(c,c.getAttribute(xt))}}},kt=n=>{let t=null;return Yt(n,(e,r)=>{let s=e.scrollTop||0,o=e.scrollLeft||0;s===0&&o===0||(t=t||{},t[r]=[s,o])}),t},ot=(n,t)=>{if(!t)return!0;let e={},r=0;for(let s in t)e[s]=!0,r++;return Yt(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 hr=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)}},G="data-route-dormant",it=[["content-visibility","hidden"],["position","absolute"],["top","0"],["left","0"],["width","100%"],["opacity","0"],["clip-path","inset(50%)"]],ur=n=>{let t=n.style,e=[];for(let s=0,o=it.length;s<o;s++){let[i,a]=it[s];e.push([i,t.getPropertyValue(i),t.getPropertyPriority(i)]),t.setProperty(i,a,"important")}let r=n.ownerDocument&&n.ownerDocument.activeElement;return r&&r!==n.ownerDocument.body&&n.contains(r)&&typeof r.blur=="function"&&r.blur(),n.setAttribute(G,""),n.inert=!0,e},dr=(n,t)=>{let e=n.style,r=t||[];for(let s=0,o=it.length;s<o;s++){let i=it[s][0],a=r.find(l=>l[0]===i);a&&a[1]?e.setProperty(i,a[1],a[2]||""):e.removeProperty(i)}n.removeAttribute(G),n.inert=!1},fr="iframe, embed, object",pr="video, audio",Jt=(n,t)=>{let e=[];for(let r=0,s=n.length;r<s;r++){let o=n[r];if(!o||o.nodeType!==1)continue;o.matches(t)&&e.push(o);let i=o.querySelectorAll(t);for(let a=0,l=i.length;a<l;a++)e.push(i[a])}return e},mr=n=>{let t=Jt(n,pr);for(let e=0,r=t.length;e<r;e++){let s=t[e];s.paused===!1&&typeof s.pause=="function"&&s.pause()}},gr=n=>/^class[\s{]/.test(Function.prototype.toString.call(n)),yr=1500,$t=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Sr=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},wt=(n,t,e)=>{if(!(!n||typeof n[t]!="function"))try{n[t](...e)}catch(r){console.error("Error in "+t+":",r)}},at=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.keepAliveMode=e.keepAliveMode==="hide"||e.keepAliveMode==="detach"?e.keepAliveMode:null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.capturedScroll=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()}getKeepAliveMode(t){if(this.keepAliveMode!==null)return this.keepAliveMode;if(t=t||this.component,t){let r=t.keepAliveMode;if(r==="hide"||r==="detach")return r;let s=t.layout;if(s&&s.isUnit===!0&&(s.keepAliveMode==="hide"||s.keepAliveMode==="detach"))return s.keepAliveMode}let e=this.pageCache;return e!==null&&typeof e.getMode=="function"?e.getMode():"detach"}isDetached(){return this.detachedNodes!==null}captureScroll(){let t=this.component;if(this.setup!==!0||!t||t.rendered!==!0){this.capturedScroll=null;return}this.capturedScroll={value:kt(this.getRootNodes(t))}}releaseCapturedScroll(){this.capturedScroll=null}takeScroll(t){let e=this.capturedScroll;return this.capturedScroll=null,e?e.value:kt(this.getRootNodes(t))}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=gr(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(jt(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)&&wt(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=Sr(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 hr(e),e}callPageHook(t,e){let r=this.component;if(!r)return;wt(r,t,e);let s=r.layout;s&&s!==r&&s.isUnit===!0&&wt(s,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,s=()=>ot(this.getRootNodes(r),t);if(s()||typeof requestAnimationFrame>"u")return;let o=$t(),i=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||s()||$t()-o>yr||requestAnimationFrame(i)};requestAnimationFrame(i)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null;let e=this.component;if(!t||!e)return;if(typeof requestAnimationFrame>"u"){ot(this.getRootNodes(e),t);return}let r=++this.scrollToken;requestAnimationFrame(()=>{r!==this.scrollToken||this.setup!==!0||this.component!==e||ot(this.getRootNodes(e),t)})}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let r=this.takeScroll(t);return this.savedScroll=r,this.pageCache.saveScroll(this.getScrollKey(),r),this.getKeepAliveMode(t)==="hide"&&t.loaded!==!1&&Jt(e,fr).length===0?(mr(e),this.hideInPlace(e)):this.removeNodes(e),this.detachedNodes=e,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}removeNodes(t){let e=new WeakMap;for(let r=0,s=t.length;r<s;r++){let o=t[r],i=o.parentNode;i&&(e.set(o,i),i.removeChild(o))}this.detachedParents=e,this.hiddenInPlace=!1,this.hiddenStyles=null}hideInPlace(t){let e=new WeakMap;for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&o.nodeType===1&&e.set(o,ur(o))}this.detachedParents=null,this.hiddenInPlace=!0,this.hiddenStyles=e}showInPlace(t,e){let r=this.hiddenStyles;for(let s=0,o=t.length;s<o;s++){let i=t[s];i.nodeType===1&&i.hasAttribute(G)&&dr(i,r?r.get(i):void 0),i.isConnected||e.appendChild(i)}}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.hiddenInPlace;this.hiddenInPlace=!1;let s=this.component,o=this.container;if(!s||s.rendered!==!0||!o||typeof o.appendChild!="function")return this.savedScroll=null,this.hiddenStyles=null,this.releaseComponent(),!1;if(r)return this.showInPlace(this.getRootNodes(s),o),this.hiddenStyles=null,this.setup=!0,v.schedule(),!0;let i=this.getRootNodes(s);for(let a=0,l=i.length;a<l;a++){let c=i[a],h=e?e.get(c):null;(h&&h.isConnected?h:o).appendChild(c)}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.detachedParents=null,this.savedScroll=null,this.hiddenInPlace=!1,this.hiddenStyles=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(),this.takeScroll(e))}this.capturedScroll=null,this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var Xt=n=>{if(!n.length)return null;let t={};for(let e=0,r=n.length;e<r;e++)t[n[e]]=null;return t},Zt=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 vr=/(\/):[^/(]*?\?/g,xr=/\//g,kr=/(\?\/+\*?)/g,wr=/(:[^/?&($]+)/g,Cr=/(\*)/g,Tr=n=>n.replace(vr,t=>t.replace(xr,"(?:$|/)")),Rr=n=>(n=n.replace(kr,"?/*"),n.replace(wr,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),Pr=n=>n.replace(Cr,".*"),Ar=(n,t)=>n+=t[t.length-1]==="*"?"":"$",te=n=>{if(!n)return"";let t=n;return t=Tr(t),t=Rr(t),t=Pr(t),t=Ar(t,n),t};var br=0,ee=(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[Ne,We=""]=N.split("="),Pt=(Ne||"").trim();Pt&&o.push({key:Pt,value:(We||"").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}},re=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,"/")},Er=n=>{if(!n)return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)},Ir=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)},lt=class extends Lt{constructor(t,e,r=null){let s=t.baseUri,i=ee(s,t.rawUri).uriPath,a=Zt(i),l=Xt(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-"+br++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=ee(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=te(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)}captureScroll(){let t=this.controller;t&&this.get("active")&&t.captureScroll()}releaseCapturedScroll(){let t=this.controller;t&&t.releaseCapturedScroll()}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return e?e.isConnected===!1?!0:typeof e.closest=="function"&&e.closest("["+G+"]")!==null:!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,Kt(e)}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:s,parent:o,keepAlive:i,keepAliveMode:a}=t,l={component:e,container:r,persist:s,parent:o,keepAlive:i,keepAliveMode:a,pageCache:this.pageCache},c=bt(this);this.controller=new at(c,l)}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=re(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(re(t))&&this.matchConditions(t)}prefetch(){let t=this.importSrc;return t?Ft(t):null}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&Er(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=Ir(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 Lr=n=>{let t=/\w\S*/;return n.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},Mr=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_r=(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(":"+Mr(r),"gi");n=n.replace(s,()=>e[r])}return n},Dr=(n,t)=>t&&(typeof t=="function"&&(t=t(n.stage)),t=_r(t,n),Lr(t)),Or=(n,t)=>(t!==""&&(n+=" - "+t),n),ne=(n,t,e)=>t&&(t=Dr(n,t),Or(t,e));var Br=()=>typeof window<"u"?window.location:{},Ur=n=>{if(!n)return"";let t=n.indexOf("#");return t>-1?n.substring(t+1):""},Hr=1500,ct=["wheel","touchstart","keydown","pointerdown"],se=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Ct=class{constructor(){this.version="1.0.2",this.baseURI="/",this.title="",this.lastPath=null,this.path=null,this.lastMatchedRoute=null,this.lastScrollGroup=null,this.activeScrollGroups=new Set,this.scrollGroupsReady=new Set,this.currentGroupId=null,this.scrollWaitToken=0,this.cancelScrollWait=null,this.keepAlive=!1,this.keepAliveMax=St,this.keepAliveMode="detach",this.pageCache=new st(this),this.history=null,this.callBackLink=null,this.location=Br(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new Mt({path:""})}setupHistory(){this.history=nt.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new lt(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let r=e?e.max:void 0;typeof r=="number"&&r>=0&&(this.keepAliveMax=r);let s=e?e.mode:void 0;return(s==="hide"||s==="detach")&&(this.keepAliveMode=s),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=et.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=ne(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.captureActiveScroll(),o=this.routes;for(let i=0,a=o.length;i<a;i++){let l=o[i];typeof l>"u"||r.size>0&&l.isDormant()||this.checkRoute(l,t)}if(this.checkSwitches(t,!0),r.historyNavigation=!1,this.releaseCapturedScroll(s),e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}captureActiveScroll(){let t=[],e=s=>{!s||!s.controller||!s.get("active")||s.isDormant()||(s.captureScroll(),t.push(s))},r=this.routes;for(let s=0,o=r.length;s<o;s++)e(r[s]);for(let s of this.switches.values())for(let o=0,i=s.length;o<i;o++)e(s[o]);return t}releaseCapturedScroll(t){for(let e=0,r=t.length;e<r;e++)t[e].releaseCapturedScroll()}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=Ur(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=ct.length;c<h;c++)window.addEventListener(ct[c],o,i);this.cancelScrollWait=()=>{for(let c=0,h=ct.length;c<h;c++)window.removeEventListener(ct[c],o,i)};let a=se(),l=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,s)||se()-a>=Hr){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 Ct;var oe=(n,t)=>({attr:n,value:t}),Nr=(n,t)=>{if(!t.startsWith(n))return!1;let e=t[n.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},Tt=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(oe("href",t)),e&&typeof e=="object"&&o.push(oe("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:Nr(l,c);this.update(m)}}),o}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var ie=(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))},ae=(n,t,e)=>{ie(n,t)},le=(n,t,e)=>{let r=()=>{n&&n.remove&&n.remove()};Wr(n,()=>ie(n,t,r),e)};f.addType("manual-destroy",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Wr=(n,t,e)=>{f.add(n,"manual-destroy",{ele:n,callBack:t,parent:e})};var K=(n,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(s=>{s&&K(n,t,s,r)});return}qr(n,t,e,r)},qr=(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=Fr(n,s,o,r);E.watch(n,t,s,i)},Fr=(n,t,e,r)=>typeof e=="object"?s=>{zr(n,e,s)}:s=>{Kr(n,e,t,s,r)},ce=new WeakSet,Gr=(n,t,e)=>{!n||!n.isUnit&&!n.isComponent||ce.has(e)||ce.add(e)},Kr=(n,t,e,r,s)=>{let o=t(r,n,s);switch(typeof o){case"object":if(o===null)break;Gr(o,e,n),d.rebuild(o,n,s);break;case"string":let i=Et(n);if(i!=="textContent"){n.setAttribute(i,o);break}q.addHtml(n,o);break}},zr=(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);K(n,r,t,e)};var he=(n,t,e)=>{t&&n.setAttribute("role",t)},Qr=n=>(t,e)=>{let r=t?"true":"false";e.setAttribute(n,r)},ue=(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(Qr(c)),U(n,h,e)}else n.setAttribute(c,l)}};var de=(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 Rt=n=>n?n.getContext():null,fe=(n,t,e)=>{if(typeof t!="function")return;let r=Rt(e),s=t(r);de(n,s,e)},pe=(n,t,e)=>{if(typeof t!="function")return;let r=Rt(e);t(r)},me=(n,t,e)=>{if(typeof t!="function"||!e)return;let r=Rt(e),s=t(r);if(!s)return;let o=s[0];o&&(e.addContextBranch(o,s[1]),jr(n,o,e))},jr=(n,t,e)=>{f.add(n,"context",{branch:t,parent:e})};var ge=(n,t,e)=>{};var ye=(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 Se=(n,t,e)=>{},ve=(n,t,e)=>{if(!t||!e)return;let r=t(e,n);r&&d.build(r,n,e)},xe=(n,t,e)=>{if(!t||!e)return;let r=e.getId(t);n.id=r},ke=(n,t,e)=>{if(!t||!e)return;let r=t(e.data,n);r&&d.build(r,n,e)},we=(n,t,e)=>{if(!t||!e)return;let r=t(e.state,n);r&&d.build(r,n,e)},Ce=(n,t,e)=>{if(!t||!e)return;let r=e.state,s=t(r);if(!e.state){e.setStateHelper(s);return}e.addState(s)},Te=(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 Re=(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 ht=(n,t,e)=>{K(n,e.state,t,e)};var Pe=n=>(t,e)=>{let[r,s,o="active"]=n,i=t===s?o:"";e.dataset[r]=i},Ae=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Pe(s)),U(n,o,e)},be=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Pe(s)),ht(n,o,e)};var Ee=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;Ee(n.scopes)});var Ie=(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&&Ee(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 Le=(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 Me=(n,t,e)=>{t(n,e)};f.addType("destroyed",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var _e=(n,t,e)=>{Vr(n,t,e)},Vr=(n,t,e)=>{f.add(n,"destroyed",{ele:n,callBack:t,parent:e})};var De=(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 Be=(n,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&Oe(n,o,e)}else Oe(n,t,e)},Oe=(n,t,e)=>{t.container=n,t.parent=e;let r=R.add(t);Yr(n,r)},Yr=(n,t)=>{f.add(n,"routes",{route:t})};var Ue=(n,t,e)=>{};f.addType("switch",n=>{if(!n)return!1;let t=n.id;R.removeSwitch(t)});var He=(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);$r(n,s)},$r=(n,t)=>{f.add(n,"switch",{id:t})};F.add("cache",Se).add("onCreated",Me).add("onDestroyed",_e).add("bind",Re).add("data",ge).add("state",Ue).add("onSet",U).add("onState",ht).add("animateIn",ae).add("animateOut",le).add("watch",De).add("useParent",ve).add("useData",ke).add("useState",we).add("getId",xe).add("addState",Ce).add("addEvent",Te).add("map",Le).add("for",Ie).add("useContext",pe).add("addContext",me).add("context",fe).add("role",he).add("aria",ue).add("route",Be).add("debug",ye).add("dataSet",Ae).add("dataStateSet",be).add("switch",He);export{F as a,Q as b,x as c,Dt as d,Ot as e,_ as f,d as g,Kt as h,Tt as i,Ct as j,R as k};
|
|
2
|
+
//# sourceMappingURL=chunk-4WQU37H7.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as x,b as B,c as g,d as p}from"./chunk-ZUB7I6Z4.js";var D=new WeakMap,P=new WeakMap;function N(n){if(!n||typeof n!="object")return n;let t=P.get(n);return t!==void 0?t:n}var W=new WeakMap;function Z(n,t,e,s){let i=D.get(n);i||(i=new Map,D.set(n,i));let r=i.get(e);if(r)return r;let u=new Proxy(n,O(t,e,s));return i.set(e,u),P.set(u,n),u}function J(n){n&&typeof n=="object"&&D.delete(n)}function z(n,t){let e=t.charCodeAt(0),s=e>=48&&e<=57;return n===""?s?"["+t+"]":t:s?n+"["+t+"]":n+"."+t}function O(n,t="",e=""){return{get(s,i,r){let u=s[i];if(t===""&&i in s){if(typeof u=="function"){let o=W.get(s);o||(o=new Map,W.set(s,o));let c=o.get(i);if(c)return c;let l=u.bind(s);return o.set(i,l),l}return u}if(u=(s[e]||s)[i],u!==null&&typeof u=="object"){let o=z(t,i);return Z(u,n,o,e)}return u},set(s,i,r,u){if(t===""&&i in s)return s[i]=r,!0;let o=(s[e]||s)[i],c=z(t,i);return n.set(c,r),o!==r&&o!==null&&typeof o=="object"&&J(o),!0}}}var at=(n,t="stage")=>{let e=new Proxy(n,O(n,"",t));return P.set(e,n),e};var k=class{constructor(){this.connections=new Map}add(t,e,s){let i=this.getOrCreate(t),r=i.get(e);return r?Array.isArray(r)?r.push(s):i.set(e,[r,s]):i.set(e,s),s}get(t,e){let s=this.connections.get(t)?.get(e);return s?Array.isArray(s)?s[s.length-1]||!1:s:!1}getOrCreate(t){let e=this.connections.get(t);return e||(e=new Map,this.connections.set(t,e)),e}remove(t,e){let s=this.connections.get(t);if(s)if(e)this.unsubscribe(s.get(e)),s.delete(e),s.size===0&&this.connections.delete(t);else{for(let i of s.values())this.unsubscribe(i);this.connections.delete(t)}}unsubscribe(t){if(t)if(Array.isArray(t))for(let e=0,s=t.length;e<s;e++)t[e]?.unsubscribe();else t.unsubscribe()}};var S=class{constructor(){this.msg=null,this.token=null}setToken(t){this.token=t}};var b=class extends S{constructor(t){super(),this.pubSub=t}subscribe(t){this.msg=t;let e=this.callBack.bind(this);this.token=this.pubSub.on(t,e)}unsubscribe(){this.pubSub&&this.msg&&this.token&&this.pubSub.off(this.msg,this.token),this.pubSub=null,this.msg=null,this.token=null}callBack(){}};var w=class extends b{constructor(t,e,s){super(s),this.data=t,this.prop=e}set(t){this.data.set(this.prop,t)}get(){return this.data.get(this.prop)}callBack(t,e){this.data!==e&&this.data.set(this.prop,t,e)}unsubscribe(){super.unsubscribe(),this.data=null,this.prop=null}};var y=class{static getById(t){return typeof t!="string"?!1:document.getElementById(t)||!1}static getByName(t){if(typeof t!="string")return!1;let e=document.getElementsByName(t);return e?Array.from(e):!1}static getBySelector(t,e){if(typeof t!="string")return!1;if(e=e||!1,e===!0)return document.querySelector(t)||!1;let s=document.querySelectorAll(t);return s?s.length===1?s[0]:Array.from(s):!1}static html(t,e){return!t||typeof t!="object"?!1:typeof e<"u"?(t.innerHTML=e,this):t.innerHTML}static setCss(t,e,s){return!t||typeof t!="object"||typeof e>"u"?this:(e=p.uncamelCase(e),t.style[e]=s,this)}static getCss(t,e){if(!t||typeof e>"u")return!1;e=p.uncamelCase(e);let s=t.style[e];if(s!=="")return s;let i=null,r=t.currentStyle;if(r&&(i=r[e]))return i;let u=window.getComputedStyle(t,null);return u?u[e]:s}static css(t,e,s){return typeof s<"u"?(this.setCss(t,e,s),this):this.getCss(t,e)}static removeAttr(t,e){return typeof t=="object"&&t!==null&&t.removeAttribute(e),this}static setAttr(t,e,s){t.setAttribute(e,s)}static getAttr(t,e){return t.getAttribute(e)}static attr(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setAttr(t,e,s),this):this.getAttr(t,e)}static _checkDataPrefix(t){return typeof t!="string"||(t=p.uncamelCase(t),t.substring(0,5)!=="data-"&&(t="data-"+t)),t}static removeDataPrefix(t){return typeof t=="string"&&t.substring(0,5)==="data-"&&(t=t.substring(5)),t}static setData(t,e,s){e=this.removeDataPrefix(e),e=p.camelCase(e),t.dataset[e]=s}static getData(t,e){return e=p.camelCase(this.removeDataPrefix(e)),t.dataset[e]}static data(t,e,s){return!t||typeof t!="object"?!1:typeof s<"u"?(this.setData(t,e,s),this):this.getData(t,e)}static find(t,e){return!t||typeof e!="string"?[]:t.querySelectorAll(e)}static show(t){if(!t||typeof t!="object")return this;let e=this.data(t,"style-display"),s=typeof e=="string"?e:"";return this.css(t,"display",s),this}static hide(t){if(!t||typeof t!="object")return this;let e=this.css(t,"display");return e!=="none"&&e&&this.data(t,"style-display",e),this.css(t,"display","none"),this}static toggle(t){return!t||typeof t!="object"?this:(this.css(t,"display")!=="none"?this.hide(t):this.show(t),this)}static getSize(t){return!t||typeof t!="object"?!1:{width:this.getWidth(t),height:this.getHeight(t)}}static getWidth(t){return typeof t=="object"&&t!==null?t.offsetWidth:!1}static getHeight(t){return typeof t=="object"&&t!==null?t.offsetHeight:!1}static getScrollPosition(t){let e=0,s=0;switch(typeof t){case"undefined":t=document.documentElement,e=t.scrollLeft,s=t.scrollTop;break;case"object":e=t.scrollLeft,s=t.scrollTop;break}return!t||typeof t!="object"?!1:{left:e-(t.clientLeft||0),top:s-(t.clientTop||0)}}static getScrollTop(t){return this.getScrollPosition(t).top}static getScrollLeft(t){return this.getScrollPosition(t).left}static getWindowSize(){let t=window,e=document,s=e.documentElement,i=e.getElementsByTagName("body")[0],r=t.innerWidth||s.clientWidth||i.clientWidth,u=t.innerHeight||s.clientHeight||i.clientHeight;return{width:r,height:u}}static getDocumentSize(){let t=document,e=t.body,s=t.documentElement,i=Math.max(e.scrollHeight,e.offsetHeight,s.clientHeight,s.scrollHeight,s.offsetHeight);return{width:Math.max(e.scrollWidth,e.offsetWidth,s.clientWidth,s.scrollWidth,s.offsetWidth),height:i}}static getDocumentHeight(){return this.getDocumentSize().height}static position(t,e=1){let s={x:0,y:0};if(!t||typeof t!="object")return s;let i=0;for(;t&&(e===0||i<e);)i++,s.x+=t.offsetLeft+t.clientLeft,s.y+=t.offsetTop+t.clientTop,t=t.offsetParent;return s}static addClass(t,e){if(!t||typeof t!="object"||e==="")return this;if(typeof e=="string"){let s=e.split(" ");for(let i=0,r=s.length;i<r;i++)t.classList.add(s[i])}return this}static removeClass(t,e){return!t||typeof t!="object"||e===""?this:(typeof e>"u"?t.className="":t.classList.remove(e),this)}static hasClass(t,e){return!t||typeof t!="object"||e===""?!1:t.classList.contains(e)}static toggleClass(t,e){return!t||typeof t!="object"?this:(t.classList.toggle(e),this)}};var R=n=>{let t="textContent";if(!n||typeof n!="object")return t;let e=n.tagName.toLowerCase();if(e==="input"||e==="textarea"||e==="select"){let s=n.type;if(!s)return t="value",t;switch(s){case"checkbox":t="checked";break;case"file":t="files";break;default:t="value"}}return t};var X=(n,t,e)=>{y.setAttr(n,t,e)},Y=(n,t,e)=>{n.checked=n.value==e},j=(n,t,e)=>{e=e==1,q(n,t,e)},q=(n,t,e)=>{n[t]=e},tt=(n,t)=>y.getAttr(n,t),et=(n,t)=>n[t],M=class extends b{constructor(t,e,s,i){super(i),this.element=t,this.attr=this.getAttrBind(e),this.addSetMethod(t,this.attr),this.filter=typeof s=="string"?this.setupFilter(s):s}addSetMethod(t,e){if(e.charAt(4)==="-")return this.setValue=X,this.getValue=tt,this;this.getValue=et;let s=t.type;if(s)switch(s){case"checkbox":return this.setValue=j,this;case"radio":return this.setValue=Y,this}return this.setValue=q,this}getAttrBind(t){return t||R(this.element)}setupFilter(t){let e=/\[\[[^\]]+\]\]/;return s=>t.replace(e,()=>s)}set(t){let e=this.element;return!e||typeof e!="object"?this:(this.filter&&(t=this.filter(t)),this.setValue(e,this.attr,t),this)}get(){let t=this.element;return!t||typeof t!="object"?"":this.getValue(t,this.attr)}callBack(t,e){return e!==this.element&&this.set(t),this}unsubscribe(){super.unsubscribe(),this.element={},this.attr="",this.filter=null,this.setValue=null,this.getValue=null}};var C=class{unsubscribe(){}};var A=class extends C{constructor(t){super(),this.element=null,this.data=null,this.pubSub=t}addElement(t,e,s){return this.element=new M(t,e,s,this.pubSub)}addData(t,e){return this.data=new w(t,e,this.pubSub)}unsubscribeSource(t){return t&&t.unsubscribe(),this}unsubscribe(){return this.unsubscribeSource(this.element),this.unsubscribeSource(this.data),this.element=null,this.data=null,this}};var st=0,V=n=>{for(let t=0,e=n.length;t<e;t++){let s=n.charCodeAt(t);if(s===46||s===58||s===91)return n.substring(0,t)}return n},I=class{constructor(t=!1,e=!1){this.callBacks=new Map,this.prefixIndex=t?new Map:null,this.rootIndex=e?new Map:null,this.updateQueue=new Map,this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.maxFlushIterations=2e3,this.batchingEnabled=!0,this.debugMode=!1,this.flushCompleteResolvers=[],this.flushCallbacks=[],this.deliveringMessage=null,this.reentrantMessages=null,this.suppressQueue=!1}get(t){return this.callBacks.has(t)||this.callBacks.set(t,new Map),this.callBacks.get(t)}reset(){this.callBacks.clear(),this.prefixIndex?.clear(),this.rootIndex?.clear(),this.updateQueue.clear(),this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this.reentrantMessages=null}on(t,e){let s=++st,i=this.callBacks.get(t);return i||(i=new Map,this.callBacks.set(t,i),this.prefixIndex&&this._indexMessage(t),this.rootIndex&&this._indexRoot(t)),i.set(s,e),s}_indexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),i=this.prefixIndex.get(s);i||(i=new Set,this.prefixIndex.set(s,i)),i.add(t)}_unindexMessage(t){let e=t.indexOf(":");if(e===-1)return;let s=t.substring(0,e+1),i=this.prefixIndex.get(s);i&&(i.delete(t),i.size===0&&this.prefixIndex.delete(s))}_indexRoot(t){let e=V(t),s=this.rootIndex.get(e);s||(s=new Set,this.rootIndex.set(e,s)),s.add(t)}_unindexRoot(t){let e=V(t),s=this.rootIndex.get(e);s&&(s.delete(t),s.size===0&&this.rootIndex.delete(e))}getRootMessages(t){return this.rootIndex?this.rootIndex.get(t)||null:this.callBacks.keys()}getPrefixMessages(t){return this.prefixIndex&&this.prefixIndex.get(t)||null}getMessages(){return this.callBacks.keys()}off(t,e){let s=this.callBacks.get(t);s&&(s.delete(e),s.size===0&&(this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t),this.rootIndex&&this._unindexRoot(t)))}remove(t){this.callBacks.delete(t),this.prefixIndex&&this._unindexMessage(t),this.rootIndex&&this._unindexRoot(t)}publish(t,e,s){if(!this.batchingEnabled){this.publishImmediate(t,e,s);return}this.suppressQueue||(t===this.deliveringMessage&&(this.reentrantMessages??=new Set).add(t),this.callBacks.has(t)&&(this.updateQueue.set(t,[e,s]),this.debugMode&&console.log("[DataPubSub] Queued update:",t,e),this.scheduleFlush()))}scheduleFlush(){this.isFlushing||this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>{this.flush()}))}flush(){if(this.updateQueue.size===0){this.flushScheduled=!1,this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete();return}if(this.isFlushing||(this.flushIterations=0,this.reentrantMessages=null),this.isFlushing=!0,this.flushScheduled=!1,this.flushIterations++,this.flushIterations>this.maxFlushIterations){console.error("[DataPubSub] Infinite loop detected! Flush iterations exceeded",this.maxFlushIterations,"- Breaking to prevent memory exhaustion."),console.error("[DataPubSub] Queue size:",this.updateQueue.size),console.error("[DataPubSub] Queued messages:",Array.from(this.updateQueue.keys())),this._breakCascade(),this.flushScheduled=!1,this.isFlushing=!1,this._resolveFlushComplete(),this.flushIterations=0;return}this.debugMode&&console.log("[DataPubSub] Flushing",this.updateQueue.size,"updates (iteration",this.flushIterations+")");let t=this.updateQueue;this.updateQueue=new Map;try{for(let[e,s]of t)this.publishImmediate(e,s[0],s[1])}finally{this.debugMode&&console.log("[DataPubSub] Flush complete (iteration",this.flushIterations+")"),this.updateQueue.size>0?(this.debugMode&&console.log("[DataPubSub] New updates queued during flush, re-flushing..."),this.flush()):(this.isFlushing=!1,this.flushIterations=0,this._resolveFlushComplete())}}_breakCascade(){let t=this.updateQueue;this.updateQueue=new Map;let e=this.reentrantMessages;this.suppressQueue=!0;try{for(let[s,i]of t)e&&e.has(s)||this.publishImmediate(s,i[0],i[1])}finally{this.suppressQueue=!1,this.reentrantMessages=null,this.updateQueue.clear()}}_resolveFlushComplete(){if(this.flushCompleteResolvers.length>0){let t=this.flushCompleteResolvers;this.flushCompleteResolvers=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}if(this.flushCallbacks.length>0){let t=this.flushCallbacks;this.flushCallbacks=[];let e=t.length;for(let s=0;s<e;s++)t[s]()}}nextFlush(){return new Promise(t=>{this.flushCompleteResolvers.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>t())})}onFlush(t){if(typeof t!="function"){console.warn("[DataPubSub] onFlush requires a function callback");return}this.flushCallbacks.push(t),!this.flushScheduled&&!this.isFlushing&&queueMicrotask(()=>{if(this.flushCallbacks.length>0){let e=this.flushCallbacks;this.flushCallbacks=[];let s=e.length;for(let i=0;i<s;i++)e[i]()}})}flushSync(){this.flush()}publishImmediate(t,e,s){let i=this.callBacks.get(t);if(!i)return;let r=this.deliveringMessage;this.deliveringMessage=t;for(let u of i.values())if(u)try{u(e,s)}catch(a){console.error('[DataPubSub] Subscriber error for "'+t+'":',a)}this.deliveringMessage=r}};var d=new WeakMap,K=(n,t)=>{let e=d.get(n);e?Array.isArray(e)?e.push(t):d.set(n,[e,t]):d.set(n,t)},F=n=>{let t=n.data;if(!t)return;let e=n.subs;if(e)for(let s=0,i=e.length;s<i;s++)t.off(e[s].msg,e[s].token);else n.token&&t.off(n.prop,n.token);n.data=null},E=n=>N(n)||n,T=class{constructor(){this.version="1.0.1",this.attr="bindId",this.blockedKeys=new Set([20,37,38,39,40]),this.connections=new k,this.pubSub=new I(!0),this.idCount=0,this.setup()}setup(){this.setupEvents()}bind(t,e,s,i){let r=s,u=null,a=s.indexOf(":");a!==-1&&(u=s.substring(0,a),r=s.substring(a+1));let o=u??"",c=this.setupConnection(t,e,r,o,i),l=c.element,f=e.get(r);return typeof f<"u"?l.set(f):(f=l.get(),f!==""&&c.data.set(f)),this}setupConnection(t,e,s,i,r){let u=this.getBindId(t),a=new A(this.pubSub);a.addData(e,s).subscribe(u);let l=`${e.getDataId()}:${s}`;return a.addElement(t,i,r).subscribe(l),this.addConnection(u,"bind",a),a}addConnection(t,e,s){return this.connections.add(t,e,s),this}setBindId(t){let e="db-"+this.idCount++;return t[this.attr]=e,e}getBindId(t){return t[this.attr]||this.setBindId(t)}unbind(t){if(!t)return this;let e=d.get(t);if(e)if(d.delete(t),Array.isArray(e))for(let i=0,r=e.length;i<r;i++)F(e[i]);else F(e);let s=t[this.attr];return s&&this.connections.remove(s),this}hasWatchers(t){return!!t&&d.has(t)}isBound(t){return!!t&&(!!t[this.attr]||d.has(t))}watch(t,e,s,i){if(x.isObject(t)===!1)return this;let r=E(e);if(!r||typeof r.on!="function")return console.warn('DataBinder.watch: Cannot subscribe - data source is null or does not have an "on" method. Make sure your component has data, state, or context.data initialized.',s,e),r&&typeof r.get=="function"&&i(r.get(s)),this;let u=r.get(s),a=!0,o=l=>{a&&(a=!1,l===u&&(l===null||typeof l!="object"))||i(l)},c=r.on(s,o);return K(t,{data:r,prop:s,token:c}),i(u),this}watchMany(t,e,s,i){if(x.isObject(t)===!1)return this;let r=s?s.length:0;if(r===0)return this;if(r===1)return this.watch(t,e,s[0],i);let u=E(e);if(!u||typeof u.on!="function")return console.warn('DataBinder.watchMany: data source has no "on" method.',e),this;let a=new Array(r),o=new Array(r);for(let h=0;h<r;h++)a[h]=u.get(s[h]),o[h]=!0;let c=!1,l,f={data:u,prop:s,subs:null},H=()=>{c=!1,f.data!==null&&i(l)},G=h=>{l=h,!c&&(c=!0,typeof u.onFlush=="function"?u.onFlush(H):queueMicrotask(H))},_=new Array(r);for(let h=0;h<r;h++){let Q=h,$=a[h];_[h]=m=>{o[Q]&&(o[Q]=!1,m===$&&(m===null||typeof m!="object"))||G(m)}}let L=new Array(r);for(let h=0;h<r;h++)L[h]={msg:s[h],token:u.on(s[h],_[h])};return f.subs=L,K(t,f),i(a[0]),this}unwatch(t,e,s){if(x.isObject(t)===!1)return this;let i=d.get(t);if(!i)return this;let r=E(e),u=Array.isArray(i)?i:[i],a=[];for(let o=0,c=u.length;o<c;o++){let l=u[o],f=Array.isArray(l.prop)?l.prop.join(","):l.prop;if(l.data===r&&f===s){F(l);continue}a.push(l)}return a.length===0?d.delete(t):d.set(t,a.length===1?a[0]:a),this}publish(t,e,s){return this.pubSub.publish(t,e,s),this}getPrefixMessages(t){return this.pubSub.getPrefixMessages(t)}isDataBound(t){if(!t)return null;let e=t[this.attr];return e||null}isBlocked(t){return t.type!=="keyup"?!1:this.blockedKeys.has(t.keyCode)}bindHandler(t){if(this.isBlocked(t))return!0;let e=t.target||t.srcElement,s=this.isDataBound(e);if(s!==null){let i=this.connections.get(s,"bind");if(i){let r=i.element.get();this.pubSub.publish(s,r,e)}}}setupEvents(){this.changeHandler=this.bindHandler.bind(this),this.addEvents()}addEvents(){typeof document<"u"&&g.on(["change","input"],document,this.changeHandler,!1)}removeEvents(){typeof document<"u"&&g.off(["change","input"],document,this.changeHandler,!1)}},v=new T;var it=new Map([["class","className"],["text","textContent"],["for","htmlFor"],["readonly","readOnly"],["maxlength","maxLength"],["cellspacing","cellSpacing"],["rowspan","rowSpan"],["colspan","colSpan"],["tabindex","tabIndex"],["celpadding","cellPadding"],["useMap","useMap"],["frameborder","frameBorder"],["contenteditable","contentEditable"]]),nt=n=>it.get(n)||n,rt=n=>typeof n=="string"&&n.charCodeAt(0)===111&&n.charCodeAt(1)===110?n.substring(2):n,ut=/(?:<[a-z][\s\S]*>)/i,U=class{static create(t,e,s,i){let r=document.createElement(t);return this.addAttributes(r,e),i===!0?this.prepend(s,r):this.append(s,r),r}static addAttributes(t,e){if(!e||typeof e!="object")return;let s=e.type;s!==void 0&&t.setAttribute("type",s);let i=Object.keys(e);for(let r=0,u=i.length;r<u;r++){let a=i[r],o=e[a];a==="innerHTML"?t.innerHTML=o:a.indexOf("-")!==-1?t.setAttribute(a,o):this.addAttr(t,a,o)}}static addHtml(t,e){return typeof e>"u"||e===""?this:(ut.test(e)?t.innerHTML=e:t.textContent=e,this)}static addAttr(t,e,s){if(s===""||!e)return;if(typeof s==="function")e=rt(e),s.originalCallback?g.add(e,t,s,!1,!0,s.originalCallback):g.add(e,t,s);else{let r=nt(e);t[r]=s}}static createDocFragment(){return document.createDocumentFragment()}static createText(t,e){let s=document.createTextNode(t);return e&&this.append(e,s),s}static createComment(t,e){let s=document.createComment(t);return e&&this.append(e,s),s}static setupSelectOptions(t,e,s){if(!t||typeof t!="object"||!Array.isArray(e))return!1;e.forEach(i=>{let r=new Option(i.label,i.value);t.options.add(r),s!==null&&r.value==s&&(r.selected=!0)})}static removeElementData(t){let e=[t];for(;e.length>0;){let s=e.pop(),i=s.childNodes;if(i&&i.length>0)for(let r=i.length-1;r>=0;r--){let u=i[r];(u.nodeType!==3||v.isBound(u))&&e.push(u)}B.remove(s),v.isBound(s)&&v.unbind(s)}}static removeElement(t){if(!t)return this;let e=B.has(t,"manual-destroy");return this.removeElementData(t),e===!1&&t.remove(),this}static removeChild(t){return this.removeElement(t),this}static removeAll(t){if(!t||typeof t!="object")return this;let e=Array.from(t.childNodes);for(let r=0,u=e.length;r<u;r++)this.removeElementData(e[r]);let s=t.childNodes;if(s.length>0&&e.length>0){let r=new Set(e);for(let u=0,a=s.length;u<a;u++)r.has(s[u])||this.removeElementData(s[u])}if(typeof t.replaceChildren=="function")return t.replaceChildren(),this;let i;for(;i=t.firstChild;)t.removeChild(i);return this}static changeParent(t,e){return e.appendChild(t),this}static append(t,e){return t.appendChild(e),this}static prepend(t,e,s){let i=s||t.firstChild;return t.insertBefore(e,i),this}static clone(t,e=!1){return!t||typeof t!="object"?!1:t.cloneNode(e)}};export{N as a,at as b,R as c,V as d,I as e,v as f,nt as g,rt as h,U as i};
|
|
2
|
+
//# sourceMappingURL=chunk-6EAE4I3C.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as D,d as E,f as R}from"./chunk-6N533MOU.js";import{a as F,b as G,d as J,e as P,f as g,g as T,h as $,i as K}from"./chunk-6EAE4I3C.js";import{a as O,c as j,d as M}from"./chunk-ZUB7I6Z4.js";var b=class{constructor(t=1e3){this.cache=new Map,this.maxSize=t,this.evictCount=t>=8?t>>3:1}get(t){let e=this.cache.get(t);if(e!==void 0)return e.used=!0,e.value}has(t){return this.cache.has(t)}set(t,e){let s=this.cache,r=s.get(t);if(r!==void 0){r.value=e,r.used=!0;return}s.set(t,{value:e,used:!1}),s.size>this.maxSize&&this.evict()}evict(){let t=this.cache,e=this.maxSize-this.evictCount+1;for(let s=0;s<2&&t.size>e;s++){let r=t.keys(),i=t.size;for(;i-- >0&&t.size>e;){let o=r.next().value,c=t.get(o);if(c!==void 0&&c.used){c.used=!1;continue}t.delete(o)}}}delete(t){this.cache.delete(t)}clear(){this.cache.clear()}};var x=class{static resume(t,e){if(!t)return null;let s=localStorage.getItem(t);if(s===null)return e!==void 0?e:void 0;try{let r=JSON.parse(s);return r===null&&e!==void 0?e:r}catch(r){return console.warn('[LocalData] Failed to parse stored value for key "'+t+'". Removing corrupted entry.',r),localStorage.removeItem(t),e!==void 0?e:void 0}}static store(t,e){if(!t||!e)return!1;try{let s=JSON.stringify(e);return localStorage.setItem(t,s),!0}catch(s){return console.error('[LocalData] Failed to store data for key "'+t+'".',s),!1}}static remove(t){return t?(localStorage.removeItem(t),!0):!1}};var w=(n={})=>{let t={};if(!O.isObject(n))return t;let e=Object.keys(n);for(let s=0,r=e.length;s<r;s++){let i=e[s],o=n[i];typeof o!="function"&&(t[i]=o)}return t};var rt=0,X=new b(8e3),A={CHANGE:"change",DELETE:"delete"},W=(n,t)=>{let e=X.get(n);return e||(e={change:`${n}:change`,delete:`${n}:delete`},X.set(n,e)),t==="change"?e.change:e.delete},_=class n{constructor(t={}){this.dirty=!1,this._retainState=!1,this._refreshState=!1,this.links=new Map,this._init(),this.setup(),this.dataTypeId="bd",this.eventSub=this.createEventSub();let e=w(t);this._initAttributes(e);let s=G(this);return this._proxy=s,s}retainState(){return this._retainState=!0,this._proxy||this}refreshState(){return this._refreshState=!0,this._proxy||this}setup(){this.stage={}}createEventSub(){return new P}_canSilentInit(){let t=n.prototype;return this.set===t.set&&this._setAttr===t._setAttr&&this._publish===t._publish}_initAttributes(t){if(this._canSilentInit()===!1){this.set(t);return}let e=this.stage,s=Object.keys(t);for(let r=0,i=s.length;r<i;r++){let o=s[r],c=t[o];c!==void 0&&(e[o]=c)}}_init(){let t=++rt;this._dataNumber=t,this._id=`dt-${t}`,this._dataId=`${this._id}:`}onFlush(t){this.eventSub.onFlush(t)}flushPending(){this.eventSub.flush()}getDataId(){return String(this._id)}remove(){this.unlink(),this.eventSub.reset()}on(t,e){let s=W(t,A.CHANGE);return this.eventSub.on(s,e)}off(t,e){let s=W(t,A.CHANGE);this.eventSub.off(s,e)}_setAttr(t,e,s=this,r=!1){let i=this.stage[t];e!==i&&(this.stage[t]=e,this._publish(t,e,s,A.CHANGE))}publishLocalEvent(t,e,s,r){let i=W(t,r);this.eventSub.publish(i,e,s)}_publish(t,e,s,r){this.publishLocalEvent(t,e,s,r),g.getPrefixMessages(this._dataId)!==null&&(s=s||this,g.publish(this._dataId+t,e,s))}set(t,e,s){if(typeof t!="object")return this._setAttr(t,e,s),this;let r=Object.keys(t);for(let i=0;i<r.length;i++){let o=r[i],c=t[o];typeof c!="function"&&this._setAttr(o,c,e,s)}return this}_silentSet(t){let e=this.stage,s=Object.keys(t);for(let r=0,i=s.length;r<i;r++){let o=s[r];e[o]=t[o]}}getModelData(){return this.stage}_deleteAttr(t,e,s=this){delete t[e],this.publishLocalEvent(e,null,s,A.DELETE)}toggle(t){return typeof t>"u"?this:(this.set(t,!this.get(t)),this)}increment(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s+e),this}decrement(t,e=null){if(typeof t>"u")return this;e=e!==null&&typeof e=="number"?e:1;let s=this.get(t);return this.set(t,s-e),this}concat(t,e){if(typeof t>"u")return this;let s=this.get(t);return this.set(t,s+e),this}ifNull(t,e){return this.get(t)===null&&this.set(t,e),this}setKey(t,e){return this.key=e!=null?t+":v"+e:t,this}resume(t){let e=x.resume(String(this.key),t);return e?(this.set(e),this):this}store(){let t=this.get();return x.store(String(this.key),t)}delete(t){return typeof t=="string"?(this._deleteAttr(this.stage,t),this):(this.setup(),this)}_getAttr(t,e){return t[e]}get(t){return typeof t<"u"?this._getAttr(this.stage,t):this.getModelData()}link(t,e,s){if(arguments.length===1&&t.isData===!0&&(e=t.get()),typeof e!="object")return this.remoteLink(t,e,s);let r=[];return Object.entries(e).forEach(([i])=>{r.push(this.remoteLink(t,i))}),r}remoteLink(t,e,s){let r=s||e,i=t.get(e);typeof i<"u"&&this.get(r)!==i&&this.set(r,i);let o=t.on(e,(u,l)=>{if(l===this)return!1;this.set(r,u,t)}),c=this.on(r,(u,l)=>{if(l===t)return!1;t.set(e,u,this)});return this.addLink(o,t,e,c),t.addLink(c,this,r,o),o}addLink(t,e,s,r){this.links.set(t,{data:e,attr:s,pair:r})}unlink(t){if(t){this.removeLink(t);return}let e=this.links;e.size!==0&&(e.forEach((s,r)=>{this.removeLink(r,!1)}),e.clear())}removeLink(t,e=!0){let s=this.links.get(t);if(s){let r=s.data;s.attr&&r.off(s.attr,t);let i=s.pair,o=i&&r.links;if(o){let c=o.get(i);c&&(o.delete(i),c.attr&&this.off(c.attr,i))}}e!==!1&&this.links.delete(t)}};_.prototype.isData=!0;var Q=new Set(["__proto__","prototype","constructor"]),nt=n=>{let t=[],e=n.length,s=0;for(let r=0;r<e;r++){let i=n.charCodeAt(r);i!==46&&i!==91&&i!==93||(r>s&&t.push(n.substring(s,r)),s=r+1)}return e>s&&t.push(n.substring(s)),t.length>0?t:null},p={deepDataPattern:/(\w+)|(?:\[(\d)\))/g,segmentCache:new b(5e3),hasDeepData(n){return n.indexOf(".")!==-1||n.indexOf("[")!==-1},isSafeAttr(n){return!Q.has(n)},getSegments(n){let t=this.segmentCache.get(n);if(t!==void 0)return t;if(t=nt(n),t){for(let e=0,s=t.length;e<s;e++)if(Q.has(t[e])){console.warn("[Data] Blocked unsafe path segment in: "+n),t=null;break}}return this.segmentCache.set(n,t),t}};var m=class{static set(t,e,s){if(!p.hasDeepData(e)){if(!p.isSafeAttr(e))return;t[e]=s;return}let r,i=p.getSegments(e);if(!i)return;let o=i.length,c=o-1;for(let u=0;u<o;u++){let l=i[u];if(u===c){t[l]=s;break}if(t[l]===void 0){let h=l.charCodeAt(0);t[l]=h<48||h>57?{}:[]}t=t[l]}}static delete(t,e){if(!p.hasDeepData(e)){if(!p.isSafeAttr(e))return;delete t[e];return}let s=p.getSegments(e);if(!s)return;let r=s.length,i=r-1;for(let o=0;o<r;o++){let c=s[o],u=t[c];if(u===void 0)break;if(o===i){if(Array.isArray(t)){let l=Number(c);Number.isInteger(l)&&l>=0&&l<t.length&&t.splice(l,1);break}delete t[c];break}t=u}}static get(t,e){if(!p.hasDeepData(e))return t[e]??void 0;let s=p.getSegments(e);if(!s)return;let r=s.length,i=r-1;for(let o=0;o<r;o++){let c=s[o],u=t[c]??void 0;if(u===void 0)break;if(t=u,o===i)return t}}};var Y=new Set,L=class{static MAX_DEPTH=50;static publishDeep(t,e,s,r){if(!p.hasDeepData(e)){this.publish(e,s,r);return}let i,o=p.getSegments(e);if(!o)return;let c=o.length,u=c-1,l="";for(let h=0;h<c;h++){let a=o[h];t=t[a];let f=a.charCodeAt(0);h>0?(f<48||f>57)&&(l+="."+a):l=a;let d;if(h===u)d=s;else{let y=o[h+1],S=y.charCodeAt(0);if(S>=48&&S<=57){l+="["+y+"]";continue}let k={};k[y]=t[y],d=k}this.publish(l,d,r)}}static publish(t,e,s,r=null,i=0){if(t=t||"",s(t,e),!(!e||typeof e!="object"||(e=F(e),r===null&&(Y.clear(),r=Y),!r))){if(r.has(e)){console.warn("[Publisher] Circular reference detected at path:",t);return}if(i>=this.MAX_DEPTH){console.warn("[Publisher] Max depth exceeded at path:",t,"- stopping recursion");return}r.add(e),Array.isArray(e)?this.publishArray(t,e,s,r,i):this.publishObject(t,e,s,r,i)}}static publishArray(t,e,s,r,i){let o=e.length;for(let c=0;c<o;c++){let u=e[c],l=t+"["+c+"]";this._checkPublish(l,u,s,r,i)}}static publishObject(t,e,s,r,i){let o=Object.keys(e);for(let c=0,u=o.length;c<u;c++){let l=o[c],h=e[l],a=t+"."+l;this._checkPublish(a,h,s,r,i)}}static _checkPublish(t,e,s,r,i){if(!e||typeof e!="object"){s(t,e);return}this.publish(t,e,s,r,i+1)}};var C=class n extends _{setup(){this.attributes={},this.stage={}}createEventSub(){return new P(!1,!0)}_canSilentInit(){let t=n.prototype;return this.set===_.prototype.set&&this._setAttr===t._setAttr&&this._publish===t._publish}_initAttributes(t){if(this._canSilentInit()===!1){this.set(t);return}let e=this.stage,s=this.attributes,r=Object.keys(t);for(let i=0,o=r.length;i<o;i++){let c=r[i],u=t[c];if(u!==void 0){if(p.hasDeepData(c)){m.set(s,c,u),m.set(e,c,u);continue}p.isSafeAttr(c)&&(s[c]=u,e[c]=u)}}}_setAttr(t,e,s,r){if(typeof e!="object"&&e===this.get(t))return;!s&&r!==!0?m.set(this.attributes,t,e):this.dirty===!1&&(this.dirty=!0),m.set(this.stage,t,e);let i=this._upstream,o=s;s=s||this,this._publish(t,e,s,A.CHANGE),i&&o!==i.data&&i.keys.has(t)&&i.data.set(i.prefix+t,e,this)}_silentSet(t){let e=this.stage,s=this.attributes,r=Object.keys(t);for(let i=0,o=r.length;i<o;i++){let c=r[i],u=t[c];e[c]=u,s[c]=u}}linkAttr(t,e){let s=t.get(e);if(!s)return;let r=Object.keys(s);for(let i=0,o=r.length;i<o;i++){let c=r[i];this.link(t,e+"."+c,c)}}scope(t,e){let s=this.get(t);if(!s)return!1;e=e||this.constructor;let r=new e(s);return typeof r.linkScope=="function"?r.linkScope(this,t):r.linkAttr(this,t),r}linkScope(t,e){let s=t.get(e);if(!s)return;let r=e+".",i=new Set(Object.keys(s));for(let o of i){let c=r+o,u=t.on(c,(l,h)=>{if(h===this)return!1;this.set(o,l,t)});this.addLink(u,t,c,null)}this._upstream={data:t,prefix:r,keys:i}}unlink(t){t||(this._upstream=null),super.unlink(t)}splice(t,e){return this.delete(t+"["+e+"]"),this.refresh(t),this}push(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.push(e),this.set(t,s),this}concat(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s=s.concat(e),this.set(t,s),this}unshift(t,e){let s=this.get(t);return Array.isArray(s)===!1&&(s=[]),s.unshift(e),this.set(t,s),this}shift(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.shift();return this.set(t,e),s}getIndex(t,e,s){let r=this.get(t);return Array.isArray(r)===!1?-1:typeof r[0]!="object"?r.indexOf(e):r.findIndex(o=>o[e]===s)}pop(t){let e=this.get(t);if(Array.isArray(e)===!1)return null;let s=e.pop();return this.set(t,e),s}refresh(t){return this.set(t,this.get(t)),this}_publish(t,e,s,r){if(this._publishAttr(t,e,s,r),!e||typeof e!="object")return;let i=t.length,o=r===A.CHANGE?":change":":"+r,c=o.length,u=i+c,l=this.eventSub.getRootMessages(J(t))||[];for(let a of l){if(a.length<=u||!a.endsWith(o)||!a.startsWith(t))continue;let f=a.charCodeAt(i);if(f!==46&&f!==91)continue;let d=a.slice(0,a.length-c);this._publishAttr(d,this.get(d),s,r)}let h=g.getPrefixMessages(this._dataId);if(h){let a=this._dataId.length;for(let f of h){if(f.length-a<=i||!f.startsWith(t,a))continue;let y=f.charCodeAt(a+i);if(y!==46&&y!==91)continue;let S=f.slice(a);g.publish(f,this.get(S),s)}}}_publishAttr(t,e,s,r){g.getPrefixMessages(this._dataId)!==null&&g.publish(this._dataId+t,e,s),this.publishLocalEvent(t,e,s,r)}mergeStage(){this.attributes=D.clone(this.stage),this.dirty=!1}getModelData(){return this.mergeStage(),this.attributes}revert(){this.set(this.attributes),this.dirty=!1}_deleteAttr(t,e,s=this){m.delete(t,e),this._delCommitter=s;let r=this._deleteCb||(this._deleteCb=i=>this._publishAttr(i,null,this._delCommitter,A.DELETE));L.publish(e,null,r)}_getAttr(t,e){return m.get(t,e)}};var it={"\n":"\\n","\r":"\\n"," ":"\\t"},ot=(n,t)=>{typeof n!="string"&&(n=String(n));let e=t?/[\n\r\t]/g:/\t/g;return n.replace(e,s=>it[s])},Z=(n,t)=>{if(typeof n!="string")return n;n=ot(n,t),n=encodeURIComponent(n);let e=/%22/g;return n.replace(e,'"')},H=(n,t)=>{let e=typeof n;if(e==="undefined")return n;if(e!=="object")return n=Z(n),n;let s=Array.isArray(n)?[...n]:{...n};return Object.keys(s).forEach(r=>{let i=s[r];i!==null&&(s[r]=typeof i=="string"?H(i,t):Z(i,t))}),s};function tt(n){if(typeof n>"u"||n.length<1)return!1;try{return JSON.parse(n)}catch(t){return console.warn("[Encode] Failed to parse JSON.",t),!1}}function q(n){return typeof n<"u"?JSON.stringify(n):null}var v=class{static prepareJsonUrl(t,e=!1){let s=typeof t=="object"?D.clone(t):t,r=H(s,e);return q(r)}static json={encode:q,decode:tt};static xmlParse(t){return typeof t>"u"?!1:new DOMParser().parseFromString(t,"text/xml")}};var B=n=>n?n.data?n.data:n.context&&n.context.data?n.context.data:n.state?n.state:null:null;var N=class extends K{static create(t,e,s,r){let i=document.createElement(t);return this.addAttributes(i,e,r),s.appendChild(i),i}static addAttributes(t,e,s){if(!(!e||e.length<1))for(let r=0,i=e.length;r<i;r++){let o=e[r];this.addAttr(t,o.key,o.value,s)}}static addAttr(t,e,s,r){if(s===""||!e||e==="children")return;if(e==="innerHTML"){t.innerHTML=s;return}if(typeof s==="function"){if(e=$(e),s.originalCallback)j.add(e,t,s,!1,!0,s.originalCallback);else{let c=s,u=function(l){c.call(this,l,r)};j.add(e,t,u,!1,!0,c)}return}if(e.charCodeAt(4)===45){t.setAttribute(e,s);return}let o=T(e);t[o]=s}static addContent(t,e){e&&(e.textContent!==null?t.textContent=e.textContent:e.innerHTML&&(t.innerHTML=e.innerHTML))}static append(t,e){t.appendChild(e)}};var et=/(\[\[(.*?(?:\[\d+\])?)\]\])/g,st=new b(1e3),ct=new Set(["disabled","checked","required","selected","hidden","readonly","readOnly","multiple","open","autofocus","inert"]),ut=n=>typeof n=="string"?n!==""&&n!=="false":!!n,lt=(n,t)=>{if(t.charCodeAt(4)===45){n.removeAttribute(t);return}let e=T(t);if(e in n){n[e]="";return}n.removeAttribute(t)},V={isWatching(n){if(Array.isArray(n)){let t=n[0];return typeof t=="string"&&t.includes("[[")}return this.hasParams(n)},hasParams(n){return typeof n=="string"&&n.includes("[[")},_getWatcherProps(n){let t=st.get(n);if(t!==void 0)return t;let e=n.match(et),s=e?e.map(r=>r.slice(2,-2)):null;return st.set(n,s),s},updateAttr(n,t,e){switch(t){case"text":case"textContent":n.textContent=e;break;case"disabled":case"checked":case"required":case"selected":case"hidden":case"readonly":case"readOnly":case"multiple":case"open":case"autofocus":case"inert":n[t==="readonly"?"readOnly":t]=ut(e);break;case"src":if(n.tagName==="IMG"){n.src=e&&(e.indexOf(".")!==-1||e.indexOf("blob:")!==-1)?e:"";break}n.src=e;break;default:if(e===""&&t){lt(n,t);break}N.addAttr(n,t,e);break}},replaceParams(n,t,e=!1){let s=0;return n.replace(et,function(r,i,o){let c=e?t[s]:t;s++;let u=c.get(o);return u??""})},_getWatcherCallBack(n,t,e,s,r){let i=this._getWatcherProps(e);if(i&&i.length===1&&e.length===i[0].length+4){let o=i[0],c=r?t[0]:t;return ct.has(s)?()=>{this.updateAttr(n,s,c.get(o))}:()=>{let u=c.get(o);this.updateAttr(n,s,u!=null?String(u):"")}}return()=>{let o=this.replaceParams(e,t,r);this.updateAttr(n,s,o)}},getValue(n,t){let e=n.value;return Array.isArray(e)===!1?[e,B(t)]:e.length<2?[e[0],B(t)]:e},getPropValues(n,t,e){let s=[];for(let r=0,i=t.length;r<i;r++){let c=(e?n[r]:n).get(t[r])??"";s.push(c)}return s},getCallBack(n,t,e,s,r,i){let o=n.attr||"textContent",c=n.callBack;if(typeof c=="function"){let u=i||this._getWatcherProps(s)||[],l=u.length>1;return(h,a)=>{h=l!==!0?h:this.getPropValues(e,u,r);let f=c(h,t,a);typeof f<"u"&&this.updateAttr(t,o,f)}}return this._getWatcherCallBack(t,e,s,o,r)},addDataWatcher(n,t,e){let s=this.getValue(t,e),r=s[1]??e?.data??e?.context?.data??e?.state??null;if(!r)return;let i=s[0],o=Array.isArray(r),c=this._getWatcherProps(i);if(!c)return;let u=this.getCallBack(t,n,r,i,o,c);if(!o)c.length>1?g.watchMany(n,r,c,u):this.addWatcher(n,r,c[0],u);else for(let l=0,h=c.length;l<h;l++)this.addWatcher(n,r[l],c[l],u)},getWatcherSettings(n,t=null){if(typeof n=="string")return{attr:t,value:n};if(Array.isArray(n)){let e=n[n.length-1];e&&typeof e=="object"&&(e=t!==null?t:null);let s=n[1]&&typeof n[1]=="object"?[n[0],n[1]]:[n[0]];return typeof e=="function"?{attr:t,value:s,callBack:e}:{attr:e||"textContent",value:s}}return n},setup(n,t,e){t&&this.addDataWatcher(n,this.getWatcherSettings(t),e)},addWatcher(n,t,e,s){g.watch(n,t,e,s)}};var I=class{constructor(t){this.model=t,this.objectType=this.objectType||"item",this.url="",this.validateCallBack=null,this.requestOptions=null,this.init()}init(){let t=this.model;t&&t.url&&(this.url=t.url)}isValid(){let t=this.validate();if(t!==!1){let e=this.validateCallBack;typeof e=="function"&&e(t)}return t}validate(){return!0}getDefaultParams(){return""}setupParams(t){let e=this.getDefaultParams();return t=this.addParams(t,e),t}objectToString(t){let e=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.push(s+"="+t[s]);return e.join("&")}addParams(t,e){if(t=t||{},typeof t=="string"&&(t=M.parseQueryString(t,!1)),!e)return this._isFormData(t)?t:this.objectToString(t);if(typeof e=="string"&&(e=M.parseQueryString(e,!1)),this._isFormData(t))for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.append(s,e[s]);else t=Object.assign(t,e),t=this.objectToString(t);return t}get(t,e){let s=this.model.get("id"),r="id="+s,i=s?`/${s}`:"",o=this.model;return this._get(i,r,t,e,c=>{if(c){let u=this.getObject(c);u&&o.set(u)}})}getObject(t){return t[this.objectType]||t||!1}setupObjectData(){let t=this.model.get();return this.objectType+"="+v.prepareJsonUrl(t)}setup(t,e){if(!this.isValid())return;let s=this.setupObjectData(),r=this.model.id,i=r!=null?`/${r}`:"";return this._put(i,s,t,e)}add(t,e){if(!this.isValid())return;let s=this.setupObjectData(),r=this.model.id,i=r!=null?`/${r}`:"";return this._post(i,s,t,e)}update(t,e){if(!this.isValid())return;let s=this.setupObjectData(),r=this.model.id,i=r!=null?`/${r}`:"";return this._patch(i,s,t,e)}delete(t,e){let s=this.model.get("id"),r=typeof s<"u"?"id="+s:this.setupObjectData(),i=s!=null?`/${s}`:"";return this._delete(i,r,t,e)}getAllParams(t,e,s,r){let i=this.model.get();t=isNaN(Number(t))?0:t,e=isNaN(Number(e))?50:e;let o=i.search||"",c=f=>{try{return JSON.stringify(f)}catch(d){return console.error("[ModelService] Failed to serialize request param.",d),""}},u=i.filter||"";typeof u=="object"&&(u=c(u));let l=i.dates||"";typeof l=="object"&&(l=c(l));let h=i.orderBy||"";typeof h=="object"&&(h=c(h));let a=i.groupBy||"";return Array.isArray(a)&&(a=c(a)),"&filter="+encodeURIComponent(u)+"&offset="+t+"&limit="+e+"&dates="+encodeURIComponent(l)+"&orderBy="+encodeURIComponent(h)+"&groupBy="+encodeURIComponent(a)+"&search="+encodeURIComponent(o)+"&lastCursor="+(typeof s<"u"&&s!==null?encodeURIComponent(s):"")+"&since="+(typeof r<"u"&&r!==null?encodeURIComponent(r):"")}all(t,e,s,r,i=null,o=null){let c=this.getAllParams(s,r,i,o);return this._get("",c,t,e)}getUrl(t){let e=this.url;if(!t)return this.replaceUrl(e);t[0]==="/"&&(t=t.substring(1));let s=t[0]==="?"?e+t:e+"/"+t;return this.replaceUrl(s)}withOptions(t){return Object.create(this,{requestOptions:{value:t||null,writable:!0}})}withCache(t=!0){return this.withOptions({...this.requestOptions,cache:t})}setupRequest(t,e,s,r,i,o){o=o||this.requestOptions||null;let c=(a,f)=>{typeof i=="function"&&i(a),this.getResponse(a,r,f)},u={url:this.getUrl(t),method:e,params:s,completed:c},l=this._isFormData(s);if(l&&(u.headers={}),!o)return E(u);o.invalidate&&(u.completed=(a,f)=>{a!==!1&&a!=null&&R.invalidate(o.invalidate),c(a,f)});let h=o.cache;return!h||!this.isCacheableMethod(e)||l?E(u):this.cachedRequest(u,h===!0?{}:h)}isCacheableMethod(t){let e=String(t||"").toUpperCase();return e==="GET"||e==="HEAD"}getCacheKey(t){let e=t.params||"";if(typeof e=="object")try{e=JSON.stringify(e)}catch{e=""}return t.method.toUpperCase()+" "+t.url+(e?" "+e:"")}cachedRequest(t,e){let s=e.key||this.getCacheKey(t),r=t.completed,i=o=>E({...t,completed:(c,u)=>o(c!=null,c,u),failed:(c,u)=>o(!1,!1,u),aborted:(c,u)=>o(!1,!1,u)});return R.resolve(s,i,{ttl:e.ttl,swr:e.swr},(o,c)=>r(o,c))}setupEventSource(t,e,s,r,i=!0){let o=null,c,u=!1,l=!1,h=()=>{c&&(clearTimeout(c),c=void 0)},a=()=>{if(u||!i||l)return;h(),c=setTimeout(()=>{c=void 0,f()},3e3)},f=()=>{if(u||l)return;if(o){try{o.close()}catch{}o=null}l=!0;let d=this.getUrl(t),y=e?"?"+e:"";o=new EventSource(d+y,{withCredentials:!0}),o.onopen=()=>{l=!1,h(),r&&r()},o.onerror=()=>{l=!1,o&&o.readyState===EventSource.CLOSED&&(o=null,a())},o.onmessage=S=>{try{let k=JSON.parse(S.data);s&&s(k)}catch{}}};return f(),{get source(){return o},close:()=>{if(u=!0,l=!1,h(),o){try{o.close()}catch{}o=null}}}}replaceUrl(t){return V.isWatching(t)&&(t=V.replaceParams(t,this.model)),t.endsWith("/")&&(t=t.substring(0,t.length-1)),t}_isFormData(t){return t instanceof FormData}request(t,e,s,r,i){return this._request("","POST",t,e,s,r,i)}_get(t,e,s,r,i,o){return e=this.setupParams(e),e=this.addParams(e,s),t=t||"",e&&(t+="?"+e),this.setupRequest(t,"GET","",r,i,o)}_post(t,e,s,r,i,o){return this._request(t,"POST",e,s,r,i,o)}_put(t,e,s,r,i,o){return this._request(t,"PUT",e,s,r,i,o)}_patch(t,e,s,r,i,o){return this._request(t,"PATCH",e,s,r,i,o)}_delete(t,e,s,r,i,o){return this._request(t,"DELETE",e,s,r,i,o)}_request(t,e,s,r,i,o,c){return s=this.setupParams(s),s=this.addParams(s,r),this.setupRequest(t,e,s,i,o,c)}getResponse(t,e,s){typeof e=="function"&&e(t,s)}static extend(t){if(!t)return{};let e=this;class s extends e{constructor(i){super(i)}}return Object.assign(s.prototype,t),s}};var ht=n=>{let t={};if(!O.isObject(n)||!n.defaults)return t;let{defaults:e}=n;return Object.keys(e).forEach(s=>{let r=e[s];typeof r!="function"&&(t[s]=r)}),delete n.defaults,t},at=n=>{if(!n||typeof n.xhr!="object")return{};let t={...n.xhr};return delete n.xhr,t},ft=0,U=class extends C{constructor(t){let e=super(t);return this.initialize(),e}setup(){this.attributes={},this.stage={},this.url=this.url||"",this.xhr=this.xhr||{}}initialize(){}static extend(t={}){let e=this,s=at(t),r=e.prototype.service.extend(s),i=ht(t);class o extends e{constructor(u){let l={...i,...w(u)};super(l),this.xhr=new r(this)}dataTypeId=`bm${ft++}`}return Object.assign(o.prototype,t),o.prototype.service=r,o}};U.prototype.service=I;var z=class extends _{};export{b as a,_ as b,C as c,B as d,N as e,V as f,U as g,z as h};
|
|
2
|
+
//# sourceMappingURL=chunk-76NP53O5.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as g}from"./chunk-76NP53O5.js";var i=class extends g{setup(){this.stage={}}addAction(t,e){return typeof e<"u"&&this.set(t,e),this}getState(t){return this.get(t)}removeAction(t,e){if(e)return this.off(t,e),this;let s=this.stage;return typeof s[t]<"u"&&delete s[t],this}};var n=class extends i{constructor(t){super(),this.id=t}setup(){this.stage={},this.id=""}};var h=class{static targets=new Map;static ownerCounts=new Map;static restore(t,e){this.targets.set(t,e),this.addOwner(t)}static getTarget(t){return this.targets.has(t)||this.targets.set(t,new n(t)),this.targets.get(t)}static attach(t){let e=this.getTarget(t);return this.addOwner(t),e}static addOwner(t){this.ownerCounts.set(t,(this.ownerCounts.get(t)||0)+1)}static detach(t){let e=this.ownerCounts.get(t);if(e===void 0)return;if(e>1){this.ownerCounts.set(t,e-1);return}this.ownerCounts.delete(t);let s=this.targets.get(t);s&&(s.remove(),this.targets.delete(t))}static getActionState(t,e){return this.getTarget(t).get(e)}static add(t,e,s){let r=this.getTarget(t);return e&&r.addAction(e,s),r}static addAction(t,e,s){return this.add(t,e,s)}static removeAction(t,e,s){if(s){this.off(t,e,s);return}let r=this.getTarget(t);r&&e&&r.removeAction(e)}static on(t,e,s){let r=this.getTarget(t);return e?r.on(e,s):null}static off(t,e,s){this.remove(t,e,s)}static remove(t,e,s){let r=this.targets,o=r.get(t);if(o){if(e){o.off(e,s);return}this.targets.delete(t),this.ownerCounts.delete(t)}}static set(t,e,s){this.getTarget(t).set(e,s)}};export{i as a,h as b};
|
|
2
|
+
//# sourceMappingURL=chunk-EBXFAKPV.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as A}from"./chunk-EBXFAKPV.js";import{a as I,b as Bt,c as Ht,d as R,e as S,f as L}from"./chunk-76NP53O5.js";import{a as W,b as _t}from"./chunk-6N533MOU.js";import{b as Mt,c as Ot,f as E,g as Dt,i as q}from"./chunk-6EAE4I3C.js";import{b as f,c as p}from"./chunk-ZUB7I6Z4.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=[],j=0,dt=!1,ze=typeof queueMicrotask=="function"?queueMicrotask:n=>Promise.resolve().then(n),Qe=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||n.container||null},Ye=n=>{n._mountPending=!1;try{n.afterMount()}catch(t){console.error("Error in afterMount:",t)}},Ut=()=>{dt=!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=Qe(s);if(o&&o.isConnected===!0){Ye(s);continue}t.push(s)}t.length&&(g=g.length?t.concat(g):t),g.length&&j===0&&g.length!==t.length&&ft()},ft=()=>{dt||(dt=!0,ze(Ut))},v={add(n){n._mountPending!==!0&&(n._mountPending=!0,g.push(n))},enter(){j++},leave(){--j>0||(j=0,g.length&&ft())},schedule(){g.length&&ft()},flush(){Ut()},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 Ve=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-"+Ve++,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 pt=Symbol("unknown"),mt=n=>{if(!n||typeof n!="object")return null;let t={};for(let e in n){if(!Object.prototype.hasOwnProperty.call(n,e))continue;let r=n[e];if(r===null||typeof r!="object"){t[e]=r;continue}try{t[e]=JSON.stringify(r)}catch{t[e]=pt}}return t},$e=(n,t)=>{let e=new Set([...Object.keys(n),...Object.keys(t)]);for(let r of e){let s=n[r],o=t[r];if(!(s===pt||o===pt)&&s!==o&&!(s!==s&&o!==o))return!1}return!0},gt=(n,t)=>{!n||!t||Object.defineProperty(n,"_initialStage",{value:t,configurable:!0,writable:!0,enumerable:!1})},_=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}this._releaseLinks(e,r);let s=mt(r.stage);gt(r,s);let o=e?e._initialStage:null,i=!!(o&&s&&!$e(o,s));if(e&&e.stage&&(!i||e._retainState||r._retainState)){let a=e._retainState||r._retainState,l=!a&&(e._refreshState||r._refreshState),c=this._buildExternalUpdates(e.stage,r.stage,a,l);W.isEmpty(c)||r._silentSet(c)}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 Y=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&&A.remove(o.targetId,o.action,o.token)}}restore(t){A.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=A.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,this._externalData&&!t._initialStage&>(t,mt(t.stage)))}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=A.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 Y(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)),A.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 Nt={created:"onCreated",setStates:"setupStates",state:"setupStates",events:"setupEvents",before:"beforeSetup",render:"render",after:"afterSetup",mounted:"afterMount",destroy:"beforeDestroy"},Wt=(n,t)=>typeof n!="function"&&t==="setupStates"?()=>n:n;var yt=(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=Nt[o]||o;t[a]=Wt(i,a)}return t},Je=n=>yt(n,{}),Xe=0,qt=(n,t)=>{class e extends n{}return Object.assign(e.prototype,t),e.prototype._classId="jot"+Xe++,e},M=(n,t=x)=>{n||(n={});let e,r=typeof n;return r==="object"&&n.render?(e=Je(n),qt(t,e)):(e={render:r==="function"?n:()=>n},qt(t,e))};var St=(n,t)=>({attr:n,directive:t});var k=(n,t)=>({key:n,value:t});var Ft=(n,t,e,r)=>({tag:n,attr:t,directives:e,children:r});var Gt=null,Ze=()=>Gt||(Gt=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(St(k(e,L.getWatcherSettings(r,Dt(e))),Ze()))}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 h=0;h<a.length;h++)i.push(a[h]);else i.push(a);continue}if((l=F.get(c))!==null){s.push(St(k(c,a),l));continue}let u=typeof a;if(u==="object"){if(L.isWatching(a)){this.setTextAsWatcher(s,c,a);continue}i.push(a);continue}if(u==="function"){let h=a,m=function(y){h.call(this,y,e)};m.originalCallback=h,r.push(k(c,m));continue}if(u==="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 Ft(o,r,s,i)}};var O=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 tr=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 O{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"&&tr(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,u=a.length;c<u;c++){let h=a[c];h!==null&&this.buildElement(h,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,...yt(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 er=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source"]),rr=/[&<>"]/,vt=n=>{let t=typeof n=="string"?n:String(n);return rr.test(t)?t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):t},D=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,u=l.value;if(c==="text"||c==="textContent"){s+=vt(u);continue}if(c==="html"||c==="innerHTML"){s+=u;continue}if(typeof u=="function")continue;let h=c+'="'+vt(u)+'"';o?o+=" "+h:o=h}return er.has(t)?"<"+t+" "+o+" />":"<"+t+" "+o+">"+s+r+"</"+t+">"}static createText(t){return vt(t)}static createComment(t){return"<!-- "+t+" -->"}};var $=class extends O{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 D.createText(o)}else if(r==="comment"){let s=t.attr[0],o=s?s.value:"";return D.createComment(o)}return D.create(r,t.attr,e)}removeAll(t){}};var J=class{static browserIsSupported(){return typeof window<"u"&&typeof document=="object"}static setup(){return this.browserIsSupported()?new V:new $}};var b=J.setup(),nr=n=>typeof n=="object"&&n.isUnit===!0,Kt=new WeakMap,sr=n=>{let t=Kt.get(n);if(!t){if(t=M(n),!t)return null;Kt.set(n,t)}return new t},d=class{static render(t,e,r){if(!t||(nr(t)||(t=sr(t)),!t))return null;v.enter();try{return b.createComponent(t,e,r)}finally{v.leave()}}static build(t,e,r){v.enter();try{return b.build(t,e,r)}finally{v.leave()}}static rebuild(t,e,r){return b.removeAll(e),this.build(t,e,r)}static setDirectives(t,e,r){b.setDirectives(t,e,r)}static createNode(t,e,r){return b.createNode(t,e,r)}static removeNode(t){b.removeNode(t)}static removeAll(t){b.removeAll(t)}};_t.augment({buildLayout(n,t,e){d.build(n,t,e)}});var xt=[],or=n=>xt.indexOf(n)!==-1,ir=n=>({tag:"script",src:n.src,async:!1,load(t){xt.push(n.src);let e=n.load;e&&e()}}),ar=n=>({tag:"link",rel:"stylesheet",type:"text/css",href:n.src,load(t){xt.push(n.src);let e=n.load;e&&e()}}),X=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=ar({load:r,src:t}):e=ir({load:r,src:t}),d.build(e,document.head)}addFiles(t){t&&t.forEach(e=>{or(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 lr=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):(lr(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 Z=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 cr=n=>({tag:"comment",textContent:"import placeholder",onCreated:n.onCreated}),T=new I(100),jt=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},zt=n=>{if(!T.has(n))return null;let t=T.get(n);return t&&typeof t.then=="function"?null:t||null},Qt=n=>{let t=typeof n;if(t!=="string"&&t!=="function")return null;if(zt(n))return Promise.resolve(T.get(n));let e;try{e=jt(n)}catch{return null}return e.catch(()=>null)},kt=n=>{for(let t=0,e=n.length;t<e;t++){let r=n[t];r&&d.removeNode(r)}},Yt=M({declareProps(){this.loaded=!1,this.errorRoot=null,this.loadingRoots=null,this.generation=0},render(){return cr({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 X(()=>{this.loadAndRender(n)}).addFiles(this.depends);return}this.loadAndRender(n)}}})},loadAndRender(n){let t=this.generation,e=zt(this.src);if(e){this.renderModule(n,e);return}this.renderLoading(n),Z.load(jt(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,kt(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&&(kt(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&&(kt(this.layoutRoots||[this.layoutRoot]),this.persist!==!0&&(this.layoutRoot=null,this.layoutRoots=null,this.layout=null,this.loaded=!1,this.updateLayout=!1))}});var Vt=n=>{let t=typeof n;return(t==="string"||t==="function"||n instanceof Promise)&&(n={src:n}),new Yt(n)};var ur=0,B=class{constructor(t){this.router=t,this.locationId="base-app-router-"+ur++,this.callBack=this.check.bind(this)}setup(){return this.trackScroll(),this.addEvent(),this}check(t){}getScrollPosition(){let t=this.scrollPosition;return t?{x:t.x,y:t.y}:{x:window.scrollX,y:window.scrollY}}trackScroll(){typeof window>"u"||this.scrollHandler||(this.scrollPosition={x:window.scrollX,y:window.scrollY},this.scrollHandler=()=>{this.scrollPosition={x:window.scrollX,y:window.scrollY}},window.addEventListener("scroll",this.scrollHandler,{passive:!0}))}untrackScroll(){this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollPosition=null)}scrollTo(t){window.scrollTo(t.x,t.y),this.scrollHandler&&(this.scrollPosition={x:t.x,y:t.y})}addEvent(){return this}};var hr=0,dr=()=>Date.now().toString(36)+"-"+(hr++).toString(36)+"-"+Math.random().toString(36).substring(2,8),Jt=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent||"")&&!window.MSStream,$t=()=>{Jt&&requestAnimationFrame(()=>requestAnimationFrame(()=>{let n=window.scrollX,t=window.scrollY;window.scrollTo(0,t+1),document.documentElement.offsetHeight,window.scrollTo(n,t)}))},tt=class extends B{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"),Jt&&(this.pageShowCallBack=this.onPageShow.bind(this),p.on("pageshow",window,this.pageShowCallBack)),this}removeEvent(){p.off("popstate",window,this.callBack),this.untrackScroll();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&&$t()}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)),$t()}createState(t,e={}){let r=this.getScrollPosition();return e=e===null?{}:e,{location:this.locationId,...e,key:dr(),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 et={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 rt=class extends B{addEvent(){return p.on("hashchange",window,this.callBack),this}removeEvent(){return p.off("hashchange",window,this.callBack),this.untrackScroll(),this}check(t){this.router.checkActiveRoutes(et.getHashUri(t.newURL))}addState(t,e,r){return window.location.hash=t,this}};var nt=class{static browserIsSupported(){return typeof window=="object"&&"history"in window&&"pushState"in window.history}static setup(t){return this.browserIsSupported()?new tt(t).setup():new rt(t).setup()}};var wt=5,fr=200,st=class{constructor(t){this.owner=t||null,this.pages=new Set,this.scrollMemory=new I(fr),this.historyNavigation=!1}isEnabled(){let t=this.owner;return t!==null&&t.keepAlive===!0}getMode(){let t=this.owner;return t!==null&&t.keepAliveMode==="hide"?"hide":"detach"}getMax(){let t=this.owner,e=t?t.keepAliveMax:void 0;return typeof e=="number"&&e>=0?e:wt}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 Ct=class extends x{getChildScope(){return this.parent}},Xt=n=>M(n,Ct);var ot="data-scroll-key",pr="["+ot+"]",mr="[data-route-dormant]",Zt=n=>typeof n.closest=="function"&&n.closest(mr)!==null,Pt=new WeakMap,Tt=!1,gr=()=>Tt?!0:typeof document>"u"||typeof document.addEventListener!="function"?!1:(document.addEventListener("scroll",n=>{let t=n.target;t&&t.nodeType===1&&t.hasAttribute(ot)&&Pt.set(t,[t.scrollTop||0,t.scrollLeft||0])},{capture:!0,passive:!0}),Tt=!0,!0);gr();var te=(n,t)=>{for(let e=0,r=n.length;e<r;e++){let s=n[e];if(!s||s.nodeType!==1||Zt(s))continue;let o=s.getAttribute(ot);o!==null&&t(s,o);let i=s.querySelectorAll(pr);for(let a=0,l=i.length;a<l;a++){let c=i[a];Zt(c)||t(c,c.getAttribute(ot))}}},Rt=n=>{let t=null,e=Tt;return te(n,(r,s)=>{let o=0,i=0;if(e){let a=Pt.get(r);a&&(o=a[0],i=a[1])}else o=r.scrollTop||0,i=r.scrollLeft||0;o===0&&i===0||(t=t||{},t[s]=[o,i])}),t},it=(n,t)=>{if(!t)return!0;let e={},r=0;for(let s in t)e[s]=!0,r++;return te(n,(s,o)=>{let i=t[o];if(!i)return;let a=i[0],l=i[1];s.scrollTop=a,s.scrollLeft=l;let c=s.scrollTop||0,u=s.scrollLeft||0;Pt.set(s,[c,u]),Math.abs(c-a)<1&&Math.abs(u-l)<1&&e[o]&&(e[o]=!1,r--)}),r<=0};var yr=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)}},G="data-route-dormant",at=[["content-visibility","hidden"],["position","absolute"],["top","0"],["left","0"],["width","100%"],["opacity","0"],["clip-path","inset(50%)"]],Sr=n=>{let t=n.style,e=[];for(let s=0,o=at.length;s<o;s++){let[i,a]=at[s];e.push([i,t.getPropertyValue(i),t.getPropertyPriority(i)]),t.setProperty(i,a,"important")}let r=n.ownerDocument&&n.ownerDocument.activeElement;return r&&r!==n.ownerDocument.body&&n.contains(r)&&typeof r.blur=="function"&&r.blur(),n.setAttribute(G,""),n.inert=!0,e},vr=(n,t)=>{let e=n.style,r=t||[];for(let s=0,o=at.length;s<o;s++){let i=at[s][0],a=r.find(l=>l[0]===i);a&&a[1]?e.setProperty(i,a[1],a[2]||""):e.removeProperty(i)}n.removeAttribute(G),n.inert=!1},xr="iframe, embed, object",kr="video, audio",re=(n,t)=>{let e=[];for(let r=0,s=n.length;r<s;r++){let o=n[r];if(!o||o.nodeType!==1)continue;o.matches(t)&&e.push(o);let i=o.querySelectorAll(t);for(let a=0,l=i.length;a<l;a++)e.push(i[a])}return e},wr=n=>{let t=re(n,kr);for(let e=0,r=t.length;e<r;e++){let s=t[e];s.paused===!1&&typeof s.pause=="function"&&s.pause()}},Cr=n=>/^class[\s{]/.test(Function.prototype.toString.call(n)),Tr=1500,ee=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),Pr=n=>{let t=n.panel,e=0;for(;t&&t.isUnit===!0&&e++<50;)t=t.panel;return t||null},At=(n,t,e)=>{if(!(!n||typeof n[t]!="function"))try{n[t](...e)}catch(r){console.error("Error in "+t+":",r)}},lt=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.keepAliveMode=e.keepAliveMode==="hide"||e.keepAliveMode==="detach"?e.keepAliveMode:null,this.hiddenInPlace=!1,this.hiddenStyles=null,this.capturedScroll=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()}getKeepAliveMode(t){if(this.keepAliveMode!==null)return this.keepAliveMode;if(t=t||this.component,t){let r=t.keepAliveMode;if(r==="hide"||r==="detach")return r;let s=t.layout;if(s&&s.isUnit===!0&&(s.keepAliveMode==="hide"||s.keepAliveMode==="detach"))return s.keepAliveMode}let e=this.pageCache;return e!==null&&typeof e.getMode=="function"?e.getMode():"detach"}isDetached(){return this.detachedNodes!==null}captureScroll(){let t=this.component;if(this.setup!==!0||!t||t.rendered!==!0){this.capturedScroll=null;return}this.capturedScroll={value:Rt(this.getRootNodes(t))}}releaseCapturedScroll(){this.capturedScroll=null}takeScroll(t){let e=this.capturedScroll;return this.capturedScroll=null,e?e.value:Rt(this.getRootNodes(t))}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=Cr(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(Xt(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)&&At(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=Pr(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 u=0,h=c.length;u<h;u++){let m=c[u];m&&e.indexOf(m)===-1&&e.push(m)}}return yr(e),e}callPageHook(t,e){let r=this.component;if(!r)return;At(r,t,e);let s=r.layout;s&&s!==r&&s.isUnit===!0&&At(s,t,e)}restoreHistoryScroll(){let t=this.pageCache.getScroll(this.getScrollKey());if(!t)return;let e=++this.scrollToken,r=this.component,s=()=>it(this.getRootNodes(r),t);if(s()||typeof requestAnimationFrame>"u")return;let o=ee(),i=()=>{e!==this.scrollToken||this.setup!==!0||this.component!==r||s()||ee()-o>Tr||requestAnimationFrame(i)};requestAnimationFrame(i)}restoreDetachedScroll(){let t=this.savedScroll;this.savedScroll=null;let e=this.component;if(!t||!e)return;if(typeof requestAnimationFrame>"u"){it(this.getRootNodes(e),t);return}let r=++this.scrollToken;requestAnimationFrame(()=>{r!==this.scrollToken||this.setup!==!0||this.component!==e||it(this.getRootNodes(e),t)})}detach(t){if(t.rendered!==!0)return!1;let e=this.getRootNodes(t);if(e.length===0)return!1;let r=this.takeScroll(t);return this.savedScroll=r,this.pageCache.saveScroll(this.getScrollKey(),r),this.getKeepAliveMode(t)==="hide"&&t.loaded!==!1&&re(e,xr).length===0?(wr(e),this.hideInPlace(e)):this.removeNodes(e),this.detachedNodes=e,this.detachedPath=this.getPagePath(),this.callPageHook("onDeactivate",[]),this.pageCache.add(this),!0}removeNodes(t){let e=new WeakMap;for(let r=0,s=t.length;r<s;r++){let o=t[r],i=o.parentNode;i&&(e.set(o,i),i.removeChild(o))}this.detachedParents=e,this.hiddenInPlace=!1,this.hiddenStyles=null}hideInPlace(t){let e=new WeakMap;for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&o.nodeType===1&&e.set(o,Sr(o))}this.detachedParents=null,this.hiddenInPlace=!0,this.hiddenStyles=e}showInPlace(t,e){let r=this.hiddenStyles;for(let s=0,o=t.length;s<o;s++){let i=t[s];i.nodeType===1&&i.hasAttribute(G)&&vr(i,r?r.get(i):void 0),i.isConnected||e.appendChild(i)}}reattach(){let t=this.pageCache;t&&t.delete(this),this.detachedNodes=null;let e=this.detachedParents;this.detachedParents=null;let r=this.hiddenInPlace;this.hiddenInPlace=!1;let s=this.component,o=this.container;if(!s||s.rendered!==!0||!o||typeof o.appendChild!="function")return this.savedScroll=null,this.hiddenStyles=null,this.releaseComponent(),!1;if(r)return this.showInPlace(this.getRootNodes(s),o),this.hiddenStyles=null,this.setup=!0,v.schedule(),!0;let i=this.getRootNodes(s);for(let a=0,l=i.length;a<l;a++){let c=i[a],u=e?e.get(c):null;(u&&u.isConnected?u:o).appendChild(c)}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.detachedParents=null,this.savedScroll=null,this.hiddenInPlace=!1,this.hiddenStyles=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(),this.takeScroll(e))}this.capturedScroll=null,this.releaseComponent()}update(t){let e=this.component;e&&typeof e.update=="function"&&e.update(t)}};var ne=n=>{if(!n.length)return null;let t={};for(let e=0,r=n.length;e<r;e++)t[n[e]]=null;return t},se=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 Rr=/(\/):[^/(]*?\?/g,Ar=/\//g,br=/(\?\/+\*?)/g,Er=/(:[^/?&($]+)/g,Ir=/(\*)/g,Lr=n=>n.replace(Rr,t=>t.replace(Ar,"(?:$|/)")),_r=n=>(n=n.replace(br,"?/*"),n.replace(Er,t=>t.indexOf(".")<0?"([^/|?]+)":"([^/|?]+.*)")),Mr=n=>n.replace(Ir,".*"),Or=(n,t)=>n+=t[t.length-1]==="*"?"":"$",oe=n=>{if(!n)return"";let t=n;return t=Lr(t),t=_r(t),t=Mr(t),t=Or(t,n),t};var Dr=0,ie=(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 u=r.substring(a+1);if(u.indexOf("=")>-1){let h=u.split("&");for(let y=0,U=h.length;y<U;y++){let N=h[y];if(!N)continue;let[Ke,je=""]=N.split("="),Lt=(Ke||"").trim();Lt&&o.push({key:Lt,value:(je||"").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}},ae=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,"/")},Br=n=>{if(!n)return"";let t=n.indexOf("#");return t===-1?"":n.substring(t+1)},Hr=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)},ct=class extends Bt{constructor(t,e,r=null){let s=t.baseUri,i=ie(s,t.rawUri).uriPath,a=se(i),l=ne(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-"+Dr++,this.rawUri=t.rawUri||null,this.path=null,this.referralPath=null;let e=ie(this.uri,this.rawUri||"");this.matchUri=e.uriPath,this.requiredHash=e.requiredHash,this.requiredQuery=e.requiredQuery,this.hasConditions=e.hasConditions;let r=oe(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)}captureScroll(){let t=this.controller;t&&this.get("active")&&t.captureScroll()}releaseCapturedScroll(){let t=this.controller;t&&t.releaseCapturedScroll()}isDormant(){let t=this.controller;if(!t)return!1;let e=t.container;return e?e.isConnected===!1?!0:typeof e.closest=="function"&&e.closest("["+G+"]")!==null:!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,Vt(e)}setupComponentHelper(t){let e=this.getLayout(t);if(!e)return;let{container:r,persist:s,parent:o,keepAlive:i,keepAliveMode:a}=t,l={component:e,container:r,persist:s,parent:o,keepAlive:i,keepAliveMode:a,pageCache:this.pageCache},c=Mt(this);this.controller=new lt(c,l)}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=ae(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(ae(t))&&this.matchConditions(t)}prefetch(){let t=this.importSrc;return t?Qt(t):null}matchConditions(t){if(!this.hasConditions)return!0;if(this.requiredHash!==null&&Br(t)!==this.requiredHash)return!1;let e=this.requiredQuery||[];if(e.length>0){let r=Hr(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 Ur=n=>{let t=/\w\S*/;return n.replace(t,e=>e.charAt(0).toUpperCase()+e.substring(1).toLowerCase())},Nr=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Wr=(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(":"+Nr(r),"gi");n=n.replace(s,()=>e[r])}return n},qr=(n,t)=>t&&(typeof t=="function"&&(t=t(n.stage)),t=Wr(t,n),Ur(t)),Fr=(n,t)=>(t!==""&&(n+=" - "+t),n),le=(n,t,e)=>t&&(t=qr(n,t),Fr(t,e));var Gr=()=>typeof window<"u"?window.location:{},Kr=n=>{if(!n)return"";let t=n.indexOf("#");return t>-1?n.substring(t+1):""},jr=1500,ut=["wheel","touchstart","keydown","pointerdown"],ce=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),bt=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=wt,this.keepAliveMode="detach",this.pageCache=new st(this),this.history=null,this.callBackLink=null,this.location=Gr(),this.routes=[],this.switches=new Map,this.switchCount=0,this.data=new Ht({path:""})}setupHistory(){this.history=nt.setup(this)}createRoute(t){let e=t.uri||"*";return t.rawUri=e,t.baseUri=this.createURI(e),new ct(t,this.updateTitle.bind(this),this.pageCache)}setKeepAlive(t,e){this.keepAlive=t===!0;let r=e?e.max:void 0;typeof r=="number"&&r>=0&&(this.keepAliveMax=r);let s=e?e.mode:void 0;return(s==="hide"||s==="detach")&&(this.keepAliveMode=s),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=et.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=le(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.captureActiveScroll(),o=this.routes;for(let i=0,a=o.length;i<a;i++){let l=o[i];typeof l>"u"||r.size>0&&l.isDormant()||this.checkRoute(l,t)}if(this.checkSwitches(t,!0),r.historyNavigation=!1,this.releaseCapturedScroll(s),e===!0){this.scrollIntent=null;return}this.applyScrollIntent()}captureActiveScroll(){let t=[],e=s=>{!s||!s.controller||!s.get("active")||s.isDormant()||(s.captureScroll(),t.push(s))},r=this.routes;for(let s=0,o=r.length;s<o;s++)e(r[s]);for(let s of this.switches.values())for(let o=0,i=s.length;o<i;o++)e(s[o]);return t}releaseCapturedScroll(t){for(let e=0,r=t.length;e<r;e++)t[e].releaseCapturedScroll()}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=Kr(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,u=ut.length;c<u;c++)window.addEventListener(ut[c],o,i);this.cancelScrollWait=()=>{for(let c=0,u=ut.length;c<u;c++)window.removeEventListener(ut[c],o,i)};let a=ce(),l=()=>{if(e!==this.scrollWaitToken){this.clearScrollWait();return}if(this.canReachScroll(r,s)||ce()-a>=jr){this.clearScrollWait(),window.scrollTo(r,s);return}requestAnimationFrame(l)};requestAnimationFrame(l)}clearScrollWait(){let t=this.cancelScrollWait;t&&(this.cancelScrollWait=null,t())}canReachScroll(t,e){if(e<=0&&t<=0)return!0;let r=document.documentElement;return r?e>0&&e>(r.scrollHeight||0)-(window.innerHeight||0)+1?!1:t<=0||t<=(r.scrollWidth||0)-(window.innerWidth||0)+1:!0}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 u=this.readScrollTarget(c);u.sized&&r(u.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 u=this.readScrollTarget(c);if(u.sized){if(a!==null&&Math.abs(a-u.targetScroll)<1){r(u.targetScroll);return}a=u.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}},P=new bt;var ue=(n,t)=>({attr:n,value:t}),zr=(n,t)=>{if(!t.startsWith(n))return!1;let e=t[n.length];return e===void 0||e==="/"||e==="#"||e==="."||e==="?"},Et=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=P.data,o=[];t&&typeof t=="object"&&o.push(ue("href",t)),e&&typeof e=="object"&&o.push(ue("text",e));let i=null,a="",l="";return o.push({value:["[[path]]",s],callBack:(c,u)=>{if(typeof u.pathname>"u")return;let h=u.getAttribute("href");if(h!==i){i=h;let y=u.pathname+u.search+u.hash;a=y,l=u.hash||u.search?y:u.pathname}let m=r?c===a:zr(l,c);this.update(m)}}),o}setupStates(){return{selected:!1}}update(t){this.state&&(this.state.selected=t)}};var he=(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,u=parseFloat(l.animationDelay)*1e3||0;r=setTimeout(o,c+u+100)}catch{r=setTimeout(o,1e3)}};if(typeof requestAnimationFrame>"u"){r=setTimeout(o,1e3);return}requestAnimationFrame(()=>requestAnimationFrame(a))},de=(n,t,e)=>{he(n,t)},fe=(n,t,e)=>{let r=()=>{n&&n.remove&&n.remove()};Qr(n,()=>he(n,t,r),e)};f.addType("manual-destroy",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Qr=(n,t,e)=>{f.add(n,"manual-destroy",{ele:n,callBack:t,parent:e})};var K=(n,t,e,r)=>{if(Array.isArray(e[0])){e.forEach(s=>{s&&K(n,t,s,r)});return}Yr(n,t,e,r)},Yr=(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=Vr(n,s,o,r);E.watch(n,t,s,i)},Vr=(n,t,e,r)=>typeof e=="object"?s=>{Xr(n,e,s)}:s=>{Jr(n,e,t,s,r)},pe=new WeakSet,$r=(n,t,e)=>{!n||!n.isUnit&&!n.isComponent||pe.has(e)||pe.add(e)},Jr=(n,t,e,r,s)=>{let o=t(r,n,s);switch(typeof o){case"object":if(o===null)break;$r(o,e,n),d.rebuild(o,n,s);break;case"string":let i=Ot(n);if(i!=="textContent"){n.setAttribute(i,o);break}q.addHtml(n,o);break}},Xr=(n,t,e)=>{let r=Object.keys(t);for(let s=0,o=r.length;s<o;s++){let i=r[s];i&&(t[i]===e?n.classList.add(i):n.classList.remove(i))}};var H=(n,t,e)=>{let r=R(e);K(n,r,t,e)};var me=(n,t,e)=>{t&&n.setAttribute("role",t)},Zr=n=>(t,e)=>{let r=t?"true":"false";e.setAttribute(n,r)},ge=(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 u=l.slice();u.push(Zr(c)),H(n,u,e)}else n.setAttribute(c,l)}};var ye=(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 It=n=>n?n.getContext():null,Se=(n,t,e)=>{if(typeof t!="function")return;let r=It(e),s=t(r);ye(n,s,e)},ve=(n,t,e)=>{if(typeof t!="function")return;let r=It(e);t(r)},xe=(n,t,e)=>{if(typeof t!="function"||!e)return;let r=It(e),s=t(r);if(!s)return;let o=s[0];o&&(e.addContextBranch(o,s[1]),tn(n,o,e))},tn=(n,t,e)=>{f.add(n,"context",{branch:t,parent:e})};var ke=(n,t,e)=>{};var we=(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 Ce=(n,t,e)=>{},Te=(n,t,e)=>{if(!t||!e)return;let r=t(e,n);r&&d.build(r,n,e)},Pe=(n,t,e)=>{if(!t||!e)return;let r=e.getId(t);n.id=r},Re=(n,t,e)=>{if(!t||!e)return;let r=t(e.data,n);r&&d.build(r,n,e)},Ae=(n,t,e)=>{if(!t||!e)return;let r=t(e.state,n);r&&d.build(r,n,e)},be=(n,t,e)=>{if(!t||!e)return;let r=e.state,s=t(r);if(!e.state){e.setStateHelper(s);return}e.addState(s)},Ee=(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 Ie=(n,t,e)=>{let r,s,o;if(typeof t=="string"){if(r=R(e),!r)return;s=t}else if(Array.isArray(t))if(typeof t[0]!="object"){let i=R(e);if(!i)return;r=i,s=t[0],o=t[1]}else[r,s,o]=t;E.bind(n,r,s,o)};var ht=(n,t,e)=>{K(n,e.state,t,e)};var Le=n=>(t,e)=>{let[r,s,o="active"]=n,i=t===s?o:"";e.dataset[r]=i},_e=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Le(s)),H(n,o,e)},Me=(n,t,e)=>{if(!t)return;let r=t.length-1,s=t[r],o=t.slice(0,r);o.push(Le(s)),ht(n,o,e)};var Oe=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;Oe(n.scopes)});var De=(n,t,e)=>{let r,s,o,i;if(typeof t[0]=="string"||t.length<3){let u=R(e);if(!u)return;r=u,[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,u=>{if(d.removeAll(n),c&&Oe(c.scopes),!u||u.length<1)return;let h=[];for(let m=0,y=u.length;m<y;m++){let U=a?r.scope(l+m+"]"):null;U&&c&&c.scopes.push(U);let N=o(u[m],m,U,h);N!==null&&h.push(N)}return d.build(h,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 He=(n,t,e)=>{t(n,e)};f.addType("destroyed",n=>{if(!n)return!1;n.callBack(n.ele,n.parent)});var Ue=(n,t,e)=>{en(n,t,e)},en=(n,t,e)=>{f.add(n,"destroyed",{ele:n,callBack:t,parent:e})};var Ne=(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&&P.removeRoute(t)});var qe=(n,t,e)=>{if(t)if(Array.isArray(t))for(let r=0,s=t.length;r<s;r++){let o=t[r];o&&We(n,o,e)}else We(n,t,e)},We=(n,t,e)=>{t.container=n,t.parent=e;let r=P.add(t);rn(n,r)},rn=(n,t)=>{f.add(n,"routes",{route:t})};var Fe=(n,t,e)=>{};f.addType("switch",n=>{if(!n)return!1;let t=n.id;P.removeSwitch(t)});var Ge=(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=P.addSwitch(t);nn(n,s)},nn=(n,t)=>{f.add(n,"switch",{id:t})};F.add("cache",Ce).add("onCreated",He).add("onDestroyed",Ue).add("bind",Ie).add("data",ke).add("state",Fe).add("onSet",H).add("onState",ht).add("animateIn",de).add("animateOut",fe).add("watch",Ne).add("useParent",Te).add("useData",Re).add("useState",Ae).add("getId",Pe).add("addState",be).add("addEvent",Ee).add("map",Be).add("for",De).add("useContext",ve).add("addContext",xe).add("context",Se).add("role",me).add("aria",ge).add("route",qe).add("debug",we).add("dataSet",_e).add("dataStateSet",Me).add("switch",Ge);export{F as a,z as b,x as c,Nt as d,Wt as e,M as f,d as g,Vt as h,Et as i,bt as j,P as k};
|
|
2
|
+
//# sourceMappingURL=chunk-FRII433W.js.map
|