aptechka 0.59.0 → 0.59.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.
@@ -59,7 +59,7 @@ export declare class Morph {
59
59
  parameters: string;
60
60
  hash: string;
61
61
  };
62
- prefetch(path: string): Promise<void>;
62
+ prefetch(path: string, revalidate?: boolean): Promise<void>;
63
63
  navigate(path: string, { historyAction, centerScroll, offsetScroll, revalidate, keepSearchParameters, }?: MorphNavigateOptions): Promise<void>;
64
64
  addLink(element: HTMLAnchorElement): void;
65
65
  addLinks(elements: Array<HTMLAnchorElement>): void;
@@ -1 +1 @@
1
- "use strict";var wt=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r),bt=r=>{throw TypeError(r)};var nt=(r,t,s)=>t.has(r)||bt("Cannot "+s);var e=(r,t,s)=>(nt(r,t,"read from private field"),s?s.call(r):t.get(r)),o=(r,t,s)=>t.has(r)?bt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,s),a=(r,t,s,i)=>(nt(r,t,"write to private field"),i?i.call(r,s):t.set(r,s),s),d=(r,t,s)=>(nt(r,t,"access private method"),s);var N=(r,t,s)=>new Promise((i,u)=>{var p=E=>{try{H(s.next(E))}catch(h){u(h)}},M=E=>{try{H(s.throw(E))}catch(h){u(h)}},H=E=>E.done?i(E.value):Promise.resolve(E.value).then(p,M);H((s=s.apply(r,t)).next())});var kt=(r,t,s)=>(t=r[wt("asyncIterator")])?t.call(r):(r=r[wt("iterator")](),t={},s=(i,u)=>(u=r[i])&&(t[i]=p=>new Promise((M,H,E)=>(p=u.call(r,p),E=p.done,Promise.resolve(p.value).then(h=>M({value:h,done:E}),H)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ct=require("../index-Cqw2NKev.cjs"),K=require("../events-KVanG9sR.cjs"),Rt=require("../polyfills-Df4r-ETT.cjs"),Pt=require("../scroll-DAhSpkhR.cjs"),tt=require("../url-D1CgmwZ_.cjs"),zt=require("../css-value-parser/index.cjs");class Tt 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)}}Ct.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Tt);var b,c,x,G,F;class rt{constructor(t,s){o(this,b);o(this,c);o(this,x);o(this,G,t=>{if(t.preventDefault(),e(this,c).hasAttribute("data-back")&&e(this,b).previousPathname)history.back();else{const i=e(this,c).getAttribute("data-history-action")||"push",u=e(this,c).hasAttribute("data-center-scroll"),p=getComputedStyle(e(this,c)).getPropertyValue("--offset-scroll").trim(),M=p?zt.cssValueParser.parse(p):void 0,H=e(this,c).hasAttribute("data-revalidate"),E=e(this,c).hasAttribute("data-keep-search-parameters");e(this,b).navigate(e(this,x),{historyAction:i,centerScroll:u,offsetScroll:M,revalidate:H,keepSearchParameters:E})}});o(this,F,()=>{e(this,b).prefetch(e(this,x)),e(this,c).removeEventListener("pointerenter",e(this,F))});a(this,b,s),a(this,c,t),a(this,x,e(this,c).getAttribute("href")||"/"),e(this,c).addEventListener("click",e(this,G)),this.checkCurrent(location.pathname),e(this,c).hasAttribute("data-prefetch")&&e(this,c).addEventListener("pointerenter",e(this,F))}get element(){return e(this,c)}checkCurrent(t){const s=e(this,b).normalizePath(t),i=e(this,b).normalizePath(e(this,x));e(this,c).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,c).classList.add("current"):i.pathname===s.pathname?e(this,c).classList.add("current"):e(this,c).classList.remove("current")}destroy(){e(this,c).removeEventListener("click",e(this,G)),e(this,c).removeEventListener("pointerenter",e(this,F)),e(this,c).classList.remove("current")}}b=new WeakMap,c=new WeakMap,x=new WeakMap,G=new WeakMap,F=new WeakMap;var A,V,v,q,D,C;class At{constructor(t,s,i){o(this,A);o(this,V);o(this,v,{x:0,y:0});o(this,q);o(this,D,null);o(this,C,null);a(this,A,t),a(this,V,s),a(this,q,i.cloneNode(!0))}get pathname(){return e(this,V)}get scrollState(){return e(this,v)}get document(){return e(this,C)}cloneDocument(){a(this,C,(e(this,D)||e(this,q)).cloneNode(!0))}get title(){let t="";if(e(this,C).title)t=e(this,C).title;else{const s=e(this,C).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,V)}return t}clearScrollState(){e(this,v).x=0,e(this,v).y=0}clearDocumentState(){a(this,D,null)}saveScrollState(){e(this,q).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,v).x=0,e(this,v).y=0):(e(this,v).x=e(this,A).scrollElement.scrollLeft,e(this,v).y=e(this,A).scrollElement.scrollTop)}saveDocumentState(){e(this,q).documentElement.hasAttribute("data-no-page-restoration")?a(this,D,null):a(this,D,document.cloneNode(!0))}restoreScrollPosition(){e(this,A).scrollElement.scroll({top:e(this,v).y,left:e(this,v).x})}renewScrollPosition(){e(this,A).scrollElement.scroll({top:0,left:0,behavior:"instant"})}}A=new WeakMap,V=new WeakMap,v=new WeakMap,q=new WeakMap,D=new WeakMap,C=new WeakMap;var k,B,m,et,T,f,J,R,P,y,W,z,Q,l,at,lt,ct,Mt,ht,ut,dt,mt,st,j;const Y=class Y{constructor(t){o(this,l);o(this,k,null);o(this,B,null);o(this,m,[]);o(this,et,new DOMParser);o(this,T);o(this,f,null);o(this,J);o(this,R,[]);o(this,P,!1);o(this,y,null);o(this,W,new Map);o(this,z,null);o(this,Q,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,st,t=>N(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),a(this,P,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,P,!1))}));o(this,j,()=>{const t=e(this,y).scrollTop,s=e(this,y).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),K.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(Ct.isBrowser&&!Y.instance){Y.instance=this,a(this,k,{base:tt.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body",morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),a(this,B,d(this,l,ct).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,f,s.pathname),e(this,W).set(e(this,f),new At(this,e(this,f),document)),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,st)),tt.changeHistory({action:"replace",pathname:e(this,f),searchParameters:s.parameters||location.search,hash:s.hash}),a(this,z,new Tt),d(this,l,dt).call(this,document)}}get currentPathname(){return e(this,f)}get previousPathname(){return e(this,J)}get links(){return e(this,m)}get scrollElement(){return e(this,y)}get isPopstateNavigation(){return e(this,P)}normalizePath(t){return tt.splitPath(t,{base:e(this,k).base,trailingSlash:e(this,k).trailingSlash})}prefetch(t){return N(this,null,function*(){const s=this.normalizePath(t);d(this,l,lt).call(this,s.pathname)})}navigate(H){return N(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:p,keepSearchParameters:M}={}){var ft;if(e(this,R).length)return;const E=this.normalizePath(((ft=this.pathnameModifier)==null?void 0:ft.call(this,t))||t);let{pathname:h,hash:X,parameters:Ht,leaf:Nt}=E;if(e(this,T)===h||e(this,f)===h){e(this,P)||d(this,l,mt).call(this,X||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,T,h),e(this,m).forEach(I=>{I.checkCurrent(h)});try{let I=!0;if(this.preprocessor)try{yield new Promise((n,w)=>{var S;(S=this.preprocessor)==null||S.call(this,{pathname:h,resolve:n,reject:w})})}catch(n){n?console.error(n):console.log("Route change canceled"),I=!1}if(!I||e(this,T)!==h){e(this,m).forEach(n=>{n.checkCurrent(e(this,f))});return}const pt=yield d(this,l,at).call(this,e(this,f)),L=yield d(this,l,at).call(this,h,p);if(e(this,T)!==h){e(this,m).forEach(n=>{n.checkCurrent(e(this,f))});return}pt.saveScrollState(),pt.saveDocumentState(),e(this,P)||(L.clearScrollState(),L.clearDocumentState()),L.cloneDocument(),e(this,z).textContent=L.title,document.body.appendChild(e(this,z));const Et={pathname:h};K.dispatchEvent(document,"morphStart",{detail:Et});const gt=Array.from(document.head.children),vt=Array.from(L.document.head.children),St=d(this,l,Mt).call(this,gt,vt),xt=d(this,l,ht).call(this,gt,St),Z=d(this,l,ht).call(this,vt,St);Z.forEach((n,w)=>{if(n.tagName==="SCRIPT"&&n.getAttribute("src")){const S=document.createElement("script");S.type="module",S.src=n.getAttribute("src"),Z[w]=S}}),Z.forEach(n=>{document.head.appendChild(n)});const it=Z.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(d(this,l,ut).call(this,n))return!0});e(this,k).waitForHeadToLoad&&it.length&&(yield new Promise(n=>N(this,null,function*(){let w=0;try{for(var S=kt(it),O,U,yt;O=!(U=yield S.next()).done;O=!1){const _=U.value;_.onload=()=>{w++,w===it.length&&n()}}}catch(U){yt=[U]}finally{try{O&&(U=S.return)&&(yield U.call(S))}finally{if(yt)throw yt[0]}}}))),yield Pt.wait(10);const Lt=[];xt.forEach(n=>{n.hasAttribute("data-permanent")||(d(this,l,ut).call(this,n)?Lt.push(n):n.remove())});const qt=d(this,l,ct).call(this,L.document.body);e(this,k).morphInsideScrollContainer||d(this,l,dt).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",h),document.documentElement.setAttribute("data-current-leaf",Nt),tt.changeHistory({action:s,pathname:h,searchParameters:Ht||(M?location.search:""),hash:X}),e(this,z).remove(),a(this,J,e(this,f)),a(this,f,h),e(this,B).forEach((n,w)=>{const S=qt[w],O=getComputedStyle(n).getPropertyValue("--morph-duration"),U=[...S.childNodes];if(O){const yt=[...n.childNodes];yt.forEach(g=>{g instanceof HTMLElement&&(this.destroyOldLinks(g),g.classList.add("old"))}),U.forEach(g=>{g instanceof HTMLElement&&(this.findNewLinks(g),g.classList.add("new"))}),n.prepend(...U),Rt.requestIdleCallback(()=>{U.forEach(g=>{g instanceof HTMLElement&&g.classList.add("in")})});const _={morphElement:n,pathname:h};K.dispatchEvent(document,"morphNewChildrenAdded",{detail:_});const Dt=new Promise(g=>{setTimeout(()=>{yt.forEach($=>$.remove()),U.forEach($=>{$ instanceof HTMLElement&&$.classList.remove("in","new")}),K.dispatchEvent(document,"morphOldChildrenRemoved",{detail:_}),g()},(parseFloat(O)||0)*1e3+10)});e(this,R).push(Dt)}else this.destroyOldLinks(n),n.innerHTML="",n.append(...U),this.findNewLinks(n)}),X?(L.clearScrollState(),d(this,l,mt).call(this,X,{centerScroll:i,offsetScroll:u})):e(this,P)?L.restoreScrollPosition():L.renewScrollPosition(),yield Promise.all(e(this,R)),Lt.forEach(n=>n.remove()),a(this,R,[]),e(this,B).forEach(n=>{n.querySelectorAll("script").forEach(S=>{const O=document.createElement("script");O.type="module",O.src=S.getAttribute("src"),S.replaceWith(O)})}),K.dispatchEvent(document,"morphComplete",{detail:Et}),window.dispatchEvent(new Event("resize"))}catch(I){console.error(I)}a(this,T,void 0)})}addLink(t){e(this,m).push(new rt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,m,e(this,m).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){a(this,m,e(this,m).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,Q));e(this,m).push(...s.map(i=>new rt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,Q));e(this,m).forEach(s=>s.destroy()),a(this,m,t.map(s=>new rt(s,this)))}};k=new WeakMap,B=new WeakMap,m=new WeakMap,et=new WeakMap,T=new WeakMap,f=new WeakMap,J=new WeakMap,R=new WeakMap,P=new WeakMap,y=new WeakMap,W=new WeakMap,z=new WeakMap,Q=new WeakMap,l=new WeakSet,at=function(t,s=!1){return N(this,null,function*(){let i=e(this,W).get(t);return(!i||s)&&(i=yield d(this,l,lt).call(this,t)),i})},lt=function(t){return N(this,null,function*(){const i=yield(yield fetch(t)).text(),u=e(this,et).parseFromString(i,"text/html"),p=new At(this,t,u);return e(this,W).set(t,p),p})},ct=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Mt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},ht=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},ut=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},dt=function(t){var s,i;(s=e(this,y))==null||s.removeEventListener("scroll",e(this,j)),a(this,y,t.querySelector(e(this,k).scrollSelector)||t.documentElement),(i=e(this,y))==null||i.addEventListener("scroll",e(this,j)),e(this,j).call(this)},mt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Pt.scrollToElement(i,{scrollElement:e(this,y),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},st=new WeakMap,j=new WeakMap,Y.instance=null;let ot=Y;exports.Morph=ot;
1
+ "use strict";var yt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),wt=n=>{throw TypeError(n)};var nt=(n,t,s)=>t.has(n)||wt("Cannot "+s);var e=(n,t,s)=>(nt(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?wt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),a=(n,t,s,i)=>(nt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),d=(n,t,s)=>(nt(n,t,"access private method"),s);var N=(n,t,s)=>new Promise((i,u)=>{var p=E=>{try{H(s.next(E))}catch(h){u(h)}},M=E=>{try{H(s.throw(E))}catch(h){u(h)}},H=E=>E.done?i(E.value):Promise.resolve(E.value).then(p,M);H((s=s.apply(n,t)).next())});var bt=(n,t,s)=>(t=n[yt("asyncIterator")])?t.call(n):(n=n[yt("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=p=>new Promise((M,H,E)=>(p=u.call(n,p),E=p.done,Promise.resolve(p.value).then(h=>M({value:h,done:E}),H)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const At=require("../index-Cqw2NKev.cjs"),K=require("../events-KVanG9sR.cjs"),Rt=require("../polyfills-Df4r-ETT.cjs"),kt=require("../scroll-DAhSpkhR.cjs"),tt=require("../url-D1CgmwZ_.cjs"),zt=require("../css-value-parser/index.cjs");class Ct 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)}}At.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Ct);var b,c,x,G,F;class ot{constructor(t,s){o(this,b);o(this,c);o(this,x);o(this,G,t=>{if(t.preventDefault(),e(this,c).hasAttribute("data-back")&&e(this,b).previousPathname)history.back();else{const i=e(this,c).getAttribute("data-history-action")||"push",u=e(this,c).hasAttribute("data-center-scroll"),p=getComputedStyle(e(this,c)).getPropertyValue("--offset-scroll").trim(),M=p?zt.cssValueParser.parse(p):void 0,H=e(this,c).hasAttribute("data-revalidate"),E=e(this,c).hasAttribute("data-keep-search-parameters");e(this,b).navigate(e(this,x),{historyAction:i,centerScroll:u,offsetScroll:M,revalidate:H,keepSearchParameters:E})}});o(this,F,()=>{const t=e(this,c).hasAttribute("data-revalidate");e(this,b).prefetch(e(this,x),t),e(this,c).removeEventListener("pointerenter",e(this,F))});a(this,b,s),a(this,c,t),a(this,x,e(this,c).getAttribute("href")||"/"),e(this,c).addEventListener("click",e(this,G)),this.checkCurrent(location.pathname),e(this,c).hasAttribute("data-prefetch")&&e(this,c).addEventListener("pointerenter",e(this,F))}get element(){return e(this,c)}checkCurrent(t){const s=e(this,b).normalizePath(t),i=e(this,b).normalizePath(e(this,x));e(this,c).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,c).classList.add("current"):i.pathname===s.pathname?e(this,c).classList.add("current"):e(this,c).classList.remove("current")}destroy(){e(this,c).removeEventListener("click",e(this,G)),e(this,c).removeEventListener("pointerenter",e(this,F)),e(this,c).classList.remove("current")}}b=new WeakMap,c=new WeakMap,x=new WeakMap,G=new WeakMap,F=new WeakMap;var A,V,v,q,D,C;class Pt{constructor(t,s,i){o(this,A);o(this,V);o(this,v,{x:0,y:0});o(this,q);o(this,D,null);o(this,C,null);a(this,A,t),a(this,V,s),a(this,q,i.cloneNode(!0))}get pathname(){return e(this,V)}get scrollState(){return e(this,v)}get document(){return e(this,C)}cloneDocument(){a(this,C,(e(this,D)||e(this,q)).cloneNode(!0))}get title(){let t="";if(e(this,C).title)t=e(this,C).title;else{const s=e(this,C).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,V)}return t}clearScrollState(){e(this,v).x=0,e(this,v).y=0}clearDocumentState(){a(this,D,null)}saveScrollState(){e(this,q).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,v).x=0,e(this,v).y=0):(e(this,v).x=e(this,A).scrollElement.scrollLeft,e(this,v).y=e(this,A).scrollElement.scrollTop)}saveDocumentState(){e(this,q).documentElement.hasAttribute("data-no-page-restoration")?a(this,D,null):a(this,D,document.cloneNode(!0))}restoreScrollPosition(){e(this,A).scrollElement.scroll({top:e(this,v).y,left:e(this,v).x})}renewScrollPosition(){e(this,A).scrollElement.scroll({top:0,left:0,behavior:"instant"})}}A=new WeakMap,V=new WeakMap,v=new WeakMap,q=new WeakMap,D=new WeakMap,C=new WeakMap;var k,B,m,st,T,f,J,R,P,y,W,z,Q,l,et,Tt,lt,Mt,ct,ht,ut,dt,it,j;const Y=class Y{constructor(t){o(this,l);o(this,k,null);o(this,B,null);o(this,m,[]);o(this,st,new DOMParser);o(this,T);o(this,f,null);o(this,J);o(this,R,[]);o(this,P,!1);o(this,y,null);o(this,W,new Map);o(this,z,null);o(this,Q,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,it,t=>N(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),a(this,P,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,P,!1))}));o(this,j,()=>{const t=e(this,y).scrollTop,s=e(this,y).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),K.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(At.isBrowser&&!Y.instance){Y.instance=this,a(this,k,{base:tt.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body",morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),a(this,B,d(this,l,lt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,f,s.pathname),e(this,W).set(e(this,f),new Pt(this,e(this,f),document)),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,it)),tt.changeHistory({action:"replace",pathname:e(this,f),searchParameters:s.parameters||location.search,hash:s.hash}),a(this,z,new Ct),d(this,l,ut).call(this,document)}}get currentPathname(){return e(this,f)}get previousPathname(){return e(this,J)}get links(){return e(this,m)}get scrollElement(){return e(this,y)}get isPopstateNavigation(){return e(this,P)}normalizePath(t){return tt.splitPath(t,{base:e(this,k).base,trailingSlash:e(this,k).trailingSlash})}prefetch(t,s){return N(this,null,function*(){const i=this.normalizePath(t);d(this,l,et).call(this,i.pathname,s)})}navigate(H){return N(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:p,keepSearchParameters:M}={}){var mt;if(e(this,R).length)return;const E=this.normalizePath(((mt=this.pathnameModifier)==null?void 0:mt.call(this,t))||t);let{pathname:h,hash:X,parameters:Ht,leaf:Nt}=E;if(e(this,T)===h||e(this,f)===h){e(this,P)||d(this,l,dt).call(this,X||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,T,h),e(this,m).forEach(I=>{I.checkCurrent(h)});try{let I=!0;if(this.preprocessor)try{yield new Promise((r,w)=>{var S;(S=this.preprocessor)==null||S.call(this,{pathname:h,resolve:r,reject:w})})}catch(r){r?console.error(r):console.log("Route change canceled"),I=!1}if(!I||e(this,T)!==h){e(this,m).forEach(r=>{r.checkCurrent(e(this,f))});return}const ft=yield d(this,l,et).call(this,e(this,f)),L=yield d(this,l,et).call(this,h,p);if(e(this,T)!==h){e(this,m).forEach(r=>{r.checkCurrent(e(this,f))});return}ft.saveScrollState(),ft.saveDocumentState(),e(this,P)||(L.clearScrollState(),L.clearDocumentState()),L.cloneDocument(),e(this,z).textContent=L.title,document.body.appendChild(e(this,z));const pt={pathname:h};K.dispatchEvent(document,"morphStart",{detail:pt});const Et=Array.from(document.head.children),gt=Array.from(L.document.head.children),vt=d(this,l,Mt).call(this,Et,gt),xt=d(this,l,ct).call(this,Et,vt),Z=d(this,l,ct).call(this,gt,vt);Z.forEach((r,w)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const S=document.createElement("script");S.type="module",S.src=r.getAttribute("src"),Z[w]=S}}),Z.forEach(r=>{document.head.appendChild(r)});const rt=Z.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(d(this,l,ht).call(this,r))return!0});e(this,k).waitForHeadToLoad&&rt.length&&(yield new Promise(r=>N(this,null,function*(){let w=0;try{for(var S=bt(rt),O,U,Lt;O=!(U=yield S.next()).done;O=!1){const _=U.value;_.onload=()=>{w++,w===rt.length&&r()}}}catch(U){Lt=[U]}finally{try{O&&(U=S.return)&&(yield U.call(S))}finally{if(Lt)throw Lt[0]}}}))),yield kt.wait(10);const St=[];xt.forEach(r=>{r.hasAttribute("data-permanent")||(d(this,l,ht).call(this,r)?St.push(r):r.remove())});const qt=d(this,l,lt).call(this,L.document.body);e(this,k).morphInsideScrollContainer||d(this,l,ut).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",h),document.documentElement.setAttribute("data-current-leaf",Nt),tt.changeHistory({action:s,pathname:h,searchParameters:Ht||(M?location.search:""),hash:X}),e(this,z).remove(),a(this,J,e(this,f)),a(this,f,h),e(this,B).forEach((r,w)=>{const S=qt[w],O=getComputedStyle(r).getPropertyValue("--morph-duration"),U=[...S.childNodes];if(O){const Lt=[...r.childNodes];Lt.forEach(g=>{g instanceof HTMLElement&&(this.destroyOldLinks(g),g.classList.add("old"))}),U.forEach(g=>{g instanceof HTMLElement&&(this.findNewLinks(g),g.classList.add("new"))}),r.prepend(...U),Rt.requestIdleCallback(()=>{U.forEach(g=>{g instanceof HTMLElement&&g.classList.add("in")})});const _={morphElement:r,pathname:h};K.dispatchEvent(document,"morphNewChildrenAdded",{detail:_});const Dt=new Promise(g=>{setTimeout(()=>{Lt.forEach($=>$.remove()),U.forEach($=>{$ instanceof HTMLElement&&$.classList.remove("in","new")}),K.dispatchEvent(document,"morphOldChildrenRemoved",{detail:_}),g()},(parseFloat(O)||0)*1e3+10)});e(this,R).push(Dt)}else this.destroyOldLinks(r),r.innerHTML="",r.append(...U),this.findNewLinks(r)}),X?(L.clearScrollState(),d(this,l,dt).call(this,X,{centerScroll:i,offsetScroll:u})):e(this,P)?L.restoreScrollPosition():L.renewScrollPosition(),yield Promise.all(e(this,R)),St.forEach(r=>r.remove()),a(this,R,[]),e(this,B).forEach(r=>{r.querySelectorAll("script").forEach(S=>{const O=document.createElement("script");O.type="module",O.src=S.getAttribute("src"),S.replaceWith(O)})}),K.dispatchEvent(document,"morphComplete",{detail:pt}),window.dispatchEvent(new Event("resize"))}catch(I){console.error(I)}a(this,T,void 0)})}addLink(t){e(this,m).push(new ot(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,m,e(this,m).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){a(this,m,e(this,m).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,Q));e(this,m).push(...s.map(i=>new ot(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,Q));e(this,m).forEach(s=>s.destroy()),a(this,m,t.map(s=>new ot(s,this)))}};k=new WeakMap,B=new WeakMap,m=new WeakMap,st=new WeakMap,T=new WeakMap,f=new WeakMap,J=new WeakMap,R=new WeakMap,P=new WeakMap,y=new WeakMap,W=new WeakMap,z=new WeakMap,Q=new WeakMap,l=new WeakSet,et=function(t,s=!1){return N(this,null,function*(){let i=e(this,W).get(t);return(!i||s)&&(i=yield d(this,l,Tt).call(this,t)),i})},Tt=function(t){return N(this,null,function*(){const i=yield(yield fetch(t)).text(),u=e(this,st).parseFromString(i,"text/html"),p=new Pt(this,t,u);return e(this,W).set(t,p),p})},lt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Mt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},ct=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},ht=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},ut=function(t){var s,i;(s=e(this,y))==null||s.removeEventListener("scroll",e(this,j)),a(this,y,t.querySelector(e(this,k).scrollSelector)||t.documentElement),(i=e(this,y))==null||i.addEventListener("scroll",e(this,j)),e(this,j).call(this)},dt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&kt.scrollToElement(i,{scrollElement:e(this,y),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},it=new WeakMap,j=new WeakMap,Y.instance=null;let at=Y;exports.Morph=at;
@@ -1,8 +1,8 @@
1
- var vt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), wt = (n) => {
1
+ var vt = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), St = (n) => {
2
2
  throw TypeError(n);
3
3
  };
