aptechka 0.71.4 → 0.71.6

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.
@@ -92,6 +92,7 @@ export declare class Morph {
92
92
  path: string;
93
93
  };
94
94
  prefetch(path: string, revalidate?: boolean): Promise<void>;
95
+ excludeHeadChild(child: Node): boolean;
95
96
  navigate(path: string, { historyAction, centerScroll, offsetScroll, revalidate, keepSearchParameters, submorph, clearState, }?: MorphNavigateOptions): Promise<void>;
96
97
  addLink(element: HTMLAnchorElement): void;
97
98
  addLinks(elements: Array<HTMLAnchorElement>): void;
@@ -1 +1 @@
1
- "use strict";var jt=Object.defineProperty,Kt=Object.defineProperties;var $t=Object.getOwnPropertyDescriptors;var Nt=Object.getOwnPropertySymbols;var Gt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable;var qt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),Ut=n=>{throw TypeError(n)};var Dt=(n,t,s)=>t in n?jt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s,gt=(n,t)=>{for(var s in t||(t={}))Gt.call(t,s)&&Dt(n,s,t[s]);if(Nt)for(var s of Nt(t))Jt.call(t,s)&&Dt(n,s,t[s]);return n},vt=(n,t)=>Kt(n,$t(t));var St=(n,t,s)=>t.has(n)||Ut("Cannot "+s);var e=(n,t,s)=>(St(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?Ut("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),r=(n,t,s,i)=>(St(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),E=(n,t,s)=>(St(n,t,"access private method"),s);var W=(n,t,s)=>new Promise((i,d)=>{var y=v=>{try{w(s.next(v))}catch(O){d(O)}},P=v=>{try{w(s.throw(v))}catch(O){d(O)}},w=v=>v.done?i(v.value):Promise.resolve(v.value).then(y,P);w((s=s.apply(n,t)).next())});var zt=(n,t,s)=>(t=n[qt("asyncIterator")])?t.call(n):(n=n[qt("iterator")](),t={},s=(i,d)=>(d=n[i])&&(t[i]=y=>new Promise((P,w,v)=>(y=d.call(n,y),v=y.done,Promise.resolve(y.value).then(O=>P({value:O,done:v}),w)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ft=require("../index-DekP7OZe.cjs"),U=require("../events-KVanG9sR.cjs"),Qt=require("../polyfills-Df4r-ETT.cjs"),It=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const it=require("../url-YEESIcRn.cjs"),Zt=require("../css-value-parser/index.cjs");class Bt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Ft.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Bt);var H,l,z,rt,J;class wt{constructor(t,s){o(this,H);o(this,l);o(this,z);o(this,rt,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,H).previousURL)history.back();else{r(this,z,e(this,l).getAttribute("href")||"/");const d=e(this,l).getAttribute("data-history-action")||"push",y=e(this,l).hasAttribute("data-center-scroll"),P=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),w=P?Zt.cssValueParser.parse(P):void 0,v=e(this,l).hasAttribute("data-revalidate"),O=e(this,l).hasAttribute("data-keep-search-parameters"),h=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(ht=>ht.trim()),lt=e(this,l).hasAttribute("data-clear-state");e(this,H).navigate(e(this,z),{historyAction:d,centerScroll:y,offsetScroll:w,revalidate:v,keepSearchParameters:O,submorph:h,clearState:lt})}});o(this,J,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,H).prefetch(e(this,z),t),e(this,l).removeEventListener("pointerenter",e(this,J))});r(this,H,s),r(this,l,t),r(this,z,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,rt)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,J))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,H).normalizePath(t),i=e(this,H).normalizePath(e(this,z));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,rt)),e(this,l).removeEventListener("pointerenter",e(this,J)),e(this,l).classList.remove("current")}}H=new WeakMap,l=new WeakMap,z=new WeakMap,rt=new WeakMap,J=new WeakMap;const _t=new DOMParser;var R,Y,L,C,X,I,Q,j,V,Z;class Vt{constructor(t,s){o(this,R);o(this,Y);o(this,L,{x:0,y:0});o(this,C,null);o(this,X,null);o(this,I,null);o(this,Q,null);o(this,j,null);o(this,V,null);o(this,Z);r(this,R,t),r(this,Y,s),r(this,Z,s)}get pathname(){return e(this,Y)}get scrollState(){return e(this,L)}get document(){return e(this,I)}setInitialDocument(t){r(this,C,t.cloneNode(!0))}abort(){var t;return(t=e(this,j))==null?void 0:t.abort(`[${e(this,Y)}] page loading cancelled`)}fetch(t,s){return W(this,null,function*(){return e(this,V)||e(this,C)&&e(this,C).documentElement.hasAttribute("data-cache")&&(!s||e(this,Z)!==t)||e(this,C)&&e(this,R).isPopstateNavigation?e(this,V):(r(this,Z,t),r(this,V,new Promise(i=>W(this,null,function*(){try{r(this,j,new AbortController);const y=yield(yield fetch(t,{signal:e(this,j).signal})).text(),P=_t.parseFromString(y,"text/html");this.setInitialDocument(P)}catch(d){console.warn(d)}finally{r(this,j,null),r(this,V,null),i()}}))),e(this,V))})}cloneDocument(){r(this,I,(e(this,X)||e(this,C)).cloneNode(!0))}get title(){let t="";if(e(this,I).title)t=e(this,I).title;else{const s=e(this,I).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,Y)}return t}clearScrollState(){e(this,L).x=0,e(this,L).y=0}clearDocumentState(){r(this,X,null)}saveScrollState(){e(this,C).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,L).x=0,e(this,L).y=0):(e(this,L).x=e(this,R).scrollValue.left,e(this,L).y=e(this,R).scrollValue.top)}restoreScrollPosition(){e(this,R).scrollElement.scroll({top:e(this,L).y,left:e(this,L).x,behavior:"instant"})}saveDocumentState(){e(this,C).documentElement.hasAttribute("data-no-page-restoration")?r(this,X,null):r(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,R).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){r(this,Q,t)}clearState(){const t=e(this,Q);return r(this,Q,null),t}}R=new WeakMap,Y=new WeakMap,L=new WeakMap,C=new WeakMap,X=new WeakMap,I=new WeakMap,Q=new WeakMap,j=new WeakMap,V=new WeakMap,Z=new WeakMap;var T,_,g,F,m,K,B,x,A,at,N,$,tt,et,ot,c,dt,Lt,Ot,bt,At,Pt,kt,mt,st;const nt=class nt{constructor(t){o(this,c);o(this,T,null);o(this,_,null);o(this,g,[]);o(this,F);o(this,m,null);o(this,K);o(this,B,[]);o(this,x,!1);o(this,A,null);o(this,at,!1);o(this,N,new Map);o(this,$,null);o(this,tt,0);o(this,et,0);o(this,ot,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});o(this,mt,t=>W(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),r(this,x,!0),yield this.navigate(t.state.path,{historyAction:"none"}),r(this,x,!1))}));o(this,st,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,et),d=t-e(this,tt);r(this,et,s),r(this,tt,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",d>0),document.documentElement.classList.toggle("scroll-x-backward",d<0),U.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Ft.isBrowser&&!nt.instance){nt.instance=this,r(this,T,{base:it.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),r(this,_,E(this,c,Lt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);r(this,m,s);const i=new Vt(this,e(this,m).pathname);i.setInitialDocument(document),e(this,N).set(e(this,m).pathname,i),document.documentElement.setAttribute("data-current-pathname",e(this,m).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,mt)),it.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,$,new Bt),E(this,c,Pt).call(this,document)}}get currentURL(){return e(this,m)}get previousURL(){return e(this,K)}get links(){return e(this,g)}get scrollElement(){return e(this,A)}get isPopstateNavigation(){return e(this,x)}get scrollValue(){let t=0,s=0;return e(this,at)?(t=window.scrollY,s=window.scrollX):(t=e(this,A).scrollTop,s=e(this,A).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,N).get(e(this,m).path);s&&s.saveState(t)}getState(){const t=e(this,N).get(e(this,m).path);return t==null?void 0:t.clearState()}normalizePath(t){return it.splitPath(t,{base:e(this,T).base,trailingSlash:e(this,T).trailingSlash})}prefetch(t,s){return W(this,null,function*(){if(e(this,B).length)return;const i=E(this,c,dt).call(this,t);i==null||i.fetch(t,s)})}navigate(O){return W(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:d,revalidate:y,keepSearchParameters:P,submorph:w,clearState:v}={}){var lt,ht,Ct;if(e(this,B).length)return;const h=this.normalizePath(((lt=this.pathnameModifier)==null?void 0:lt.call(this,t))||t);if(((ht=e(this,F))==null?void 0:ht.pathname)===h.pathname||e(this,m).pathname===h.pathname){e(this,x)||E(this,c,kt).call(this,h.hash||0,{centerScroll:i,offsetScroll:d,behavior:"smooth"}),((Ct=e(this,m))==null?void 0:Ct.parameters)!==h.parameters&&(r(this,K,e(this,m)),r(this,m,h),it.changeHistory({action:s,pathname:h.pathname,searchParameters:h.parameters,hash:h.hash}),U.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,m),previousURL:e(this,K)}}));return}r(this,F,h),e(this,g).forEach(G=>{G.checkCurrent(h.pathname)});try{let G=!0;if(this.preprocessor)try{yield new Promise((a,M)=>{var p;(p=this.preprocessor)==null||p.call(this,{url:h,resolve:a,reject:M,submorph:w})})}catch(a){a?console.error(a):console.log("Route change canceled"),G=!1}if(!G||e(this,F).pathname!==h.pathname){e(this,g).forEach(a=>{a.checkCurrent(e(this,m).pathname)});return}const Tt={url:h,submorph:w};U.dispatchEvent(document,"morphNavigation",{detail:Tt});const ft=E(this,c,dt).call(this,e(this,m).pathname),f=E(this,c,dt).call(this,h.pathname);if(e(this,N).forEach(a=>{a.pathname!==h.pathname&&a.abort()}),yield f==null?void 0:f.fetch(t,y),e(this,F).pathname!==h.pathname){e(this,g).forEach(a=>{a.checkCurrent(e(this,m).path)});return}ft.clearState(),ft.saveScrollState(),ft.saveDocumentState(),e(this,x)||(f.clearScrollState(),f.clearDocumentState()),v&&f.clearState(),f.cloneDocument(),e(this,$).textContent=f.title,document.body.appendChild(e(this,$));const pt=vt(gt({},Tt),{document:f.document});U.dispatchEvent(document,"morphStart",{detail:pt});const Mt=Array.from(document.head.children),Ht=Array.from(f.document.head.children),Rt=E(this,c,Ot).call(this,Mt,Ht),Wt=E(this,c,bt).call(this,Mt,Rt),ct=E(this,c,bt).call(this,Ht,Rt);ct.forEach((a,M)=>{if(a.tagName==="SCRIPT"&&a.getAttribute("src")){const p=document.createElement("script"),q=a.getAttribute("src");q.includes("http")||(p.type="module"),p.src=q,ct[M]=p}}),ct.forEach(a=>{document.head.appendChild(a)});const Et=ct.filter(a=>{if(a.hasAttribute("data-no-waiting"))return!1;if(E(this,c,At).call(this,a))return!0});e(this,T).waitForHeadToLoad&&Et.length&&(yield new Promise(a=>W(this,null,function*(){let M=0;try{for(var p=zt(Et),q,b,k;q=!(b=yield p.next()).done;q=!1){const ut=b.value;ut.onload=()=>{M++,M===Et.length&&a()}}}catch(b){k=[b]}finally{try{q&&(b=p.return)&&(yield b.call(p))}finally{if(k)throw k[0]}}}))),yield It.wait(10);const xt=[];Wt.forEach(a=>{a.hasAttribute("data-permanent")||(E(this,c,At).call(this,a)?xt.push(a):a.remove())});const Yt=E(this,c,Lt).call(this,f.document.body);e(this,T).morphInsideScrollContainer||E(this,c,Pt).call(this,f.document),document.documentElement.setAttribute("data-current-pathname",h.pathname),document.documentElement.setAttribute("data-current-leaf",h.leaf),it.changeHistory({action:s,pathname:h.pathname,searchParameters:h.parameters||(P?location.search:""),hash:h.hash}),e(this,$).remove(),r(this,K,e(this,m)),r(this,m,h),e(this,_).forEach((a,M)=>{const p=Yt[M],q=getComputedStyle(a).getPropertyValue("--morph-duration");let b=[],k=[];w?w.forEach(u=>{const S=a.querySelector(u),D=p.querySelector(u);S&&D&&(k.push(S),b.push(D))}):(b.push(...p.childNodes),k.push(...a.childNodes)),k.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),b.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),w?b.forEach((u,S)=>{var D;(D=k[S].parentElement)==null||D.insertBefore(u,k[S])}):a.prepend(...b),Qt.requestIdleCallback(()=>{k.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),b.forEach(u=>{var S;u instanceof HTMLElement&&((S=u.parentElement)==null||S.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})});const ut=vt(gt({},pt),{morphElement:a});U.dispatchEvent(document,"morphNewChildrenAdded",{detail:ut});const Xt=new Promise(u=>{setTimeout(()=>{k.forEach(S=>S.remove()),b.forEach(S=>{var D;S instanceof HTMLElement&&((D=S.parentElement)==null||D.style.removeProperty("--new-content-height"),S.classList.remove("new-idle","new"))}),U.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ut}),u()},(parseFloat(q)||0)*1e3+10)});e(this,B).push(Xt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-f.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),U.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:f.scrollState}),h.hash?(f.clearScrollState(),E(this,c,kt).call(this,h.hash,{centerScroll:i,offsetScroll:d})):e(this,x)?f.restoreScrollPosition():f.renewScrollPosition(),yield Promise.all(e(this,B)),xt.forEach(a=>a.remove()),r(this,B,[]),e(this,_).forEach(a=>{a.querySelectorAll("script").forEach(p=>{const q=document.createElement("script");for(let b=0;b<p.attributes.length;b++){const k=p.attributes[b];q.setAttribute(k.name,k.value)}p.hasAttribute("src")||(q.innerHTML=p.innerHTML),p.replaceWith(q)})}),U.dispatchEvent(document,"morphComplete",{detail:pt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(G){console.error(G)}r(this,F,void 0)})}addLink(t){e(this,g).push(new wt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){r(this,g,e(this,g).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){r(this,g,e(this,g).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,ot));e(this,g).push(...s.map(i=>new wt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,ot));e(this,g).forEach(s=>s.destroy()),r(this,g,t.map(s=>new wt(s,this)))}};T=new WeakMap,_=new WeakMap,g=new WeakMap,F=new WeakMap,m=new WeakMap,K=new WeakMap,B=new WeakMap,x=new WeakMap,A=new WeakMap,at=new WeakMap,N=new WeakMap,$=new WeakMap,tt=new WeakMap,et=new WeakMap,ot=new WeakMap,c=new WeakSet,dt=function(t){const s=this.normalizePath(t);let i=e(this,N).get(s.pathname);return i||(i=new Vt(this,s.pathname),e(this,N).set(s.pathname,i)),i},Lt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Ot=function(t,s){return t.filter(i=>s.find(d=>d.outerHTML===i.outerHTML))},bt=function(t,s){return t.filter(i=>!s.find(d=>d.outerHTML===i.outerHTML))},At=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},Pt=function(t){var s,i;(s=e(this,A))==null||s.removeEventListener("scroll",e(this,st)),r(this,et,0),r(this,tt,0),r(this,A,e(this,T).scrollSelector&&t.querySelector(e(this,T).scrollSelector)||window),r(this,at,e(this,A)===window),(i=e(this,A))==null||i.addEventListener("scroll",e(this,st)),e(this,st).call(this)},kt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&It.scrollToElement(i,{scrollElement:e(this,A),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},mt=new WeakMap,st=new WeakMap,nt.instance=null;let yt=nt;exports.Morph=yt;
1
+ "use strict";var $t=Object.defineProperty,Gt=Object.defineProperties;var Jt=Object.getOwnPropertyDescriptors;var qt=Object.getOwnPropertySymbols;var Qt=Object.prototype.hasOwnProperty,Zt=Object.prototype.propertyIsEnumerable;var Dt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),zt=n=>{throw TypeError(n)};var Ut=(n,t,s)=>t in n?$t(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s,Et=(n,t)=>{for(var s in t||(t={}))Qt.call(t,s)&&Ut(n,s,t[s]);if(qt)for(var s of qt(t))Zt.call(t,s)&&Ut(n,s,t[s]);return n},gt=(n,t)=>Gt(n,Jt(t));var vt=(n,t,s)=>t.has(n)||zt("Cannot "+s);var e=(n,t,s)=>(vt(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?zt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),r=(n,t,s,i)=>(vt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),p=(n,t,s)=>(vt(n,t,"access private method"),s);var O=(n,t,s)=>new Promise((i,u)=>{var w=g=>{try{S(s.next(g))}catch(V){u(V)}},b=g=>{try{S(s.throw(g))}catch(V){u(V)}},S=g=>g.done?i(g.value):Promise.resolve(g.value).then(w,b);S((s=s.apply(n,t)).next())});var It=(n,t,s)=>(t=n[Dt("asyncIterator")])?t.call(n):(n=n[Dt("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=w=>new Promise((b,S,g)=>(w=u.call(n,w),g=w.done,Promise.resolve(w.value).then(V=>b({value:V,done:g}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bt=require("../index-DekP7OZe.cjs"),R=require("../events-KVanG9sR.cjs"),_t=require("../polyfills-Df4r-ETT.cjs"),Vt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-YEESIcRn.cjs"),te=require("../css-value-parser/index.cjs");class Ot extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Bt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Ot);var C,h,N,nt,G;class St{constructor(t,s){o(this,C);o(this,h);o(this,N);o(this,nt,t=>{var i;if(t.preventDefault(),e(this,h).hasAttribute("data-back")&&e(this,C).previousURL)history.back();else{r(this,N,e(this,h).getAttribute("href")||"/");const u=e(this,h).getAttribute("data-history-action")||"push",w=e(this,h).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,h)).getPropertyValue("--offset-scroll").trim(),S=b?te.cssValueParser.parse(b):void 0,g=e(this,h).hasAttribute("data-revalidate"),V=e(this,h).hasAttribute("data-keep-search-parameters"),l=(i=e(this,h).getAttribute("data-submorph"))==null?void 0:i.split(",").map(lt=>lt.trim()),ot=e(this,h).hasAttribute("data-clear-state");e(this,C).navigate(e(this,N),{historyAction:u,centerScroll:w,offsetScroll:S,revalidate:g,keepSearchParameters:V,submorph:l,clearState:ot})}});o(this,G,()=>{const t=e(this,h).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,N),t),e(this,h).removeEventListener("pointerenter",e(this,G))});r(this,C,s),r(this,h,t),r(this,N,e(this,h).getAttribute("href")||"/"),e(this,h).addEventListener("click",e(this,nt)),this.checkCurrent(location.pathname),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,G))}get element(){return e(this,h)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,N));e(this,h).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,h).classList.add("current"):i.pathname===s.pathname?e(this,h).classList.add("current"):e(this,h).classList.remove("current")}destroy(){e(this,h).removeEventListener("click",e(this,nt)),e(this,h).removeEventListener("pointerenter",e(this,G)),e(this,h).classList.remove("current")}}C=new WeakMap,h=new WeakMap,N=new WeakMap,nt=new WeakMap,G=new WeakMap;const ee=new DOMParser;var H,W,y,P,Y,q,J,X,D,Q;class Ft{constructor(t,s){o(this,H);o(this,W);o(this,y,{x:0,y:0});o(this,P,null);o(this,Y,null);o(this,q,null);o(this,J,null);o(this,X,null);o(this,D,null);o(this,Q);r(this,H,t),r(this,W,s),r(this,Q,s)}get pathname(){return e(this,W)}get scrollState(){return e(this,y)}get document(){return e(this,q)}setInitialDocument(t){r(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,X))==null?void 0:t.abort(`[${e(this,W)}] page loading cancelled`)}fetch(t,s){return O(this,null,function*(){return e(this,D)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&(!s||e(this,Q)!==t)||e(this,P)&&e(this,H).isPopstateNavigation?e(this,D):(r(this,Q,t),r(this,D,new Promise(i=>O(this,null,function*(){try{r(this,X,new AbortController);const w=yield(yield fetch(t,{signal:e(this,X).signal})).text(),b=ee.parseFromString(w,"text/html");this.setInitialDocument(b)}catch(u){console.warn(u)}finally{r(this,X,null),r(this,D,null),i()}}))),e(this,D))})}cloneDocument(){r(this,q,(e(this,Y)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,q).title)t=e(this,q).title;else{const s=e(this,q).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,W)}return t}clearScrollState(){e(this,y).x=0,e(this,y).y=0}clearDocumentState(){r(this,Y,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,y).x=0,e(this,y).y=0):(e(this,y).x=e(this,H).scrollValue.left,e(this,y).y=e(this,H).scrollValue.top)}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,y).y,left:e(this,y).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?r(this,Y,null):r(this,Y,document.cloneNode(!0))}renewScrollPosition(){e(this,H).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){r(this,J,t)}clearState(){const t=e(this,J);return r(this,J,null),t}}H=new WeakMap,W=new WeakMap,y=new WeakMap,P=new WeakMap,Y=new WeakMap,q=new WeakMap,J=new WeakMap,X=new WeakMap,D=new WeakMap,Q=new WeakMap;var A,Z,E,U,m,j,z,I,L,rt,M,K,_,tt,c,yt,at,ut,Lt,Wt,bt,Pt,At,kt,dt,et;const it=class it{constructor(t){o(this,c);o(this,A,null);o(this,Z,null);o(this,E,[]);o(this,U);o(this,m,null);o(this,j);o(this,z,[]);o(this,I,!1);o(this,L,null);o(this,rt,!1);o(this,M,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,at,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});o(this,dt,t=>O(this,null,function*(){t.preventDefault(),r(this,I,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none"}),r(this,I,!1)}));o(this,et,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,tt),u=t-e(this,_);r(this,tt,s),r(this,_,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",u>0),document.documentElement.classList.toggle("scroll-x-backward",u<0),R.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Bt.isBrowser&&!it.instance){it.instance=this,r(this,A,{base:st.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),r(this,Z,p(this,c,Lt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);r(this,m,s);const i=new Ft(this,e(this,m).pathname);i.setInitialDocument(document),e(this,M).set(e(this,m).pathname,i),document.documentElement.setAttribute("data-current-pathname",e(this,m).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,dt)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,K,new Ot),p(this,c,At).call(this,document)}}get currentURL(){return e(this,m)}get previousURL(){return e(this,j)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,I)}get scrollValue(){let t=0,s=0;return e(this,rt)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,M).get(e(this,m).path);s&&s.saveState(t)}getState(){const t=e(this,M).get(e(this,m).path);return t==null?void 0:t.clearState()}normalizePath(t){return st.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return O(this,null,function*(){if(e(this,z).length)return;const i=p(this,c,ut).call(this,t);i==null||i.fetch(t,s)})}excludeHeadChild(t){return!1}navigate(V){return O(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:w,keepSearchParameters:b,submorph:S,clearState:g}={}){var ot,lt,Ct,Ht;if(e(this,z).length)return;const l=this.normalizePath(((ot=this.pathnameModifier)==null?void 0:ot.call(this,t))||t);if(((lt=e(this,U))==null?void 0:lt.pathname)===l.pathname||e(this,m).pathname===l.pathname){p(this,c,kt).call(this,l.hash||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"}),((Ct=e(this,m))==null?void 0:Ct.parameters)!==l.parameters&&(r(this,j,e(this,m)),r(this,m,l),st.changeHistory({action:((Ht=e(this,m))==null?void 0:Ht.hash)!==l.hash?"replace":s,pathname:l.pathname,searchParameters:l.parameters,hash:l.hash}),R.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,m),previousURL:e(this,j)}}));return}r(this,U,l),e(this,E).forEach($=>{$.checkCurrent(l.pathname)});try{let $=!0;if(this.preprocessor)try{yield new Promise((a,k)=>{var T;(T=this.preprocessor)==null||T.call(this,{url:l,resolve:a,reject:k,submorph:S})})}catch(a){a?console.error(a):console.log("Route change canceled"),$=!1}if(!$||e(this,U).pathname!==l.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,m).pathname)});return}const Mt={url:l,submorph:S};R.dispatchEvent(document,"morphNavigation",{detail:Mt});const mt=p(this,c,ut).call(this,e(this,m).pathname),f=p(this,c,ut).call(this,l.pathname);if(e(this,M).forEach(a=>{a.pathname!==l.pathname&&a.abort()}),yield f==null?void 0:f.fetch(t,w),e(this,U).pathname!==l.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,m).path)});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,I)||(f.clearScrollState(),f.clearDocumentState()),g&&f.clearState(),f.cloneDocument(),e(this,K).textContent=f.title,document.body.appendChild(e(this,K));const ft=gt(Et({},Mt),{document:f.document});R.dispatchEvent(document,"morphStart",{detail:ft});const Tt=Array.from(document.head.children),xt=Array.from(f.document.head.children),Rt=p(this,c,Wt).call(this,Tt,xt),Yt=p(this,c,bt).call(this,Tt,Rt),ht=p(this,c,bt).call(this,xt,Rt).filter(a=>!this.excludeHeadChild(a));ht.forEach((a,k)=>{a.tagName==="SCRIPT"&&(ht[k]=p(this,c,yt).call(this,a))}),ht.forEach(a=>{document.head.appendChild(a)});const pt=ht.filter(a=>{if(a.hasAttribute("data-no-waiting"))return!1;if(p(this,c,Pt).call(this,a))return!0});e(this,A).waitForHeadToLoad&&pt.length&&(yield new Promise(a=>O(this,null,function*(){let k=0;try{for(var T=It(pt),jt,F,B;jt=!(F=yield T.next()).done;jt=!1){const ct=F.value;ct.onload=()=>{k++,k===pt.length&&a()}}}catch(F){B=[F]}finally{try{jt&&(F=T.return)&&(yield F.call(T))}finally{if(B)throw B[0]}}}))),yield Vt.wait(10);const Nt=[];Yt.forEach(a=>{a.hasAttribute("data-permanent")||(p(this,c,Pt).call(this,a)?Nt.push(a):a.remove())});const Xt=p(this,c,Lt).call(this,f.document.body);e(this,A).morphInsideScrollContainer||p(this,c,At).call(this,f.document),document.documentElement.setAttribute("data-current-pathname",l.pathname),document.documentElement.setAttribute("data-current-leaf",l.leaf),st.changeHistory({action:s,pathname:l.pathname,searchParameters:l.parameters||(b?location.search:""),hash:l.hash}),e(this,K).remove(),r(this,j,e(this,m)),r(this,m,l),e(this,Z).forEach((a,k)=>{const T=Xt[k],jt=getComputedStyle(a).getPropertyValue("--morph-duration");let F=[],B=[];S?S.forEach(d=>{const v=a.querySelector(d),x=T.querySelector(d);v&&x&&(B.push(v),F.push(x))}):(F.push(...T.childNodes),B.push(...a.childNodes)),B.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),F.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),S?F.forEach((d,v)=>{var x;(x=B[v].parentElement)==null||x.insertBefore(d,B[v])}):a.prepend(...F),_t.requestIdleCallback(()=>{B.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old-idle")}),F.forEach(d=>{var v;d instanceof HTMLElement&&((v=d.parentElement)==null||v.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("new-idle"))})});const ct=gt(Et({},ft),{morphElement:a});R.dispatchEvent(document,"morphNewChildrenAdded",{detail:ct});const Kt=new Promise(d=>{setTimeout(()=>{B.forEach(v=>v.remove()),F.forEach(v=>{var x;v instanceof HTMLElement&&((x=v.parentElement)==null||x.style.removeProperty("--new-content-height"),v.classList.remove("new-idle","new"))}),R.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ct}),d()},(parseFloat(jt)||0)*1e3+10)});e(this,z).push(Kt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-f.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),R.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:f.scrollState}),l.hash?(f.clearScrollState(),p(this,c,kt).call(this,l.hash,{centerScroll:i,offsetScroll:u})):e(this,I)?f.restoreScrollPosition():f.renewScrollPosition(),yield Promise.all(e(this,z)),Nt.forEach(a=>a.remove()),r(this,z,[]),e(this,Z).forEach(a=>{a.querySelectorAll("script").forEach(T=>{T.replaceWith(p(this,c,yt).call(this,T))})}),R.dispatchEvent(document,"morphComplete",{detail:ft}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}r(this,U,void 0)})}addLink(t){e(this,E).push(new St(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){r(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){r(this,E,e(this,E).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,at));e(this,E).push(...s.map(i=>new St(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,at));e(this,E).forEach(s=>s.destroy()),r(this,E,t.map(s=>new St(s,this)))}};A=new WeakMap,Z=new WeakMap,E=new WeakMap,U=new WeakMap,m=new WeakMap,j=new WeakMap,z=new WeakMap,I=new WeakMap,L=new WeakMap,rt=new WeakMap,M=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,c=new WeakSet,yt=function(t){const s=document.createElement("script");for(let i=0;i<t.attributes.length;i++){const u=t.attributes[i];s.setAttribute(u.name,u.value)}return t.hasAttribute("src")||(s.innerHTML=t.innerHTML),s},at=new WeakMap,ut=function(t){const s=this.normalizePath(t);let i=e(this,M).get(s.pathname);return i||(i=new Ft(this,s.pathname),e(this,M).set(s.pathname,i)),i},Lt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Wt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},bt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},Pt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},At=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,et)),r(this,tt,0),r(this,_,0),r(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),r(this,rt,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},kt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Vt.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},dt=new WeakMap,et=new WeakMap,it.instance=null;let wt=it;exports.Morph=wt;
@@ -1,45 +1,45 @@
1
- var Xt = Object.defineProperty, jt = Object.defineProperties;
2
- var Kt = Object.getOwnPropertyDescriptors;
3
- var xt = Object.getOwnPropertySymbols;
4
- var $t = Object.prototype.hasOwnProperty, Gt = Object.prototype.propertyIsEnumerable;
5
- var Nt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), Ut = (n) => {
1
+ var Kt = Object.defineProperty, $t = Object.defineProperties;
2
+ var Gt = Object.getOwnPropertyDescriptors;
3
+ var Nt = Object.getOwnPropertySymbols;
4
+ var Jt = Object.prototype.hasOwnProperty, Qt = Object.prototype.propertyIsEnumerable;
5
+ var Dt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), zt = (n) => {
6
6
  throw TypeError(n);
7
7
  };
