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