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