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