8
- var Dt = (n, t, s) => t in n ? Xt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s, Et = (n, t) => {
8
+ var Ut = (n, t, s) => t in n ? Kt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s, pt = (n, t) => {
9
9
  for (var s in t || (t = {}))
10
- $t.call(t, s) && Dt(n, s, t[s]);
11
- if (xt)
12
- for (var s of xt(t))
13
- Gt.call(t, s) && Dt(n, s, t[s]);
10
+ Jt.call(t, s) && Ut(n, s, t[s]);
11
+ if (Nt)
12
+ for (var s of Nt(t))
13
+ Qt.call(t, s) && Ut(n, s, t[s]);
14
14
  return n;
15
- }, gt = (n, t) => jt(n, Kt(t));
16
- var wt = (n, t, s) => t.has(n) || Ut("Cannot " + s);
17
- var e = (n, t, s) => (wt(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? Ut("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), r = (n, t, s, i) => (wt(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), E = (n, t, s) => (wt(n, t, "access private method"), s);
18
- var W = (n, t, s) => new Promise((i, d) => {
19
- var v = (w) => {
15
+ }, Et = (n, t) => $t(n, Gt(t));
16
+ var gt = (n, t, s) => t.has(n) || zt("Cannot " + s);
17
+ var e = (n, t, s) => (gt(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? zt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), r = (n, t, s, i) => (gt(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), p = (n, t, s) => (gt(n, t, "access private method"), s);
18
+ var O = (n, t, s) => new Promise((i, u) => {
19
+ var v = (g) => {
20
20
  try {
21
- L(s.next(w));
22
- } catch (O) {
23
- d(O);
21
+ w(s.next(g));
22
+ } catch (q) {
23
+ u(q);
24
24
  }
25
- }, k = (w) => {
25
+ }, b = (g) => {
26
26
  try {
27
- L(s.throw(w));
28
- } catch (O) {
29
- d(O);
27
+ w(s.throw(g));
28
+ } catch (q) {
29
+ u(q);
30
30
  }
31
- }, L = (w) => w.done ? i(w.value) : Promise.resolve(w.value).then(v, k);
32
- L((s = s.apply(n, t)).next());
31
+ }, w = (g) => g.done ? i(g.value) : Promise.resolve(g.value).then(v, b);
32
+ w((s = s.apply(n, t)).next());
33
33
  });
34
- var zt = (n, t, s) => (t = n[Nt("asyncIterator")]) ? t.call(n) : (n = n[Nt("iterator")](), t = {}, s = (i, d) => (d = n[i]) && (t[i] = (v) => new Promise((k, L, w) => (v = d.call(n, v), w = v.done, Promise.resolve(v.value).then((O) => k({ value: O, done: w }), L)))), s("next"), s("return"), t);
35
- import { i as qt } from "../index-Bv9zgfdb.js";
36
- import { d as z } from "../events-CsVF98U6.js";
37
- import { r as Jt } from "../polyfills-DJrTJQky.js";
38
- import { w as Qt, s as Zt } from "../scroll-DPkCFTxg.js";
34
+ var It = (n, t, s) => (t = n[Dt("asyncIterator")]) ? t.call(n) : (n = n[Dt("iterator")](), t = {}, s = (i, u) => (u = n[i]) && (t[i] = (v) => new Promise((b, w, g) => (v = u.call(n, v), g = v.done, Promise.resolve(v.value).then((q) => b({ value: q, done: g }), w)))), s("next"), s("return"), t);
35
+ import { i as Ft } from "../index-Bv9zgfdb.js";
36
+ import { d as R } from "../events-CsVF98U6.js";
37
+ import { r as Zt } from "../polyfills-DJrTJQky.js";
38
+ import { w as _t, s as te } from "../scroll-DPkCFTxg.js";
39
39
  import "construct-style-sheets-polyfill";
40
- import { n as _t, c as St, s as te } from "../url-UL9zSCHb.js";
41
- import { cssValueParser as ee } from "../css-value-parser/index.js";
42
- class Ft extends HTMLElement {
40
+ import { n as ee, c as St, s as se } from "../url-UL9zSCHb.js";
41
+ import { cssValueParser as ie } from "../css-value-parser/index.js";
42
+ class Bt extends HTMLElement {
43
43
  connectedCallback() {
44
44
  const t = {
45
45
  "aria-live": "assertive",
@@ -50,139 +50,139 @@ class Ft extends HTMLElement {
50
50
  this.setAttribute(s, i);
51
51
  }
52
52
  }
53
- qt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Ft);
54
- var R, l, I, nt, J;
55
- class Lt {
53
+ Ft && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Bt);
54
+ var C, h, N, it, G;
55
+ class wt {
56
56
  constructor(t, s) {
57
- o(this, R);
58
- o(this, l);
59
- o(this, I);
60
- o(this, nt, (t) => {
57
+ o(this, C);
58
+ o(this, h);
59
+ o(this, N);
60
+ o(this, it, (t) => {
61
61
  var i;
62
- if (t.preventDefault(), e(this, l).hasAttribute("data-back") && e(this, R).previousURL)
62
+ if (t.preventDefault(), e(this, h).hasAttribute("data-back") && e(this, C).previousURL)
63
63
  history.back();
64
64
  else {
65
- r(this, I, e(this, l).getAttribute("href") || "/");
66
- const d = e(this, l).getAttribute(
65
+ r(this, N, e(this, h).getAttribute("href") || "/");
66
+ const u = e(this, h).getAttribute(
67
67
  "data-history-action"
68
- ) || "push", v = e(this, l).hasAttribute("data-center-scroll"), k = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), L = k ? ee.parse(k) : void 0, w = e(this, l).hasAttribute("data-revalidate"), O = e(this, l).hasAttribute(
68
+ ) || "push", v = e(this, h).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, h)).getPropertyValue("--offset-scroll").trim(), w = b ? ie.parse(b) : void 0, g = e(this, h).hasAttribute("data-revalidate"), q = e(this, h).hasAttribute(
69
69
  "data-keep-search-parameters"
70
- ), h = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((lt) => lt.trim()), ot = e(this, l).hasAttribute("data-clear-state");
71
- e(this, R).navigate(e(this, I), {
72
- historyAction: d,
70
+ ), l = (i = e(this, h).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((ot) => ot.trim()), at = e(this, h).hasAttribute("data-clear-state");
71
+ e(this, C).navigate(e(this, N), {
72
+ historyAction: u,
73
73
  centerScroll: v,
74
- offsetScroll: L,
75
- revalidate: w,
76
- keepSearchParameters: O,
77
- submorph: h,
78
- clearState: ot
74
+ offsetScroll: w,
75
+ revalidate: g,
76
+ keepSearchParameters: q,
77
+ submorph: l,
78
+ clearState: at
79
79
  });
80
80
  }
81
81
  });
82
- o(this, J, () => {
83
- const t = e(this, l).hasAttribute("data-revalidate");
84
- e(this, R).prefetch(e(this, I), t), e(this, l).removeEventListener("pointerenter", e(this, J));
82
+ o(this, G, () => {
83
+ const t = e(this, h).hasAttribute("data-revalidate");
84
+ e(this, C).prefetch(e(this, N), t), e(this, h).removeEventListener("pointerenter", e(this, G));
85
85
  });
86
- r(this, R, s), r(this, l, t), r(this, I, e(this, l).getAttribute("href") || "/"), e(this, l).addEventListener("click", e(this, nt)), this.checkCurrent(location.pathname), e(this, l).hasAttribute("data-prefetch") && e(this, l).addEventListener("pointerenter", e(this, J));
86
+ r(this, C, s), r(this, h, t), r(this, N, e(this, h).getAttribute("href") || "/"), e(this, h).addEventListener("click", e(this, it)), this.checkCurrent(location.pathname), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, G));
87
87
  }
88
88
  get element() {
89
- return e(this, l);
89
+ return e(this, h);
90
90
  }
91
91
  checkCurrent(t) {
92
- const s = e(this, R).normalizePath(t), i = e(this, R).normalizePath(e(this, I));
93
- e(this, l).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? e(this, l).classList.add("current") : i.pathname === s.pathname ? e(this, l).classList.add("current") : e(this, l).classList.remove("current");
92
+ const s = e(this, C).normalizePath(t), i = e(this, C).normalizePath(e(this, N));
93
+ e(this, h).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? e(this, h).classList.add("current") : i.pathname === s.pathname ? e(this, h).classList.add("current") : e(this, h).classList.remove("current");
94
94
  }
95
95
  destroy() {
96
- e(this, l).removeEventListener("click", e(this, nt)), e(this, l).removeEventListener("pointerenter", e(this, J)), e(this, l).classList.remove("current");
96
+ e(this, h).removeEventListener("click", e(this, it)), e(this, h).removeEventListener("pointerenter", e(this, G)), e(this, h).classList.remove("current");
97
97
  }
98
98
  }
99
- R = new WeakMap(), l = new WeakMap(), I = new WeakMap(), nt = new WeakMap(), J = new WeakMap();
100
- const se = new DOMParser();
101
- var H, Y, y, C, X, V, Q, j, q, Z;
102
- class It {
99
+ C = new WeakMap(), h = new WeakMap(), N = new WeakMap(), it = new WeakMap(), G = new WeakMap();
100
+ const ne = new DOMParser();
101
+ var H, W, L, A, Y, D, J, X, U, Q;
102
+ class Vt {
103
103
  constructor(t, s) {
104
104
  o(this, H);
105
- o(this, Y);
106
- o(this, y, { x: 0, y: 0 });
107
- o(this, C, null);
105
+ o(this, W);
106
+ o(this, L, { x: 0, y: 0 });
107
+ o(this, A, null);
108
+ o(this, Y, null);
109
+ o(this, D, null);
110
+ o(this, J, null);
108
111
  o(this, X, null);
109
- o(this, V, null);
110
- o(this, Q, null);
111
- o(this, j, null);
112
- o(this, q, null);
113
- o(this, Z);
114
- r(this, H, t), r(this, Y, s), r(this, Z, s);
112
+ o(this, U, null);
113
+ o(this, Q);
114
+ r(this, H, t), r(this, W, s), r(this, Q, s);
115
115
  }
116
116
  get pathname() {
117
- return e(this, Y);
117
+ return e(this, W);
118
118
  }
119
119
  get scrollState() {
120
- return e(this, y);
120
+ return e(this, L);
121
121
  }
122
122
  get document() {
123
- return e(this, V);
123
+ return e(this, D);
124
124
  }
125
125
  setInitialDocument(t) {
126
- r(this, C, t.cloneNode(!0));
126
+ r(this, A, t.cloneNode(!0));
127
127
  }
128
128
  abort() {
129
129
  var t;
130
- return (t = e(this, j)) == null ? void 0 : t.abort(
131
- `[${e(this, Y)}] page loading cancelled`
130
+ return (t = e(this, X)) == null ? void 0 : t.abort(
131
+ `[${e(this, W)}] page loading cancelled`
132
132
  );
133
133
  }
134
134
  fetch(t, s) {
135
- return W(this, null, function* () {
136
- return e(this, q) || e(this, C) && e(this, C).documentElement.hasAttribute("data-cache") && (!s || e(this, Z) !== t) || e(this, C) && e(this, H).isPopstateNavigation ? e(this, q) : (r(this, Z, t), r(this, q, new Promise((i) => W(this, null, function* () {
135
+ return O(this, null, function* () {
136
+ return e(this, U) || e(this, A) && e(this, A).documentElement.hasAttribute("data-cache") && (!s || e(this, Q) !== t) || e(this, A) && e(this, H).isPopstateNavigation ? e(this, U) : (r(this, Q, t), r(this, U, new Promise((i) => O(this, null, function* () {
137
137
  try {
138
- r(this, j, new AbortController());
138
+ r(this, X, new AbortController());
139
139
  const v = yield (yield fetch(t, {
140
- signal: e(this, j).signal
141
- })).text(), k = se.parseFromString(v, "text/html");
142
- this.setInitialDocument(k);
143
- } catch (d) {
144
- console.warn(d);
140
+ signal: e(this, X).signal
141
+ })).text(), b = ne.parseFromString(v, "text/html");
142
+ this.setInitialDocument(b);
143
+ } catch (u) {
144
+ console.warn(u);
145
145
  } finally {
146
- r(this, j, null), r(this, q, null), i();
146
+ r(this, X, null), r(this, U, null), i();
147
147
  }
148
- }))), e(this, q));
148
+ }))), e(this, U));
149
149
  });
150
150
  }
151
151
  cloneDocument() {
152
- r(this, V, (e(this, X) || e(this, C)).cloneNode(!0));
152
+ r(this, D, (e(this, Y) || e(this, A)).cloneNode(!0));
153
153
  }
154
154
  get title() {
155
155
  let t = "";
156
- if (e(this, V).title)
157
- t = e(this, V).title;
156
+ if (e(this, D).title)
157
+ t = e(this, D).title;
158
158
  else {
159
- const s = e(this, V).querySelector("h1");
160
- t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, Y);
159
+ const s = e(this, D).querySelector("h1");
160
+ t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, W);
161
161
  }
162
162
  return t;
163
163
  }
164
164
  clearScrollState() {
165
- e(this, y).x = 0, e(this, y).y = 0;
165
+ e(this, L).x = 0, e(this, L).y = 0;
166
166
  }
167
167
  clearDocumentState() {
168
- r(this, X, null);
168
+ r(this, Y, null);
169
169
  }
170
170
  saveScrollState() {
171
- e(this, C).documentElement.hasAttribute(
171
+ e(this, A).documentElement.hasAttribute(
172
172
  "data-no-scroll-restoration"
173
- ) ? (e(this, y).x = 0, e(this, y).y = 0) : (e(this, y).x = e(this, H).scrollValue.left, e(this, y).y = e(this, H).scrollValue.top);
173
+ ) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this, H).scrollValue.left, e(this, L).y = e(this, H).scrollValue.top);
174
174
  }
175
175
  restoreScrollPosition() {
176
176
  e(this, H).scrollElement.scroll({
177
- top: e(this, y).y,
178
- left: e(this, y).x,
177
+ top: e(this, L).y,
178
+ left: e(this, L).x,
179
179
  behavior: "instant"
180
180
  });
181
181
  }
182
182
  saveDocumentState() {
183
- e(this, C).documentElement.hasAttribute(
183
+ e(this, A).documentElement.hasAttribute(
184
184
  "data-no-page-restoration"
185
- ) ? r(this, X, null) : r(this, X, document.cloneNode(!0));
185
+ ) ? r(this, Y, null) : r(this, Y, document.cloneNode(!0));
186
186
  }
187
187
  renewScrollPosition() {
188
188
  e(this, H).scrollElement.scroll({
@@ -192,43 +192,44 @@ class It {
192
192
  });
193
193
  }
194
194
  saveState(t) {
195
- r(this, Q, t);
195
+ r(this, J, t);
196
196
  }
197
197
  clearState() {
198
- const t = e(this, Q);
199
- return r(this, Q, null), t;
198
+ const t = e(this, J);
199
+ return r(this, J, null), t;
200
200
  }
201
201
  }
202
- H = new WeakMap(), Y = new WeakMap(), y = new WeakMap(), C = new WeakMap(), X = new WeakMap(), V = new WeakMap(), Q = new WeakMap(), j = new WeakMap(), q = new WeakMap(), Z = new WeakMap();
203
- var T, _, g, F, m, K, B, x, A, rt, N, $, tt, et, at, c, ut, vt, Bt, yt, bt, At, kt, dt, st;
204
- const it = class it {
202
+ H = new WeakMap(), W = new WeakMap(), L = new WeakMap(), A = new WeakMap(), Y = new WeakMap(), D = new WeakMap(), J = new WeakMap(), X = new WeakMap(), U = new WeakMap(), Q = new WeakMap();
203
+ var k, Z, E, z, m, j, I, V, y, nt, T, K, _, tt, c, vt, rt, ct, Lt, Ot, yt, bt, At, kt, ut, et;
204
+ const st = class st {
205
205
  constructor(t) {
206
206
  o(this, c);
207
- o(this, T, null);
208
- o(this, _, null);
209
- o(this, g, []);
210
- o(this, F);
207
+ o(this, k, null);
208
+ o(this, Z, null);
209
+ o(this, E, []);
210
+ o(this, z);
211
211
  o(this, m, null);
212
- o(this, K);
213
- o(this, B, []);
214
- o(this, x, !1);
215
- o(this, A, null);
216
- o(this, rt, !1);
217
- o(this, N, /* @__PURE__ */ new Map());
218
- o(this, $, null);
212
+ o(this, j);
213
+ o(this, I, []);
214
+ o(this, V, !1);
215
+ o(this, y, null);
216
+ o(this, nt, !1);
217
+ o(this, T, /* @__PURE__ */ new Map());
218
+ o(this, K, null);
219
+ o(this, _, 0);
219
220
  o(this, tt, 0);
220
- o(this, et, 0);
221
- o(this, at, (t) => {
221
+ o(this, rt, (t) => {
222
222
  var s;
223
223
  return ((s = t.getAttribute("href")) == null ? void 0 : s.startsWith("/")) && !t.hasAttribute("download") && !t.hasAttribute("data-morph-skip") && !t.closest("[data-morph-skip]") && t.getAttribute("target") !== "_blank";
224
224
  });
225
- o(this, dt, (t) => W(this, null, function* () {
226
- var s;
227
- (s = t.state) != null && s.path && (t.preventDefault(), r(this, x, !0), yield this.navigate(t.state.path, { historyAction: "none" }), r(this, x, !1));
225
+ o(this, ut, (t) => O(this, null, function* () {
226
+ t.preventDefault(), r(this, V, !0), yield this.navigate(location.href.replace(location.origin, ""), {
227
+ historyAction: "none"
228
+ }), r(this, V, !1);
228
229
  }));
229
- o(this, st, () => {
230
- const { left: t, top: s } = this.scrollValue, i = s - e(this, et), d = t - e(this, tt);
231
- r(this, et, s), r(this, tt, t), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", t > 0), document.documentElement.classList.toggle(
230
+ o(this, et, () => {
231
+ const { left: t, top: s } = this.scrollValue, i = s - e(this, tt), u = t - e(this, _);
232
+ r(this, tt, s), r(this, _, t), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", t > 0), document.documentElement.classList.toggle(
232
233
  "scroll-y-forward",
233
234
  i > 0
234
235
  ), document.documentElement.classList.toggle(
@@ -236,297 +237,292 @@ const it = class it {
236
237
  i < 0
237
238
  ), document.documentElement.classList.toggle(
238
239
  "scroll-x-forward",
239
- d > 0
240
+ u > 0
240
241
  ), document.documentElement.classList.toggle(
241
242
  "scroll-x-backward",
242
- d < 0
243
- ), z(document, "morphScroll", {
243
+ u < 0
244
+ ), R(document, "morphScroll", {
244
245
  detail: {
245
246
  left: t,
246
247
  top: s
247
248
  }
248
249
  });
249
250
  });
250
- if (qt && !it.instance) {
251
- it.instance = this, r(this, T, {
252
- base: _t(t == null ? void 0 : t.base),
251
+ if (Ft && !st.instance) {
252
+ st.instance = this, r(this, k, {
253
+ base: ee(t == null ? void 0 : t.base),
253
254
  waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
254
255
  trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
255
256
  scrollSelector: t == null ? void 0 : t.scrollSelector,
256
257
  morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
257
- }), r(this, _, E(this, c, vt).call(this, document.body));
258
+ }), r(this, Z, p(this, c, Lt).call(this, document.body));
258
259
  const s = this.normalizePath(
259
260
  location.pathname + location.hash + location.search
260
261
  );
261
262
  r(this, m, s);
262
- const i = new It(this, e(this, m).pathname);
263
- i.setInitialDocument(document), e(this, N).set(e(this, m).pathname, i), document.documentElement.setAttribute(
263
+ const i = new Vt(this, e(this, m).pathname);
264
+ i.setInitialDocument(document), e(this, T).set(e(this, m).pathname, i), document.documentElement.setAttribute(
264
265
  "data-current-pathname",
265
266
  e(this, m).pathname
266
267
  ), document.documentElement.setAttribute(
267
268
  "data-current-leaf",
268
269
  s.leaf
269
- ), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, dt)), St({
270
+ ), this.findLinks(), history.scrollRestoration = "manual", addEventListener("popstate", e(this, ut)), St({
270
271
  action: "replace",
271
272
  pathname: s.pathname,
272
273
  searchParameters: s.parameters,
273
274
  hash: s.hash
274
- }), r(this, $, new Ft()), E(this, c, At).call(this, document);
275
+ }), r(this, K, new Bt()), p(this, c, At).call(this, document);
275
276
  }
276
277
  }
277
278
  get currentURL() {
278
279
  return e(this, m);
279
280
  }
280
281
  get previousURL() {
281
- return e(this, K);
282
+ return e(this, j);
282
283
  }
283
284
  get links() {
284
- return e(this, g);
285
+ return e(this, E);
285
286
  }
286
287
  get scrollElement() {
287
- return e(this, A);
288
+ return e(this, y);
288
289
  }
289
290
  get isPopstateNavigation() {
290
- return e(this, x);
291
+ return e(this, V);
291
292
  }
292
293
  get scrollValue() {
293
294
  let t = 0, s = 0;
294
- return e(this, rt) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, A).scrollTop, s = e(this, A).scrollLeft), { top: t, left: s };
295
+ return e(this, nt) ? (t = window.scrollY, s = window.scrollX) : (t = e(this, y).scrollTop, s = e(this, y).scrollLeft), { top: t, left: s };
295
296
  }
296
297
  saveState(t) {
297
- const s = e(this, N).get(e(this, m).path);
298
+ const s = e(this, T).get(e(this, m).path);
298
299
  s && s.saveState(t);
299
300
  }
300
301
  getState() {
301
- const t = e(this, N).get(e(this, m).path);
302
+ const t = e(this, T).get(e(this, m).path);
302
303
  return t == null ? void 0 : t.clearState();
303
304
  }
304
305
  normalizePath(t) {
305
- return te(t, {
306
- base: e(this, T).base,
307
- trailingSlash: e(this, T).trailingSlash
306
+ return se(t, {
307
+ base: e(this, k).base,
308
+ trailingSlash: e(this, k).trailingSlash
308
309
  });
309
310
  }
310
311
  prefetch(t, s) {
311
- return W(this, null, function* () {
312
- if (e(this, B).length)
312
+ return O(this, null, function* () {
313
+ if (e(this, I).length)
313
314
  return;
314
- const i = E(this, c, ut).call(this, t);
315
+ const i = p(this, c, ct).call(this, t);
315
316
  i == null || i.fetch(t, s);
316
317
  });
317
318
  }
318
- navigate(O) {
319
- return W(this, arguments, function* (t, {
319
+ excludeHeadChild(t) {
320
+ return !1;
321
+ }
322
+ navigate(q) {
323
+ return O(this, arguments, function* (t, {
320
324
  historyAction: s = "push",
321
325
  centerScroll: i,
322
- offsetScroll: d,
326
+ offsetScroll: u,
323
327
  revalidate: v,
324
- keepSearchParameters: k,
325
- submorph: L,
326
- clearState: w
328
+ keepSearchParameters: b,
329
+ submorph: w,
330
+ clearState: g
327
331
  } = {}) {
328
- var ot, lt, Pt;
329
- if (e(this, B).length)
332
+ var at, ot, Pt, Ct;
333
+ if (e(this, I).length)
330
334
  return;
331
- const h = this.normalizePath(
332
- ((ot = this.pathnameModifier) == null ? void 0 : ot.call(this, t)) || t
335
+ const l = this.normalizePath(
336
+ ((at = this.pathnameModifier) == null ? void 0 : at.call(this, t)) || t
333
337
  );
334
- if (((lt = e(this, F)) == null ? void 0 : lt.pathname) === h.pathname || e(this, m).pathname === h.pathname) {
335
- e(this, x) || E(this, c, kt).call(this, h.hash || 0, {
338
+ if (((ot = e(this, z)) == null ? void 0 : ot.pathname) === l.pathname || e(this, m).pathname === l.pathname) {
339
+ p(this, c, kt).call(this, l.hash || 0, {
336
340
  centerScroll: i,
337
- offsetScroll: d,
341
+ offsetScroll: u,
338
342
  behavior: "smooth"
339
- }), ((Pt = e(this, m)) == null ? void 0 : Pt.parameters) !== h.parameters && (r(this, K, e(this, m)), r(this, m, h), St({
340
- action: s,
341
- pathname: h.pathname,
342
- searchParameters: h.parameters,
343
- hash: h.hash
344
- }), z(document, "morphURLParametersChange", {
343
+ }), ((Pt = e(this, m)) == null ? void 0 : Pt.parameters) !== l.parameters && (r(this, j, e(this, m)), r(this, m, l), St({
344
+ action: ((Ct = e(this, m)) == null ? void 0 : Ct.hash) !== l.hash ? "replace" : s,
345
+ pathname: l.pathname,
346
+ searchParameters: l.parameters,
347
+ hash: l.hash
348
+ }), R(document, "morphURLParametersChange", {
345
349
  detail: {
346
350
  newURL: e(this, m),
347
- previousURL: e(this, K)
351
+ previousURL: e(this, j)
348
352
  }
349
353
  }));
350
354
  return;
351
355
  }
352
- r(this, F, h), e(this, g).forEach((G) => {
353
- G.checkCurrent(h.pathname);
356
+ r(this, z, l), e(this, E).forEach(($) => {
357
+ $.checkCurrent(l.pathname);
354
358
  });
355
359
  try {
356
- let G = !0;
360
+ let $ = !0;
357
361
  if (this.preprocessor)
358
362
  try {
359
- yield new Promise((a, M) => {
360
- var p;
361
- (p = this.preprocessor) == null || p.call(this, {
362
- url: h,
363
+ yield new Promise((a, P) => {
364
+ var x;
365
+ (x = this.preprocessor) == null || x.call(this, {
366
+ url: l,
363
367
  resolve: a,
364
- reject: M,
365
- submorph: L
368
+ reject: P,
369
+ submorph: w
366
370
  });
367
371
  });
368
372
  } catch (a) {
369
- a ? console.error(a) : console.log("Route change canceled"), G = !1;
373
+ a ? console.error(a) : console.log("Route change canceled"), $ = !1;
370
374
  }
371
- if (!G || e(this, F).pathname !== h.pathname) {
372
- e(this, g).forEach((a) => {
375
+ if (!$ || e(this, z).pathname !== l.pathname) {
376
+ e(this, E).forEach((a) => {
373
377
  a.checkCurrent(e(this, m).pathname);
374
378
  });
375
379
  return;
376
380
  }
377
- const Ct = {
378
- url: h,
379
- submorph: L
381
+ const Ht = {
382
+ url: l,
383
+ submorph: w
380
384
  };
381
- z(document, "morphNavigation", {
382
- detail: Ct
385
+ R(document, "morphNavigation", {
386
+ detail: Ht
383
387
  });
384
- const mt = E(this, c, ut).call(this, e(this, m).pathname), f = E(this, c, ut).call(this, h.pathname);
385
- if (e(this, N).forEach((a) => {
386
- a.pathname !== h.pathname && a.abort();
387
- }), yield f == null ? void 0 : f.fetch(t, v), e(this, F).pathname !== h.pathname) {
388
- e(this, g).forEach((a) => {
388
+ const dt = p(this, c, ct).call(this, e(this, m).pathname), f = p(this, c, ct).call(this, l.pathname);
389
+ if (e(this, T).forEach((a) => {
390
+ a.pathname !== l.pathname && a.abort();
391
+ }), yield f == null ? void 0 : f.fetch(t, v), e(this, z).pathname !== l.pathname) {
392
+ e(this, E).forEach((a) => {
389
393
  a.checkCurrent(e(this, m).path);
390
394
  });
391
395
  return;
392
396
  }
393
- mt.clearState(), mt.saveScrollState(), mt.saveDocumentState(), e(this, x) || (f.clearScrollState(), f.clearDocumentState()), w && f.clearState(), f.cloneDocument(), e(this, $).textContent = f.title, document.body.appendChild(e(this, $));
394
- const ft = gt(Et({}, Ct), {
397
+ dt.clearState(), dt.saveScrollState(), dt.saveDocumentState(), e(this, V) || (f.clearScrollState(), f.clearDocumentState()), g && f.clearState(), f.cloneDocument(), e(this, K).textContent = f.title, document.body.appendChild(e(this, K));
398
+ const mt = Et(pt({}, Ht), {
395
399
  document: f.document
396
400
  });
397
- z(document, "morphStart", {
398
- detail: ft
401
+ R(document, "morphStart", {
402
+ detail: mt
399
403
  });
400
- const Tt = Array.from(document.head.children), Mt = Array.from(f.document.head.children), Rt = E(this, c, Bt).call(this, Tt, Mt), Ot = E(this, c, yt).call(this, Tt, Rt), ht = E(this, c, yt).call(this, Mt, Rt);
401
- ht.forEach((a, M) => {
402
- if (a.tagName === "SCRIPT" && a.getAttribute("src")) {
403
- const p = document.createElement("script"), D = a.getAttribute("src");
404
- D.includes("http") || (p.type = "module"), p.src = D, ht[M] = p;
405
- }
406
- }), ht.forEach((a) => {
404
+ const Tt = Array.from(document.head.children), xt = Array.from(f.document.head.children), Mt = p(this, c, Ot).call(this, Tt, xt), Wt = p(this, c, yt).call(this, Tt, Mt), lt = p(this, c, yt).call(this, xt, Mt).filter((a) => !this.excludeHeadChild(a));
405
+ lt.forEach((a, P) => {
406
+ a.tagName === "SCRIPT" && (lt[P] = p(this, c, vt).call(this, a));
407
+ }), lt.forEach((a) => {
407
408
  document.head.appendChild(a);
408
409
  });
409
- const pt = ht.filter((a) => {
410
+ const ft = lt.filter((a) => {
410
411
  if (a.hasAttribute("data-no-waiting"))
411
412
  return !1;
412
- if (E(this, c, bt).call(this, a))
413
+ if (p(this, c, bt).call(this, a))
413
414
  return !0;
414
415
  });
415
- e(this, T).waitForHeadToLoad && pt.length && (yield new Promise((a) => W(this, null, function* () {
416
- let M = 0;
416
+ e(this, k).waitForHeadToLoad && ft.length && (yield new Promise((a) => O(this, null, function* () {
417
+ let P = 0;
417
418
  try {
418
- for (var p = zt(pt), D, b, P; D = !(b = yield p.next()).done; D = !1) {
419
- const ct = b.value;
420
- ct.onload = () => {
421
- M++, M === pt.length && a();
419
+ for (var x = It(ft), Xt, F, B; Xt = !(F = yield x.next()).done; Xt = !1) {
420
+ const ht = F.value;
421
+ ht.onload = () => {
422
+ P++, P === ft.length && a();
422
423
  };
423
424
  }
424
- } catch (b) {
425
- P = [b];
425
+ } catch (F) {
426
+ B = [F];
426
427
  } finally {
427
428
  try {
428
- D && (b = p.return) && (yield b.call(p));
429
+ Xt && (F = x.return) && (yield F.call(x));
429
430
  } finally {
430
- if (P)
431
- throw P[0];
431
+ if (B)
432
+ throw B[0];
432
433
  }
433
434
  }
434
- }))), yield Qt(10);
435
- const Ht = [];
436
- Ot.forEach((a) => {
437
- a.hasAttribute("data-permanent") || (E(this, c, bt).call(this, a) ? Ht.push(a) : a.remove());
435
+ }))), yield _t(10);
436
+ const Rt = [];
437
+ Wt.forEach((a) => {
438
+ a.hasAttribute("data-permanent") || (p(this, c, bt).call(this, a) ? Rt.push(a) : a.remove());
438
439
  });
439
- const Wt = E(this, c, vt).call(this, f.document.body);
440
- e(this, T).morphInsideScrollContainer || E(this, c, At).call(this, f.document), document.documentElement.setAttribute(
440
+ const Yt = p(this, c, Lt).call(this, f.document.body);
441
+ e(this, k).morphInsideScrollContainer || p(this, c, At).call(this, f.document), document.documentElement.setAttribute(
441
442
  "data-current-pathname",
442
- h.pathname
443
+ l.pathname
443
444
  ), document.documentElement.setAttribute(
444
445
  "data-current-leaf",
445
- h.leaf
446
+ l.leaf
446
447
  ), St({
447
448
  action: s,
448
- pathname: h.pathname,
449
- searchParameters: h.parameters || (k ? location.search : ""),
450
- hash: h.hash
451
- }), e(this, $).remove(), r(this, K, e(this, m)), r(this, m, h), e(this, _).forEach((a, M) => {
452
- const p = Wt[M], D = getComputedStyle(a).getPropertyValue("--morph-duration");
453
- let b = [], P = [];
454
- L ? L.forEach((u) => {
455
- const S = a.querySelector(u), U = p.querySelector(u);
456
- S && U && (P.push(S), b.push(U));
457
- }) : (b.push(...p.childNodes), P.push(...a.childNodes)), P.forEach((u) => {
458
- u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
459
- }), b.forEach((u) => {
460
- u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
461
- }), L ? b.forEach((u, S) => {
462
- var U;
463
- (U = P[S].parentElement) == null || U.insertBefore(
464
- u,
465
- P[S]
449
+ pathname: l.pathname,
450
+ searchParameters: l.parameters || (b ? location.search : ""),
451
+ hash: l.hash
452
+ }), e(this, K).remove(), r(this, j, e(this, m)), r(this, m, l), e(this, Z).forEach((a, P) => {
453
+ const x = Yt[P], Xt = getComputedStyle(a).getPropertyValue("--morph-duration");
454
+ let F = [], B = [];
455
+ w ? w.forEach((d) => {
456
+ const S = a.querySelector(d), M = x.querySelector(d);
457
+ S && M && (B.push(S), F.push(M));
458
+ }) : (F.push(...x.childNodes), B.push(...a.childNodes)), B.forEach((d) => {
459
+ d instanceof HTMLElement && (this.destroyOldLinks(d), d.classList.add("old"));
460
+ }), F.forEach((d) => {
461
+ d instanceof HTMLElement && (this.findNewLinks(d), d.classList.add("new"));
462
+ }), w ? F.forEach((d, S) => {
463
+ var M;
464
+ (M = B[S].parentElement) == null || M.insertBefore(
465
+ d,
466
+ B[S]
466
467
  );
467
- }) : a.prepend(...b), Jt(() => {
468
- P.forEach((u) => {
469
- u instanceof HTMLElement && u.classList.add("old-idle");
470
- }), b.forEach((u) => {
468
+ }) : a.prepend(...F), Zt(() => {
469
+ B.forEach((d) => {
470
+ d instanceof HTMLElement && d.classList.add("old-idle");
471
+ }), F.forEach((d) => {
471
472
  var S;
472
- u instanceof HTMLElement && ((S = u.parentElement) == null || S.style.setProperty(
473
+ d instanceof HTMLElement && ((S = d.parentElement) == null || S.style.setProperty(
473
474
  "--new-content-height",
474
- u.offsetHeight + "px"
475
- ), u.classList.add("new-idle"));
475
+ d.offsetHeight + "px"
476
+ ), d.classList.add("new-idle"));
476
477
  });
477
478
  });
478
- const ct = gt(Et({}, ft), {
479
+ const ht = Et(pt({}, mt), {
479
480
  morphElement: a
480
481
  });
481
- z(document, "morphNewChildrenAdded", {
482
- detail: ct
482
+ R(document, "morphNewChildrenAdded", {
483
+ detail: ht
483
484
  });
484
- const Yt = new Promise((u) => {
485
+ const jt = new Promise((d) => {
485
486
  setTimeout(() => {
486
- P.forEach((S) => S.remove()), b.forEach((S) => {
487
- var U;
488
- S instanceof HTMLElement && ((U = S.parentElement) == null || U.style.removeProperty(
487
+ B.forEach((S) => S.remove()), F.forEach((S) => {
488
+ var M;
489
+ S instanceof HTMLElement && ((M = S.parentElement) == null || M.style.removeProperty(
489
490
  "--new-content-height"
490
491
  ), S.classList.remove("new-idle", "new"));
491
- }), z(document, "morphOldChildrenRemoved", {
492
- detail: ct
493
- }), u();
494
- }, (parseFloat(D) || 0) * 1e3 + 10);
492
+ }), R(document, "morphOldChildrenRemoved", {
493
+ detail: ht
494
+ }), d();
495
+ }, (parseFloat(Xt) || 0) * 1e3 + 10);
495
496
  });
496
- e(this, B).push(Yt);
497
+ e(this, I).push(jt);
497
498
  }), this.isPopstateNavigation ? document.documentElement.style.setProperty(
498
499
  "--new-document-scroll-position",
499
500
  (this.scrollValue.top - f.scrollState.y) * 1 + "px"
500
501
  ) : document.documentElement.style.setProperty(
501
502
  "--new-document-scroll-position",
502
503
  this.scrollValue.top + "px"
503
- ), z(document, "morphBeforeNavigationScroll", {
504
+ ), R(document, "morphBeforeNavigationScroll", {
504
505
  detail: f.scrollState
505
- }), h.hash ? (f.clearScrollState(), E(this, c, kt).call(this, h.hash, {
506
+ }), l.hash ? (f.clearScrollState(), p(this, c, kt).call(this, l.hash, {
506
507
  centerScroll: i,
507
- offsetScroll: d
508
- })) : e(this, x) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, B)), Ht.forEach((a) => a.remove()), r(this, B, []), e(this, _).forEach((a) => {
509
- a.querySelectorAll("script").forEach((p) => {
510
- const D = document.createElement("script");
511
- for (let b = 0; b < p.attributes.length; b++) {
512
- const P = p.attributes[b];
513
- D.setAttribute(P.name, P.value);
514
- }
515
- p.hasAttribute("src") || (D.innerHTML = p.innerHTML), p.replaceWith(D);
508
+ offsetScroll: u
509
+ })) : e(this, V) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, I)), Rt.forEach((a) => a.remove()), r(this, I, []), e(this, Z).forEach((a) => {
510
+ a.querySelectorAll("script").forEach((x) => {
511
+ x.replaceWith(p(this, c, vt).call(this, x));
516
512
  });
517
- }), z(document, "morphComplete", {
518
- detail: ft
513
+ }), R(document, "morphComplete", {
514
+ detail: mt
519
515
  }), document.documentElement.style.removeProperty(
520
516
  "--new-document-scroll-position"
521
517
  ), window.dispatchEvent(new Event("resize"));
522
- } catch (G) {
523
- console.error(G);
518
+ } catch ($) {
519
+ console.error($);
524
520
  }
525
- r(this, F, void 0);
521
+ r(this, z, void 0);
526
522
  });
527
523
  }
528
524
  addLink(t) {
529
- e(this, g).push(new Lt(t, this));
525
+ e(this, E).push(new wt(t, this));
530
526
  }
531
527
  addLinks(t) {
532
528
  t.forEach((s) => {
@@ -534,63 +530,70 @@ const it = class it {
534
530
  });
535
531
  }
536
532
  removeLink(t) {
537
- r(this, g, e(this, g).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
533
+ r(this, E, e(this, E).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
538
534
  }
539
535
  destroyOldLinks(t) {
540
- r(this, g, e(this, g).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
536
+ r(this, E, e(this, E).filter((s) => t.contains(s.element) ? (s.destroy(), !1) : !0));
541
537
  }
542
538
  findNewLinks(t) {
543
539
  const s = [...t.querySelectorAll("a")].filter(
544
- e(this, at)
540
+ e(this, rt)
545
541
  );
546
- e(this, g).push(
547
- ...s.map((i) => new Lt(i, this))
542
+ e(this, E).push(
543
+ ...s.map((i) => new wt(i, this))
548
544
  );
549
545
  }
550
546
  findLinks() {
551
547
  const t = [
552
548
  ...document.documentElement.querySelectorAll("a")
553
- ].filter(e(this, at));
554
- e(this, g).forEach((s) => s.destroy()), r(this, g, t.map((s) => new Lt(s, this)));
549
+ ].filter(e(this, rt));
550
+ e(this, E).forEach((s) => s.destroy()), r(this, E, t.map((s) => new wt(s, this)));
555
551
  }
556
552
  };
557
- T = new WeakMap(), _ = new WeakMap(), g = new WeakMap(), F = new WeakMap(), m = new WeakMap(), K = new WeakMap(), B = new WeakMap(), x = new WeakMap(), A = new WeakMap(), rt = new WeakMap(), N = new WeakMap(), $ = new WeakMap(), tt = new WeakMap(), et = new WeakMap(), at = new WeakMap(), c = new WeakSet(), ut = function(t) {
553
+ k = new WeakMap(), Z = new WeakMap(), E = new WeakMap(), z = new WeakMap(), m = new WeakMap(), j = new WeakMap(), I = new WeakMap(), V = new WeakMap(), y = new WeakMap(), nt = new WeakMap(), T = new WeakMap(), K = new WeakMap(), _ = new WeakMap(), tt = new WeakMap(), c = new WeakSet(), vt = function(t) {
554
+ const s = document.createElement("script");
555
+ for (let i = 0; i < t.attributes.length; i++) {
556
+ const u = t.attributes[i];
557
+ s.setAttribute(u.name, u.value);
558
+ }
559
+ return t.hasAttribute("src") || (s.innerHTML = t.innerHTML), s;
560
+ }, rt = new WeakMap(), ct = function(t) {
558
561
  const s = this.normalizePath(t);
559
- let i = e(this, N).get(s.pathname);
560
- return i || (i = new It(this, s.pathname), e(this, N).set(s.pathname, i)), i;
561
- }, vt = function(t) {
562
+ let i = e(this, T).get(s.pathname);
563
+ return i || (i = new Vt(this, s.pathname), e(this, T).set(s.pathname, i)), i;
564
+ }, Lt = function(t) {
562
565
  const s = [...t.querySelectorAll("[data-morph]")];
563
566
  return s.length ? s : [t];
564
- }, Bt = function(t, s) {
567
+ }, Ot = function(t, s) {
565
568
  return t.filter(
566
569
  (i) => s.find(
567
- (d) => d.outerHTML === i.outerHTML
570
+ (u) => u.outerHTML === i.outerHTML
568
571
  )
569
572
  );
570
573
  }, yt = function(t, s) {
571
574
  return t.filter(
572
575
  (i) => !s.find(
573
- (d) => d.outerHTML === i.outerHTML
576
+ (u) => u.outerHTML === i.outerHTML
574
577
  )
575
578
  );
576
579
  }, bt = function(t) {
577
580
  return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
578
581
  }, At = function(t) {
579
582
  var s, i;
580
- (s = e(this, A)) == null || s.removeEventListener(
583
+ (s = e(this, y)) == null || s.removeEventListener(
581
584
  "scroll",
582
- e(this, st)
583
- ), r(this, et, 0), r(this, tt, 0), r(this, A, e(this, T).scrollSelector && t.querySelector(e(this, T).scrollSelector) || window), r(this, rt, e(this, A) === window), (i = e(this, A)) == null || i.addEventListener("scroll", e(this, st)), e(this, st).call(this);
585
+ e(this, et)
586
+ ), r(this, tt, 0), r(this, _, 0), r(this, y, e(this, k).scrollSelector && t.querySelector(e(this, k).scrollSelector) || window), r(this, nt, e(this, y) === window), (i = e(this, y)) == null || i.addEventListener("scroll", e(this, et)), e(this, et).call(this);
584
587
  }, kt = function(t, s) {
585
588
  const i = typeof t == "string" ? document.getElementById(t) : t;
586
- (typeof i == "number" || i) && Zt(i, {
587
- scrollElement: e(this, A),
589
+ (typeof i == "number" || i) && te(i, {
590
+ scrollElement: e(this, y),
588
591
  behavior: (s == null ? void 0 : s.behavior) || "instant",
589
592
  center: s == null ? void 0 : s.centerScroll,
590
593
  offset: s == null ? void 0 : s.offsetScroll
591
594
  });
592
- }, dt = new WeakMap(), st = new WeakMap(), it.instance = null;
593
- let Vt = it;
595
+ }, ut = new WeakMap(), et = new WeakMap(), st.instance = null;
596
+ let qt = st;
594
597
  export {
595
- Vt as Morph
598
+ qt as Morph
596
599
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.71.4",
3
+ "version": "0.71.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"