aptechka 0.73.0 → 0.73.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 ae=Object.defineProperty,ne=Object.defineProperties;var re=Object.getOwnPropertyDescriptors;var Xt=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var Yt=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),Kt=o=>{throw TypeError(o)};var jt=(o,e,i)=>e in o?ae(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,Et=(o,e)=>{for(var i in e||(e={}))oe.call(e,i)&&jt(o,i,e[i]);if(Xt)for(var i of Xt(e))le.call(e,i)&&jt(o,i,e[i]);return o},Pt=(o,e)=>ne(o,re(e));var Ct=(o,e,i)=>e.has(o)||Kt("Cannot "+i);var t=(o,e,i)=>(Ct(o,e,"read from private field"),i?i.call(o):e.get(o)),l=(o,e,i)=>e.has(o)?Kt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,i),r=(o,e,i,s)=>(Ct(o,e,"write to private field"),s?s.call(o,i):e.set(o,i),i),p=(o,e,i)=>(Ct(o,e,"access private method"),i);var W=(o,e,i)=>new Promise((s,h)=>{var g=f=>{try{w(i.next(f))}catch(v){h(v)}},E=f=>{try{w(i.throw(f))}catch(v){h(v)}},w=f=>f.done?s(f.value):Promise.resolve(f.value).then(g,E);w((i=i.apply(o,e)).next())});var $t=(o,e,i)=>(e=o[Yt("asyncIterator")])?e.call(o):(o=o[Yt("iterator")](),e={},i=(s,h)=>(h=o[s])&&(e[s]=g=>new Promise((E,w,f)=>(g=h.call(o,g),f=g.done,Promise.resolve(g.value).then(v=>E({value:v,done:f}),w)))),i("next"),i("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qt=require("../index-DekP7OZe.cjs"),T=require("../events-KVanG9sR.cjs"),he=require("../polyfills-Df4r-ETT.cjs"),Gt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const nt=require("../url-DGcX4fGV.cjs"),ce=require("../css-value-parser/index.cjs");class Zt extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[i,s]of Object.entries(e))this.setAttribute(i,s)}}Qt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Zt);var P,a,D,J,vt,ot,Q;class Ht{constructor(e,i){l(this,J);l(this,P);l(this,a);l(this,D);l(this,ot,e=>{var s;if(e.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(t(this,a).hasAttribute("data-back")&&t(this,P).previousURL)history.back();else{r(this,D,t(this,a).getAttribute("href")||"/");const h=t(this,a).getAttribute("data-history-action")||"push",g=t(this,a).hasAttribute("data-center-scroll"),E=getComputedStyle(t(this,a)).getPropertyValue("--offset-scroll").trim(),w=E?ce.cssValueParser.parse(E):void 0,f=t(this,a).hasAttribute("data-revalidate")||t(this,a).hasAttribute("data-pagination-more-link")||t(this,a).hasAttribute("data-pagination-set-link"),v=t(this,a).hasAttribute("data-keep-search-parameters"),Lt=t(this,a).hasAttribute("data-keep-scroll-position")||t(this,a).hasAttribute("data-pagination-more-link"),yt=t(this,a).getAttribute("data-scroll-behaviour"),dt=p(this,J,vt).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));dt&&(t(this,a).hasAttribute("data-pagination-set-link")?t(this,P).links.forEach(q=>{q.updatePagination(parseInt(t(this,a).getAttribute("data-value")||"1"),dt.selector)}):t(this,a).hasAttribute("data-pagination-more-link")&&t(this,P).links.forEach(q=>{q.updatePagination(dt.currentPage+1,dt.selector)}));const mt=((s=t(this,a).getAttribute("data-submorph"))==null?void 0:s.split(",").map(q=>q.trim()))||t(this,a).hasAttribute("data-pagination-more-link")&&[t(this,a).getAttribute("data-pagination-more-link")]||t(this,a).hasAttribute("data-pagination-set-link")&&[t(this,a).getAttribute("data-pagination-set-link")]||void 0,c=t(this,a).hasAttribute("data-clear-state");t(this,P).navigate(t(this,D),{historyAction:h,centerScroll:g,offsetScroll:w,revalidate:f,keepSearchParameters:v,submorph:mt,clearState:c,keepScrollPosition:Lt,scrollBehaviour:yt,submorphAppend:t(this,a).hasAttribute("data-pagination-more-link")})}});l(this,Q,()=>{const e=t(this,a).hasAttribute("data-revalidate");t(this,P).prefetch(t(this,D),e),t(this,a).removeEventListener("pointerenter",t(this,Q))});r(this,P,i),r(this,a,e),t(this,a).addEventListener("click",t(this,ot)),r(this,D,t(this,a).getAttribute("href")||"/"),this.checkCurrent(location.href.replace(location.origin,""));const s=p(this,J,vt).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));s&&this.updatePagination(s.currentPage,s.selector),t(this,a).hasAttribute("data-prefetch")&&t(this,a).addEventListener("pointerenter",t(this,Q))}get element(){return t(this,a)}checkCurrent(e){var h;const i=t(this,P).normalizePath(e),s=t(this,P).normalizePath(t(this,D));t(this,a).hasAttribute("data-include")&&i.pathname.includes(s.pathname)?t(this,a).classList.add("current"):s.pathname===i.pathname?t(this,a).classList.add("current"):(h=t(this,a).getAttribute("data-associated-paths"))!=null&&h.split(",").find(g=>i.pathname.includes(g))?t(this,a).classList.add("current"):t(this,a).classList.remove("current"),i.path===s.path?t(this,a).classList.add("exact"):t(this,a).classList.remove("exact")}updatePagination(e,i){const s=p(this,J,vt).call(this,i);if(s)if(s.element.setAttribute("data-current-page",e.toString()),t(this,a).hasAttribute("data-pagination-more-link"))if(e<s.totalPages){t(this,a).style.display="";const h=t(this,a).querySelector("[data-pagination-more-link-counter]");h&&(h.textContent=(s.totalPages-e).toString());const g=t(this,a).getAttribute("href"),E=new URL(g,window.location.origin);E.searchParams.set("page",(e+1).toString());const w=E.href.replace(E.origin,"").toString();t(this,a).setAttribute("href",w),this.checkCurrent(w)}else t(this,a).style.display="none";else t(this,a).hasAttribute("data-pagination-set-link")&&(t(this,a).getAttribute("data-value")===e.toString()?t(this,a).classList.add("pagination-current"):t(this,a).classList.remove("pagination-current"))}destroy(){t(this,a).removeEventListener("click",t(this,ot)),t(this,a).removeEventListener("pointerenter",t(this,Q)),t(this,a).classList.remove("current","exact","pagination-current")}}P=new WeakMap,a=new WeakMap,D=new WeakMap,J=new WeakSet,vt=function(e){if(!e)return;const i=document.querySelector(e);if(i){const s=parseInt(i.getAttribute("data-current-page")||"1"),h=parseInt(i.getAttribute("data-total-pages")||"1");return{element:i,currentPage:s,totalPages:h,selector:e}}},ot=new WeakMap,Q=new WeakMap;const ue=new DOMParser;var x,X,A,R,Y,z,Z,j,V,_,lt;class Jt{constructor(e,i){l(this,x);l(this,X);l(this,A,{x:0,y:0});l(this,R,null);l(this,Y,null);l(this,z,null);l(this,Z,null);l(this,j,null);l(this,V,null);l(this,_);l(this,lt);r(this,x,e),r(this,X,i),r(this,_,i)}get pathname(){return t(this,X)}get scrollState(){return t(this,A)}get document(){return t(this,z)}setHeaders(e){r(this,lt,e)}setInitialDocument(e){r(this,R,e.cloneNode(!0))}abort(){var e;return(e=t(this,j))==null?void 0:e.abort(`[${t(this,X)}] page loading cancelled`)}fetch(e,i,s){return W(this,null,function*(){return!s&&(t(this,V)||t(this,R)&&t(this,R).documentElement.hasAttribute("data-cache")&&t(this,_)!==e||t(this,R)&&t(this,x).isPopstateNavigation)?t(this,V):(r(this,_,e),r(this,V,new Promise(h=>W(this,null,function*(){try{r(this,j,new AbortController);const E=yield(yield fetch(e,{signal:t(this,j).signal,headers:Et({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(i),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,lt))})).text(),w=ue.parseFromString(E,"text/html");this.setInitialDocument(w)}catch(g){console.warn(g)}finally{r(this,j,null),r(this,V,null),h()}}))),t(this,V))})}cloneDocument(){r(this,z,(t(this,Y)||t(this,R)).cloneNode(!0))}get title(){let e="";if(t(this,z).title)e=t(this,z).title;else{const i=t(this,z).querySelector("h1");e=(i==null?void 0:i.innerText)||(i==null?void 0:i.textContent)||t(this,X)}return e}clearScrollState(){t(this,A).x=0,t(this,A).y=0}clearDocumentState(){r(this,Y,null)}saveScrollState(){t(this,R).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,A).x=0,t(this,A).y=0):(t(this,A).x=t(this,x).scrollValue.left,t(this,A).y=t(this,x).scrollValue.top)}restoreScrollPosition(){t(this,x).scrollElement.scroll({top:t(this,A).y,left:t(this,A).x,behavior:"instant"})}saveDocumentState(){t(this,R).documentElement.hasAttribute("data-no-page-restoration")?r(this,Y,null):r(this,Y,document.cloneNode(!0))}renewScrollPosition(){t(this,x).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){r(this,Z,e)}clearState(){const e=t(this,Z);return r(this,Z,null),e}}x=new WeakMap,X=new WeakMap,A=new WeakMap,R=new WeakMap,Y=new WeakMap,z=new WeakMap,Z=new WeakMap,j=new WeakMap,V=new WeakMap,_=new WeakMap,lt=new WeakMap;var M,tt,L,O,m,K,B,F,C,ht,N,$,et,it,ct,st,d,Mt,ut,St,Tt,_t,xt,Nt,qt,Ut,bt,at;const rt=class rt{constructor(e){l(this,d);l(this,M,null);l(this,tt,null);l(this,L,[]);l(this,O);l(this,m,null);l(this,K);l(this,B,[]);l(this,F,!1);l(this,C,null);l(this,ht,!1);l(this,N,new Map);l(this,$,null);l(this,et,0);l(this,it,0);l(this,ct);l(this,st);l(this,ut,e=>{var i;return((i=e.getAttribute("href"))==null?void 0:i.startsWith("/"))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,bt,e=>W(this,null,function*(){e.preventDefault(),r(this,F,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,st)?void 0:t(this,ct),revalidate:t(this,st)}),r(this,F,!1)}));l(this,at,()=>{const{left:e,top:i}=this.scrollValue,s=i-t(this,it),h=e-t(this,et);r(this,it,i),r(this,et,e),document.documentElement.classList.toggle("scroll-y",i>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",s>0),document.documentElement.classList.toggle("scroll-y-backward",s<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),T.dispatchEvent(document,"morphScroll",{detail:{left:e,top:i}})});if(Qt.isBrowser&&!rt.instance){rt.instance=this,r(this,M,{base:nt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),r(this,tt,p(this,d,Tt).call(this,document.body));const i=this.normalizePath(location.pathname+location.search+location.hash);r(this,m,i);const s=new Jt(this,t(this,m).pathname);s.setInitialDocument(document),t(this,N).set(t(this,m).pathname,s),document.documentElement.setAttribute("data-current-pathname",t(this,m).pathname),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",t(this,bt)),nt.changeHistory({action:"replace",pathname:i.pathname,searchParameters:i.parameters,hash:i.hash}),r(this,$,new Zt),p(this,d,qt).call(this,document)}}get currentURL(){return t(this,m)}get previousURL(){return t(this,K)}get links(){return t(this,L)}get scrollElement(){return t(this,C)}get isPopstateNavigation(){return t(this,F)}get scrollValue(){let e=0,i=0;return t(this,ht)?(e=window.scrollY,i=window.scrollX):(e=t(this,C).scrollTop,i=t(this,C).scrollLeft),{top:e,left:i}}saveState(e){const i=t(this,N).get(t(this,m).path);i&&i.saveState(e)}getState(){const e=t(this,N).get(t(this,m).path);return e==null?void 0:e.clearState()}normalizePath(e){return nt.splitPath(e,{base:t(this,M).base,trailingSlash:t(this,M).trailingSlash})}prefetch(e,i){return W(this,null,function*(){var h;if(t(this,B).length)return;e=((h=this.pathnameModifier)==null?void 0:h.call(this,e))||e;const s=p(this,d,St).call(this,e);s==null||s.fetch(e,t(this,m).path,i)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate(dt){return W(this,arguments,function*(e,{historyAction:i="push",centerScroll:s,offsetScroll:h,scrollBehaviour:g,revalidate:E,keepSearchParameters:w,submorph:f,submorphAppend:v,clearState:Lt,keepScrollPosition:yt}={}){var q,It,Dt,zt;if(t(this,B).length)return;r(this,ct,f),r(this,st,E);const mt=((q=this.pathnameModifier)==null?void 0:q.call(this,e))||e,c=this.normalizePath(mt);if(t(this,L).forEach(G=>{G.checkCurrent(c.path)}),!E&&(((It=t(this,O))==null?void 0:It.pathname)===c.pathname||t(this,m).pathname===c.pathname)){p(this,d,Ut).call(this,c.hash||0,{centerScroll:s,offsetScroll:h,behavior:"smooth"}),T.dispatchEvent(document,"morphSamePath",{custom:!0}),((Dt=t(this,m))==null?void 0:Dt.parameters)!==c.parameters&&(r(this,K,t(this,m)),r(this,m,c),nt.changeHistory({action:((zt=t(this,m))==null?void 0:zt.hash)!==c.hash?"replace":i,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),T.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,m),previousURL:t(this,K)}}));return}r(this,O,c);try{let G=!0;if(this.preprocessor)try{yield new Promise((n,y)=>{var k;(k=this.preprocessor)==null||k.call(this,{url:c,resolve:n,reject:y,submorph:f})})}catch(n){n?console.error(n):console.log("Route change canceled"),G=!1}if(!G||t(this,O).pathname!==c.pathname){t(this,L).forEach(n=>{n.checkCurrent(t(this,m).path)});return}const Vt={url:c,submorph:f};f?v||f.forEach(n=>{document.querySelectorAll(n).forEach(y=>{y.classList.add("out"),y.setAttribute("data-morph-out","")})}):t(this,tt).forEach(n=>{var y,k;(y=n.firstElementChild)==null||y.classList.add("out"),(k=n.firstElementChild)==null||k.setAttribute("data-morph-out","")}),T.dispatchEvent(document,"morphNavigation",{detail:Vt});const wt=p(this,d,St).call(this,t(this,m).pathname),S=p(this,d,St).call(this,c.pathname);if(t(this,N).forEach(n=>{n.pathname!==c.pathname&&n.abort()}),yield S==null?void 0:S.fetch(mt,t(this,m).path,E),t(this,O).pathname!==c.pathname){t(this,L).forEach(n=>{n.checkCurrent(t(this,m).path)});return}wt.clearState(),wt.saveScrollState(),wt.saveDocumentState(),(!t(this,F)||E)&&(S.clearScrollState(),S.clearDocumentState()),Lt&&S.clearState(),S.cloneDocument(),t(this,$).textContent=S.title,document.body.appendChild(t(this,$));const ft=Pt(Et({},Vt),{document:S.document});v||ft.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),T.dispatchEvent(document,"morphStart",{detail:ft});const Ot=Array.from(document.head.children),Bt=Array.from(S.document.head.children),Ft=p(this,d,_t).call(this,Ot,Bt),te=p(this,d,xt).call(this,Ot,Ft),pt=p(this,d,xt).call(this,Bt,Ft).filter(n=>!this.excludeHeadChild(n));pt.forEach((n,y)=>{n.tagName==="SCRIPT"&&(pt[y]=p(this,d,Mt).call(this,n))}),pt.forEach(n=>{document.head.appendChild(n)});const At=pt.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(p(this,d,Nt).call(this,n))return!0});t(this,M).waitForHeadToLoad&&At.length&&(yield new Promise(n=>W(this,null,function*(){let y=0;try{for(var k=$t(At),ie,U,H;ie=!(U=yield k.next()).done;ie=!1){const gt=U.value;gt.onload=()=>{y++,y===At.length&&n()}}}catch(U){H=[U]}finally{try{ie&&(U=k.return)&&(yield U.call(k))}finally{if(H)throw H[0]}}}))),yield Gt.wait(10);const Wt=[];v||te.forEach(n=>{n.hasAttribute("data-permanent")||(p(this,d,Nt).call(this,n)?Wt.push(n):n.remove())});const ee=p(this,d,Tt).call(this,S.document.body);!t(this,M).morphInsideScrollContainer&&!f&&p(this,d,qt).call(this,S.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),nt.changeHistory({action:i,pathname:c.pathname,searchParameters:c.parameters||(w?location.search:""),hash:c.hash}),t(this,$).remove(),r(this,K,t(this,m)),r(this,m,c);const kt=[];t(this,tt).forEach((n,y)=>{const k=ee[y],ie=getComputedStyle(n).getPropertyValue("--morph-duration");let U=[],H=[];f?(f.forEach(u=>{const b=n.querySelector(u),I=k.querySelector(u);b&&I&&(H.push(b),U.push(I))}),H.forEach(u=>{u.parentElement&&kt.push(u.parentElement)})):(U.push(...k.childNodes),H.push(...n.childNodes),kt.push(n)),v||H.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),U.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),f?v?U.forEach((u,b)=>{H[b]instanceof HTMLElement&&H[b].append(...u.childNodes)}):U.forEach((u,b)=>{var I;(I=H[b].parentElement)==null||I.insertBefore(u,H[b])}):n.prepend(...U),he.requestIdleCallback(()=>{v||H.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),U.forEach(u=>{var b;u instanceof HTMLElement&&((b=u.parentElement)==null||b.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})});const gt=Pt(Et({},ft),{morphElement:n});T.dispatchEvent(document,"morphNewChildrenAdded",{detail:gt});const se=new Promise(u=>{setTimeout(()=>{v||H.forEach(b=>b.remove()),U.forEach(b=>{var I;b instanceof HTMLElement&&((I=b.parentElement)==null||I.style.removeProperty("--new-content-height"),b.classList.remove("new-idle","new"))}),v||T.dispatchEvent(document,"morphOldChildrenRemoved",{detail:gt}),u()},(parseFloat(ie)||0)*1e3+10)});t(this,B).push(se)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-S.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),T.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:S.scrollState}),c.hash?(S.clearScrollState(),p(this,d,Ut).call(this,c.hash,{centerScroll:s,offsetScroll:h,behavior:g})):t(this,F)?S.restoreScrollPosition():yt||S.renewScrollPosition(),yield Promise.all(t(this,B)),v||Wt.forEach(n=>n.remove()),r(this,B,[]),kt.forEach(n=>{n.querySelectorAll("script").forEach(k=>{k.replaceWith(p(this,d,Mt).call(this,k))})}),t(this,L).forEach(n=>{n.checkCurrent(t(this,m).path)}),T.dispatchEvent(document,"morphComplete",{detail:ft}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(G){console.error(G)}r(this,O,void 0)})}addLink(e){t(this,L).push(new Ht(e,this))}addLinks(e){e.forEach(i=>{this.addLink(i)})}removeLink(e){r(this,L,t(this,L).filter(i=>i.element===e?(i.destroy(),!1):!0))}destroyOldLinks(e){r(this,L,t(this,L).filter(i=>e.contains(i.element)?(i.destroy(),!1):!0))}findNewLinks(e){const i=[...e.querySelectorAll("a")].filter(t(this,ut));t(this,L).push(...i.map(s=>new Ht(s,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,ut));t(this,L).forEach(i=>i.destroy()),r(this,L,e.map(i=>new Ht(i,this)))}};M=new WeakMap,tt=new WeakMap,L=new WeakMap,O=new WeakMap,m=new WeakMap,K=new WeakMap,B=new WeakMap,F=new WeakMap,C=new WeakMap,ht=new WeakMap,N=new WeakMap,$=new WeakMap,et=new WeakMap,it=new WeakMap,ct=new WeakMap,st=new WeakMap,d=new WeakSet,Mt=function(e){const i=document.createElement("script");for(let s=0;s<e.attributes.length;s++){const h=e.attributes[s];i.setAttribute(h.name,h.value)}return e.hasAttribute("src")||(i.innerHTML=e.innerHTML),i},ut=new WeakMap,St=function(e){const i=this.normalizePath(e);let s=t(this,N).get(i.pathname);return s||(s=new Jt(this,i.pathname),t(this,N).set(i.pathname,s)),s},Tt=function(e){const i=[...e.querySelectorAll("[data-morph]")];return i.length?i:[e]},_t=function(e,i){return e.filter(s=>i.find(h=>h.outerHTML===s.outerHTML))},xt=function(e,i){return e.filter(s=>!i.find(h=>h.outerHTML===s.outerHTML))},Nt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},qt=function(e){var i,s;(i=t(this,C))==null||i.removeEventListener("scroll",t(this,at)),r(this,it,0),r(this,et,0),r(this,C,t(this,M).scrollSelector&&e.querySelector(t(this,M).scrollSelector)||window),r(this,ht,t(this,C)===window),(s=t(this,C))==null||s.addEventListener("scroll",t(this,at)),t(this,at).call(this)},Ut=function(e,i){const s=typeof e=="string"?document.getElementById(e):e;(typeof s=="number"||s)&&Gt.scrollToElement(s,{scrollElement:t(this,C),behavior:(i==null?void 0:i.behavior)||"instant",center:i==null?void 0:i.centerScroll,offset:i==null?void 0:i.offsetScroll})},bt=new WeakMap,at=new WeakMap,rt.instance=null;let Rt=rt;exports.Morph=Rt;
1
+ "use strict";var se=Object.defineProperty,ae=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var Wt=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;var Xt=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),jt=o=>{throw TypeError(o)};var Yt=(o,e,i)=>e in o?se(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i,gt=(o,e)=>{for(var i in e||(e={}))re.call(e,i)&&Yt(o,i,e[i]);if(Wt)for(var i of Wt(e))oe.call(e,i)&&Yt(o,i,e[i]);return o},At=(o,e)=>ae(o,ne(e));var Pt=(o,e,i)=>e.has(o)||jt("Cannot "+i);var t=(o,e,i)=>(Pt(o,e,"read from private field"),i?i.call(o):e.get(o)),l=(o,e,i)=>e.has(o)?jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,i),r=(o,e,i,s)=>(Pt(o,e,"write to private field"),s?s.call(o,i):e.set(o,i),i),p=(o,e,i)=>(Pt(o,e,"access private method"),i);var W=(o,e,i)=>new Promise((s,h)=>{var v=d=>{try{L(i.next(d))}catch(E){h(E)}},g=d=>{try{L(i.throw(d))}catch(E){h(E)}},L=d=>d.done?s(d.value):Promise.resolve(d.value).then(v,g);L((i=i.apply(o,e)).next())});var Kt=(o,e,i)=>(e=o[Xt("asyncIterator")])?e.call(o):(o=o[Xt("iterator")](),e={},i=(s,h)=>(h=o[s])&&(e[s]=v=>new Promise((g,L,d)=>(v=h.call(o,v),d=v.done,Promise.resolve(v.value).then(E=>g({value:E,done:d}),L)))),i("next"),i("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Jt=require("../index-DekP7OZe.cjs"),M=require("../events-KVanG9sR.cjs"),le=require("../polyfills-Df4r-ETT.cjs"),$t=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const at=require("../url-DGcX4fGV.cjs"),he=require("../css-value-parser/index.cjs");class Qt extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[i,s]of Object.entries(e))this.setAttribute(i,s)}}Jt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Qt);var P,a,I,J,Et,rt,Q;class Ct{constructor(e,i){l(this,J);l(this,P);l(this,a);l(this,I);l(this,rt,e=>{var s;if(e.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(t(this,a).hasAttribute("data-back")&&t(this,P).previousURL)history.back();else{r(this,I,t(this,a).getAttribute("href")||"/");const h=t(this,a).getAttribute("data-history-action")||"push",v=t(this,a).hasAttribute("data-center-scroll"),g=getComputedStyle(t(this,a)).getPropertyValue("--offset-scroll").trim(),L=g?he.cssValueParser.parse(g):void 0,d=t(this,a).hasAttribute("data-revalidate")||t(this,a).hasAttribute("data-pagination-more-link")||t(this,a).hasAttribute("data-pagination-set-link"),E=t(this,a).hasAttribute("data-keep-search-parameters"),bt=t(this,a).hasAttribute("data-keep-scroll-position")||t(this,a).hasAttribute("data-pagination-more-link"),Lt=t(this,a).getAttribute("data-scroll-behaviour"),ut=p(this,J,Et).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));ut&&(t(this,a).hasAttribute("data-pagination-set-link")?t(this,P).links.forEach(q=>{q.updatePagination(parseInt(t(this,a).getAttribute("data-value")||"1"),ut.selector)}):t(this,a).hasAttribute("data-pagination-more-link")&&t(this,P).links.forEach(q=>{q.updatePagination(ut.currentPage+1,ut.selector)}));const dt=((s=t(this,a).getAttribute("data-submorph"))==null?void 0:s.split(",").map(q=>q.trim()))||t(this,a).hasAttribute("data-pagination-more-link")&&[t(this,a).getAttribute("data-pagination-more-link")]||t(this,a).hasAttribute("data-pagination-set-link")&&[t(this,a).getAttribute("data-pagination-set-link")]||void 0,c=t(this,a).hasAttribute("data-clear-state");t(this,P).navigate(t(this,I),{historyAction:h,centerScroll:v,offsetScroll:L,revalidate:d,keepSearchParameters:E,submorph:dt,clearState:c,keepScrollPosition:bt,scrollBehaviour:Lt,submorphAppend:t(this,a).hasAttribute("data-pagination-more-link")})}});l(this,Q,()=>{const e=t(this,a).hasAttribute("data-revalidate");t(this,P).prefetch(t(this,I),e),t(this,a).removeEventListener("pointerenter",t(this,Q))});r(this,P,i),r(this,a,e),t(this,a).addEventListener("click",t(this,rt)),r(this,I,t(this,a).getAttribute("href")||"/"),this.checkCurrent(location.href.replace(location.origin,""));const s=p(this,J,Et).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));s&&this.updatePagination(s.currentPage,s.selector),t(this,a).hasAttribute("data-prefetch")&&t(this,a).addEventListener("pointerenter",t(this,Q))}get element(){return t(this,a)}checkCurrent(e){var h;const i=t(this,P).normalizePath(e),s=t(this,P).normalizePath(t(this,I));t(this,a).hasAttribute("data-include")&&i.pathname.includes(s.pathname)?t(this,a).classList.add("current"):s.pathname===i.pathname?t(this,a).classList.add("current"):(h=t(this,a).getAttribute("data-associated-paths"))!=null&&h.split(",").find(v=>i.pathname.includes(v))?t(this,a).classList.add("current"):t(this,a).classList.remove("current"),i.path===s.path?t(this,a).classList.add("exact"):t(this,a).classList.remove("exact")}updatePagination(e,i){const s=p(this,J,Et).call(this,i);if(s)if(s.element.setAttribute("data-current-page",e.toString()),t(this,a).hasAttribute("data-pagination-more-link"))if(e<s.totalPages){t(this,a).style.display="";const h=t(this,a).querySelector("[data-pagination-more-link-counter]");h&&(h.textContent=(s.totalPages-e).toString());const v=t(this,a).getAttribute("href"),g=new URL(v,window.location.origin);g.searchParams.set("page",(e+1).toString());const L=g.href.replace(g.origin,"").toString();t(this,a).setAttribute("href",L),this.checkCurrent(L)}else t(this,a).style.display="none";else t(this,a).hasAttribute("data-pagination-set-link")&&(t(this,a).getAttribute("data-value")===e.toString()?t(this,a).classList.add("pagination-current"):t(this,a).classList.remove("pagination-current"))}destroy(){t(this,a).removeEventListener("click",t(this,rt)),t(this,a).removeEventListener("pointerenter",t(this,Q)),t(this,a).classList.remove("current","exact","pagination-current")}}P=new WeakMap,a=new WeakMap,I=new WeakMap,J=new WeakSet,Et=function(e){if(!e)return;const i=document.querySelector(e);if(i){const s=parseInt(i.getAttribute("data-current-page")||"1"),h=parseInt(i.getAttribute("data-total-pages")||"1");return{element:i,currentPage:s,totalPages:h,selector:e}}},rt=new WeakMap,Q=new WeakMap;const ce=new DOMParser;var T,X,k,x,Y,z,Z,j,V,ot;class Gt{constructor(e,i){l(this,T);l(this,X);l(this,k,{x:0,y:0});l(this,x,null);l(this,Y,null);l(this,z,null);l(this,Z,null);l(this,j,null);l(this,V,null);l(this,ot);r(this,T,e),r(this,X,i)}get pathname(){return t(this,X)}get scrollState(){return t(this,k)}get document(){return t(this,z)}setHeaders(e){r(this,ot,e)}setInitialDocument(e){r(this,x,e.cloneNode(!0))}abort(){var e;return(e=t(this,j))==null?void 0:e.abort(`[${t(this,X)}] page loading cancelled`)}fetch(e,i,s){return W(this,null,function*(){var h;if(!s){const L=((h=t(this,x))==null?void 0:h.documentElement.getAttribute("data-cache"))&&i!==e,d=t(this,x)&&t(this,T).isPopstateNavigation;if(t(this,V)||L||d)return t(this,V)}return r(this,V,new Promise(v=>W(this,null,function*(){try{r(this,j,new AbortController);const L=yield(yield fetch(e,{signal:t(this,j).signal,headers:gt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(i),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,ot))})).text(),d=ce.parseFromString(L,"text/html");this.setInitialDocument(d)}catch(g){console.warn(g)}finally{r(this,j,null),r(this,V,null),v()}}))),t(this,V)})}cloneDocument(){r(this,z,(t(this,Y)||t(this,x)).cloneNode(!0))}get title(){let e="";if(t(this,z).title)e=t(this,z).title;else{const i=t(this,z).querySelector("h1");e=(i==null?void 0:i.innerText)||(i==null?void 0:i.textContent)||t(this,X)}return e}clearScrollState(){t(this,k).x=0,t(this,k).y=0}clearDocumentState(){r(this,Y,null)}saveScrollState(){t(this,x).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,k).x=0,t(this,k).y=0):(t(this,k).x=t(this,T).scrollValue.left,t(this,k).y=t(this,T).scrollValue.top)}restoreScrollPosition(){t(this,T).scrollElement.scroll({top:t(this,k).y,left:t(this,k).x,behavior:"instant"})}saveDocumentState(){t(this,x).documentElement.hasAttribute("data-no-page-restoration")?r(this,Y,null):r(this,Y,document.cloneNode(!0))}renewScrollPosition(){t(this,T).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){r(this,Z,e)}clearState(){const e=t(this,Z);return r(this,Z,null),e}}T=new WeakMap,X=new WeakMap,k=new WeakMap,x=new WeakMap,Y=new WeakMap,z=new WeakMap,Z=new WeakMap,j=new WeakMap,V=new WeakMap,ot=new WeakMap;var R,_,y,O,f,K,F,B,C,lt,N,$,tt,et,ht,it,m,Rt,ct,vt,Mt,Zt,Tt,xt,Nt,qt,St,st;const nt=class nt{constructor(e){l(this,m);l(this,R,null);l(this,_,null);l(this,y,[]);l(this,O);l(this,f,null);l(this,K);l(this,F,[]);l(this,B,!1);l(this,C,null);l(this,lt,!1);l(this,N,new Map);l(this,$,null);l(this,tt,0);l(this,et,0);l(this,ht);l(this,it);l(this,ct,e=>{var i;return((i=e.getAttribute("href"))==null?void 0:i.startsWith("/"))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,St,e=>W(this,null,function*(){e.preventDefault(),r(this,B,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,it)?void 0:t(this,ht),revalidate:t(this,it)}),r(this,B,!1)}));l(this,st,()=>{const{left:e,top:i}=this.scrollValue,s=i-t(this,et),h=e-t(this,tt);r(this,et,i),r(this,tt,e),document.documentElement.classList.toggle("scroll-y",i>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",s>0),document.documentElement.classList.toggle("scroll-y-backward",s<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),M.dispatchEvent(document,"morphScroll",{detail:{left:e,top:i}})});if(Jt.isBrowser&&!nt.instance){nt.instance=this,r(this,R,{base:at.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),r(this,_,p(this,m,Mt).call(this,document.body));const i=this.normalizePath(location.pathname+location.search+location.hash);r(this,f,i);const s=new Gt(this,t(this,f).pathname);s.setInitialDocument(document),t(this,N).set(t(this,f).pathname,s),document.documentElement.setAttribute("data-current-pathname",t(this,f).pathname),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",t(this,St)),at.changeHistory({action:"replace",pathname:i.pathname,searchParameters:i.parameters,hash:i.hash}),r(this,$,new Qt),p(this,m,Nt).call(this,document)}}get currentURL(){return t(this,f)}get previousURL(){return t(this,K)}get links(){return t(this,y)}get scrollElement(){return t(this,C)}get isPopstateNavigation(){return t(this,B)}get scrollValue(){let e=0,i=0;return t(this,lt)?(e=window.scrollY,i=window.scrollX):(e=t(this,C).scrollTop,i=t(this,C).scrollLeft),{top:e,left:i}}saveState(e){const i=t(this,N).get(t(this,f).path);i&&i.saveState(e)}getState(){const e=t(this,N).get(t(this,f).path);return e==null?void 0:e.clearState()}normalizePath(e){return at.splitPath(e,{base:t(this,R).base,trailingSlash:t(this,R).trailingSlash})}prefetch(e,i){return W(this,null,function*(){var h;if(t(this,F).length)return;e=((h=this.pathnameModifier)==null?void 0:h.call(this,e))||e;const s=p(this,m,vt).call(this,e);s==null||s.fetch(e,t(this,f).path,i)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate(ut){return W(this,arguments,function*(e,{historyAction:i="push",centerScroll:s,offsetScroll:h,scrollBehaviour:v,revalidate:g,keepSearchParameters:L,submorph:d,submorphAppend:E,clearState:bt,keepScrollPosition:Lt}={}){var q,Ut,Dt,It;if(t(this,F).length)return;r(this,ht,d),r(this,it,g);const dt=((q=this.pathnameModifier)==null?void 0:q.call(this,e))||e,c=this.normalizePath(dt);if(t(this,y).forEach(G=>{G.checkCurrent(c.path)}),!g&&(((Ut=t(this,O))==null?void 0:Ut.pathname)===c.pathname||t(this,f).pathname===c.pathname)){p(this,m,qt).call(this,c.hash||0,{centerScroll:s,offsetScroll:h,behavior:"smooth"}),M.dispatchEvent(document,"morphSamePath",{custom:!0}),((Dt=t(this,f))==null?void 0:Dt.parameters)!==c.parameters&&(r(this,K,t(this,f)),r(this,f,c),at.changeHistory({action:((It=t(this,f))==null?void 0:It.hash)!==c.hash?"replace":i,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),M.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,f),previousURL:t(this,K)}}));return}r(this,O,c);try{let G=!0;if(this.preprocessor)try{yield new Promise((n,w)=>{var A;(A=this.preprocessor)==null||A.call(this,{url:c,resolve:n,reject:w,submorph:d})})}catch(n){n?console.error(n):console.log("Route change canceled"),G=!1}if(!G||t(this,O).pathname!==c.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}const zt={url:c,submorph:d};d?E||d.forEach(n=>{document.querySelectorAll(n).forEach(w=>{w.classList.add("out"),w.setAttribute("data-morph-out","")})}):t(this,_).forEach(n=>{var w,A;(w=n.firstElementChild)==null||w.classList.add("out"),(A=n.firstElementChild)==null||A.setAttribute("data-morph-out","")}),M.dispatchEvent(document,"morphNavigation",{detail:zt});const yt=p(this,m,vt).call(this,t(this,f).pathname),S=p(this,m,vt).call(this,c.pathname);if(t(this,N).forEach(n=>{n.pathname!==c.pathname&&n.abort()}),yield S==null?void 0:S.fetch(dt,t(this,f).path,g),t(this,O).pathname!==c.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}yt.clearState(),yt.saveScrollState(),yt.saveDocumentState(),(!t(this,B)||g)&&(S.clearScrollState(),S.clearDocumentState()),bt&&S.clearState(),S.cloneDocument(),t(this,$).textContent=S.title,document.body.appendChild(t(this,$));const mt=At(gt({},zt),{document:S.document});E||mt.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),M.dispatchEvent(document,"morphStart",{detail:mt});const Vt=Array.from(document.head.children),Ot=Array.from(S.document.head.children),Ft=p(this,m,Zt).call(this,Vt,Ot),_t=p(this,m,Tt).call(this,Vt,Ft),ft=p(this,m,Tt).call(this,Ot,Ft).filter(n=>!this.excludeHeadChild(n));ft.forEach((n,w)=>{n.tagName==="SCRIPT"&&(ft[w]=p(this,m,Rt).call(this,n))}),ft.forEach(n=>{document.head.appendChild(n)});const wt=ft.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(p(this,m,xt).call(this,n))return!0});t(this,R).waitForHeadToLoad&&wt.length&&(yield new Promise(n=>W(this,null,function*(){let w=0;try{for(var A=Kt(wt),ee,U,H;ee=!(U=yield A.next()).done;ee=!1){const pt=U.value;pt.onload=()=>{w++,w===wt.length&&n()}}}catch(U){H=[U]}finally{try{ee&&(U=A.return)&&(yield U.call(A))}finally{if(H)throw H[0]}}}))),yield $t.wait(10);const Bt=[];E||_t.forEach(n=>{n.hasAttribute("data-permanent")||(p(this,m,xt).call(this,n)?Bt.push(n):n.remove())});const te=p(this,m,Mt).call(this,S.document.body);!t(this,R).morphInsideScrollContainer&&!d&&p(this,m,Nt).call(this,S.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),at.changeHistory({action:i,pathname:c.pathname,searchParameters:c.parameters||(L?location.search:""),hash:c.hash}),t(this,$).remove(),r(this,K,t(this,f)),r(this,f,c);const kt=[];t(this,_).forEach((n,w)=>{const A=te[w],ee=getComputedStyle(n).getPropertyValue("--morph-duration");let U=[],H=[];d?(d.forEach(u=>{const b=n.querySelector(u),D=A.querySelector(u);b&&D&&(H.push(b),U.push(D))}),H.forEach(u=>{u.parentElement&&kt.push(u.parentElement)})):(U.push(...A.childNodes),H.push(...n.childNodes),kt.push(n)),E||H.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),U.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),d?E?U.forEach((u,b)=>{H[b]instanceof HTMLElement&&H[b].append(...u.childNodes)}):U.forEach((u,b)=>{var D;(D=H[b].parentElement)==null||D.insertBefore(u,H[b])}):n.prepend(...U),le.requestIdleCallback(()=>{E||H.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),U.forEach(u=>{var b;u instanceof HTMLElement&&((b=u.parentElement)==null||b.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})});const pt=At(gt({},mt),{morphElement:n});M.dispatchEvent(document,"morphNewChildrenAdded",{detail:pt});const ie=new Promise(u=>{setTimeout(()=>{E||H.forEach(b=>b.remove()),U.forEach(b=>{var D;b instanceof HTMLElement&&((D=b.parentElement)==null||D.style.removeProperty("--new-content-height"),b.classList.remove("new-idle","new"))}),E||M.dispatchEvent(document,"morphOldChildrenRemoved",{detail:pt}),u()},(parseFloat(ee)||0)*1e3+10)});t(this,F).push(ie)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-S.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),M.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:S.scrollState}),c.hash?(S.clearScrollState(),p(this,m,qt).call(this,c.hash,{centerScroll:s,offsetScroll:h,behavior:v})):t(this,B)?S.restoreScrollPosition():Lt||S.renewScrollPosition(),yield Promise.all(t(this,F)),E||Bt.forEach(n=>n.remove()),r(this,F,[]),kt.forEach(n=>{n.querySelectorAll("script").forEach(A=>{A.replaceWith(p(this,m,Rt).call(this,A))})}),t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)}),M.dispatchEvent(document,"morphComplete",{detail:mt}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(G){console.error(G)}r(this,O,void 0)})}addLink(e){t(this,y).push(new Ct(e,this))}addLinks(e){e.forEach(i=>{this.addLink(i)})}removeLink(e){r(this,y,t(this,y).filter(i=>i.element===e?(i.destroy(),!1):!0))}destroyOldLinks(e){r(this,y,t(this,y).filter(i=>e.contains(i.element)?(i.destroy(),!1):!0))}findNewLinks(e){const i=[...e.querySelectorAll("a")].filter(t(this,ct));t(this,y).push(...i.map(s=>new Ct(s,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,ct));t(this,y).forEach(i=>i.destroy()),r(this,y,e.map(i=>new Ct(i,this)))}};R=new WeakMap,_=new WeakMap,y=new WeakMap,O=new WeakMap,f=new WeakMap,K=new WeakMap,F=new WeakMap,B=new WeakMap,C=new WeakMap,lt=new WeakMap,N=new WeakMap,$=new WeakMap,tt=new WeakMap,et=new WeakMap,ht=new WeakMap,it=new WeakMap,m=new WeakSet,Rt=function(e){const i=document.createElement("script");for(let s=0;s<e.attributes.length;s++){const h=e.attributes[s];i.setAttribute(h.name,h.value)}return e.hasAttribute("src")||(i.innerHTML=e.innerHTML),i},ct=new WeakMap,vt=function(e){const i=this.normalizePath(e);let s=t(this,N).get(i.pathname);return s||(s=new Gt(this,i.pathname),t(this,N).set(i.pathname,s)),s},Mt=function(e){const i=[...e.querySelectorAll("[data-morph]")];return i.length?i:[e]},Zt=function(e,i){return e.filter(s=>i.find(h=>h.outerHTML===s.outerHTML))},Tt=function(e,i){return e.filter(s=>!i.find(h=>h.outerHTML===s.outerHTML))},xt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Nt=function(e){var i,s;(i=t(this,C))==null||i.removeEventListener("scroll",t(this,st)),r(this,et,0),r(this,tt,0),r(this,C,t(this,R).scrollSelector&&e.querySelector(t(this,R).scrollSelector)||window),r(this,lt,t(this,C)===window),(s=t(this,C))==null||s.addEventListener("scroll",t(this,st)),t(this,st).call(this)},qt=function(e,i){const s=typeof e=="string"?document.getElementById(e):e;(typeof s=="number"||s)&&$t.scrollToElement(s,{scrollElement:t(this,C),behavior:(i==null?void 0:i.behavior)||"instant",center:i==null?void 0:i.centerScroll,offset:i==null?void 0:i.offsetScroll})},St=new WeakMap,st=new WeakMap,nt.instance=null;let Ht=nt;exports.Morph=Ht;