aptechka 0.74.0 → 0.74.2

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