4
- var it = (n, t, s) => t.has(n) || wt("Cannot " + s);
5
- var e = (n, t, s) => (it(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? wt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), a = (n, t, s, i) => (it(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), d = (n, t, s) => (it(n, t, "access private method"), s);
4
+ var rt = (n, t, s) => t.has(n) || St("Cannot " + s);
5
+ var e = (n, t, s) => (rt(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? St("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), a = (n, t, s, i) => (rt(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), d = (n, t, s) => (rt(n, t, "access private method"), s);
6
6
  var N = (n, t, s) => new Promise((i, u) => {
7
7
  var p = (E) => {
8
8
  try {
@@ -19,14 +19,14 @@ var N = (n, t, s) => new Promise((i, u) => {
19
19
  }, M = (E) => E.done ? i(E.value) : Promise.resolve(E.value).then(p, H);
20
20
  M((s = s.apply(n, t)).next());
21
21
  });
22
- var yt = (n, t, s) => (t = n[vt("asyncIterator")]) ? t.call(n) : (n = n[vt("iterator")](), t = {}, s = (i, u) => (u = n[i]) && (t[i] = (p) => new Promise((H, M, E) => (p = u.call(n, p), E = p.done, Promise.resolve(p.value).then((h) => H({ value: h, done: E }), M)))), s("next"), s("return"), t);
22
+ var wt = (n, t, s) => (t = n[vt("asyncIterator")]) ? t.call(n) : (n = n[vt("iterator")](), t = {}, s = (i, u) => (u = n[i]) && (t[i] = (p) => new Promise((H, M, E) => (p = u.call(n, p), E = p.done, Promise.resolve(p.value).then((h) => H({ value: h, done: E }), M)))), s("next"), s("return"), t);
23
23
  import { i as At } from "../index-euf5anj6.js";
24
24
  import { d as K } from "../events-CsVF98U6.js";
25
25
  import { r as Rt } from "../polyfills-DJrTJQky.js";
26
26
  import { w as zt, s as It } from "../scroll-Benkuq-t.js";
27
- import { n as qt, c as bt, s as Ot } from "../url-B6BNcw6_.js";
27
+ import { n as qt, c as yt, s as Ot } from "../url-B6BNcw6_.js";
28
28
  import { cssValueParser as Ft } from "../css-value-parser/index.js";
29
- class Ct extends HTMLElement {
29
+ class Pt extends HTMLElement {
30
30
  connectedCallback() {
31
31
  const t = {
32
32
  "aria-live": "assertive",
@@ -37,9 +37,9 @@ class Ct extends HTMLElement {
37
37
  this.setAttribute(s, i);
38
38
  }
39
39
  }
40
- At && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Ct);
40
+ At && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Pt);
41
41
  var b, c, x, G, F;
42
- class rt {
42
+ class nt {
43
43
  constructor(t, s) {
44
44
  o(this, b);
45
45
  o(this, c);
@@ -63,7 +63,8 @@ class rt {
63
63
  }
64
64
  });
65
65
  o(this, F, () => {
66
- e(this, b).prefetch(e(this, x)), e(this, c).removeEventListener("pointerenter", e(this, F));
66
+ const t = e(this, c).hasAttribute("data-revalidate");
67
+ e(this, b).prefetch(e(this, x), t), e(this, c).removeEventListener("pointerenter", e(this, F));
67
68
  });
68
69
  a(this, b, s), a(this, c, t), a(this, x, e(this, c).getAttribute("href") || "/"), e(this, c).addEventListener("click", e(this, G)), this.checkCurrent(location.pathname), e(this, c).hasAttribute("data-prefetch") && e(this, c).addEventListener("pointerenter", e(this, F));
69
70
  }
@@ -79,16 +80,16 @@ class rt {
79
80
  }
80
81
  }
81
82
  b = new WeakMap(), c = new WeakMap(), x = new WeakMap(), G = new WeakMap(), F = new WeakMap();
82
- var A, V, L, D, R, C;
83
- class kt {
83
+ var P, V, L, D, R, C;
84
+ class bt {
84
85
  constructor(t, s, i) {
85
- o(this, A);
86
+ o(this, P);
86
87
  o(this, V);
87
88
  o(this, L, { x: 0, y: 0 });
88
89
  o(this, D);
89
90
  o(this, R, null);
90
91
  o(this, C, null);
91
- a(this, A, t), a(this, V, s), a(this, D, i.cloneNode(!0));
92
+ a(this, P, t), a(this, V, s), a(this, D, i.cloneNode(!0));
92
93
  }
93
94
  get pathname() {
94
95
  return e(this, V);
@@ -121,7 +122,7 @@ class kt {
121
122
  saveScrollState() {
122
123
  e(this, D).documentElement.hasAttribute(
123
124
  "data-no-scroll-restoration"
124
- ) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this, A).scrollElement.scrollLeft, e(this, L).y = e(this, A).scrollElement.scrollTop);
125
+ ) ? (e(this, L).x = 0, e(this, L).y = 0) : (e(this, L).x = e(this, P).scrollElement.scrollLeft, e(this, L).y = e(this, P).scrollElement.scrollTop);
125
126
  }
126
127
  saveDocumentState() {
127
128
  e(this, D).documentElement.hasAttribute(
@@ -129,33 +130,33 @@ class kt {
129
130
  ) ? a(this, R, null) : a(this, R, document.cloneNode(!0));
130
131
  }
131
132
  restoreScrollPosition() {
132
- e(this, A).scrollElement.scroll({
133
+ e(this, P).scrollElement.scroll({
133
134
  top: e(this, L).y,
134
135
  left: e(this, L).x
135
136
  });
136
137
  }
137
138
  renewScrollPosition() {
138
- e(this, A).scrollElement.scroll({
139
+ e(this, P).scrollElement.scroll({
139
140
  top: 0,
140
141
  left: 0,
141
142
  behavior: "instant"
142
143
  });
143
144
  }
144
145
  }
145
- A = new WeakMap(), V = new WeakMap(), L = new WeakMap(), D = new WeakMap(), R = new WeakMap(), C = new WeakMap();
146
- var k, W, m, tt, T, f, J, z, P, w, B, I, Q, l, nt, ot, at, Tt, lt, ct, ht, ut, et, U;
146
+ P = new WeakMap(), V = new WeakMap(), L = new WeakMap(), D = new WeakMap(), R = new WeakMap(), C = new WeakMap();
147
+ var k, W, m, et, T, f, J, z, A, w, B, I, Q, l, tt, Ct, ot, Tt, at, lt, ct, ht, st, U;
147
148
  const Y = class Y {
148
149
  constructor(t) {
149
150
  o(this, l);
150
151
  o(this, k, null);
151
152
  o(this, W, null);
152
153
  o(this, m, []);
153
- o(this, tt, new DOMParser());
154
+ o(this, et, new DOMParser());
154
155
  o(this, T);
155
156
  o(this, f, null);
156
157
  o(this, J);
157
158
  o(this, z, []);
158
- o(this, P, !1);
159
+ o(this, A, !1);
159
160
  o(this, w, null);
160
161
  o(this, B, /* @__PURE__ */ new Map());
161
162
  o(this, I, null);
@@ -163,9 +164,9 @@ const Y = class Y {
163
164
  var s;
164
165
  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";
165
166
  });
166
- o(this, et, (t) => N(this, null, function* () {
167
+ o(this, st, (t) => N(this, null, function* () {
167
168
  var s;
168
- (s = t.state) != null && s.path && (t.preventDefault(), a(this, P, !0), yield this.navigate(t.state.path, { historyAction: "none" }), a(this, P, !1));
169
+ (s = t.state) != null && s.path && (t.preventDefault(), a(this, A, !0), yield this.navigate(t.state.path, { historyAction: "none" }), a(this, A, !1));
169
170
  }));
170
171
  o(this, U, () => {
171
172
  const t = e(this, w).scrollTop, s = e(this, w).scrollLeft;
@@ -184,25 +185,25 @@ const Y = class Y {
184
185
  trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
185
186
  scrollSelector: (t == null ? void 0 : t.scrollSelector) || "body",
186
187
  morphInsideScrollContainer: (t == null ? void 0 : t.morphInsideScrollContainer) || !1
187
- }), a(this, W, d(this, l, at).call(this, document.body));
188
+ }), a(this, W, d(this, l, ot).call(this, document.body));
188
189
  const s = this.normalizePath(
189
190
  location.pathname + location.hash
190
191
  );
191
192
  a(this, f, s.pathname), e(this, B).set(
192
193
  e(this, f),
193
- new kt(this, e(this, f), document)
194
+ new bt(this, e(this, f), document)
194
195
  ), document.documentElement.setAttribute(
195
196
  "data-current-pathname",
196
197
  e(this, f)
197
198
  ), document.documentElement.setAttribute(
198
199
  "data-current-leaf",
199
200
  s.leaf
200
- ), this.findLinks(), addEventListener("popstate", e(this, et)), bt({
201
+ ), this.findLinks(), addEventListener("popstate", e(this, st)), yt({
201
202
  action: "replace",
202
203
  pathname: e(this, f),
203
204
  searchParameters: s.parameters || location.search,
204
205
  hash: s.hash
205
- }), a(this, I, new Ct()), d(this, l, ht).call(this, document);
206
+ }), a(this, I, new Pt()), d(this, l, ct).call(this, document);
206
207
  }
207
208
  }
208
209
  get currentPathname() {
@@ -218,7 +219,7 @@ const Y = class Y {
218
219
  return e(this, w);
219
220
  }
220
221
  get isPopstateNavigation() {
221
- return e(this, P);
222
+ return e(this, A);
222
223
  }
223
224
  normalizePath(t) {
224
225
  return Ot(t, {
@@ -226,10 +227,10 @@ const Y = class Y {
226
227
  trailingSlash: e(this, k).trailingSlash
227
228
  });
228
229
  }
229
- prefetch(t) {
230
+ prefetch(t, s) {
230
231
  return N(this, null, function* () {
231
- const s = this.normalizePath(t);
232
- d(this, l, ot).call(this, s.pathname);
232
+ const i = this.normalizePath(t);
233
+ d(this, l, tt).call(this, i.pathname, s);
233
234
  });
234
235
  }
235
236
  navigate(M) {
@@ -240,13 +241,13 @@ const Y = class Y {
240
241
  revalidate: p,
241
242
  keepSearchParameters: H
242
243
  } = {}) {
243
- var dt;
244
+ var ut;
244
245
  if (e(this, z).length)
245
246
  return;
246
- const E = this.normalizePath(((dt = this.pathnameModifier) == null ? void 0 : dt.call(this, t)) || t);
247
+ const E = this.normalizePath(((ut = this.pathnameModifier) == null ? void 0 : ut.call(this, t)) || t);
247
248
  let { pathname: h, hash: X, parameters: Ht, leaf: Mt } = E;
248
249
  if (e(this, T) === h || e(this, f) === h) {
249
- e(this, P) || d(this, l, ut).call(this, X || 0, {
250
+ e(this, A) || d(this, l, ht).call(this, X || 0, {
250
251
  centerScroll: i,
251
252
  offsetScroll: u,
252
253
  behavior: "smooth"
@@ -261,8 +262,8 @@ const Y = class Y {
261
262
  if (this.preprocessor)
262
263
  try {
263
264
  yield new Promise((r, y) => {
264
- var S;
265
- (S = this.preprocessor) == null || S.call(this, {
265
+ var v;
266
+ (v = this.preprocessor) == null || v.call(this, {
266
267
  pathname: h,
267
268
  resolve: r,
268
269
  reject: y
@@ -277,70 +278,70 @@ const Y = class Y {
277
278
  });
278
279
  return;
279
280
  }
280
- const mt = yield d(this, l, nt).call(this, e(this, f)), v = yield d(this, l, nt).call(this, h, p);
281
+ const dt = yield d(this, l, tt).call(this, e(this, f)), S = yield d(this, l, tt).call(this, h, p);
281
282
  if (e(this, T) !== h) {
282
283
  e(this, m).forEach((r) => {
283
284
  r.checkCurrent(e(this, f));
284
285
  });
285
286
  return;
286
287
  }
287
- mt.saveScrollState(), mt.saveDocumentState(), e(this, P) || (v.clearScrollState(), v.clearDocumentState()), v.cloneDocument(), e(this, I).textContent = v.title, document.body.appendChild(e(this, I));
288
- const ft = {
288
+ dt.saveScrollState(), dt.saveDocumentState(), e(this, A) || (S.clearScrollState(), S.clearDocumentState()), S.cloneDocument(), e(this, I).textContent = S.title, document.body.appendChild(e(this, I));
289
+ const mt = {
289
290
  pathname: h
290
291
  };
291
292
  K(document, "morphStart", {
292
- detail: ft
293
+ detail: mt
293
294
  });
294
- const pt = Array.from(document.head.children), Et = Array.from(v.document.head.children), gt = d(this, l, Tt).call(this, pt, Et), Nt = d(this, l, lt).call(this, pt, gt), Z = d(this, l, lt).call(this, Et, gt);
295
+ const ft = Array.from(document.head.children), pt = Array.from(S.document.head.children), Et = d(this, l, Tt).call(this, ft, pt), Nt = d(this, l, at).call(this, ft, Et), Z = d(this, l, at).call(this, pt, Et);
295
296
  Z.forEach((r, y) => {
296
297
  if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
297
- const S = document.createElement("script");
298
- S.type = "module", S.src = r.getAttribute("src"), Z[y] = S;
298
+ const v = document.createElement("script");
299
+ v.type = "module", v.src = r.getAttribute("src"), Z[y] = v;
299
300
  }
300
301
  }), Z.forEach((r) => {
301
302
  document.head.appendChild(r);
302
303
  });
303
- const st = Z.filter((r) => {
304
+ const it = Z.filter((r) => {
304
305
  if (r.hasAttribute("data-no-waiting"))
305
306
  return !1;
306
- if (d(this, l, ct).call(this, r))
307
+ if (d(this, l, lt).call(this, r))
307
308
  return !0;
308
309
  });
309
- e(this, k).waitForHeadToLoad && st.length && (yield new Promise((r) => N(this, null, function* () {
310
+ e(this, k).waitForHeadToLoad && it.length && (yield new Promise((r) => N(this, null, function* () {
310
311
  let y = 0;
311
312
  try {
312
- for (var S = yt(st), O, j, St; O = !(j = yield S.next()).done; O = !1) {
313
+ for (var v = wt(it), O, j, Lt; O = !(j = yield v.next()).done; O = !1) {
313
314
  const $ = j.value;
314
315
  $.onload = () => {
315
- y++, y === st.length && r();
316
+ y++, y === it.length && r();
316
317
  };
317
318
  }
318
319
  } catch (j) {
319
- St = [j];
320
+ Lt = [j];
320
321
  } finally {
321
322
  try {
322
- O && (j = S.return) && (yield j.call(S));
323
+ O && (j = v.return) && (yield j.call(v));
323
324
  } finally {
324
- if (St)
325
- throw St[0];
325
+ if (Lt)
326
+ throw Lt[0];
326
327
  }
327
328
  }
328
329
  }))), yield zt(10);
329
- const Lt = [];
330
+ const gt = [];
330
331
  Nt.forEach((r) => {
331
- r.hasAttribute("data-permanent") || (d(this, l, ct).call(this, r) ? Lt.push(r) : r.remove());
332
+ r.hasAttribute("data-permanent") || (d(this, l, lt).call(this, r) ? gt.push(r) : r.remove());
332
333
  });
333
- const xt = d(this, l, at).call(this, v.document.body);
334
- e(this, k).morphInsideScrollContainer || d(this, l, ht).call(this, v.document), document.documentElement.setAttribute("data-current-pathname", h), document.documentElement.setAttribute("data-current-leaf", Mt), bt({
334
+ const xt = d(this, l, ot).call(this, S.document.body);
335
+ e(this, k).morphInsideScrollContainer || d(this, l, ct).call(this, S.document), document.documentElement.setAttribute("data-current-pathname", h), document.documentElement.setAttribute("data-current-leaf", Mt), yt({
335
336
  action: s,
336
337
  pathname: h,
337
338
  searchParameters: Ht || (H ? location.search : ""),
338
339
  hash: X
339
340
  }), e(this, I).remove(), a(this, J, e(this, f)), a(this, f, h), e(this, W).forEach((r, y) => {
340
- const S = xt[y], O = getComputedStyle(r).getPropertyValue("--morph-duration"), j = [...S.childNodes];
341
+ const v = xt[y], O = getComputedStyle(r).getPropertyValue("--morph-duration"), j = [...v.childNodes];
341
342
  if (O) {
342
- const St = [...r.childNodes];
343
- St.forEach((g) => {
343
+ const Lt = [...r.childNodes];
344
+ Lt.forEach((g) => {
344
345
  g instanceof HTMLElement && (this.destroyOldLinks(g), g.classList.add("old"));
345
346
  }), j.forEach((g) => {
346
347
  g instanceof HTMLElement && (this.findNewLinks(g), g.classList.add("new"));
@@ -358,7 +359,7 @@ const Y = class Y {
358
359
  });
359
360
  const Dt = new Promise((g) => {
360
361
  setTimeout(() => {
361
- St.forEach((_) => _.remove()), j.forEach((_) => {
362
+ Lt.forEach((_) => _.remove()), j.forEach((_) => {
362
363
  _ instanceof HTMLElement && _.classList.remove("in", "new");
363
364
  }), K(document, "morphOldChildrenRemoved", {
364
365
  detail: $
@@ -368,13 +369,13 @@ const Y = class Y {
368
369
  e(this, z).push(Dt);
369
370
  } else
370
371
  this.destroyOldLinks(r), r.innerHTML = "", r.append(...j), this.findNewLinks(r);
371
- }), X ? (v.clearScrollState(), d(this, l, ut).call(this, X, { centerScroll: i, offsetScroll: u })) : e(this, P) ? v.restoreScrollPosition() : v.renewScrollPosition(), yield Promise.all(e(this, z)), Lt.forEach((r) => r.remove()), a(this, z, []), e(this, W).forEach((r) => {
372
- r.querySelectorAll("script").forEach((S) => {
372
+ }), X ? (S.clearScrollState(), d(this, l, ht).call(this, X, { centerScroll: i, offsetScroll: u })) : e(this, A) ? S.restoreScrollPosition() : S.renewScrollPosition(), yield Promise.all(e(this, z)), gt.forEach((r) => r.remove()), a(this, z, []), e(this, W).forEach((r) => {
373
+ r.querySelectorAll("script").forEach((v) => {
373
374
  const O = document.createElement("script");
374
- O.type = "module", O.src = S.getAttribute("src"), S.replaceWith(O);
375
+ O.type = "module", O.src = v.getAttribute("src"), v.replaceWith(O);
375
376
  });
376
377
  }), K(document, "morphComplete", {
377
- detail: ft
378
+ detail: mt
378
379
  }), window.dispatchEvent(new Event("resize"));
379
380
  } catch (q) {
380
381
  console.error(q);
@@ -383,7 +384,7 @@ const Y = class Y {
383
384
  });
384
385
  }
385
386
  addLink(t) {
386
- e(this, m).push(new rt(t, this));
387
+ e(this, m).push(new nt(t, this));
387
388
  }
388
389
  addLinks(t) {
389
390
  t.forEach((s) => {
@@ -401,27 +402,27 @@ const Y = class Y {
401
402
  e(this, Q)
402
403
  );
403
404
  e(this, m).push(
404
- ...s.map((i) => new rt(i, this))
405
+ ...s.map((i) => new nt(i, this))
405
406
  );
406
407
  }
407
408
  findLinks() {
408
409
  const t = [
409
410
  ...document.documentElement.querySelectorAll("a")
410
411
  ].filter(e(this, Q));
411
- e(this, m).forEach((s) => s.destroy()), a(this, m, t.map((s) => new rt(s, this)));
412
+ e(this, m).forEach((s) => s.destroy()), a(this, m, t.map((s) => new nt(s, this)));
412
413
  }
413
414
  };
414
- k = new WeakMap(), W = new WeakMap(), m = new WeakMap(), tt = new WeakMap(), T = new WeakMap(), f = new WeakMap(), J = new WeakMap(), z = new WeakMap(), P = new WeakMap(), w = new WeakMap(), B = new WeakMap(), I = new WeakMap(), Q = new WeakMap(), l = new WeakSet(), nt = function(t, s = !1) {
415
+ k = new WeakMap(), W = new WeakMap(), m = new WeakMap(), et = new WeakMap(), T = new WeakMap(), f = new WeakMap(), J = new WeakMap(), z = new WeakMap(), A = new WeakMap(), w = new WeakMap(), B = new WeakMap(), I = new WeakMap(), Q = new WeakMap(), l = new WeakSet(), tt = function(t, s = !1) {
415
416
  return N(this, null, function* () {
416
417
  let i = e(this, B).get(t);
417
- return (!i || s) && (i = yield d(this, l, ot).call(this, t)), i;
418
+ return (!i || s) && (i = yield d(this, l, Ct).call(this, t)), i;
418
419
  });
419
- }, ot = function(t) {
420
+ }, Ct = function(t) {
420
421
  return N(this, null, function* () {
421
- const i = yield (yield fetch(t)).text(), u = e(this, tt).parseFromString(i, "text/html"), p = new kt(this, t, u);
422
+ const i = yield (yield fetch(t)).text(), u = e(this, et).parseFromString(i, "text/html"), p = new bt(this, t, u);
422
423
  return e(this, B).set(t, p), p;
423
424
  });
424
- }, at = function(t) {
425
+ }, ot = function(t) {
425
426
  const s = [...t.querySelectorAll("[data-morph]")];
426
427
  return s.length ? s : [t];
427
428
  }, Tt = function(t, s) {
@@ -430,21 +431,21 @@ k = new WeakMap(), W = new WeakMap(), m = new WeakMap(), tt = new WeakMap(), T =
430
431
  (u) => u.outerHTML === i.outerHTML
431
432
  )
432
433
  );
433
- }, lt = function(t, s) {
434
+ }, at = function(t, s) {
434
435
  return t.filter(
435
436
  (i) => !s.find(
436
437
  (u) => u.outerHTML === i.outerHTML
437
438
  )
438
439
  );
439
- }, ct = function(t) {
440
+ }, lt = function(t) {
440
441
  return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
441
- }, ht = function(t) {
442
+ }, ct = function(t) {
442
443
  var s, i;
443
444
  (s = e(this, w)) == null || s.removeEventListener(
444
445
  "scroll",
445
446
  e(this, U)
446
447
  ), a(this, w, t.querySelector(e(this, k).scrollSelector) || t.documentElement), (i = e(this, w)) == null || i.addEventListener("scroll", e(this, U)), e(this, U).call(this);
447
- }, ut = function(t, s) {
448
+ }, ht = function(t, s) {
448
449
  const i = typeof t == "string" ? document.getElementById(t) : t;
449
450
  (typeof i == "number" || i) && It(i, {
450
451
  scrollElement: e(this, w),
@@ -452,8 +453,8 @@ k = new WeakMap(), W = new WeakMap(), m = new WeakMap(), tt = new WeakMap(), T =
452
453
  center: s == null ? void 0 : s.centerScroll,
453
454
  offset: s == null ? void 0 : s.offsetScroll
454
455
  });
455
- }, et = new WeakMap(), U = new WeakMap(), Y.instance = null;
456
- let Pt = Y;
456
+ }, st = new WeakMap(), U = new WeakMap(), Y.instance = null;
457
+ let kt = Y;
457
458
  export {
458
- Pt as Morph
459
+ kt as Morph
459
460
  };
@@ -1 +1 @@
1
- "use strict";var _=c=>{throw TypeError(c)};var Q=(c,r,t)=>r.has(c)||_("Cannot "+t);var e=(c,r,t)=>(Q(c,r,"read from private field"),t?t.call(c):r.get(c)),i=(c,r,t)=>r.has(c)?_("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(c):r.set(c,t),n=(c,r,t,s)=>(Q(c,r,"write to private field"),s?s.call(c,t):r.set(c,t),t),E=(c,r,t)=>(Q(c,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const oe=require("../element-linked-store/index.cjs"),b=require("../css-property/index.cjs"),Z=require("../index-Cqw2NKev.cjs"),F=require("../events-KVanG9sR.cjs"),ne=require("../function-MthRj-GJ.cjs"),ee=require("../style-At6aDoqG.cjs"),te=require("../url-D1CgmwZ_.cjs"),se=require("../window-resizer/index.cjs");var u,m,J,K;class he{constructor(){i(this,u,new Map);i(this,m,[]);i(this,J,r=>{var s;const t=[...e(this,m)].reverse().find(o=>o.clickOutside.current);if(t){const o=r.composedPath();if(o.find(N=>N instanceof HTMLElement&&N.hasAttribute("data-popover-content")))return;const a=o[0],p=a instanceof Node&&(t.contains(a)||((s=t.shadowRoot)==null?void 0:s.contains(a))),z=a instanceof HTMLElement&&a.hasAttribute("data-outside");(!p||z)&&t.close()}});i(this,K,r=>{if(r.code==="Escape"){const t=[...e(this,m)].reverse().find(s=>s.escape.current);t&&t.close()}});addEventListener("click",e(this,J)),addEventListener("keydown",e(this,K))}get groups(){return e(this,u)}get stack(){return e(this,m)}add(r,t){if(t.closeRest.current)e(this,u).forEach(o=>{o.forEach(a=>{a.close()})});else if(t.closeRestInGroup.current){let o=e(this,u).get(r);o==null||o.forEach(a=>{a.close()})}let s=e(this,u).get(r);s!=null&&s.length||(s=[],e(this,u).set(r,s)),e(this,m).push(t),s.push(t)}remove(r,t){if(n(this,m,e(this,m).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(o=>{o.forEach(a=>s.push(a))}),e(this,u).clear(),s.forEach(o=>o.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(r);e(this,u).delete(r),s==null||s.forEach(o=>{o.close()})}else{let s=e(this,u).get(r);s&&(s=s.filter(o=>o!==t),e(this,u).set(r,s))}}}u=new WeakMap,m=new WeakMap,J=new WeakMap,K=new WeakMap;var f,$,M,P,O,g,L,k,C,v,A,R,T,x,l,S,ie,I,q,V,B,H;const y=class y extends HTMLElement{constructor(){super();i(this,S);i(this,f);i(this,$);i(this,M);i(this,P);i(this,O);i(this,g);i(this,L);i(this,k);i(this,C);i(this,v);i(this,A);i(this,R);i(this,T);i(this,x);i(this,l);i(this,q);i(this,V);i(this,B);i(this,H);this.urlValue="",n(this,f,!1),n(this,g,new b.CSSProperty(this,"--history",!1)),n(this,L,new b.CSSProperty(this,"--restore",!1)),n(this,k,new b.CSSProperty(this,"--close-rest",!1)),n(this,C,new b.CSSProperty(this,"--close-rest-in-group",!1)),n(this,v,new b.CSSProperty(this,"--group","")),n(this,A,new b.CSSProperty(this,"--click-outside",!1)),n(this,R,new b.CSSProperty(this,"--escape",!1)),n(this,T,!1),n(this,l,new oe.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,q,()=>{n(this,T,!1),e(this,f)&&e(this,g).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,g).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,T,!0)}),n(this,V,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,B).call(this)}),n(this,B,ne.debounce(()=>{e(this,H).call(this)},10)),n(this,H,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")}),e(this,v).subscribe(t=>{t.previous&&(y.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,l).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=y.stack.groups.get(this.group.current),o=s==null?void 0:s.find(a=>a.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!o)}})}get history(){return e(this,g)}get restore(){return e(this,L)}get closeRest(){return e(this,k)}get closeRestInGroup(){return e(this,C)}get group(){return e(this,v)}get clickOutside(){return e(this,A)}get escape(){return e(this,R)}get opened(){return e(this,f)}get lastTrigger(){return e(this,x)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&te.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;n(this,x,t==null?void 0:t.trigger),clearTimeout(e(this,$)),clearTimeout(e(this,M)),e(this,l).set("closing",!1),e(this,l).set("triggered",!0),F.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,x)}}),e(this,g).current&&e(this,T)&&history.pushState(history.state,"",e(this,S,ie)),n(this,f,!0);const s=()=>{y.stack.add(e(this,v).current,this),e(this,H).call(this),e(this,l).set("opened",!0),F.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,x)}}),n(this,P,void 0),n(this,O,setTimeout(()=>{e(this,l).set("transitionend",!0)},ee.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,P,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,P)),clearTimeout(e(this,O)),y.stack.remove(e(this,v).current,this),n(this,f,!1),E(this,S,I).call(this),e(this,l).set("transitionend",!1),n(this,$,setTimeout(()=>{e(this,l).set("opened",!1),e(this,l).set("closing",!0),F.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,M,setTimeout(()=>{e(this,l).set("triggered",!1),e(this,l).set("closing",!1),F.dispatchEvent(this,"popoverClosed",{custom:!0})},ee.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,g).observe(),e(this,L).observe(),e(this,k).observe(),e(this,C).observe(),e(this,v).observe(),e(this,A).observe(),e(this,R).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,q)),setTimeout(()=>{e(this,L).current?(this.urlValue=te.parseSearchParameters(location.search)[this.id],e(this,q).call(this)):(E(this,S,I).call(this),n(this,T,!0))},0),se.windowResizer.subscribe(e(this,V))}disconnectedCallback(){y.stack.remove(e(this,v).current,this),se.windowResizer.unsubscribe(e(this,V)),e(this,l).close(),e(this,g).close(),e(this,L).close(),e(this,k).close(),e(this,C).close(),e(this,v).close(),e(this,A).close(),e(this,R).close(),this.removeAttribute("role"),clearTimeout(e(this,$)),clearTimeout(e(this,M)),clearTimeout(e(this,P)),clearTimeout(e(this,O)),removeEventListener("popstate",e(this,q)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),E(this,S,I).call(this)}};f=new WeakMap,$=new WeakMap,M=new WeakMap,P=new WeakMap,O=new WeakMap,g=new WeakMap,L=new WeakMap,k=new WeakMap,C=new WeakMap,v=new WeakMap,A=new WeakMap,R=new WeakMap,T=new WeakMap,x=new WeakMap,l=new WeakMap,S=new WeakSet,ie=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},I=function(){if(e(this,g).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},q=new WeakMap,V=new WeakMap,B=new WeakMap,H=new WeakMap,y.stack=new he;let W=y;Z.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",W);var h,d,w,X,G,D,U,j,Y;class re extends HTMLElement{constructor(){super();i(this,w);i(this,h);i(this,d,new b.CSSProperty(this,"--type","open"));i(this,G,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});i(this,D,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});i(this,U,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});i(this,j,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});Z.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).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"&&t.currentTarget.click()}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(E(this,w,X).call(this),t){let o=null;if(t==="parent"){const a=this.closest("[data-popover]");if(a)o=a;else{const p=this.getRootNode();p instanceof ShadowRoot?o=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(o=p.closest("[data-popover]"))}}else if(t==="sibling")o=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const a=p=>{if(!p)return null;let z=p.querySelector("[data-popover]");return!z&&(p!=null&&p.parentElement)&&(z=a(p.parentElement)),z};o=a(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),o=document.querySelector(t)||this.getRootNode().querySelector(t);o instanceof HTMLElement?(n(this,h,o),e(this,h).addEventListener("popoverTriggered",e(this,G)),e(this,h).addEventListener("popoverOpened",e(this,D)),e(this,h).addEventListener("popoverClosing",e(this,U)),e(this,h).addEventListener("popoverClosed",e(this,j))):console.warn(this,`target ${t} not found`)}E(this,w,Y).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{E(this,w,Y).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),E(this,w,X).call(this)}}h=new WeakMap,d=new WeakMap,w=new WeakSet,X=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,G)),e(this,h).removeEventListener("popoverOpened",e(this,D)),e(this,h).removeEventListener("popoverClosing",e(this,U)),e(this,h).removeEventListener("popoverClosed",e(this,j)))},G=new WeakMap,D=new WeakMap,U=new WeakMap,j=new WeakMap,Y=function(t){e(this,h)instanceof W&&(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")))};Z.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",re);exports.PopoverButtonElement=re;exports.PopoverElement=W;
1
+ "use strict";var te=c=>{throw TypeError(c)};var Q=(c,o,t)=>o.has(c)||te("Cannot "+t);var e=(c,o,t)=>(Q(c,o,"read from private field"),t?t.call(c):o.get(c)),r=(c,o,t)=>o.has(c)?te("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(c):o.set(c,t),n=(c,o,t,s)=>(Q(c,o,"write to private field"),s?s.call(c,t):o.set(c,t),t),b=(c,o,t)=>(Q(c,o,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const he=require("../element-linked-store/index.cjs"),m=require("../css-property/index.cjs"),N=require("../index-Cqw2NKev.cjs"),Y=require("../events-KVanG9sR.cjs"),ce=require("../function-MthRj-GJ.cjs"),se=require("../style-At6aDoqG.cjs"),ie=require("../url-D1CgmwZ_.cjs"),re=require("../window-resizer/index.cjs"),F=require("../device/index.cjs");var u,y,J,K;class le{constructor(){r(this,u,new Map);r(this,y,[]);r(this,J,o=>{var s;const t=[...e(this,y)].reverse().find(i=>i.clickOutside.current);if(t){const i=o.composedPath();if(i.find(ee=>ee instanceof HTMLElement&&ee.hasAttribute("data-popover-content")))return;const l=i[0],p=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),H=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!p||H)&&t.close()}});r(this,K,o=>{if(o.code==="Escape"){const t=[...e(this,y)].reverse().find(s=>s.escape.current);t&&t.close()}});addEventListener("click",e(this,J)),addEventListener("keydown",e(this,K))}get groups(){return e(this,u)}get stack(){return e(this,y)}add(o,t){if(t.closeRest.current)e(this,u).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,u).get(o);i==null||i.forEach(l=>{l.close()})}let s=e(this,u).get(o);s!=null&&s.length||(s=[],e(this,u).set(o,s)),e(this,y).push(t),s.push(t)}remove(o,t){if(n(this,y,e(this,y).filter(s=>s!==t)),t.closeRest.current){let s=[];e(this,u).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,u).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,u).get(o);e(this,u).delete(o),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,u).get(o);s&&(s=s.filter(i=>i!==t),e(this,u).set(o,s))}}}u=new WeakMap,y=new WeakMap,J=new WeakMap,K=new WeakMap;var f,M,V,C,B,v,w,x,A,g,R,q,L,T,O,a,P,oe,I,$,S,W,G;const E=class E extends HTMLElement{constructor(){super();r(this,P);r(this,f);r(this,M);r(this,V);r(this,C);r(this,B);r(this,v);r(this,w);r(this,x);r(this,A);r(this,g);r(this,R);r(this,q);r(this,L);r(this,T);r(this,O);r(this,a);r(this,$);r(this,S);r(this,W);r(this,G);this.urlValue="",n(this,f,!1),n(this,v,new m.CSSProperty(this,"--history",!1)),n(this,w,new m.CSSProperty(this,"--restore",!1)),n(this,x,new m.CSSProperty(this,"--close-rest",!1)),n(this,A,new m.CSSProperty(this,"--close-rest-in-group",!1)),n(this,g,new m.CSSProperty(this,"--group","")),n(this,R,new m.CSSProperty(this,"--click-outside",!1)),n(this,q,new m.CSSProperty(this,"--escape",!1)),n(this,L,new m.CSSProperty(this,"--check-viewport-bounds",!1)),n(this,T,!1),n(this,a,new he.ElementLinkedStore(this,{opened:!1,closing:!1,triggered:!1,transitionend:!1})),n(this,$,()=>{n(this,T,!1),e(this,f)&&e(this,v).current&&!location.search.includes(this.id)?this.close():!e(this,f)&&e(this,v).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),n(this,T,!0)}),n(this,S,()=>{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,W).call(this)}),n(this,W,ce.debounce(()=>{e(this,G).call(this)},10)),n(this,G,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,L).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>F.viewport.width?s=F.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>F.viewport.height?i=F.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")}}),e(this,g).subscribe(t=>{t.previous&&(E.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=E.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get history(){return e(this,v)}get restore(){return e(this,w)}get closeRest(){return e(this,x)}get closeRestInGroup(){return e(this,A)}get group(){return e(this,g)}get clickOutside(){return e(this,R)}get escape(){return e(this,q)}get opened(){return e(this,f)}get lastTrigger(){return e(this,O)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,f)&&ie.updateSearchParameter(this.id,t)}open(t){if(e(this,f))return;n(this,O,t==null?void 0:t.trigger),clearTimeout(e(this,M)),clearTimeout(e(this,V)),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),Y.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,O)}}),e(this,v).current&&e(this,T)&&history.pushState(history.state,"",e(this,P,oe)),n(this,f,!0);const s=()=>{E.stack.add(e(this,g).current,this),e(this,S).call(this),e(this,a).set("opened",!0),Y.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,O)}}),n(this,C,void 0),n(this,B,setTimeout(()=>{e(this,a).set("transitionend",!0)},se.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():n(this,C,setTimeout(s,10))}close(){e(this,f)&&(clearTimeout(e(this,C)),clearTimeout(e(this,B)),E.stack.remove(e(this,g).current,this),n(this,f,!1),b(this,P,I).call(this),e(this,a).set("transitionend",!1),n(this,M,setTimeout(()=>{e(this,a).set("opened",!1),e(this,a).set("closing",!0),Y.dispatchEvent(this,"popoverClosing",{custom:!0}),n(this,V,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("closing",!1),Y.dispatchEvent(this,"popoverClosed",{custom:!0})},se.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){e(this,v).observe(),e(this,w).observe(),e(this,x).observe(),e(this,A).observe(),e(this,g).observe(),e(this,R).observe(),e(this,q).observe(),e(this,L).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,$)),setTimeout(()=>{e(this,w).current?(this.urlValue=ie.parseSearchParameters(location.search)[this.id],e(this,$).call(this)):(b(this,P,I).call(this),n(this,T,!0))},0),e(this,L).subscribe(()=>{e(this,S).call(this)}),re.windowResizer.subscribe(e(this,S))}disconnectedCallback(){E.stack.remove(e(this,g).current,this),re.windowResizer.unsubscribe(e(this,S)),e(this,a).close(),e(this,v).close(),e(this,w).close(),e(this,x).close(),e(this,A).close(),e(this,g).close(),e(this,R).close(),e(this,q).close(),e(this,L).close(),this.removeAttribute("role"),clearTimeout(e(this,M)),clearTimeout(e(this,V)),clearTimeout(e(this,C)),clearTimeout(e(this,B)),removeEventListener("popstate",e(this,$)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),b(this,P,I).call(this)}};f=new WeakMap,M=new WeakMap,V=new WeakMap,C=new WeakMap,B=new WeakMap,v=new WeakMap,w=new WeakMap,x=new WeakMap,A=new WeakMap,g=new WeakMap,R=new WeakMap,q=new WeakMap,L=new WeakMap,T=new WeakMap,O=new WeakMap,a=new WeakMap,P=new WeakSet,oe=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},I=function(){if(e(this,v).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},$=new WeakMap,S=new WeakMap,W=new WeakMap,G=new WeakMap,E.stack=new le;let z=E;N.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",z);var h,d,k,Z,D,U,j,X,_;class ne extends HTMLElement{constructor(){super();r(this,k);r(this,h);r(this,d,new m.CSSProperty(this,"--type","open"));r(this,D,()=>{e(this,d).current!=="close"&&this.classList.add("triggered")});r(this,U,()=>{e(this,d).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,j,()=>{e(this,d).current!=="close"&&this.classList.remove("opened")});r(this,X,()=>{e(this,d).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});N.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,d).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"&&t.currentTarget.click()}))}get type(){return e(this,d)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(b(this,k,Z).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const p=this.getRootNode();p instanceof ShadowRoot?i=p.host.closest("[data-popover]"):p instanceof HTMLElement&&(i=p.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=p=>{if(!p)return null;let H=p.querySelector("[data-popover]");return!H&&(p!=null&&p.parentElement)&&(H=l(p.parentElement)),H};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(n(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,D)),e(this,h).addEventListener("popoverOpened",e(this,U)),e(this,h).addEventListener("popoverClosing",e(this,j)),e(this,h).addEventListener("popoverClosed",e(this,X))):console.warn(this,`target ${t} not found`)}b(this,k,_).call(this,e(this,d).current)}connectedCallback(){e(this,d).subscribe(s=>{b(this,k,_).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,d).observe()}disconnectedCallback(){e(this,d).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),b(this,k,Z).call(this)}}h=new WeakMap,d=new WeakMap,k=new WeakSet,Z=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,D)),e(this,h).removeEventListener("popoverOpened",e(this,U)),e(this,h).removeEventListener("popoverClosing",e(this,j)),e(this,h).removeEventListener("popoverClosed",e(this,X)))},D=new WeakMap,U=new WeakMap,j=new WeakMap,X=new WeakMap,_=function(t){e(this,h)instanceof z&&(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")))};N.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ne);exports.PopoverButtonElement=ne;exports.PopoverElement=z;
@@ -1,334 +1,342 @@
1
- var _ = (c) => {
1
+ var et = (c) => {
2
2
  throw TypeError(c);
3
3
  };
4
- var Q = (c, r, t) => r.has(c) || _("Cannot " + t);
5
- var e = (c, r, t) => (Q(c, r, "read from private field"), t ? t.call(c) : r.get(c)), i = (c, r, t) => r.has(c) ? _("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(c) : r.set(c, t), h = (c, r, t, s) => (Q(c, r, "write to private field"), s ? s.call(c, t) : r.set(c, t), t), b = (c, r, t) => (Q(c, r, "access private method"), t);
6
- import { ElementLinkedStore as ie } from "../element-linked-store/index.js";
7
- import { CSSProperty as E } from "../css-property/index.js";
8
- import { i as Z } from "../index-euf5anj6.js";
9
- import { d as j } from "../events-CsVF98U6.js";
10
- import { d as re } from "../function-C10DGppn.js";
11
- import { g as ee } from "../style-j2TwriJ_.js";
12
- import { u as oe, p as he } from "../url-B6BNcw6_.js";
13
- import { windowResizer as te } from "../window-resizer/index.js";
14
- var u, v, J, K;
15
- class ne {
4
+ var Q = (c, o, e) => o.has(c) || et("Cannot " + e);
5
+ var t = (c, o, e) => (Q(c, o, "read from private field"), e ? e.call(c) : o.get(c)), r = (c, o, e) => o.has(c) ? et("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(c) : o.set(c, e), h = (c, o, e, s) => (Q(c, o, "write to private field"), s ? s.call(c, e) : o.set(c, e), e), y = (c, o, e) => (Q(c, o, "access private method"), e);
6
+ import { ElementLinkedStore as ot } from "../element-linked-store/index.js";
7
+ import { CSSProperty as v } from "../css-property/index.js";
8
+ import { i as _ } from "../index-euf5anj6.js";
9
+ import { d as Y } from "../events-CsVF98U6.js";
10
+ import { d as ht } from "../function-C10DGppn.js";
11
+ import { g as st } from "../style-j2TwriJ_.js";
12
+ import { u as nt, p as ct } from "../url-B6BNcw6_.js";
13
+ import { windowResizer as it } from "../window-resizer/index.js";
14
+ import { viewport as j } from "../device/index.js";
15
+ var u, b, J, K;
16
+ class lt {
16
17
  constructor() {
17
- i(this, u, /* @__PURE__ */ new Map());
18
- i(this, v, []);
19
- i(this, J, (r) => {
18
+ r(this, u, /* @__PURE__ */ new Map());
19
+ r(this, b, []);
20
+ r(this, J, (o) => {
20
21
  var s;
21
- const t = [...e(this, v)].reverse().find((o) => o.clickOutside.current);
22
- if (t) {
23
- const o = r.composedPath();
24
- if (o.find(
25
- (N) => N instanceof HTMLElement && N.hasAttribute("data-popover-content")
22
+ const e = [...t(this, b)].reverse().find((i) => i.clickOutside.current);
23
+ if (e) {
24
+ const i = o.composedPath();
25
+ if (i.find(
26
+ (tt) => tt instanceof HTMLElement && tt.hasAttribute("data-popover-content")
26
27
  ))
27
28
  return;
28
- const a = o[0], p = a instanceof Node && (t.contains(a) || ((s = t.shadowRoot) == null ? void 0 : s.contains(a))), G = a instanceof HTMLElement && a.hasAttribute("data-outside");
29
- (!p || G) && t.close();
29
+ const l = i[0], p = l instanceof Node && (e.contains(l) || ((s = e.shadowRoot) == null ? void 0 : s.contains(l))), G = l instanceof HTMLElement && l.hasAttribute("data-outside");
30
+ (!p || G) && e.close();
30
31
  }
31
32
  });
32
- i(this, K, (r) => {
33
- if (r.code === "Escape") {
34
- const t = [...e(this, v)].reverse().find((s) => s.escape.current);
35
- t && t.close();
33
+ r(this, K, (o) => {
34
+ if (o.code === "Escape") {
35
+ const e = [...t(this, b)].reverse().find((s) => s.escape.current);
36
+ e && e.close();
36
37
  }
37
38
  });
38
- addEventListener("click", e(this, J)), addEventListener("keydown", e(this, K));
39
+ addEventListener("click", t(this, J)), addEventListener("keydown", t(this, K));
39
40
  }
40
41
  get groups() {
41
- return e(this, u);
42
+ return t(this, u);
42
43
  }
43
44
  get stack() {
44
- return e(this, v);
45
+ return t(this, b);
45
46
  }
46
- add(r, t) {
47
- if (t.closeRest.current)
48
- e(this, u).forEach((o) => {
49
- o.forEach((a) => {
50
- a.close();
47
+ add(o, e) {
48
+ if (e.closeRest.current)
49
+ t(this, u).forEach((i) => {
50
+ i.forEach((l) => {
51
+ l.close();
51
52
  });
52
53
  });
53
- else if (t.closeRestInGroup.current) {
54
- let o = e(this, u).get(r);
55
- o == null || o.forEach((a) => {
56
- a.close();
54
+ else if (e.closeRestInGroup.current) {
55
+ let i = t(this, u).get(o);
56
+ i == null || i.forEach((l) => {
57
+ l.close();
57
58
  });
58
59
  }
59
- let s = e(this, u).get(r);
60
- s != null && s.length || (s = [], e(this, u).set(r, s)), e(this, v).push(t), s.push(t);
60
+ let s = t(this, u).get(o);
61
+ s != null && s.length || (s = [], t(this, u).set(o, s)), t(this, b).push(e), s.push(e);
61
62
  }
62
- remove(r, t) {
63
- if (h(this, v, e(this, v).filter((s) => s !== t)), t.closeRest.current) {
63
+ remove(o, e) {
64
+ if (h(this, b, t(this, b).filter((s) => s !== e)), e.closeRest.current) {
64
65
  let s = [];
65
- e(this, u).forEach((o) => {
66
- o.forEach((a) => s.push(a));
67
- }), e(this, u).clear(), s.forEach((o) => o.close());
68
- } else if (t.closeRestInGroup.current) {
69
- const s = e(this, u).get(r);
70
- e(this, u).delete(r), s == null || s.forEach((o) => {
71
- o.close();
66
+ t(this, u).forEach((i) => {
67
+ i.forEach((l) => s.push(l));
68
+ }), t(this, u).clear(), s.forEach((i) => i.close());
69
+ } else if (e.closeRestInGroup.current) {
70
+ const s = t(this, u).get(o);
71
+ t(this, u).delete(o), s == null || s.forEach((i) => {
72
+ i.close();
72
73
  });
73
74
  } else {
74
- let s = e(this, u).get(r);
75
- s && (s = s.filter((o) => o !== t), e(this, u).set(r, s));
75
+ let s = t(this, u).get(o);
76
+ s && (s = s.filter((i) => i !== e), t(this, u).set(o, s));
76
77
  }
77
78
  }
78
79
  }
79
- u = new WeakMap(), v = new WeakMap(), J = new WeakMap(), K = new WeakMap();
80
- var f, V, M, A, O, g, T, P, S, m, C, R, y, x, l, k, se, F, $, H, q, W;
81
- const L = class L extends HTMLElement {
80
+ u = new WeakMap(), b = new WeakMap(), J = new WeakMap(), K = new WeakMap();
81
+ var f, M, H, A, W, g, w, S, C, m, R, $, L, T, O, a, P, rt, F, V, k, q, z;
82
+ const E = class E extends HTMLElement {
82
83
  constructor() {
83
84
  super();
84
- i(this, k);
85
- i(this, f);
86
- i(this, V);
87
- i(this, M);
88
- i(this, A);
89
- i(this, O);
90
- i(this, g);
91
- i(this, T);
92
- i(this, P);
93
- i(this, S);
94
- i(this, m);
95
- i(this, C);
96
- i(this, R);
97
- i(this, y);
98
- i(this, x);
99
- i(this, l);
100
- i(this, $);
101
- i(this, H);
102
- i(this, q);
103
- i(this, W);
104
- this.urlValue = "", h(this, f, !1), h(this, g, new E(this, "--history", !1)), h(this, T, new E(this, "--restore", !1)), h(this, P, new E(this, "--close-rest", !1)), h(this, S, new E(
85
+ r(this, P);
86
+ r(this, f);
87
+ r(this, M);
88
+ r(this, H);
89
+ r(this, A);
90
+ r(this, W);
91
+ r(this, g);
92
+ r(this, w);
93
+ r(this, S);
94
+ r(this, C);
95
+ r(this, m);
96
+ r(this, R);
97
+ r(this, $);
98
+ r(this, L);
99
+ r(this, T);
100
+ r(this, O);
101
+ r(this, a);
102
+ r(this, V);
103
+ r(this, k);
104
+ r(this, q);
105
+ r(this, z);
106
+ this.urlValue = "", h(this, f, !1), h(this, g, new v(this, "--history", !1)), h(this, w, new v(this, "--restore", !1)), h(this, S, new v(this, "--close-rest", !1)), h(this, C, new v(
105
107
  this,
106
108
  "--close-rest-in-group",
107
109
  !1
108
- )), h(this, m, new E(this, "--group", "")), h(this, C, new E(this, "--click-outside", !1)), h(this, R, new E(this, "--escape", !1)), h(this, y, !1), h(this, l, new ie(this, {
110
+ )), h(this, m, new v(this, "--group", "")), h(this, R, new v(this, "--click-outside", !1)), h(this, $, new v(this, "--escape", !1)), h(this, L, new v(this, "--check-viewport-bounds", !1)), h(this, T, !1), h(this, a, new ot(this, {
109
111
  opened: !1,
110
112
  closing: !1,
111
113
  triggered: !1,
112
114
  transitionend: !1
113
- })), h(this, $, () => {
114
- h(this, y, !1), e(this, f) && e(this, g).current && !location.search.includes(this.id) ? this.close() : !e(this, f) && e(this, g).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), h(this, y, !0);
115
- }), h(this, H, () => {
116
- this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, q).call(this);
117
- }), h(this, q, re(() => {
118
- e(this, W).call(this);
119
- }, 10)), h(this, W, () => {
120
- this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
121
- }), e(this, m).subscribe((t) => {
122
- t.previous && (L.stack.remove(t.previous, this), t.current || (document.documentElement.classList.remove(
115
+ })), h(this, V, () => {
116
+ h(this, T, !1), t(this, f) && t(this, g).current && !location.search.includes(this.id) ? this.close() : !t(this, f) && t(this, g).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), h(this, T, !0);
117
+ }), h(this, k, () => {
118
+ 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"), t(this, q).call(this);
119
+ }), h(this, q, ht(() => {
120
+ t(this, z).call(this);
121
+ }, 10)), h(this, z, () => {
122
+ if (this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px"), t(this, L).current) {
123
+ const e = this.getBoundingClientRect();
124
+ let s = 0, i = 0;
125
+ e.right > j.width ? s = j.width - e.right : e.left < 0 && (s = e.left * -1), e.bottom > j.height ? i = j.height - e.bottom : e.top < 0 && (i = e.top * -1), this.style.setProperty("--viewport-offset-x", s + "px"), this.style.setProperty("--viewport-offset-y", i + "px");
126
+ }
127
+ }), t(this, m).subscribe((e) => {
128
+ e.previous && (E.stack.remove(e.previous, this), e.current || (document.documentElement.classList.remove(
123
129
  `${this.group.previous}-closing`
124
130
  ), document.documentElement.classList.remove(
125
131
  `${this.group.previous}-opened`
126
132
  )));
127
- }), e(this, l).subscribe((t) => {
133
+ }), t(this, a).subscribe((e) => {
128
134
  if (this.group.current) {
129
135
  document.documentElement.classList.toggle(
130
136
  `${this.group.current}-closing`,
131
- t.current.closing
137
+ e.current.closing
132
138
  );
133
- const s = L.stack.groups.get(this.group.current), o = s == null ? void 0 : s.find((a) => a.opened);
139
+ const s = E.stack.groups.get(this.group.current), i = s == null ? void 0 : s.find((l) => l.opened);
134
140
  document.documentElement.classList.toggle(
135
141
  `${this.group.current}-opened`,
136
- !!o
142
+ !!i
137
143
  );
138
144
  }
139
145
  });
140
146
  }
141
147
  get history() {
142
- return e(this, g);
148
+ return t(this, g);
143
149
  }
144
150
  get restore() {
145
- return e(this, T);
151
+ return t(this, w);
146
152
  }
147
153
  get closeRest() {
148
- return e(this, P);
154
+ return t(this, S);
149
155
  }
150
156
  get closeRestInGroup() {
151
- return e(this, S);
157
+ return t(this, C);
152
158
  }
153
159
  get group() {
154
- return e(this, m);
160
+ return t(this, m);
155
161
  }
156
162
  get clickOutside() {
157
- return e(this, C);
163
+ return t(this, R);
158
164
  }
159
165
  get escape() {
160
- return e(this, R);
166
+ return t(this, $);
161
167
  }
162
168
  get opened() {
163
- return e(this, f);
169
+ return t(this, f);
164
170
  }
165
171
  get lastTrigger() {
166
- return e(this, x);
172
+ return t(this, O);
167
173
  }
168
174
  get idWithValue() {
169
175
  return `${this.id}${this.urlValue ? "=" + this.urlValue : ""}`;
170
176
  }
171
- updateUrlValue(t) {
172
- this.urlValue = (t == null ? void 0 : t.toString()) || "", e(this, f) && oe(this.id, t);
177
+ updateUrlValue(e) {
178
+ this.urlValue = (e == null ? void 0 : e.toString()) || "", t(this, f) && nt(this.id, e);
173
179
  }
174
- open(t) {
175
- if (e(this, f))
180
+ open(e) {
181
+ if (t(this, f))
176
182
  return;
177
- h(this, x, t == null ? void 0 : t.trigger), clearTimeout(e(this, V)), clearTimeout(e(this, M)), e(this, l).set("closing", !1), e(this, l).set("triggered", !0), j(this, "popoverTriggered", {
183
+ h(this, O, e == null ? void 0 : e.trigger), clearTimeout(t(this, M)), clearTimeout(t(this, H)), t(this, a).set("closing", !1), t(this, a).set("triggered", !0), Y(this, "popoverTriggered", {
178
184
  custom: !0,
179
185
  detail: {
180
- trigger: e(this, x)
186
+ trigger: t(this, O)
181
187
  }
182
- }), e(this, g).current && e(this, y) && history.pushState(history.state, "", e(this, k, se)), h(this, f, !0);
188
+ }), t(this, g).current && t(this, T) && history.pushState(history.state, "", t(this, P, rt)), h(this, f, !0);
183
189
  const s = () => {
184
- L.stack.add(e(this, m).current, this), e(this, W).call(this), e(this, l).set("opened", !0), j(this, "popoverOpened", {
190
+ E.stack.add(t(this, m).current, this), t(this, k).call(this), t(this, a).set("opened", !0), Y(this, "popoverOpened", {
185
191
  custom: !0,
186
192
  detail: {
187
- trigger: e(this, x)
193
+ trigger: t(this, O)
188
194
  }
189
- }), h(this, A, void 0), h(this, O, setTimeout(() => {
190
- e(this, l).set("transitionend", !0);
191
- }, ee(this) + 10));
195
+ }), h(this, A, void 0), h(this, W, setTimeout(() => {
196
+ t(this, a).set("transitionend", !0);
197
+ }, st(this) + 10));
192
198
  };
193
- t != null && t.skipTransition ? s() : h(this, A, setTimeout(s, 10));
199
+ e != null && e.skipTransition ? s() : h(this, A, setTimeout(s, 10));
194
200
  }
195
201
  close() {
196
- e(this, f) && (clearTimeout(e(this, A)), clearTimeout(e(this, O)), L.stack.remove(e(this, m).current, this), h(this, f, !1), b(this, k, F).call(this), e(this, l).set("transitionend", !1), h(this, V, setTimeout(() => {
197
- e(this, l).set("opened", !1), e(this, l).set("closing", !0), j(this, "popoverClosing", {
202
+ t(this, f) && (clearTimeout(t(this, A)), clearTimeout(t(this, W)), E.stack.remove(t(this, m).current, this), h(this, f, !1), y(this, P, F).call(this), t(this, a).set("transitionend", !1), h(this, M, setTimeout(() => {
203
+ t(this, a).set("opened", !1), t(this, a).set("closing", !0), Y(this, "popoverClosing", {
198
204
  custom: !0
199
- }), h(this, M, setTimeout(() => {
200
- e(this, l).set("triggered", !1), e(this, l).set("closing", !1), j(this, "popoverClosed", {
205
+ }), h(this, H, setTimeout(() => {
206
+ t(this, a).set("triggered", !1), t(this, a).set("closing", !1), Y(this, "popoverClosed", {
201
207
  custom: !0
202
208
  });
203
- }, ee(this) + 10));
209
+ }, st(this) + 10));
204
210
  }, 10)));
205
211
  }
206
212
  connectedCallback() {
207
- e(this, g).observe(), e(this, T).observe(), e(this, P).observe(), e(this, S).observe(), e(this, m).observe(), e(this, C).observe(), e(this, R).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", e(this, $)), setTimeout(() => {
208
- e(this, T).current ? (this.urlValue = he(location.search)[this.id], e(this, $).call(this)) : (b(this, k, F).call(this), h(this, y, !0));
209
- }, 0), te.subscribe(e(this, H));
213
+ t(this, g).observe(), t(this, w).observe(), t(this, S).observe(), t(this, C).observe(), t(this, m).observe(), t(this, R).observe(), t(this, $).observe(), t(this, L).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", t(this, V)), setTimeout(() => {
214
+ t(this, w).current ? (this.urlValue = ct(location.search)[this.id], t(this, V).call(this)) : (y(this, P, F).call(this), h(this, T, !0));
215
+ }, 0), t(this, L).subscribe(() => {
216
+ t(this, k).call(this);
217
+ }), it.subscribe(t(this, k));
210
218
  }
211
219
  disconnectedCallback() {
212
- L.stack.remove(e(this, m).current, this), te.unsubscribe(e(this, H)), e(this, l).close(), e(this, g).close(), e(this, T).close(), e(this, P).close(), e(this, S).close(), e(this, m).close(), e(this, C).close(), e(this, R).close(), this.removeAttribute("role"), clearTimeout(e(this, V)), clearTimeout(e(this, M)), clearTimeout(e(this, A)), clearTimeout(e(this, O)), removeEventListener("popstate", e(this, $)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), b(this, k, F).call(this);
220
+ E.stack.remove(t(this, m).current, this), it.unsubscribe(t(this, k)), t(this, a).close(), t(this, g).close(), t(this, w).close(), t(this, S).close(), t(this, C).close(), t(this, m).close(), t(this, R).close(), t(this, $).close(), t(this, L).close(), this.removeAttribute("role"), clearTimeout(t(this, M)), clearTimeout(t(this, H)), clearTimeout(t(this, A)), clearTimeout(t(this, W)), removeEventListener("popstate", t(this, V)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), this.style.removeProperty("--viewport-offset-x"), this.style.removeProperty("--viewport-offset-y"), y(this, P, F).call(this);
213
221
  }
214
222
  };
215
- f = new WeakMap(), V = new WeakMap(), M = new WeakMap(), A = new WeakMap(), O = new WeakMap(), g = new WeakMap(), T = new WeakMap(), P = new WeakMap(), S = new WeakMap(), m = new WeakMap(), C = new WeakMap(), R = new WeakMap(), y = new WeakMap(), x = new WeakMap(), l = new WeakMap(), k = new WeakSet(), se = function() {
223
+ f = new WeakMap(), M = new WeakMap(), H = new WeakMap(), A = new WeakMap(), W = new WeakMap(), g = new WeakMap(), w = new WeakMap(), S = new WeakMap(), C = new WeakMap(), m = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), L = new WeakMap(), T = new WeakMap(), O = new WeakMap(), a = new WeakMap(), P = new WeakSet(), rt = function() {
216
224
  return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
217
225
  }, F = function() {
218
- if (e(this, g).current) {
219
- const t = new URL(location.href);
220
- t.searchParams.delete(this.id), history.replaceState(history.state, "", t.href);
226
+ if (t(this, g).current) {
227
+ const e = new URL(location.href);
228
+ e.searchParams.delete(this.id), history.replaceState(history.state, "", e.href);
221
229
  }
222
- }, $ = new WeakMap(), H = new WeakMap(), q = new WeakMap(), W = new WeakMap(), L.stack = new ne();
223
- let I = L;
224
- Z && !customElements.get("e-popover") && customElements.define("e-popover", I);
225
- var n, d, w, X, z, B, U, D, Y;
226
- class ce extends HTMLElement {
230
+ }, V = new WeakMap(), k = new WeakMap(), q = new WeakMap(), z = new WeakMap(), E.stack = new lt();
231
+ let I = E;
232
+ _ && !customElements.get("e-popover") && customElements.define("e-popover", I);
233
+ var n, d, x, Z, B, U, D, X, N;
234
+ class at extends HTMLElement {
227
235
  constructor() {
228
236
  super();
229
- i(this, w);
230
- i(this, n);
231
- i(this, d, new E(this, "--type", "open"));
232
- i(this, z, () => {
233
- e(this, d).current !== "close" && this.classList.add("triggered");
237
+ r(this, x);
238
+ r(this, n);
239
+ r(this, d, new v(this, "--type", "open"));
240
+ r(this, B, () => {
241
+ t(this, d).current !== "close" && this.classList.add("triggered");
234
242
  });
235
- i(this, B, () => {
236
- e(this, d).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
243
+ r(this, U, () => {
244
+ t(this, d).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
237
245
  });
238
- i(this, U, () => {
239
- e(this, d).current !== "close" && this.classList.remove("opened");
246
+ r(this, D, () => {
247
+ t(this, d).current !== "close" && this.classList.remove("opened");
240
248
  });
241
- i(this, D, () => {
242
- e(this, d).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
249
+ r(this, X, () => {
250
+ t(this, d).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
243
251
  });
244
- Z && (this.addEventListener("click", () => {
245
- if (e(this, n)) {
246
- const t = e(this, d).current;
247
- t === "open" || t === "toggle" && !e(this, n).opened ? e(this, n).open({ trigger: this }) : (t === "close" || t === "toggle" && e(this, n).opened) && e(this, n).close();
252
+ _ && (this.addEventListener("click", () => {
253
+ if (t(this, n)) {
254
+ const e = t(this, d).current;
255
+ e === "open" || e === "toggle" && !t(this, n).opened ? t(this, n).open({ trigger: this }) : (e === "close" || e === "toggle" && t(this, n).opened) && t(this, n).close();
248
256
  }
249
- }), this.addEventListener("keydown", (t) => {
250
- t.code === "Space" && t.currentTarget.click();
257
+ }), this.addEventListener("keydown", (e) => {
258
+ e.code === "Space" && e.currentTarget.click();
251
259
  }));
252
260
  }
253
261
  get type() {
254
- return e(this, d);
262
+ return t(this, d);
255
263
  }
256
264
  get popoverElement() {
257
- return e(this, n);
265
+ return t(this, n);
258
266
  }
259
- changePopover(t) {
267
+ changePopover(e) {
260
268
  var s;
261
- if (b(this, w, X).call(this), t) {
262
- let o = null;
263
- if (t === "parent") {
264
- const a = this.closest("[data-popover]");
265
- if (a)
266
- o = a;
269
+ if (y(this, x, Z).call(this), e) {
270
+ let i = null;
271
+ if (e === "parent") {
272
+ const l = this.closest("[data-popover]");
273
+ if (l)
274
+ i = l;
267
275
  else {
268
276
  const p = this.getRootNode();
269
- p instanceof ShadowRoot ? o = p.host.closest("[data-popover]") : p instanceof HTMLElement && (o = p.closest("[data-popover]"));
277
+ p instanceof ShadowRoot ? i = p.host.closest("[data-popover]") : p instanceof HTMLElement && (i = p.closest("[data-popover]"));
270
278
  }
271
- } else if (t === "sibling")
272
- o = (s = this.parentElement) == null ? void 0 : s.querySelector("[data-popover]");
273
- else if (t === "ancestor-child") {
274
- const a = (p) => {
279
+ } else if (e === "sibling")
280
+ i = (s = this.parentElement) == null ? void 0 : s.querySelector("[data-popover]");
281
+ else if (e === "ancestor-child") {
282
+ const l = (p) => {
275
283
  if (!p)
276
284
  return null;
277
285
  let G = p.querySelector("[data-popover]");
278
- return !G && (p != null && p.parentElement) && (G = a(p.parentElement)), G;
286
+ return !G && (p != null && p.parentElement) && (G = l(p.parentElement)), G;
279
287
  };
280
- o = a(this.parentElement) || null;
288
+ i = l(this.parentElement) || null;
281
289
  } else
282
- !t.startsWith(".") && !t.startsWith("[") && (t = `#${t}`), o = document.querySelector(t) || this.getRootNode().querySelector(t);
283
- o instanceof HTMLElement ? (h(this, n, o), e(this, n).addEventListener(
290
+ !e.startsWith(".") && !e.startsWith("[") && (e = `#${e}`), i = document.querySelector(e) || this.getRootNode().querySelector(e);
291
+ i instanceof HTMLElement ? (h(this, n, i), t(this, n).addEventListener(
284
292
  "popoverTriggered",
285
- e(this, z)
286
- ), e(this, n).addEventListener(
293
+ t(this, B)
294
+ ), t(this, n).addEventListener(
287
295
  "popoverOpened",
288
- e(this, B)
289
- ), e(this, n).addEventListener(
296
+ t(this, U)
297
+ ), t(this, n).addEventListener(
290
298
  "popoverClosing",
291
- e(this, U)
292
- ), e(this, n).addEventListener(
299
+ t(this, D)
300
+ ), t(this, n).addEventListener(
293
301
  "popoverClosed",
294
- e(this, D)
295
- )) : console.warn(this, `target ${t} not found`);
302
+ t(this, X)
303
+ )) : console.warn(this, `target ${e} not found`);
296
304
  }
297
- b(this, w, Y).call(this, e(this, d).current);
305
+ y(this, x, N).call(this, t(this, d).current);
298
306
  }
299
307
  connectedCallback() {
300
- e(this, d).subscribe((s) => {
301
- b(this, w, Y).call(this, s.current);
308
+ t(this, d).subscribe((s) => {
309
+ y(this, x, N).call(this, s.current);
302
310
  }), this.hasAttribute("tabindex") || (this.tabIndex = 0);
303
- const t = this.getAttribute("target");
304
- t && this.changePopover(t), this.isConnected && e(this, d).observe();
311
+ const e = this.getAttribute("target");
312
+ e && this.changePopover(e), this.isConnected && t(this, d).observe();
305
313
  }
306
314
  disconnectedCallback() {
307
- e(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), b(this, w, X).call(this);
315
+ t(this, d).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), y(this, x, Z).call(this);
308
316
  }
309
317
  }
310
- n = new WeakMap(), d = new WeakMap(), w = new WeakSet(), X = function() {
311
- e(this, n) && (e(this, n).removeEventListener(
318
+ n = new WeakMap(), d = new WeakMap(), x = new WeakSet(), Z = function() {
319
+ t(this, n) && (t(this, n).removeEventListener(
312
320
  "popoverTriggered",
313
- e(this, z)
314
- ), e(this, n).removeEventListener(
321
+ t(this, B)
322
+ ), t(this, n).removeEventListener(
315
323
  "popoverOpened",
316
- e(this, B)
317
- ), e(this, n).removeEventListener(
324
+ t(this, U)
325
+ ), t(this, n).removeEventListener(
318
326
  "popoverClosing",
319
- e(this, U)
320
- ), e(this, n).removeEventListener(
327
+ t(this, D)
328
+ ), t(this, n).removeEventListener(
321
329
  "popoverClosed",
322
- e(this, D)
330
+ t(this, X)
323
331
  ));
324
- }, z = new WeakMap(), B = new WeakMap(), U = new WeakMap(), D = new WeakMap(), Y = function(t) {
325
- e(this, n) instanceof I && (t !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
332
+ }, B = new WeakMap(), U = new WeakMap(), D = new WeakMap(), X = new WeakMap(), N = function(e) {
333
+ t(this, n) instanceof I && (e !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
326
334
  "aria-expanded",
327
- e(this, n).opened ? "true" : "false"
328
- ), this.setAttribute("aria-controls", e(this, n).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
335
+ t(this, n).opened ? "true" : "false"
336
+ ), this.setAttribute("aria-controls", t(this, n).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
329
337
  };
330
- Z && !customElements.get("e-popover-button") && customElements.define("e-popover-button", ce);
338
+ _ && !customElements.get("e-popover-button") && customElements.define("e-popover-button", at);
331
339
  export {
332
- ce as PopoverButtonElement,
340
+ at as PopoverButtonElement,
333
341
  I as PopoverElement
334
342
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.59.0",
3
+ "version": "0.59.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"