aptechka 0.71.15 → 0.71.17

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 Gt=Object.defineProperty,Jt=Object.defineProperties;var Qt=Object.getOwnPropertyDescriptors;var Dt=Object.getOwnPropertySymbols;var Zt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;var Ut=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),It=r=>{throw TypeError(r)};var zt=(r,t,s)=>t in r?Gt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,dt=(r,t)=>{for(var s in t||(t={}))Zt.call(t,s)&&zt(r,s,t[s]);if(Dt)for(var s of Dt(t))_t.call(t,s)&&zt(r,s,t[s]);return r},vt=(r,t)=>Jt(r,Qt(t));var St=(r,t,s)=>t.has(r)||It("Cannot "+s);var e=(r,t,s)=>(St(r,t,"read from private field"),s?s.call(r):t.get(r)),o=(r,t,s)=>t.has(r)?It("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(St(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(St(r,t,"access private method"),s);var B=(r,t,s)=>new Promise((i,h)=>{var g=S=>{try{v(s.next(S))}catch(V){h(V)}},b=S=>{try{v(s.throw(S))}catch(V){h(V)}},v=S=>S.done?i(S.value):Promise.resolve(S.value).then(g,b);v((s=s.apply(r,t)).next())});var Vt=(r,t,s)=>(t=r[Ut("asyncIterator")])?t.call(r):(r=r[Ut("iterator")](),t={},s=(i,h)=>(h=r[i])&&(t[i]=g=>new Promise((b,v,S)=>(g=h.call(r,g),S=g.done,Promise.resolve(g.value).then(V=>b({value:V,done:S}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bt=require("../index-DekP7OZe.cjs"),C=require("../events-KVanG9sR.cjs"),te=require("../polyfills-Df4r-ETT.cjs"),Ot=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-YEESIcRn.cjs"),ee=require("../css-value-parser/index.cjs");class Wt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Bt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Wt);var H,l,N,nt,G;class wt{constructor(t,s){o(this,H);o(this,l);o(this,N);o(this,nt,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,H).previousURL)history.back();else{n(this,N,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",g=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=b?ee.cssValueParser.parse(b):void 0,S=e(this,l).hasAttribute("data-revalidate"),V=e(this,l).hasAttribute("data-keep-search-parameters"),c=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(ht=>ht.trim()),lt=e(this,l).hasAttribute("data-clear-state");e(this,H).navigate(e(this,N),{historyAction:h,centerScroll:g,offsetScroll:v,revalidate:S,keepSearchParameters:V,submorph:c,clearState:lt})}});o(this,G,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,H).prefetch(e(this,N),t),e(this,l).removeEventListener("pointerenter",e(this,G))});n(this,H,s),n(this,l,t),n(this,N,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,nt)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,G))}get element(){return e(this,l)}checkCurrent(t){var h;const s=e(this,H).normalizePath(t),i=e(this,H).normalizePath(e(this,N));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):(h=e(this,l).getAttribute("data-associated-paths"))!=null&&h.split(",").find(g=>s.pathname.includes(g))?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,nt)),e(this,l).removeEventListener("pointerenter",e(this,G)),e(this,l).classList.remove("current")}}H=new WeakMap,l=new WeakMap,N=new WeakMap,nt=new WeakMap,G=new WeakMap;const se=new DOMParser;var M,W,y,P,X,q,J,Y,D,Q,rt;class Ft{constructor(t,s){o(this,M);o(this,W);o(this,y,{x:0,y:0});o(this,P,null);o(this,X,null);o(this,q,null);o(this,J,null);o(this,Y,null);o(this,D,null);o(this,Q);o(this,rt);n(this,M,t),n(this,W,s),n(this,Q,s)}get pathname(){return e(this,W)}get scrollState(){return e(this,y)}get document(){return e(this,q)}setHeaders(t){n(this,rt,t)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,Y))==null?void 0:t.abort(`[${e(this,W)}] page loading cancelled`)}fetch(t,s,i){return B(this,null,function*(){return e(this,D)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&(!i||e(this,Q)!==t)||e(this,P)&&e(this,M).isPopstateNavigation?e(this,D):(n(this,Q,t),n(this,D,new Promise(h=>B(this,null,function*(){try{n(this,Y,new AbortController);const b=yield(yield fetch(t,{signal:e(this,Y).signal,headers:dt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":s,"X-MORPH-NEW-PATH":t},e(this,rt))})).text(),v=se.parseFromString(b,"text/html");this.setInitialDocument(v)}catch(g){console.warn(g)}finally{n(this,Y,null),n(this,D,null),h()}}))),e(this,D))})}cloneDocument(){n(this,q,(e(this,X)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,q).title)t=e(this,q).title;else{const s=e(this,q).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,W)}return t}clearScrollState(){e(this,y).x=0,e(this,y).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,y).x=0,e(this,y).y=0):(e(this,y).x=e(this,M).scrollValue.left,e(this,y).y=e(this,M).scrollValue.top)}restoreScrollPosition(){e(this,M).scrollElement.scroll({top:e(this,y).y,left:e(this,y).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?n(this,X,null):n(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,M).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,J,t)}clearState(){const t=e(this,J);return n(this,J,null),t}}M=new WeakMap,W=new WeakMap,y=new WeakMap,P=new WeakMap,X=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakMap,D=new WeakMap,Q=new WeakMap,rt=new WeakMap;var A,Z,E,U,d,j,z,I,L,at,R,K,_,tt,u,Lt,ot,mt,bt,Xt,Pt,At,kt,Ct,ft,et;const it=class it{constructor(t){o(this,u);o(this,A,null);o(this,Z,null);o(this,E,[]);o(this,U);o(this,d,null);o(this,j);o(this,z,[]);o(this,I,!1);o(this,L,null);o(this,at,!1);o(this,R,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,ot,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});o(this,ft,t=>B(this,null,function*(){t.preventDefault(),n(this,I,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none"}),n(this,I,!1)}));o(this,et,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,tt),h=t-e(this,_);n(this,tt,s),n(this,_,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),C.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Bt.isBrowser&&!it.instance){it.instance=this,n(this,A,{base:st.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,Z,p(this,u,bt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,d,s);const i=new Ft(this,e(this,d).pathname);i.setInitialDocument(document),e(this,R).set(e(this,d).pathname,i),document.documentElement.setAttribute("data-current-pathname",e(this,d).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ft)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,K,new Wt),p(this,u,kt).call(this,document)}}get currentURL(){return e(this,d)}get previousURL(){return e(this,j)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,I)}get scrollValue(){let t=0,s=0;return e(this,at)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,R).get(e(this,d).path);s&&s.saveState(t)}getState(){const t=e(this,R).get(e(this,d).path);return t==null?void 0:t.clearState()}normalizePath(t){return st.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return B(this,null,function*(){var h;if(e(this,z).length)return;t=((h=this.pathnameModifier)==null?void 0:h.call(this,t))||t;const i=p(this,u,mt).call(this,t);i==null||i.fetch(t,e(this,d).path,s)})}excludeHeadChild(t){return!1}setHeaders(t){}navigate(V){return B(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:g,keepSearchParameters:b,submorph:v,clearState:S}={}){var lt,ht,Ht,Mt;if(e(this,z).length)return;const c=this.normalizePath(((lt=this.pathnameModifier)==null?void 0:lt.call(this,t))||t);if(((ht=e(this,U))==null?void 0:ht.pathname)===c.pathname||e(this,d).pathname===c.pathname){p(this,u,Ct).call(this,c.hash||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"}),C.dispatchEvent(document,"morphSamePath",{custom:!0}),((Ht=e(this,d))==null?void 0:Ht.parameters)!==c.parameters&&(n(this,j,e(this,d)),n(this,d,c),st.changeHistory({action:((Mt=e(this,d))==null?void 0:Mt.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),C.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,d),previousURL:e(this,j)}}));return}n(this,U,c),e(this,E).forEach($=>{$.checkCurrent(c.pathname)});try{let $=!0;if(this.preprocessor)try{yield new Promise((a,k)=>{var T;(T=this.preprocessor)==null||T.call(this,{url:c,resolve:a,reject:k,submorph:v})})}catch(a){a?console.error(a):console.log("Route change canceled"),$=!1}if(!$||e(this,U).pathname!==c.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,d).pathname)});return}const Rt={url:c,submorph:v};C.dispatchEvent(document,"morphNavigation",{detail:Rt});const pt=p(this,u,mt).call(this,e(this,d).pathname),f=p(this,u,mt).call(this,c.pathname);if(e(this,R).forEach(a=>{a.pathname!==c.pathname&&a.abort()}),yield f==null?void 0:f.fetch(t,e(this,d).path,g),e(this,U).pathname!==c.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,d).path)});return}pt.clearState(),pt.saveScrollState(),pt.saveDocumentState(),e(this,I)||(f.clearScrollState(),f.clearDocumentState()),S&&f.clearState(),f.cloneDocument(),e(this,K).textContent=f.title,document.body.appendChild(e(this,K));const Et=vt(dt({},Rt),{document:f.document});C.dispatchEvent(document,"morphStart",{detail:Et});const Tt=Array.from(document.head.children),xt=Array.from(f.document.head.children),Nt=p(this,u,Xt).call(this,Tt,xt),Yt=p(this,u,Pt).call(this,Tt,Nt),ct=p(this,u,Pt).call(this,xt,Nt).filter(a=>!this.excludeHeadChild(a));ct.forEach((a,k)=>{a.tagName==="SCRIPT"&&(ct[k]=p(this,u,Lt).call(this,a))}),ct.forEach(a=>{document.head.appendChild(a)});const gt=ct.filter(a=>{if(a.hasAttribute("data-no-waiting"))return!1;if(p(this,u,At).call(this,a))return!0});e(this,A).waitForHeadToLoad&&gt.length&&(yield new Promise(a=>B(this,null,function*(){let k=0;try{for(var T=Vt(gt),Kt,O,F;Kt=!(O=yield T.next()).done;Kt=!1){const ut=O.value;ut.onload=()=>{k++,k===gt.length&&a()}}}catch(O){F=[O]}finally{try{Kt&&(O=T.return)&&(yield O.call(T))}finally{if(F)throw F[0]}}}))),yield Ot.wait(10);const qt=[];Yt.forEach(a=>{a.hasAttribute("data-permanent")||(p(this,u,At).call(this,a)?qt.push(a):a.remove())});const jt=p(this,u,bt).call(this,f.document.body);e(this,A).morphInsideScrollContainer||p(this,u,kt).call(this,f.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),st.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(b?location.search:""),hash:c.hash}),e(this,K).remove(),n(this,j,e(this,d)),n(this,d,c),e(this,Z).forEach((a,k)=>{const T=jt[k],Kt=getComputedStyle(a).getPropertyValue("--morph-duration");let O=[],F=[];v?v.forEach(m=>{const w=a.querySelector(m),x=T.querySelector(m);w&&x&&(F.push(w),O.push(x))}):(O.push(...T.childNodes),F.push(...a.childNodes)),F.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"))}),O.forEach(m=>{m instanceof HTMLElement&&(this.findNewLinks(m),m.classList.add("new"))}),v?O.forEach((m,w)=>{var x;(x=F[w].parentElement)==null||x.insertBefore(m,F[w])}):a.prepend(...O),te.requestIdleCallback(()=>{F.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var w;m instanceof HTMLElement&&((w=m.parentElement)==null||w.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})});const ut=vt(dt({},Et),{morphElement:a});C.dispatchEvent(document,"morphNewChildrenAdded",{detail:ut});const $t=new Promise(m=>{setTimeout(()=>{F.forEach(w=>w.remove()),O.forEach(w=>{var x;w instanceof HTMLElement&&((x=w.parentElement)==null||x.style.removeProperty("--new-content-height"),w.classList.remove("new-idle","new"))}),C.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ut}),m()},(parseFloat(Kt)||0)*1e3+10)});e(this,z).push($t)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-f.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),C.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:f.scrollState}),c.hash?(f.clearScrollState(),p(this,u,Ct).call(this,c.hash,{centerScroll:i,offsetScroll:h})):e(this,I)?f.restoreScrollPosition():f.renewScrollPosition(),yield Promise.all(e(this,z)),qt.forEach(a=>a.remove()),n(this,z,[]),e(this,Z).forEach(a=>{a.querySelectorAll("script").forEach(T=>{T.replaceWith(p(this,u,Lt).call(this,T))})}),e(this,E).forEach(a=>{a.checkCurrent(e(this,d).path)}),C.dispatchEvent(document,"morphComplete",{detail:Et}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}n(this,U,void 0)})}addLink(t){e(this,E).push(new wt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,E,e(this,E).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,ot));e(this,E).push(...s.map(i=>new wt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,ot));e(this,E).forEach(s=>s.destroy()),n(this,E,t.map(s=>new wt(s,this)))}};A=new WeakMap,Z=new WeakMap,E=new WeakMap,U=new WeakMap,d=new WeakMap,j=new WeakMap,z=new WeakMap,I=new WeakMap,L=new WeakMap,at=new WeakMap,R=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,u=new WeakSet,Lt=function(t){const s=document.createElement("script");for(let i=0;i<t.attributes.length;i++){const h=t.attributes[i];s.setAttribute(h.name,h.value)}return t.hasAttribute("src")||(s.innerHTML=t.innerHTML),s},ot=new WeakMap,mt=function(t){const s=this.normalizePath(t);let i=e(this,R).get(s.pathname);return i||(i=new Ft(this,s.pathname),e(this,R).set(s.pathname,i)),i},bt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Xt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},Pt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},At=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},kt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,et)),n(this,tt,0),n(this,_,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,at,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},Ct=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Ot.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ft=new WeakMap,et=new WeakMap,it.instance=null;let yt=it;exports.Morph=yt;
1
+ "use strict";var Jt=Object.defineProperty,Qt=Object.defineProperties;var Zt=Object.getOwnPropertyDescriptors;var Ut=Object.getOwnPropertySymbols;var _t=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var zt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),Vt=r=>{throw TypeError(r)};var It=(r,t,s)=>t in r?Jt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s,dt=(r,t)=>{for(var s in t||(t={}))_t.call(t,s)&&It(r,s,t[s]);if(Ut)for(var s of Ut(t))te.call(t,s)&&It(r,s,t[s]);return r},vt=(r,t)=>Qt(r,Zt(t));var St=(r,t,s)=>t.has(r)||Vt("Cannot "+s);var e=(r,t,s)=>(St(r,t,"read from private field"),s?s.call(r):t.get(r)),o=(r,t,s)=>t.has(r)?Vt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),n=(r,t,s,i)=>(St(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),p=(r,t,s)=>(St(r,t,"access private method"),s);var B=(r,t,s)=>new Promise((i,h)=>{var g=S=>{try{v(s.next(S))}catch(V){h(V)}},b=S=>{try{v(s.throw(S))}catch(V){h(V)}},v=S=>S.done?i(S.value):Promise.resolve(S.value).then(g,b);v((s=s.apply(r,t)).next())});var Ot=(r,t,s)=>(t=r[zt("asyncIterator")])?t.call(r):(r=r[zt("iterator")](),t={},s=(i,h)=>(h=r[i])&&(t[i]=g=>new Promise((b,v,S)=>(g=h.call(r,g),S=g.done,Promise.resolve(g.value).then(V=>b({value:V,done:S}),v)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Wt=require("../index-DekP7OZe.cjs"),C=require("../events-KVanG9sR.cjs"),ee=require("../polyfills-Df4r-ETT.cjs"),Ft=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const st=require("../url-YEESIcRn.cjs"),se=require("../css-value-parser/index.cjs");class Xt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}Wt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Xt);var H,l,N,nt,G;class wt{constructor(t,s){o(this,H);o(this,l);o(this,N);o(this,nt,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,H).previousURL)history.back();else{n(this,N,e(this,l).getAttribute("href")||"/");const h=e(this,l).getAttribute("data-history-action")||"push",g=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),v=b?se.cssValueParser.parse(b):void 0,S=e(this,l).hasAttribute("data-revalidate"),V=e(this,l).hasAttribute("data-keep-search-parameters"),lt=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(ht=>ht.trim()),c=e(this,l).hasAttribute("data-clear-state");e(this,H).navigate(e(this,N),{historyAction:h,centerScroll:g,offsetScroll:v,revalidate:S,keepSearchParameters:V,submorph:lt,clearState:c})}});o(this,G,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,H).prefetch(e(this,N),t),e(this,l).removeEventListener("pointerenter",e(this,G))});n(this,H,s),n(this,l,t),n(this,N,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,nt)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,G))}get element(){return e(this,l)}checkCurrent(t){var h;const s=e(this,H).normalizePath(t),i=e(this,H).normalizePath(e(this,N));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):(h=e(this,l).getAttribute("data-associated-paths"))!=null&&h.split(",").find(g=>s.pathname.includes(g))?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,nt)),e(this,l).removeEventListener("pointerenter",e(this,G)),e(this,l).classList.remove("current")}}H=new WeakMap,l=new WeakMap,N=new WeakMap,nt=new WeakMap,G=new WeakMap;const ie=new DOMParser;var M,W,y,P,X,q,J,Y,D,Q,rt;class Bt{constructor(t,s){o(this,M);o(this,W);o(this,y,{x:0,y:0});o(this,P,null);o(this,X,null);o(this,q,null);o(this,J,null);o(this,Y,null);o(this,D,null);o(this,Q);o(this,rt);n(this,M,t),n(this,W,s),n(this,Q,s)}get pathname(){return e(this,W)}get scrollState(){return e(this,y)}get document(){return e(this,q)}setHeaders(t){n(this,rt,t)}setInitialDocument(t){n(this,P,t.cloneNode(!0))}abort(){var t;return(t=e(this,Y))==null?void 0:t.abort(`[${e(this,W)}] page loading cancelled`)}fetch(t,s,i){return B(this,null,function*(){return e(this,D)||e(this,P)&&e(this,P).documentElement.hasAttribute("data-cache")&&(!i||e(this,Q)!==t)||e(this,P)&&e(this,M).isPopstateNavigation?e(this,D):(n(this,Q,t),n(this,D,new Promise(h=>B(this,null,function*(){try{n(this,Y,new AbortController);const b=yield(yield fetch(t,{signal:e(this,Y).signal,headers:dt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":s,"X-MORPH-NEW-PATH":t},e(this,rt))})).text(),v=ie.parseFromString(b,"text/html");this.setInitialDocument(v)}catch(g){console.warn(g)}finally{n(this,Y,null),n(this,D,null),h()}}))),e(this,D))})}cloneDocument(){n(this,q,(e(this,X)||e(this,P)).cloneNode(!0))}get title(){let t="";if(e(this,q).title)t=e(this,q).title;else{const s=e(this,q).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,W)}return t}clearScrollState(){e(this,y).x=0,e(this,y).y=0}clearDocumentState(){n(this,X,null)}saveScrollState(){e(this,P).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,y).x=0,e(this,y).y=0):(e(this,y).x=e(this,M).scrollValue.left,e(this,y).y=e(this,M).scrollValue.top)}restoreScrollPosition(){e(this,M).scrollElement.scroll({top:e(this,y).y,left:e(this,y).x,behavior:"instant"})}saveDocumentState(){e(this,P).documentElement.hasAttribute("data-no-page-restoration")?n(this,X,null):n(this,X,document.cloneNode(!0))}renewScrollPosition(){e(this,M).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,J,t)}clearState(){const t=e(this,J);return n(this,J,null),t}}M=new WeakMap,W=new WeakMap,y=new WeakMap,P=new WeakMap,X=new WeakMap,q=new WeakMap,J=new WeakMap,Y=new WeakMap,D=new WeakMap,Q=new WeakMap,rt=new WeakMap;var A,Z,E,U,d,j,z,I,L,at,R,K,_,tt,u,Lt,ot,mt,bt,Yt,Pt,At,kt,Ct,ft,et;const it=class it{constructor(t){o(this,u);o(this,A,null);o(this,Z,null);o(this,E,[]);o(this,U);o(this,d,null);o(this,j);o(this,z,[]);o(this,I,!1);o(this,L,null);o(this,at,!1);o(this,R,new Map);o(this,K,null);o(this,_,0);o(this,tt,0);o(this,ot,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});o(this,ft,t=>B(this,null,function*(){t.preventDefault(),n(this,I,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none"}),n(this,I,!1)}));o(this,et,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,tt),h=t-e(this,_);n(this,tt,s),n(this,_,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),C.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Wt.isBrowser&&!it.instance){it.instance=this,n(this,A,{base:st.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:t==null?void 0:t.scrollSelector,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,Z,p(this,u,bt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash+location.search);n(this,d,s);const i=new Bt(this,e(this,d).pathname);i.setInitialDocument(document),e(this,R).set(e(this,d).pathname,i),document.documentElement.setAttribute("data-current-pathname",e(this,d).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ft)),st.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),n(this,K,new Xt),p(this,u,kt).call(this,document)}}get currentURL(){return e(this,d)}get previousURL(){return e(this,j)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}get isPopstateNavigation(){return e(this,I)}get scrollValue(){let t=0,s=0;return e(this,at)?(t=window.scrollY,s=window.scrollX):(t=e(this,L).scrollTop,s=e(this,L).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,R).get(e(this,d).path);s&&s.saveState(t)}getState(){const t=e(this,R).get(e(this,d).path);return t==null?void 0:t.clearState()}normalizePath(t){return st.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t,s){return B(this,null,function*(){var h;if(e(this,z).length)return;t=((h=this.pathnameModifier)==null?void 0:h.call(this,t))||t;const i=p(this,u,mt).call(this,t);i==null||i.fetch(t,e(this,d).path,s)})}excludeHeadChild(t){return!1}setHeaders(t){}navigate(V){return B(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:g,keepSearchParameters:b,submorph:v,clearState:S}={}){var ht,Ht,Mt,Rt;if(e(this,z).length)return;const lt=((ht=this.pathnameModifier)==null?void 0:ht.call(this,t))||t,c=this.normalizePath(lt);if(((Ht=e(this,U))==null?void 0:Ht.pathname)===c.pathname||e(this,d).pathname===c.pathname){p(this,u,Ct).call(this,c.hash||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"}),C.dispatchEvent(document,"morphSamePath",{custom:!0}),((Mt=e(this,d))==null?void 0:Mt.parameters)!==c.parameters&&(n(this,j,e(this,d)),n(this,d,c),st.changeHistory({action:((Rt=e(this,d))==null?void 0:Rt.hash)!==c.hash?"replace":s,pathname:c.pathname,searchParameters:c.parameters,hash:c.hash}),C.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:e(this,d),previousURL:e(this,j)}}));return}n(this,U,c),e(this,E).forEach($=>{$.checkCurrent(c.pathname)});try{let $=!0;if(this.preprocessor)try{yield new Promise((a,k)=>{var T;(T=this.preprocessor)==null||T.call(this,{url:c,resolve:a,reject:k,submorph:v})})}catch(a){a?console.error(a):console.log("Route change canceled"),$=!1}if(!$||e(this,U).pathname!==c.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,d).pathname)});return}const Tt={url:c,submorph:v};C.dispatchEvent(document,"morphNavigation",{detail:Tt});const pt=p(this,u,mt).call(this,e(this,d).pathname),f=p(this,u,mt).call(this,c.pathname);if(e(this,R).forEach(a=>{a.pathname!==c.pathname&&a.abort()}),yield f==null?void 0:f.fetch(lt,e(this,d).path,g),e(this,U).pathname!==c.pathname){e(this,E).forEach(a=>{a.checkCurrent(e(this,d).path)});return}pt.clearState(),pt.saveScrollState(),pt.saveDocumentState(),e(this,I)||(f.clearScrollState(),f.clearDocumentState()),S&&f.clearState(),f.cloneDocument(),e(this,K).textContent=f.title,document.body.appendChild(e(this,K));const Et=vt(dt({},Tt),{document:f.document});C.dispatchEvent(document,"morphStart",{detail:Et});const xt=Array.from(document.head.children),Nt=Array.from(f.document.head.children),qt=p(this,u,Yt).call(this,xt,Nt),jt=p(this,u,Pt).call(this,xt,qt),ct=p(this,u,Pt).call(this,Nt,qt).filter(a=>!this.excludeHeadChild(a));ct.forEach((a,k)=>{a.tagName==="SCRIPT"&&(ct[k]=p(this,u,Lt).call(this,a))}),ct.forEach(a=>{document.head.appendChild(a)});const gt=ct.filter(a=>{if(a.hasAttribute("data-no-waiting"))return!1;if(p(this,u,At).call(this,a))return!0});e(this,A).waitForHeadToLoad&&gt.length&&(yield new Promise(a=>B(this,null,function*(){let k=0;try{for(var T=Ot(gt),$t,O,F;$t=!(O=yield T.next()).done;$t=!1){const ut=O.value;ut.onload=()=>{k++,k===gt.length&&a()}}}catch(O){F=[O]}finally{try{$t&&(O=T.return)&&(yield O.call(T))}finally{if(F)throw F[0]}}}))),yield Ft.wait(10);const Dt=[];jt.forEach(a=>{a.hasAttribute("data-permanent")||(p(this,u,At).call(this,a)?Dt.push(a):a.remove())});const Kt=p(this,u,bt).call(this,f.document.body);e(this,A).morphInsideScrollContainer||p(this,u,kt).call(this,f.document),document.documentElement.setAttribute("data-current-pathname",c.pathname),document.documentElement.setAttribute("data-current-leaf",c.leaf),st.changeHistory({action:s,pathname:c.pathname,searchParameters:c.parameters||(b?location.search:""),hash:c.hash}),e(this,K).remove(),n(this,j,e(this,d)),n(this,d,c),e(this,Z).forEach((a,k)=>{const T=Kt[k],$t=getComputedStyle(a).getPropertyValue("--morph-duration");let O=[],F=[];v?v.forEach(m=>{const w=a.querySelector(m),x=T.querySelector(m);w&&x&&(F.push(w),O.push(x))}):(O.push(...T.childNodes),F.push(...a.childNodes)),F.forEach(m=>{m instanceof HTMLElement&&(this.destroyOldLinks(m),m.classList.add("old"))}),O.forEach(m=>{m instanceof HTMLElement&&(this.findNewLinks(m),m.classList.add("new"))}),v?O.forEach((m,w)=>{var x;(x=F[w].parentElement)==null||x.insertBefore(m,F[w])}):a.prepend(...O),ee.requestIdleCallback(()=>{F.forEach(m=>{m instanceof HTMLElement&&m.classList.add("old-idle")}),O.forEach(m=>{var w;m instanceof HTMLElement&&((w=m.parentElement)==null||w.style.setProperty("--new-content-height",m.offsetHeight+"px"),m.classList.add("new-idle"))})});const ut=vt(dt({},Et),{morphElement:a});C.dispatchEvent(document,"morphNewChildrenAdded",{detail:ut});const Gt=new Promise(m=>{setTimeout(()=>{F.forEach(w=>w.remove()),O.forEach(w=>{var x;w instanceof HTMLElement&&((x=w.parentElement)==null||x.style.removeProperty("--new-content-height"),w.classList.remove("new-idle","new"))}),C.dispatchEvent(document,"morphOldChildrenRemoved",{detail:ut}),m()},(parseFloat($t)||0)*1e3+10)});e(this,z).push(Gt)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-f.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),C.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:f.scrollState}),c.hash?(f.clearScrollState(),p(this,u,Ct).call(this,c.hash,{centerScroll:i,offsetScroll:h})):e(this,I)?f.restoreScrollPosition():f.renewScrollPosition(),yield Promise.all(e(this,z)),Dt.forEach(a=>a.remove()),n(this,z,[]),e(this,Z).forEach(a=>{a.querySelectorAll("script").forEach(T=>{T.replaceWith(p(this,u,Lt).call(this,T))})}),e(this,E).forEach(a=>{a.checkCurrent(e(this,d).path)}),C.dispatchEvent(document,"morphComplete",{detail:Et}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch($){console.error($)}n(this,U,void 0)})}addLink(t){e(this,E).push(new wt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,E,e(this,E).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,ot));e(this,E).push(...s.map(i=>new wt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,ot));e(this,E).forEach(s=>s.destroy()),n(this,E,t.map(s=>new wt(s,this)))}};A=new WeakMap,Z=new WeakMap,E=new WeakMap,U=new WeakMap,d=new WeakMap,j=new WeakMap,z=new WeakMap,I=new WeakMap,L=new WeakMap,at=new WeakMap,R=new WeakMap,K=new WeakMap,_=new WeakMap,tt=new WeakMap,u=new WeakSet,Lt=function(t){const s=document.createElement("script");for(let i=0;i<t.attributes.length;i++){const h=t.attributes[i];s.setAttribute(h.name,h.value)}return t.hasAttribute("src")||(s.innerHTML=t.innerHTML),s},ot=new WeakMap,mt=function(t){const s=this.normalizePath(t);let i=e(this,R).get(s.pathname);return i||(i=new Bt(this,s.pathname),e(this,R).set(s.pathname,i)),i},bt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Yt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},Pt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},At=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},kt=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,et)),n(this,tt,0),n(this,_,0),n(this,L,e(this,A).scrollSelector&&t.querySelector(e(this,A).scrollSelector)||window),n(this,at,e(this,L)===window),(i=e(this,L))==null||i.addEventListener("scroll",e(this,et)),e(this,et).call(this)},Ct=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Ft.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ft=new WeakMap,et=new WeakMap,it.instance=null;let yt=it;exports.Morph=yt;
@@ -1,20 +1,20 @@
1
- var $t = Object.defineProperty, Gt = Object.defineProperties;
2
- var Jt = Object.getOwnPropertyDescriptors;
3
- var Dt = Object.getOwnPropertySymbols;
4
- var Qt = Object.prototype.hasOwnProperty, Zt = Object.prototype.propertyIsEnumerable;
5
- var Ut = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), It = (n) => {
1
+ var Gt = Object.defineProperty, Jt = Object.defineProperties;
2
+ var Qt = Object.getOwnPropertyDescriptors;
3
+ var Ut = Object.getOwnPropertySymbols;
4
+ var Zt = Object.prototype.hasOwnProperty, _t = Object.prototype.propertyIsEnumerable;
5
+ var zt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), Vt = (n) => {
6
6
  throw TypeError(n);
7
7
  };
8
- var zt = (n, t, s) => t in n ? $t(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s, ut = (n, t) => {
8
+ var It = (n, t, s) => t in n ? Gt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : n[t] = s, ut = (n, t) => {
9
9
  for (var s in t || (t = {}))
10
- Qt.call(t, s) && zt(n, s, t[s]);
11
- if (Dt)
12
- for (var s of Dt(t))
13
- Zt.call(t, s) && zt(n, s, t[s]);
10
+ Zt.call(t, s) && It(n, s, t[s]);
11
+ if (Ut)
12
+ for (var s of Ut(t))
13
+ _t.call(t, s) && It(n, s, t[s]);
14
14
  return n;
15
- }, gt = (n, t) => Gt(n, Jt(t));
16
- var St = (n, t, s) => t.has(n) || It("Cannot " + s);
17
- var e = (n, t, s) => (St(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? It("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), r = (n, t, s, i) => (St(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), p = (n, t, s) => (St(n, t, "access private method"), s);
15
+ }, gt = (n, t) => Jt(n, Qt(t));
16
+ var St = (n, t, s) => t.has(n) || Vt("Cannot " + s);
17
+ var e = (n, t, s) => (St(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? Vt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), r = (n, t, s, i) => (St(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), p = (n, t, s) => (St(n, t, "access private method"), s);
18
18
  var W = (n, t, s) => new Promise((i, h) => {
19
19
  var g = (w) => {
20
20
  try {
@@ -31,15 +31,15 @@ var W = (n, t, s) => new Promise((i, h) => {
31
31
  }, S = (w) => w.done ? i(w.value) : Promise.resolve(w.value).then(g, b);
32
32
  S((s = s.apply(n, t)).next());
33
33
  });
34
- var Vt = (n, t, s) => (t = n[Ut("asyncIterator")]) ? t.call(n) : (n = n[Ut("iterator")](), t = {}, s = (i, h) => (h = n[i]) && (t[i] = (g) => new Promise((b, S, w) => (g = h.call(n, g), w = g.done, Promise.resolve(g.value).then((q) => b({ value: q, done: w }), S)))), s("next"), s("return"), t);
35
- import { i as Ft } from "../index-Bv9zgfdb.js";
34
+ var qt = (n, t, s) => (t = n[zt("asyncIterator")]) ? t.call(n) : (n = n[zt("iterator")](), t = {}, s = (i, h) => (h = n[i]) && (t[i] = (g) => new Promise((b, S, w) => (g = h.call(n, g), w = g.done, Promise.resolve(g.value).then((q) => b({ value: q, done: w }), S)))), s("next"), s("return"), t);
35
+ import { i as Wt } from "../index-Bv9zgfdb.js";
36
36
  import { d as C } from "../events-CsVF98U6.js";
37
- import { r as _t } from "../polyfills-DJrTJQky.js";
38
- import { w as te, s as ee } from "../scroll-DPkCFTxg.js";
37
+ import { r as te } from "../polyfills-DJrTJQky.js";
38
+ import { w as ee, s as se } from "../scroll-DPkCFTxg.js";
39
39
  import "construct-style-sheets-polyfill";
40
- import { n as se, c as wt, s as ie } from "../url-UL9zSCHb.js";
41
- import { cssValueParser as re } from "../css-value-parser/index.js";
42
- class Wt extends HTMLElement {
40
+ import { n as ie, c as wt, s as re } from "../url-UL9zSCHb.js";
41
+ import { cssValueParser as ne } from "../css-value-parser/index.js";
42
+ class Xt extends HTMLElement {
43
43
  connectedCallback() {
44
44
  const t = {
45
45
  "aria-live": "assertive",
@@ -50,7 +50,7 @@ class Wt extends HTMLElement {
50
50
  this.setAttribute(s, i);
51
51
  }
52
52
  }
53
- Ft && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Wt);
53
+ Wt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Xt);
54
54
  var H, l, N, it, G;
55
55
  class Lt {
56
56
  constructor(t, s) {
@@ -65,17 +65,17 @@ class Lt {
65
65
  r(this, N, e(this, l).getAttribute("href") || "/");
66
66
  const h = e(this, l).getAttribute(
67
67
  "data-history-action"
68
- ) || "push", g = e(this, l).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = b ? re.parse(b) : void 0, w = e(this, l).hasAttribute("data-revalidate"), q = e(this, l).hasAttribute(
68
+ ) || "push", g = e(this, l).hasAttribute("data-center-scroll"), b = getComputedStyle(e(this, l)).getPropertyValue("--offset-scroll").trim(), S = b ? ne.parse(b) : void 0, w = e(this, l).hasAttribute("data-revalidate"), q = e(this, l).hasAttribute(
69
69
  "data-keep-search-parameters"
70
- ), c = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((lt) => lt.trim()), ot = e(this, l).hasAttribute("data-clear-state");
70
+ ), ot = (i = e(this, l).getAttribute("data-submorph")) == null ? void 0 : i.split(",").map((lt) => lt.trim()), c = e(this, l).hasAttribute("data-clear-state");
71
71
  e(this, H).navigate(e(this, N), {
72
72
  historyAction: h,
73
73
  centerScroll: g,
74
74
  offsetScroll: S,
75
75
  revalidate: w,
76
76
  keepSearchParameters: q,
77
- submorph: c,
78
- clearState: ot
77
+ submorph: ot,
78
+ clearState: c
79
79
  });
80
80
  }
81
81
  });
@@ -98,9 +98,9 @@ class Lt {
98
98
  }
99
99
  }
100
100
  H = new WeakMap(), l = new WeakMap(), N = new WeakMap(), it = new WeakMap(), G = new WeakMap();
101
- const ne = new DOMParser();
101
+ const ae = new DOMParser();
102
102
  var R, X, v, P, B, D, J, Y, U, Q, rt;
103
- class qt {
103
+ class Ot {
104
104
  constructor(t, s) {
105
105
  o(this, R);
106
106
  o(this, X);
@@ -148,7 +148,7 @@ class qt {
148
148
  "X-MORPH-CURRENT-PATH": s,
149
149
  "X-MORPH-NEW-PATH": t
150
150
  }, e(this, rt))
151
- })).text(), S = ne.parseFromString(b, "text/html");
151
+ })).text(), S = ae.parseFromString(b, "text/html");
152
152
  this.setInitialDocument(S);
153
153
  } catch (g) {
154
154
  console.warn(g);
@@ -210,7 +210,7 @@ class qt {
210
210
  }
211
211
  }
212
212
  R = new WeakMap(), X = new WeakMap(), v = new WeakMap(), P = new WeakMap(), B = new WeakMap(), D = new WeakMap(), J = new WeakMap(), Y = new WeakMap(), U = new WeakMap(), Q = new WeakMap(), rt = new WeakMap();
213
- var A, Z, E, z, d, j, I, V, y, nt, M, K, _, tt, u, vt, at, dt, yt, Xt, bt, Pt, At, kt, mt, et;
213
+ var A, Z, E, z, d, j, I, V, y, nt, M, K, _, tt, u, vt, at, dt, yt, Bt, bt, Pt, At, kt, mt, et;
214
214
  const st = class st {
215
215
  constructor(t) {
216
216
  o(this, u);
@@ -258,9 +258,9 @@ const st = class st {
258
258
  }
259
259
  });
260
260
  });
261
- if (Ft && !st.instance) {
261
+ if (Wt && !st.instance) {
262
262
  st.instance = this, r(this, A, {
263
- base: se(t == null ? void 0 : t.base),
263
+ base: ie(t == null ? void 0 : t.base),
264
264
  waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
265
265
  trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
266
266
  scrollSelector: t == null ? void 0 : t.scrollSelector,
@@ -270,7 +270,7 @@ const st = class st {
270
270
  location.pathname + location.hash + location.search
271
271
  );
272
272
  r(this, d, s);
273
- const i = new qt(this, e(this, d).pathname);
273
+ const i = new Ot(this, e(this, d).pathname);
274
274
  i.setInitialDocument(document), e(this, M).set(e(this, d).pathname, i), document.documentElement.setAttribute(
275
275
  "data-current-pathname",
276
276
  e(this, d).pathname
@@ -282,7 +282,7 @@ const st = class st {
282
282
  pathname: s.pathname,
283
283
  searchParameters: s.parameters,
284
284
  hash: s.hash
285
- }), r(this, K, new Wt()), p(this, u, At).call(this, document);
285
+ }), r(this, K, new Xt()), p(this, u, At).call(this, document);
286
286
  }
287
287
  }
288
288
  get currentURL() {
@@ -313,7 +313,7 @@ const st = class st {
313
313
  return t == null ? void 0 : t.clearState();
314
314
  }
315
315
  normalizePath(t) {
316
- return ie(t, {
316
+ return re(t, {
317
317
  base: e(this, A).base,
318
318
  trailingSlash: e(this, A).trailingSlash
319
319
  });
@@ -343,21 +343,19 @@ const st = class st {
343
343
  submorph: S,
344
344
  clearState: w
345
345
  } = {}) {
346
- var ot, lt, Ct, Ht;
346
+ var lt, Ct, Ht, Rt;
347
347
  if (e(this, I).length)
348
348
  return;
349
- const c = this.normalizePath(
350
- ((ot = this.pathnameModifier) == null ? void 0 : ot.call(this, t)) || t
351
- );
352
- if (((lt = e(this, z)) == null ? void 0 : lt.pathname) === c.pathname || e(this, d).pathname === c.pathname) {
349
+ const ot = ((lt = this.pathnameModifier) == null ? void 0 : lt.call(this, t)) || t, c = this.normalizePath(ot);
350
+ if (((Ct = e(this, z)) == null ? void 0 : Ct.pathname) === c.pathname || e(this, d).pathname === c.pathname) {
353
351
  p(this, u, kt).call(this, c.hash || 0, {
354
352
  centerScroll: i,
355
353
  offsetScroll: h,
356
354
  behavior: "smooth"
357
355
  }), C(document, "morphSamePath", {
358
356
  custom: !0
359
- }), ((Ct = e(this, d)) == null ? void 0 : Ct.parameters) !== c.parameters && (r(this, j, e(this, d)), r(this, d, c), wt({
360
- action: ((Ht = e(this, d)) == null ? void 0 : Ht.hash) !== c.hash ? "replace" : s,
357
+ }), ((Ht = e(this, d)) == null ? void 0 : Ht.parameters) !== c.parameters && (r(this, j, e(this, d)), r(this, d, c), wt({
358
+ action: ((Rt = e(this, d)) == null ? void 0 : Rt.hash) !== c.hash ? "replace" : s,
361
359
  pathname: c.pathname,
362
360
  searchParameters: c.parameters,
363
361
  hash: c.hash
@@ -394,30 +392,30 @@ const st = class st {
394
392
  });
395
393
  return;
396
394
  }
397
- const Rt = {
395
+ const Mt = {
398
396
  url: c,
399
397
  submorph: S
400
398
  };
401
399
  C(document, "morphNavigation", {
402
- detail: Rt
400
+ detail: Mt
403
401
  });
404
402
  const ft = p(this, u, dt).call(this, e(this, d).pathname), f = p(this, u, dt).call(this, c.pathname);
405
403
  if (e(this, M).forEach((a) => {
406
404
  a.pathname !== c.pathname && a.abort();
407
- }), yield f == null ? void 0 : f.fetch(t, e(this, d).path, g), e(this, z).pathname !== c.pathname) {
405
+ }), yield f == null ? void 0 : f.fetch(ot, e(this, d).path, g), e(this, z).pathname !== c.pathname) {
408
406
  e(this, E).forEach((a) => {
409
407
  a.checkCurrent(e(this, d).path);
410
408
  });
411
409
  return;
412
410
  }
413
411
  ft.clearState(), ft.saveScrollState(), ft.saveDocumentState(), e(this, V) || (f.clearScrollState(), f.clearDocumentState()), w && f.clearState(), f.cloneDocument(), e(this, K).textContent = f.title, document.body.appendChild(e(this, K));
414
- const pt = gt(ut({}, Rt), {
412
+ const pt = gt(ut({}, Mt), {
415
413
  document: f.document
416
414
  });
417
415
  C(document, "morphStart", {
418
416
  detail: pt
419
417
  });
420
- const Mt = Array.from(document.head.children), Tt = Array.from(f.document.head.children), xt = p(this, u, Xt).call(this, Mt, Tt), Bt = p(this, u, bt).call(this, Mt, xt), ht = p(this, u, bt).call(this, Tt, xt).filter((a) => !this.excludeHeadChild(a));
418
+ const Tt = Array.from(document.head.children), xt = Array.from(f.document.head.children), Nt = p(this, u, Bt).call(this, Tt, xt), Yt = p(this, u, bt).call(this, Tt, Nt), ht = p(this, u, bt).call(this, xt, Nt).filter((a) => !this.excludeHeadChild(a));
421
419
  ht.forEach((a, k) => {
422
420
  a.tagName === "SCRIPT" && (ht[k] = p(this, u, vt).call(this, a));
423
421
  }), ht.forEach((a) => {
@@ -432,7 +430,7 @@ const st = class st {
432
430
  e(this, A).waitForHeadToLoad && Et.length && (yield new Promise((a) => W(this, null, function* () {
433
431
  let k = 0;
434
432
  try {
435
- for (var T = Vt(Et), jt, O, F; jt = !(O = yield T.next()).done; jt = !1) {
433
+ for (var T = qt(Et), Kt, O, F; Kt = !(O = yield T.next()).done; Kt = !1) {
436
434
  const ct = O.value;
437
435
  ct.onload = () => {
438
436
  k++, k === Et.length && a();
@@ -442,18 +440,18 @@ const st = class st {
442
440
  F = [O];
443
441
  } finally {
444
442
  try {
445
- jt && (O = T.return) && (yield O.call(T));
443
+ Kt && (O = T.return) && (yield O.call(T));
446
444
  } finally {
447
445
  if (F)
448
446
  throw F[0];
449
447
  }
450
448
  }
451
- }))), yield te(10);
452
- const Nt = [];
453
- Bt.forEach((a) => {
454
- a.hasAttribute("data-permanent") || (p(this, u, Pt).call(this, a) ? Nt.push(a) : a.remove());
449
+ }))), yield ee(10);
450
+ const Dt = [];
451
+ Yt.forEach((a) => {
452
+ a.hasAttribute("data-permanent") || (p(this, u, Pt).call(this, a) ? Dt.push(a) : a.remove());
455
453
  });
456
- const Yt = p(this, u, yt).call(this, f.document.body);
454
+ const jt = p(this, u, yt).call(this, f.document.body);
457
455
  e(this, A).morphInsideScrollContainer || p(this, u, At).call(this, f.document), document.documentElement.setAttribute(
458
456
  "data-current-pathname",
459
457
  c.pathname
@@ -466,7 +464,7 @@ const st = class st {
466
464
  searchParameters: c.parameters || (b ? location.search : ""),
467
465
  hash: c.hash
468
466
  }), e(this, K).remove(), r(this, j, e(this, d)), r(this, d, c), e(this, Z).forEach((a, k) => {
469
- const T = Yt[k], jt = getComputedStyle(a).getPropertyValue("--morph-duration");
467
+ const T = jt[k], Kt = getComputedStyle(a).getPropertyValue("--morph-duration");
470
468
  let O = [], F = [];
471
469
  S ? S.forEach((m) => {
472
470
  const L = a.querySelector(m), x = T.querySelector(m);
@@ -481,7 +479,7 @@ const st = class st {
481
479
  m,
482
480
  F[L]
483
481
  );
484
- }) : a.prepend(...O), _t(() => {
482
+ }) : a.prepend(...O), te(() => {
485
483
  F.forEach((m) => {
486
484
  m instanceof HTMLElement && m.classList.add("old-idle");
487
485
  }), O.forEach((m) => {
@@ -498,7 +496,7 @@ const st = class st {
498
496
  C(document, "morphNewChildrenAdded", {
499
497
  detail: ct
500
498
  });
501
- const Kt = new Promise((m) => {
499
+ const $t = new Promise((m) => {
502
500
  setTimeout(() => {
503
501
  F.forEach((L) => L.remove()), O.forEach((L) => {
504
502
  var x;
@@ -508,9 +506,9 @@ const st = class st {
508
506
  }), C(document, "morphOldChildrenRemoved", {
509
507
  detail: ct
510
508
  }), m();
511
- }, (parseFloat(jt) || 0) * 1e3 + 10);
509
+ }, (parseFloat(Kt) || 0) * 1e3 + 10);
512
510
  });
513
- e(this, I).push(Kt);
511
+ e(this, I).push($t);
514
512
  }), this.isPopstateNavigation ? document.documentElement.style.setProperty(
515
513
  "--new-document-scroll-position",
516
514
  (this.scrollValue.top - f.scrollState.y) * 1 + "px"
@@ -522,7 +520,7 @@ const st = class st {
522
520
  }), c.hash ? (f.clearScrollState(), p(this, u, kt).call(this, c.hash, {
523
521
  centerScroll: i,
524
522
  offsetScroll: h
525
- })) : e(this, V) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, I)), Nt.forEach((a) => a.remove()), r(this, I, []), e(this, Z).forEach((a) => {
523
+ })) : e(this, V) ? f.restoreScrollPosition() : f.renewScrollPosition(), yield Promise.all(e(this, I)), Dt.forEach((a) => a.remove()), r(this, I, []), e(this, Z).forEach((a) => {
526
524
  a.querySelectorAll("script").forEach((T) => {
527
525
  T.replaceWith(p(this, u, vt).call(this, T));
528
526
  });
@@ -578,11 +576,11 @@ A = new WeakMap(), Z = new WeakMap(), E = new WeakMap(), z = new WeakMap(), d =
578
576
  }, at = new WeakMap(), dt = function(t) {
579
577
  const s = this.normalizePath(t);
580
578
  let i = e(this, M).get(s.pathname);
581
- return i || (i = new qt(this, s.pathname), e(this, M).set(s.pathname, i)), i;
579
+ return i || (i = new Ot(this, s.pathname), e(this, M).set(s.pathname, i)), i;
582
580
  }, yt = function(t) {
583
581
  const s = [...t.querySelectorAll("[data-morph]")];
584
582
  return s.length ? s : [t];
585
- }, Xt = function(t, s) {
583
+ }, Bt = function(t, s) {
586
584
  return t.filter(
587
585
  (i) => s.find(
588
586
  (h) => h.outerHTML === i.outerHTML
@@ -604,14 +602,14 @@ A = new WeakMap(), Z = new WeakMap(), E = new WeakMap(), z = new WeakMap(), d =
604
602
  ), r(this, tt, 0), r(this, _, 0), r(this, y, e(this, A).scrollSelector && t.querySelector(e(this, A).scrollSelector) || window), r(this, nt, e(this, y) === window), (i = e(this, y)) == null || i.addEventListener("scroll", e(this, et)), e(this, et).call(this);
605
603
  }, kt = function(t, s) {
606
604
  const i = typeof t == "string" ? document.getElementById(t) : t;
607
- (typeof i == "number" || i) && ee(i, {
605
+ (typeof i == "number" || i) && se(i, {
608
606
  scrollElement: e(this, y),
609
607
  behavior: (s == null ? void 0 : s.behavior) || "instant",
610
608
  center: s == null ? void 0 : s.centerScroll,
611
609
  offset: s == null ? void 0 : s.offsetScroll
612
610
  });
613
611
  }, mt = new WeakMap(), et = new WeakMap(), st.instance = null;
614
- let Ot = st;
612
+ let Ft = st;
615
613
  export {
616
- Ot as Morph
614
+ Ft as Morph
617
615
  };
@@ -1 +1 @@
1
- "use strict";var oe=l=>{throw TypeError(l)};var ee=(l,n,t)=>n.has(l)||oe("Cannot "+t);var e=(l,n,t)=>(ee(l,n,"read from private field"),t?t.call(l):n.get(l)),r=(l,n,t)=>n.has(l)?oe("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(l):n.set(l,t),o=(l,n,t,s)=>(ee(l,n,"write to private field"),s?s.call(l,t):n.set(l,t),t),p=(l,n,t)=>(ee(l,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("../element-linked-store/index.cjs"),E=require("../css-property/index.cjs"),ie=require("../index-DekP7OZe.cjs"),M=require("../events-KVanG9sR.cjs"),pe=require("../function-MthRj-GJ.cjs"),ne=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const he=require("../url-YEESIcRn.cjs"),le=require("../window-resizer/index.cjs"),Q=require("../Viewport-DB0qAZPJ.cjs");var d,w,_,N;class de{constructor(){r(this,d,new Map);r(this,w,[]);r(this,_,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(re=>re instanceof HTMLElement&&re.hasAttribute("data-popover-content")))return;const c=i[0],f=c instanceof Node&&(t.contains(c)||((s=t.shadowRoot)==null?void 0:s.contains(c))),F=c instanceof HTMLElement&&c.hasAttribute("data-outside");(!f||F)&&t.close()}});r(this,N,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,_)),addEventListener("keydown",e(this,N))}get groups(){return e(this,d)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,d).forEach(i=>{i.forEach(c=>{c.close()})});else if(t.closeRestInGroup.current){let i=e(this,d).get(n);i==null||i.forEach(c=>{c.close()})}let s=e(this,d).get(n);s!=null&&s.length||(s=[],e(this,d).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(o(this,w,e(this,w).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,d).forEach(i=>{i.forEach(c=>s.push(c))}),e(this,d).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,d).get(n);e(this,d).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,d).get(n);s&&(s=s.filter(i=>i!==t),e(this,d).set(n,s))}}}d=new WeakMap,w=new WeakMap,_=new WeakMap,N=new WeakMap;var v,z,B,k,H,m,C,A,x,b,R,q,T,y,$,a,V,W,u,ce,L,Z,G,O,j,X,D;const S=class S extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,z);r(this,B);r(this,k);r(this,H);r(this,m);r(this,C);r(this,A);r(this,x);r(this,b);r(this,R);r(this,q);r(this,T);r(this,y);r(this,$);r(this,a);r(this,V);r(this,W);r(this,G);r(this,O);r(this,j);r(this,X);r(this,D);this.urlValue="",o(this,v,!1),o(this,m,new E.CSSProperty(this,"--history",!1)),o(this,C,new E.CSSProperty(this,"--restore",!1)),o(this,A,new E.CSSProperty(this,"--close-rest",!1)),o(this,x,new E.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new E.CSSProperty(this,"--group","")),o(this,R,new E.CSSProperty(this,"--click-outside",!1)),o(this,q,new E.CSSProperty(this,"--escape",!1)),o(this,T,new E.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,y,!0),o(this,a,new ue.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,V,[]),o(this,W,[]),o(this,G,()=>{o(this,y,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,y,!0)}),o(this,O,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,j).call(this)}),o(this,j,pe.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,T).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Q.viewport.width?s=Q.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Q.viewport.height?i=Q.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,D,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(S.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=S.stack.groups.get(this.group.current),i=s==null?void 0:s.find(c=>c.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,C)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,b)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,v)}get lastTrigger(){return e(this,$)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&he.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,$,t==null?void 0:t.trigger),clearTimeout(e(this,z)),clearTimeout(e(this,B)),p(this,u,L).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),M.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,$)}}),e(this,m).current&&e(this,y)&&history.pushState(history.state,"",e(this,u,ce)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{S.stack.add(e(this,b).current,this),e(this,W).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,L).call(this,!0,this.openClass),e(this,a).set("opened",!0),M.dispatchEvent(window,"resize"),M.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,$)},bubbles:!0}),o(this,k,void 0),o(this,H,setTimeout(()=>{e(this,a).set("transitionend",!0),M.dispatchEvent(this,"popoverTransitionend")},ne.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,k,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,k)),clearTimeout(e(this,H)),S.stack.remove(e(this,b).current,this),p(this,u,Z).call(this),o(this,z,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!0,this.closingClass),M.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,B,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,L).call(this,!1,this.closingClass),M.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},ne.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,V,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,V).forEach(t=>{t.addEventListener("click",e(this,D))}),o(this,W,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,C).observe(),e(this,A).observe(),e(this,x).observe(),e(this,b).observe(),e(this,R).observe(),e(this,q).observe(),e(this,T).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,G)),setTimeout(()=>{e(this,C).current?(o(this,y,!1),this.urlValue=he.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,y,!0)):(p(this,u,Z).call(this),o(this,y,!0))},0),e(this,T).subscribe(()=>{e(this,O).call(this)}),le.windowResizer.subscribe(e(this,O))}disconnectedCallback(){e(this,V).forEach(t=>{t.removeEventListener("click",e(this,D))}),S.stack.remove(e(this,b).current,this),le.windowResizer.unsubscribe(e(this,O)),e(this,m).close(),e(this,C).close(),e(this,A).close(),e(this,x).close(),e(this,b).close(),e(this,R).close(),e(this,q).close(),e(this,T).close(),this.removeAttribute("role"),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!1,this.closingClass),clearTimeout(e(this,z)),clearTimeout(e(this,B)),clearTimeout(e(this,k)),clearTimeout(e(this,H)),removeEventListener("popstate",e(this,G)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,Z).call(this)}};v=new WeakMap,z=new WeakMap,B=new WeakMap,k=new WeakMap,H=new WeakMap,m=new WeakMap,C=new WeakMap,A=new WeakMap,x=new WeakMap,b=new WeakMap,R=new WeakMap,q=new WeakMap,T=new WeakMap,y=new WeakMap,$=new WeakMap,a=new WeakMap,V=new WeakMap,W=new WeakMap,u=new WeakSet,ce=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},L=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},Z=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},G=new WeakMap,O=new WeakMap,j=new WeakMap,X=new WeakMap,D=new WeakMap,S.stack=new de;let U=S;ie.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",U);var h,g,P,te,Y,I,J,K,se;class ae extends HTMLElement{constructor(){super();r(this,P);r(this,h);r(this,g,new E.CSSProperty(this,"--type","open"));r(this,Y,()=>{e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,I,()=>{e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,J,()=>{e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,K,()=>{e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});ie.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,P,te).call(this),t){let i=null;if(t==="parent"){const c=this.closest("[data-popover]");if(c)i=c;else{const f=this.getRootNode();f instanceof ShadowRoot?i=f.host.closest("[data-popover]"):f instanceof HTMLElement&&(i=f.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const c=f=>{if(!f)return null;let F=f.querySelector("[data-popover]");return!F&&(f!=null&&f.parentElement)&&(F=c(f.parentElement)),F};i=c(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,I)),e(this,h).addEventListener("popoverClosing",e(this,J)),e(this,h).addEventListener("popoverClosed",e(this,K))):console.warn(this,`target ${t} not found`)}p(this,P,se).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,P,se).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,P,te).call(this)}}h=new WeakMap,g=new WeakMap,P=new WeakSet,te=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,I)),e(this,h).removeEventListener("popoverClosing",e(this,J)),e(this,h).removeEventListener("popoverClosed",e(this,K)))},Y=new WeakMap,I=new WeakMap,J=new WeakMap,K=new WeakMap,se=function(t){e(this,h)instanceof U&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};ie.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ae);exports.PopoverButtonElement=ae;exports.PopoverElement=U;
1
+ "use strict";var oe=l=>{throw TypeError(l)};var ee=(l,n,t)=>n.has(l)||oe("Cannot "+t);var e=(l,n,t)=>(ee(l,n,"read from private field"),t?t.call(l):n.get(l)),r=(l,n,t)=>n.has(l)?oe("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(l):n.set(l,t),o=(l,n,t,s)=>(ee(l,n,"write to private field"),s?s.call(l,t):n.set(l,t),t),p=(l,n,t)=>(ee(l,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("../element-linked-store/index.cjs"),E=require("../css-property/index.cjs"),ie=require("../index-DekP7OZe.cjs"),M=require("../events-KVanG9sR.cjs"),pe=require("../function-MthRj-GJ.cjs"),ne=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const he=require("../url-YEESIcRn.cjs"),le=require("../window-resizer/index.cjs"),Q=require("../Viewport-DB0qAZPJ.cjs");var d,w,_,N;class de{constructor(){r(this,d,new Map);r(this,w,[]);r(this,_,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(re=>re instanceof HTMLElement&&re.hasAttribute("data-popover-content")))return;const c=i[0],f=c instanceof Node&&(t.contains(c)||((s=t.shadowRoot)==null?void 0:s.contains(c))),F=c instanceof HTMLElement&&c.hasAttribute("data-outside");(!f||F)&&t.close()}});r(this,N,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,_)),addEventListener("keydown",e(this,N))}get groups(){return e(this,d)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,d).forEach(i=>{i.forEach(c=>{c.close()})});else if(t.closeRestInGroup.current){let i=e(this,d).get(n);i==null||i.forEach(c=>{c.close()})}let s=e(this,d).get(n);s!=null&&s.length||(s=[],e(this,d).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(o(this,w,e(this,w).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,d).forEach(i=>{i.forEach(c=>s.push(c))}),e(this,d).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,d).get(n);e(this,d).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,d).get(n);s&&(s=s.filter(i=>i!==t),e(this,d).set(n,s))}}}d=new WeakMap,w=new WeakMap,_=new WeakMap,N=new WeakMap;var v,z,B,k,H,m,C,A,x,b,R,q,T,y,$,a,V,W,u,ce,L,Z,G,O,j,X,D;const S=class S extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,z);r(this,B);r(this,k);r(this,H);r(this,m);r(this,C);r(this,A);r(this,x);r(this,b);r(this,R);r(this,q);r(this,T);r(this,y);r(this,$);r(this,a);r(this,V);r(this,W);r(this,G);r(this,O);r(this,j);r(this,X);r(this,D);this.urlValue="",o(this,v,!1),o(this,m,new E.CSSProperty(this,"--history",!1)),o(this,C,new E.CSSProperty(this,"--restore",!1)),o(this,A,new E.CSSProperty(this,"--close-rest",!1)),o(this,x,new E.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new E.CSSProperty(this,"--group","")),o(this,R,new E.CSSProperty(this,"--click-outside",!1)),o(this,q,new E.CSSProperty(this,"--escape",!1)),o(this,T,new E.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,y,!0),o(this,a,new ue.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,V,[]),o(this,W,[]),o(this,G,()=>{o(this,y,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,y,!0)}),o(this,O,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,j).call(this)}),o(this,j,pe.debounce(()=>{e(this,X).call(this)},10)),o(this,X,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,T).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Q.viewport.width?s=Q.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Q.viewport.height?i=Q.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,D,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(S.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=S.stack.groups.get(this.group.current),i=s==null?void 0:s.find(c=>c.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,C)}get closeRest(){return e(this,A)}get closeRestInGroup(){return e(this,x)}get group(){return e(this,b)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,v)}get lastTrigger(){return e(this,$)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&he.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,$,t==null?void 0:t.trigger),clearTimeout(e(this,z)),clearTimeout(e(this,B)),p(this,u,L).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),M.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,$)}}),e(this,m).current&&e(this,y)&&history.pushState(history.state,"",e(this,u,ce)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{S.stack.add(e(this,b).current,this),e(this,W).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,L).call(this,!0,this.openClass),e(this,a).set("opened",!0),M.dispatchEvent(window,"resize"),M.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,$)},bubbles:!0}),o(this,k,void 0),o(this,H,setTimeout(()=>{e(this,a).set("transitionend",!0),M.dispatchEvent(this,"popoverTransitionend")},ne.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,k,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,k)),clearTimeout(e(this,H)),S.stack.remove(e(this,b).current,this),p(this,u,Z).call(this),o(this,z,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!0,this.closingClass),M.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,B,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,L).call(this,!1,this.closingClass),M.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},ne.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,V,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,V).forEach(t=>{t.addEventListener("click",e(this,D))}),o(this,W,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,C).observe(),e(this,A).observe(),e(this,x).observe(),e(this,b).observe(),e(this,R).observe(),e(this,q).observe(),e(this,T).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,G)),setTimeout(()=>{e(this,C).current?(o(this,y,!1),this.urlValue=he.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,y,!0)):(p(this,u,Z).call(this),o(this,y,!0))},0),e(this,T).subscribe(()=>{e(this,O).call(this)}),le.windowResizer.subscribe(e(this,O))}disconnectedCallback(){e(this,V).forEach(t=>{t.removeEventListener("click",e(this,D))}),S.stack.remove(e(this,b).current,this),le.windowResizer.unsubscribe(e(this,O)),e(this,m).close(),e(this,C).close(),e(this,A).close(),e(this,x).close(),e(this,b).close(),e(this,R).close(),e(this,q).close(),e(this,T).close(),this.removeAttribute("role"),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!1,this.closingClass),clearTimeout(e(this,z)),clearTimeout(e(this,B)),clearTimeout(e(this,k)),clearTimeout(e(this,H)),removeEventListener("popstate",e(this,G)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,Z).call(this)}};v=new WeakMap,z=new WeakMap,B=new WeakMap,k=new WeakMap,H=new WeakMap,m=new WeakMap,C=new WeakMap,A=new WeakMap,x=new WeakMap,b=new WeakMap,R=new WeakMap,q=new WeakMap,T=new WeakMap,y=new WeakMap,$=new WeakMap,a=new WeakMap,V=new WeakMap,W=new WeakMap,u=new WeakSet,ce=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},L=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},Z=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},G=new WeakMap,O=new WeakMap,j=new WeakMap,X=new WeakMap,D=new WeakMap,S.stack=new de;let U=S;ie.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",U);var h,g,P,te,Y,I,J,K,se;class ae extends HTMLElement{constructor(){super();r(this,P);r(this,h);r(this,g,new E.CSSProperty(this,"--type","open"));r(this,Y,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,I,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});ie.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,P,te).call(this),t){let i=null;if(t==="parent"){const c=this.closest("[data-popover]");if(c)i=c;else{const f=this.getRootNode();f instanceof ShadowRoot?i=f.host.closest("[data-popover]"):f instanceof HTMLElement&&(i=f.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const c=f=>{if(!f)return null;let F=f.querySelector("[data-popover]");return!F&&(f!=null&&f.parentElement)&&(F=c(f.parentElement)),F};i=c(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,Y)),e(this,h).addEventListener("popoverOpened",e(this,I)),e(this,h).addEventListener("popoverClosing",e(this,J)),e(this,h).addEventListener("popoverClosed",e(this,K))):console.warn(this,`target ${t} not found`)}p(this,P,se).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,P,se).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,P,te).call(this)}}h=new WeakMap,g=new WeakMap,P=new WeakSet,te=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,Y)),e(this,h).removeEventListener("popoverOpened",e(this,I)),e(this,h).removeEventListener("popoverClosing",e(this,J)),e(this,h).removeEventListener("popoverClosed",e(this,K)))},Y=new WeakMap,I=new WeakMap,J=new WeakMap,K=new WeakMap,se=function(t){e(this,h)instanceof U&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};ie.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ae);exports.PopoverButtonElement=ae;exports.PopoverElement=U;
@@ -278,17 +278,17 @@ class ft extends HTMLElement {
278
278
  r(this, C);
279
279
  r(this, n);
280
280
  r(this, g, new y(this, "--type", "open"));
281
- r(this, Y, () => {
282
- t(this, g).current !== "close" && this.classList.add("triggered");
281
+ r(this, Y, (e) => {
282
+ e.target === t(this, n) && t(this, g).current !== "close" && this.classList.add("triggered");
283
283
  });
284
- r(this, j, () => {
285
- t(this, g).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
284
+ r(this, j, (e) => {
285
+ e.target === t(this, n) && t(this, g).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
286
286
  });
287
- r(this, I, () => {
288
- t(this, g).current !== "close" && this.classList.remove("opened");
287
+ r(this, I, (e) => {
288
+ e.target === t(this, n) && t(this, g).current !== "close" && this.classList.remove("opened");
289
289
  });
290
- r(this, J, () => {
291
- t(this, g).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
290
+ r(this, J, (e) => {
291
+ e.target === t(this, n) && t(this, g).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
292
292
  });
293
293
  it && (this.addEventListener("click", () => {
294
294
  if (t(this, n)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.71.15",
3
+ "version": "0.71.17",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"