aptechka 0.39.11 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var at=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s),ot=s=>{throw TypeError(s)};var V=(s,t,i)=>t.has(s)||ot("Cannot "+i);var e=(s,t,i)=>(V(s,t,"read from private field"),i?i.call(s):t.get(s)),r=(s,t,i)=>t.has(s)?ot("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),c=(s,t,i,n)=>(V(s,t,"write to private field"),n?n.call(s,i):t.set(s,i),i),b=(s,t,i)=>(V(s,t,"access private method"),i);var N=(s,t,i)=>new Promise((n,l)=>{var u=m=>{try{g(i.next(m))}catch(w){l(w)}},o=m=>{try{g(i.throw(m))}catch(w){l(w)}},g=m=>m.done?n(m.value):Promise.resolve(m.value).then(u,o);g((i=i.apply(s,t)).next())});var ht=(s,t,i)=>(t=s[at("asyncIterator")])?t.call(s):(s=s[at("iterator")](),t={},i=(n,l)=>(l=s[n])&&(t[n]=u=>new Promise((o,g,m)=>(u=l.call(s,u),m=u.done,Promise.resolve(u.value).then(w=>o({value:w,done:m}),g)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ct=require("../notifier/index.cjs"),gt=require("../browser-CpzFX2xg.cjs"),K=require("../url-DELd-VFC.cjs"),lt=require("../loading/index.cjs");var A,h,f,T,S,M,C,k;class ut{constructor(t,i){r(this,A);r(this,h);r(this,f);r(this,T);r(this,S);r(this,M);r(this,C,t=>{t.preventDefault(),e(this,A).links.forEach(i=>{var n;e(this,f)===e(i,f)||(n=e(i,M))!=null&&n.includes(e(this,f))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,A).navigate(e(this,f),{historyAction:e(this,T),state:e(this,S)})});r(this,k,()=>{e(this,A).prefetch(e(this,f)),e(this,h).removeEventListener("pointerenter",e(this,k))});var u,o;c(this,A,i),c(this,h,t),c(this,f,e(this,h).getAttribute("href")||"/"),c(this,T,e(this,h).getAttribute("data-history-action")||"push"),c(this,S,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,C));const n=i.normalizePath(e(this,f)),l=i.normalizePath(location.pathname);c(this,M,(u=e(this,h).getAttribute("data-match-paths"))==null?void 0:u.split(",").map(g=>i.normalizePath(g.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(n.pathname)&&e(this,h).classList.add("current"):n.pathname===l.pathname||(o=e(this,M))!=null&&o.includes(l.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,k))}destroy(){e(this,h).removeEventListener("click",e(this,C)),e(this,h).removeEventListener("pointerenter",e(this,k)),e(this,h).classList.remove("current")}}A=new WeakMap,h=new WeakMap,f=new WeakMap,T=new WeakMap,S=new WeakMap,M=new WeakMap,C=new WeakMap,k=new WeakMap;var z,q,x,_,y,Y,P,L,p,D,R,F,I,d,X,Z,dt,$,G;class Et{constructor(t){r(this,d);r(this,z,null);r(this,q,null);r(this,x,null);r(this,_,null);r(this,y,[]);r(this,Y,new DOMParser);r(this,P,new Map);r(this,L);r(this,p,null);r(this,D);r(this,R);r(this,F,new ct.Notifier);r(this,I,new ct.Notifier);r(this,G,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(gt.isBrowser){c(this,z,K.normalizeBase(t==null?void 0:t.base)),c(this,q,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,x,(t==null?void 0:t.cachePages)!==!1),c(this,_,b(this,d,Z).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,p,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,p)),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),addEventListener("popstate",e(this,G)),K.changeHistory("replace",e(this,p),i.parameters,i.hash)}}get currentPathname(){return e(this,p)}get previousPathname(){return e(this,D)}get currentState(){return e(this,R)}get links(){return e(this,y)}normalizePath(t){return K.splitPath(t,e(this,z))}beforeNavigationEvent(t){return e(this,F).subscribe(t)}afterNavigationEvent(t){return e(this,I).subscribe(t)}prefetch(t){return N(this,null,function*(){const i=this.normalizePath(t);return b(this,d,X).call(this,i.pathname)})}navigate(l){return N(this,arguments,function*(t,{historyAction:i="push",state:n}={}){var tt;const u=this.normalizePath(t);let{pathname:o,hash:g,parameters:m,leaf:w}=u;if(e(this,L)===o||e(this,p)===o)return;c(this,R,n),c(this,L,o);const O=e(this,P).has(o);try{lt.loading.add("__morph");let B=!0;if(e(this,F).notify({pathname:o,isCached:O,state:n}),this.preprocessor)try{yield new Promise((a,E)=>{var v;(v=this.preprocessor)==null||v.call(this,{pathname:o,resolve:a,reject:E,isCached:O,state:n})})}catch(a){a?console.error(a):console.log("Route change canceled"),B=!1}if(!B||e(this,L)!==o)return;const et=e(this,P).get(o)||(yield b(this,d,X).call(this,o));if(e(this,L)!==o)return;const it=Array.from(document.head.children),st=Array.from(et.head.cloneNode(!0).children),nt=b(this,d,dt).call(this,it,st),mt=b(this,d,$).call(this,it,nt),W=b(this,d,$).call(this,st,nt);W.forEach((a,E)=>{if(a.tagName==="SCRIPT"&&a.getAttribute("src")){const v=document.createElement("script");v.type="module",v.src=a.getAttribute("src"),W[E]=v}}),W.forEach(a=>{document.head.appendChild(a)});const J=W.filter(a=>(a.tagName==="STYLE"||a.tagName==="SCRIPT"||a.tagName==="LINK")&&a.getAttribute("rel")!=="canonical");e(this,q)&&J.length&&(yield new Promise(a=>N(this,null,function*(){let E=0;try{for(var v=ht(J),pt,Q,j;pt=!(Q=yield v.next()).done;pt=!1){const H=Q.value;H.onload=()=>{E++,E===J.length&&a()}}}catch(Q){j=[Q]}finally{try{pt&&(Q=v.return)&&(yield Q.call(v))}finally{if(j)throw j[0]}}}))),mt.forEach(a=>{a.hasAttribute("data-permanent")||a.remove()}),c(this,D,e(this,p)),c(this,p,o),K.changeHistory(i,o,m,g);const ft=b(this,d,Z).call(this,et.body.cloneNode(!0));e(this,_).forEach((a,E)=>{const v=ft[E];let pt=[...a.childNodes],Q=[...v.childNodes];pt.forEach(j=>{if(j instanceof HTMLElement){const H=j.getAttribute("data-remain");let rt;Q=Q.filter(U=>U instanceof HTMLElement&&H&&U.getAttribute("data-remain")===H?(rt=U,!1):!0),H&&rt||j.remove()}else j.remove()}),a.append(...Q)}),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",o),document.documentElement.setAttribute("data-current-leaf",w),(tt=this.postprocessor)==null||tt.call(this,{pathname:o,isCached:O,state:n}),e(this,I).notify({pathname:o,isCached:O,state:n}),lt.loading.complete("__morph")}catch(B){console.error(B)}c(this,L,void 0)})}addLinks(t){t.forEach(i=>{e(this,y).push(new ut(i,this))})}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var n;return((n=i.getAttribute("href"))==null?void 0:n.startsWith("/"))&&!i.hasAttribute("download")&&!i.hasAttribute("data-morph-skip")});e(this,y).forEach(i=>i.destroy()),c(this,y,t.map(i=>new ut(i,this)))}}z=new WeakMap,q=new WeakMap,x=new WeakMap,_=new WeakMap,y=new WeakMap,Y=new WeakMap,P=new WeakMap,L=new WeakMap,p=new WeakMap,D=new WeakMap,R=new WeakMap,F=new WeakMap,I=new WeakMap,d=new WeakSet,X=function(t){return N(this,null,function*(){const i=e(this,P).get(t);if(i)return i;const l=yield(yield fetch(t)).text(),u=e(this,Y).parseFromString(l,"text/html");return e(this,x)&&e(this,P).set(t,u),u})},Z=function(t){return[...t.querySelectorAll("[data-morph]")]},dt=function(t,i){return t.filter(n=>i.find(l=>l.outerHTML===n.outerHTML))},$=function(t,i){return t.filter(n=>!i.find(l=>l.outerHTML===n.outerHTML))},G=new WeakMap;exports.Morph=Et;
1
+ "use strict";var at=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s),ot=s=>{throw TypeError(s)};var V=(s,t,i)=>t.has(s)||ot("Cannot "+i);var e=(s,t,i)=>(V(s,t,"read from private field"),i?i.call(s):t.get(s)),r=(s,t,i)=>t.has(s)?ot("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),c=(s,t,i,n)=>(V(s,t,"write to private field"),n?n.call(s,i):t.set(s,i),i),b=(s,t,i)=>(V(s,t,"access private method"),i);var N=(s,t,i)=>new Promise((n,l)=>{var u=m=>{try{g(i.next(m))}catch(w){l(w)}},o=m=>{try{g(i.throw(m))}catch(w){l(w)}},g=m=>m.done?n(m.value):Promise.resolve(m.value).then(u,o);g((i=i.apply(s,t)).next())});var ht=(s,t,i)=>(t=s[at("asyncIterator")])?t.call(s):(s=s[at("iterator")](),t={},i=(n,l)=>(l=s[n])&&(t[n]=u=>new Promise((o,g,m)=>(u=l.call(s,u),m=u.done,Promise.resolve(u.value).then(w=>o({value:w,done:m}),g)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ct=require("../notifier/index.cjs"),gt=require("../browser-CpzFX2xg.cjs"),K=require("../url-BiHPIsKq.cjs"),lt=require("../loading/index.cjs");var A,h,f,T,S,M,C,k;class ut{constructor(t,i){r(this,A);r(this,h);r(this,f);r(this,T);r(this,S);r(this,M);r(this,C,t=>{t.preventDefault(),e(this,A).links.forEach(i=>{var n;e(this,f)===e(i,f)||(n=e(i,M))!=null&&n.includes(e(this,f))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,A).navigate(e(this,f),{historyAction:e(this,T),state:e(this,S)})});r(this,k,()=>{e(this,A).prefetch(e(this,f)),e(this,h).removeEventListener("pointerenter",e(this,k))});var u,o;c(this,A,i),c(this,h,t),c(this,f,e(this,h).getAttribute("href")||"/"),c(this,T,e(this,h).getAttribute("data-history-action")||"push"),c(this,S,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,C));const n=i.normalizePath(e(this,f)),l=i.normalizePath(location.pathname);c(this,M,(u=e(this,h).getAttribute("data-match-paths"))==null?void 0:u.split(",").map(g=>i.normalizePath(g.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(n.pathname)&&e(this,h).classList.add("current"):n.pathname===l.pathname||(o=e(this,M))!=null&&o.includes(l.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,k))}destroy(){e(this,h).removeEventListener("click",e(this,C)),e(this,h).removeEventListener("pointerenter",e(this,k)),e(this,h).classList.remove("current")}}A=new WeakMap,h=new WeakMap,f=new WeakMap,T=new WeakMap,S=new WeakMap,M=new WeakMap,C=new WeakMap,k=new WeakMap;var z,q,x,_,y,Y,P,L,p,D,R,F,I,d,X,Z,dt,$,G;class Et{constructor(t){r(this,d);r(this,z,null);r(this,q,null);r(this,x,null);r(this,_,null);r(this,y,[]);r(this,Y,new DOMParser);r(this,P,new Map);r(this,L);r(this,p,null);r(this,D);r(this,R);r(this,F,new ct.Notifier);r(this,I,new ct.Notifier);r(this,G,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(gt.isBrowser){c(this,z,K.normalizeBase(t==null?void 0:t.base)),c(this,q,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,x,(t==null?void 0:t.cachePages)!==!1),c(this,_,b(this,d,Z).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,p,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,p)),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),addEventListener("popstate",e(this,G)),K.changeHistory("replace",e(this,p),i.parameters,i.hash)}}get currentPathname(){return e(this,p)}get previousPathname(){return e(this,D)}get currentState(){return e(this,R)}get links(){return e(this,y)}normalizePath(t){return K.splitPath(t,e(this,z))}beforeNavigationEvent(t){return e(this,F).subscribe(t)}afterNavigationEvent(t){return e(this,I).subscribe(t)}prefetch(t){return N(this,null,function*(){const i=this.normalizePath(t);return b(this,d,X).call(this,i.pathname)})}navigate(l){return N(this,arguments,function*(t,{historyAction:i="push",state:n}={}){var tt;const u=this.normalizePath(t);let{pathname:o,hash:g,parameters:m,leaf:w}=u;if(e(this,L)===o||e(this,p)===o)return;c(this,R,n),c(this,L,o);const O=e(this,P).has(o);try{lt.loading.add("__morph");let B=!0;if(e(this,F).notify({pathname:o,isCached:O,state:n}),this.preprocessor)try{yield new Promise((a,E)=>{var v;(v=this.preprocessor)==null||v.call(this,{pathname:o,resolve:a,reject:E,isCached:O,state:n})})}catch(a){a?console.error(a):console.log("Route change canceled"),B=!1}if(!B||e(this,L)!==o)return;const et=e(this,P).get(o)||(yield b(this,d,X).call(this,o));if(e(this,L)!==o)return;const it=Array.from(document.head.children),st=Array.from(et.head.cloneNode(!0).children),nt=b(this,d,dt).call(this,it,st),mt=b(this,d,$).call(this,it,nt),W=b(this,d,$).call(this,st,nt);W.forEach((a,E)=>{if(a.tagName==="SCRIPT"&&a.getAttribute("src")){const v=document.createElement("script");v.type="module",v.src=a.getAttribute("src"),W[E]=v}}),W.forEach(a=>{document.head.appendChild(a)});const J=W.filter(a=>(a.tagName==="STYLE"||a.tagName==="SCRIPT"||a.tagName==="LINK")&&a.getAttribute("rel")!=="canonical");e(this,q)&&J.length&&(yield new Promise(a=>N(this,null,function*(){let E=0;try{for(var v=ht(J),pt,Q,j;pt=!(Q=yield v.next()).done;pt=!1){const H=Q.value;H.onload=()=>{E++,E===J.length&&a()}}}catch(Q){j=[Q]}finally{try{pt&&(Q=v.return)&&(yield Q.call(v))}finally{if(j)throw j[0]}}}))),mt.forEach(a=>{a.hasAttribute("data-permanent")||a.remove()}),c(this,D,e(this,p)),c(this,p,o),K.changeHistory(i,o,m,g);const ft=b(this,d,Z).call(this,et.body.cloneNode(!0));e(this,_).forEach((a,E)=>{const v=ft[E];let pt=[...a.childNodes],Q=[...v.childNodes];pt.forEach(j=>{if(j instanceof HTMLElement){const H=j.getAttribute("data-remain");let rt;Q=Q.filter(U=>U instanceof HTMLElement&&H&&U.getAttribute("data-remain")===H?(rt=U,!1):!0),H&&rt||j.remove()}else j.remove()}),a.append(...Q)}),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",o),document.documentElement.setAttribute("data-current-leaf",w),(tt=this.postprocessor)==null||tt.call(this,{pathname:o,isCached:O,state:n}),e(this,I).notify({pathname:o,isCached:O,state:n}),lt.loading.complete("__morph")}catch(B){console.error(B)}c(this,L,void 0)})}addLinks(t){t.forEach(i=>{e(this,y).push(new ut(i,this))})}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var n;return((n=i.getAttribute("href"))==null?void 0:n.startsWith("/"))&&!i.hasAttribute("download")&&!i.hasAttribute("data-morph-skip")});e(this,y).forEach(i=>i.destroy()),c(this,y,t.map(i=>new ut(i,this)))}}z=new WeakMap,q=new WeakMap,x=new WeakMap,_=new WeakMap,y=new WeakMap,Y=new WeakMap,P=new WeakMap,L=new WeakMap,p=new WeakMap,D=new WeakMap,R=new WeakMap,F=new WeakMap,I=new WeakMap,d=new WeakSet,X=function(t){return N(this,null,function*(){const i=e(this,P).get(t);if(i)return i;const l=yield(yield fetch(t)).text(),u=e(this,Y).parseFromString(l,"text/html");return e(this,x)&&e(this,P).set(t,u),u})},Z=function(t){return[...t.querySelectorAll("[data-morph]")]},dt=function(t,i){return t.filter(n=>i.find(l=>l.outerHTML===n.outerHTML))},$=function(t,i){return t.filter(n=>!i.find(l=>l.outerHTML===n.outerHTML))},G=new WeakMap;exports.Morph=Et;
@@ -22,7 +22,7 @@ var N = (s, t, i) => new Promise((n, l) => {
22
22
  var ht = (s, t, i) => (t = s[rt("asyncIterator")]) ? t.call(s) : (s = s[rt("iterator")](), t = {}, i = (n, l) => (l = s[n]) && (t[n] = (u) => new Promise((h, g, m) => (u = l.call(s, u), m = u.done, Promise.resolve(u.value).then((A) => h({ value: A, done: m }), g)))), i("next"), i("return"), t);
23
23
  import { Notifier as ot } from "../notifier/index.js";
24
24
  import { i as gt } from "../browser-0zX67oeU.js";
25
- import { n as Et, c as ct, s as vt } from "../url-BnTGHSgP.js";
25
+ import { n as Et, c as ct, s as vt } from "../url-B5eH5z6S.js";
26
26
  import { loading as lt } from "../loading/index.js";
27
27
  var w, o, f, T, C, k, S, H;
28
28
  class ut {
@@ -14,6 +14,7 @@ export interface PopoverEvents {
14
14
  export declare class PopoverElement extends HTMLElement {
15
15
  #private;
16
16
  private static __opened;
17
+ urlValue: string;
17
18
  get history(): CSSProperty<false>;
18
19
  get restore(): CSSProperty<false>;
19
20
  get dominance(): CSSProperty<0>;
@@ -22,6 +23,8 @@ export declare class PopoverElement extends HTMLElement {
22
23
  get escape(): CSSProperty<false>;
23
24
  get opened(): Store<boolean>;
24
25
  get lastTrigger(): any;
26
+ get idWithValue(): string;
27
+ updateUrlValue(value?: string | number): void;
25
28
  open: (options?: {
26
29
  skipTransition?: boolean;
27
30
  trigger?: any;
@@ -1 +1 @@
1
- "use strict";var G=n=>{throw TypeError(n)};var D=(n,c,t)=>c.has(n)||G("Cannot "+t);var e=(n,c,t)=>(D(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?G("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(D(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),g=(n,c,t)=>(D(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),V=require("../Store-C2J4Q87x.cjs"),N=require("../events-KVanG9sR.cjs"),X=require("../function-MthRj-GJ.cjs"),Y=require("../style-At6aDoqG.cjs"),J=require("../window-resizer/vanilla/index.cjs"),Z=require("../browser-CpzFX2xg.cjs");var A,d,O,w,p,m,u,v,f,y,L,S,l,K,T,B,k,j,C,_,R,x,U;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,A);s(this,d);s(this,O);s(this,w);s(this,p);s(this,m);s(this,u);s(this,v);s(this,f);s(this,y);s(this,L);s(this,S);s(this,T);s(this,k);s(this,C);s(this,_);s(this,R);s(this,x);i(this,A,-1),i(this,d,new V.Store(!1)),i(this,p,new E.CSSProperty(this,"--history",!1)),i(this,m,new E.CSSProperty(this,"--restore",!1)),i(this,u,new E.CSSProperty(this,"--dominance",0)),i(this,v,new E.CSSProperty(this,"--group","")),i(this,f,new E.CSSProperty(this,"--click-outside",!1)),i(this,y,new E.CSSProperty(this,"--escape",!1)),i(this,L,!1),this.open=t=>{if(e(this,d).current)return;i(this,S,t==null?void 0:t.trigger),e(this,d).current=!0,e(this,u).current&&(a.__opened=a.__opened.filter(o=>o!==this&&g(this,l,U).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,A,a.__opened.length-1),e(this,p).current&&e(this,L)&&history.pushState(history.state,"",e(this,l,K)),clearTimeout(e(this,O)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",N.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,S)}});const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,k)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),N.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,S)}}),i(this,w,void 0)};t!=null&&t.skipTransition?h():i(this,w,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,w)&&g(this,l,U).call(this,this,t)?(t.close(),!1):!0),g(this,l,B).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.style.opacity="0",N.dispatchEvent(this,"popoverClosing",{custom:!0}),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",N.dispatchEvent(this,"popoverClosed",{custom:!0})},Y.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,f).current&&g(this,l,j).call(this,()=>{var W;const h=t.composedPath();if(h.find(F=>F instanceof HTMLElement&&F.hasAttribute("data-popover-content")))return;const o=h[0],I=o instanceof Node&&(this.contains(o)||((W=this.shadowRoot)==null?void 0:W.contains(o))),P=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!I||P)&&this.close()})}),i(this,k,t=>{e(this,y).current&&g(this,l,j).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,C,()=>{i(this,L,!1),e(this,d).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,p).current&&location.search.includes(this.id)&&this.open(),i(this,L,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,R).call(this)}),i(this,R,X.debounce(()=>{e(this,x).call(this)},10)),i(this,x,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")})}get history(){return e(this,p)}get restore(){return e(this,m)}get dominance(){return e(this,u)}get group(){return e(this,v)}get clickOutside(){return e(this,f)}get escape(){return e(this,y)}get opened(){return e(this,d)}get lastTrigger(){return e(this,S)}connectedCallback(){e(this,p).observe(),e(this,m).observe(),e(this,u).observe(),e(this,v).observe(),e(this,f).observe(),e(this,y).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,C)),setTimeout(()=>{e(this,m).current?e(this,C).call(this):(g(this,l,B).call(this),i(this,L,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,p).close(),e(this,m).close(),e(this,u).close(),e(this,v).close(),e(this,f).close(),e(this,y).close(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,O)),clearTimeout(e(this,w)),removeEventListener("popstate",e(this,C)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),g(this,l,B).call(this)}};A=new WeakMap,d=new WeakMap,O=new WeakMap,w=new WeakMap,p=new WeakMap,m=new WeakMap,u=new WeakMap,v=new WeakMap,f=new WeakMap,y=new WeakMap,L=new WeakMap,S=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},T=new WeakMap,B=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},k=new WeakMap,j=function(t){(a.__opened[e(this,A)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,u).current>h.dominance.current))&&t()},C=new WeakMap,_=new WeakMap,R=new WeakMap,x=new WeakMap,U=function(t,h){if(e(t,v).current===e(h,v).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let q=a;customElements.get("e-popover")||customElements.define("e-popover",q);var r,b,M,H,z,$;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,b,new E.CSSProperty(this,"--type","open"));s(this,M,()=>{this.classList.add("triggered")});s(this,H,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,z,()=>{this.classList.remove("opened")});s(this,$,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});Z.isBrowser&&(this.addEventListener("click",()=>{if(e(this,r)){const t=e(this,b).current;t==="open"||t==="toggle"&&!e(this,r).opened.current?e(this,r).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,r).opened.current)&&e(this,r).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,b)}get popoverElement(){return e(this,r)}connectedCallback(){var h;e(this,b).subscribe(o=>{e(this,r)instanceof q&&(o.current!=="close"?(this.setAttribute("aria-has-popup","true"),this.setAttribute("aria-expanded",e(this,r).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,r).id||"")):(this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let o=null;if(t==="parent"){const I=this.closest("[popover-target]");if(I)o=I;else{const P=this.getRootNode();P instanceof ShadowRoot?o=P.host.closest("[popover-target]"):P instanceof HTMLElement&&(o=P.closest("[popover-target]"))}}else t==="sibling"?o=(h=this.parentElement)==null?void 0:h.querySelector("[popover-target]"):o=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);o instanceof HTMLElement?(i(this,r,o),e(this,r).addEventListener("popoverTriggered",e(this,M)),e(this,r).addEventListener("popoverOpened",e(this,H)),e(this,r).addEventListener("popoverClosing",e(this,z)),e(this,r).addEventListener("popoverClosed",e(this,$))):console.warn(this,`target ${t} not found`)}this.isConnected&&e(this,b).observe()}disconnectedCallback(){e(this,b).unobserve(),this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,M)),e(this,r).removeEventListener("popoverOpened",e(this,H)),e(this,r).removeEventListener("popoverClosing",e(this,z)),e(this,r).removeEventListener("popoverClosed",e(this,$)))}}r=new WeakMap,b=new WeakMap,M=new WeakMap,H=new WeakMap,z=new WeakMap,$=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=q;
1
+ "use strict";var F=n=>{throw TypeError(n)};var W=(n,c,t)=>c.has(n)||F("Cannot "+t);var e=(n,c,t)=>(W(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?F("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(W(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),v=(n,c,t)=>(W(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),X=require("../Store-C2J4Q87x.cjs"),I=require("../events-KVanG9sR.cjs"),Y=require("../function-MthRj-GJ.cjs"),Z=require("../style-At6aDoqG.cjs"),G=require("../url-BiHPIsKq.cjs"),J=require("../window-resizer/vanilla/index.cjs"),ee=require("../browser-CpzFX2xg.cjs");var A,d,O,S,p,m,u,g,f,y,L,w,l,K,T,N,k,B,P,_,R,x,D;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,A);s(this,d);s(this,O);s(this,S);s(this,p);s(this,m);s(this,u);s(this,g);s(this,f);s(this,y);s(this,L);s(this,w);s(this,T);s(this,k);s(this,P);s(this,_);s(this,R);s(this,x);this.urlValue="",i(this,A,-1),i(this,d,new X.Store(!1)),i(this,p,new E.CSSProperty(this,"--history",!1)),i(this,m,new E.CSSProperty(this,"--restore",!1)),i(this,u,new E.CSSProperty(this,"--dominance",0)),i(this,g,new E.CSSProperty(this,"--group","")),i(this,f,new E.CSSProperty(this,"--click-outside",!1)),i(this,y,new E.CSSProperty(this,"--escape",!1)),i(this,L,!1),this.open=t=>{if(e(this,d).current)return;i(this,w,t==null?void 0:t.trigger),e(this,u).current&&(a.__opened=a.__opened.filter(o=>o!==this&&v(this,l,D).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,A,a.__opened.length-1),clearTimeout(e(this,O)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,w)}}),e(this,p).current&&e(this,L)&&history.pushState(history.state,"",e(this,l,K)),e(this,d).current=!0;const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,k)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,w)}}),i(this,S,void 0)};t!=null&&t.skipTransition?h():i(this,S,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,S)&&v(this,l,D).call(this,this,t)?(t.close(),!1):!0),v(this,l,N).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.style.opacity="0",I.dispatchEvent(this,"popoverClosing",{custom:!0}),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",I.dispatchEvent(this,"popoverClosed",{custom:!0})},Z.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,f).current&&v(this,l,B).call(this,()=>{var U;const h=t.composedPath();if(h.find(j=>j instanceof HTMLElement&&j.hasAttribute("data-popover-content")))return;const o=h[0],z=o instanceof Node&&(this.contains(o)||((U=this.shadowRoot)==null?void 0:U.contains(o))),C=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!z||C)&&this.close()})}),i(this,k,t=>{e(this,y).current&&v(this,l,B).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,P,()=>{i(this,L,!1),e(this,d).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,p).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),i(this,L,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,R).call(this)}),i(this,R,Y.debounce(()=>{e(this,x).call(this)},10)),i(this,x,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")})}get history(){return e(this,p)}get restore(){return e(this,m)}get dominance(){return e(this,u)}get group(){return e(this,g)}get clickOutside(){return e(this,f)}get escape(){return e(this,y)}get opened(){return e(this,d)}get lastTrigger(){return e(this,w)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,d).current&&G.updateSearchParameter(this.id,t)}connectedCallback(){e(this,p).observe(),e(this,m).observe(),e(this,u).observe(),e(this,g).observe(),e(this,f).observe(),e(this,y).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,P)),setTimeout(()=>{e(this,m).current?(this.urlValue=G.parseSearchParameters(location.search)[this.id],e(this,P).call(this)):(v(this,l,N).call(this),i(this,L,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,p).close(),e(this,m).close(),e(this,u).close(),e(this,g).close(),e(this,f).close(),e(this,y).close(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,O)),clearTimeout(e(this,S)),removeEventListener("popstate",e(this,P)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),v(this,l,N).call(this)}};A=new WeakMap,d=new WeakMap,O=new WeakMap,S=new WeakMap,p=new WeakMap,m=new WeakMap,u=new WeakMap,g=new WeakMap,f=new WeakMap,y=new WeakMap,L=new WeakMap,w=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},T=new WeakMap,N=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},k=new WeakMap,B=function(t){(a.__opened[e(this,A)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,u).current>h.dominance.current))&&t()},P=new WeakMap,_=new WeakMap,R=new WeakMap,x=new WeakMap,D=function(t,h){if(e(t,g).current===e(h,g).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let q=a;customElements.get("e-popover")||customElements.define("e-popover",q);var r,b,V,M,$,H;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,b,new E.CSSProperty(this,"--type","open"));s(this,V,()=>{this.classList.add("triggered")});s(this,M,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,$,()=>{this.classList.remove("opened")});s(this,H,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});ee.isBrowser&&(this.addEventListener("click",()=>{if(e(this,r)){const t=e(this,b).current;t==="open"||t==="toggle"&&!e(this,r).opened.current?e(this,r).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,r).opened.current)&&e(this,r).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,b)}get popoverElement(){return e(this,r)}connectedCallback(){var h;e(this,b).subscribe(o=>{e(this,r)instanceof q&&(o.current!=="close"?(this.setAttribute("aria-has-popup","true"),this.setAttribute("aria-expanded",e(this,r).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,r).id||"")):(this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let o=null;if(t==="parent"){const z=this.closest("[popover-target]");if(z)o=z;else{const C=this.getRootNode();C instanceof ShadowRoot?o=C.host.closest("[popover-target]"):C instanceof HTMLElement&&(o=C.closest("[popover-target]"))}}else t==="sibling"?o=(h=this.parentElement)==null?void 0:h.querySelector("[popover-target]"):o=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);o instanceof HTMLElement?(i(this,r,o),e(this,r).addEventListener("popoverTriggered",e(this,V)),e(this,r).addEventListener("popoverOpened",e(this,M)),e(this,r).addEventListener("popoverClosing",e(this,$)),e(this,r).addEventListener("popoverClosed",e(this,H))):console.warn(this,`target ${t} not found`)}this.isConnected&&e(this,b).observe()}disconnectedCallback(){e(this,b).unobserve(),this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,V)),e(this,r).removeEventListener("popoverOpened",e(this,M)),e(this,r).removeEventListener("popoverClosing",e(this,$)),e(this,r).removeEventListener("popoverClosed",e(this,H)))}}r=new WeakMap,b=new WeakMap,V=new WeakMap,M=new WeakMap,$=new WeakMap,H=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=q;
@@ -1,49 +1,50 @@
1
- var G = (n) => {
1
+ var F = (n) => {
2
2
  throw TypeError(n);
3
3
  };
4
- var D = (n, c, t) => c.has(n) || G("Cannot " + t);
5
- var e = (n, c, t) => (D(n, c, "read from private field"), t ? t.call(n) : c.get(n)), s = (n, c, t) => c.has(n) ? G("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(n) : c.set(n, t), i = (n, c, t, h) => (D(n, c, "write to private field"), h ? h.call(n, t) : c.set(n, t), t), g = (n, c, t) => (D(n, c, "access private method"), t);
4
+ var q = (n, a, t) => a.has(n) || F("Cannot " + t);
5
+ var e = (n, a, t) => (q(n, a, "read from private field"), t ? t.call(n) : a.get(n)), s = (n, a, t) => a.has(n) ? F("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(n) : a.set(n, t), i = (n, a, t, h) => (q(n, a, "write to private field"), h ? h.call(n, t) : a.set(n, t), t), m = (n, a, t) => (q(n, a, "access private method"), t);
6
6
  import { CSSProperty as E } from "../css-property/index.js";
7
- import { S as Q } from "../Store-Cm3LPXlx.js";
8
- import { d as N } from "../events-CsVF98U6.js";
9
- import { d as V } from "../function-C10DGppn.js";
7
+ import { S as K } from "../Store-Cm3LPXlx.js";
8
+ import { d as z } from "../events-CsVF98U6.js";
9
+ import { d as Q } from "../function-C10DGppn.js";
10
10
  import { g as X } from "../style-j2TwriJ_.js";
11
- import { windowResizer as J } from "../window-resizer/vanilla/index.js";
12
- import { i as Y } from "../browser-0zX67oeU.js";
13
- var x, d, O, T, p, m, u, v, f, y, L, w, l, K, k, q, A, U, C, _, H, P, W;
14
- const a = class a extends HTMLElement {
11
+ import { u as Y, p as Z } from "../url-B5eH5z6S.js";
12
+ import { windowResizer as G } from "../window-resizer/vanilla/index.js";
13
+ import { i as ee } from "../browser-0zX67oeU.js";
14
+ var x, d, V, T, p, v, u, g, f, y, L, w, l, J, k, N, A, B, S, _, O, P, D;
15
+ const c = class c extends HTMLElement {
15
16
  constructor() {
16
17
  super(...arguments);
17
18
  s(this, l);
18
19
  s(this, x);
19
20
  s(this, d);
20
- s(this, O);
21
+ s(this, V);
21
22
  s(this, T);
22
23
  s(this, p);
23
- s(this, m);
24
- s(this, u);
25
24
  s(this, v);
25
+ s(this, u);
26
+ s(this, g);
26
27
  s(this, f);
27
28
  s(this, y);
28
29
  s(this, L);
29
30
  s(this, w);
30
31
  s(this, k);
31
32
  s(this, A);
32
- s(this, C);
33
+ s(this, S);
33
34
  s(this, _);
34
- s(this, H);
35
+ s(this, O);
35
36
  s(this, P);
36
- i(this, x, -1), i(this, d, new Q(!1)), i(this, p, new E(this, "--history", !1)), i(this, m, new E(this, "--restore", !1)), i(this, u, new E(this, "--dominance", 0)), i(this, v, new E(this, "--group", "")), i(this, f, new E(this, "--click-outside", !1)), i(this, y, new E(this, "--escape", !1)), i(this, L, !1), this.open = (t) => {
37
+ this.urlValue = "", i(this, x, -1), i(this, d, new K(!1)), i(this, p, new E(this, "--history", !1)), i(this, v, new E(this, "--restore", !1)), i(this, u, new E(this, "--dominance", 0)), i(this, g, new E(this, "--group", "")), i(this, f, new E(this, "--click-outside", !1)), i(this, y, new E(this, "--escape", !1)), i(this, L, !1), this.open = (t) => {
37
38
  if (e(this, d).current)
38
39
  return;
39
- i(this, w, t == null ? void 0 : t.trigger), e(this, d).current = !0, e(this, u).current && (a.__opened = a.__opened.filter((o) => o !== this && g(this, l, W).call(this, this, o) ? (o.close(), !1) : !0)), a.__opened.push(this), i(this, x, a.__opened.length - 1), e(this, p).current && e(this, L) && history.pushState(history.state, "", e(this, l, K)), clearTimeout(e(this, O)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", N(this, "popoverTriggered", {
40
+ i(this, w, t == null ? void 0 : t.trigger), e(this, u).current && (c.__opened = c.__opened.filter((o) => o !== this && m(this, l, D).call(this, this, o) ? (o.close(), !1) : !0)), c.__opened.push(this), i(this, x, c.__opened.length - 1), clearTimeout(e(this, V)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", z(this, "popoverTriggered", {
40
41
  custom: !0,
41
42
  detail: {
42
43
  trigger: e(this, w)
43
44
  }
44
- });
45
+ }), e(this, p).current && e(this, L) && history.pushState(history.state, "", e(this, l, J)), e(this, d).current = !0;
45
46
  const h = () => {
46
- addEventListener("click", e(this, k)), addEventListener("keydown", e(this, A)), e(this, P).call(this), this.style.opacity = "1", this.classList.add("opened"), N(this, "popoverOpened", {
47
+ addEventListener("click", e(this, k)), addEventListener("keydown", e(this, A)), e(this, P).call(this), this.style.opacity = "1", this.classList.add("opened"), z(this, "popoverOpened", {
47
48
  custom: !0,
48
49
  detail: {
49
50
  trigger: e(this, w)
@@ -52,33 +53,33 @@ const a = class a extends HTMLElement {
52
53
  };
53
54
  t != null && t.skipTransition ? h() : i(this, T, setTimeout(h, 10));
54
55
  }, this.close = () => {
55
- e(this, d).current && (removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), e(this, d).current = !1, a.__opened = a.__opened.filter((t) => t === this ? !1 : !e(t, T) && g(this, l, W).call(this, this, t) ? (t.close(), !1) : !0), g(this, l, q).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", N(this, "popoverClosing", {
56
+ e(this, d).current && (removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), e(this, d).current = !1, c.__opened = c.__opened.filter((t) => t === this ? !1 : !e(t, T) && m(this, l, D).call(this, this, t) ? (t.close(), !1) : !0), m(this, l, N).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", z(this, "popoverClosing", {
56
57
  custom: !0
57
58
  }), setTimeout(() => {
58
- this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", N(this, "popoverClosed", {
59
+ this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", z(this, "popoverClosed", {
59
60
  custom: !0
60
61
  });
61
62
  }, X(this) + 10));
62
63
  }, i(this, k, (t) => {
63
- e(this, f).current && g(this, l, U).call(this, () => {
64
- var j;
64
+ e(this, f).current && m(this, l, B).call(this, () => {
65
+ var U;
65
66
  const h = t.composedPath();
66
67
  if (h.find(
67
- (F) => F instanceof HTMLElement && F.hasAttribute("data-popover-content")
68
+ (j) => j instanceof HTMLElement && j.hasAttribute("data-popover-content")
68
69
  ))
69
70
  return;
70
- const o = h[0], z = o instanceof Node && (this.contains(o) || ((j = this.shadowRoot) == null ? void 0 : j.contains(o))), S = o instanceof HTMLElement && o.hasAttribute("data-outside");
71
- (!z || S) && this.close();
71
+ const o = h[0], I = o instanceof Node && (this.contains(o) || ((U = this.shadowRoot) == null ? void 0 : U.contains(o))), C = o instanceof HTMLElement && o.hasAttribute("data-outside");
72
+ (!I || C) && this.close();
72
73
  });
73
74
  }), i(this, A, (t) => {
74
- e(this, y).current && g(this, l, U).call(this, () => {
75
+ e(this, y).current && m(this, l, B).call(this, () => {
75
76
  t.code === "Escape" && this.close();
76
77
  });
77
- }), i(this, C, () => {
78
- i(this, L, !1), e(this, d).current && e(this, p).current && !location.search.includes(this.id) ? this.close() : !e(this, d).current && e(this, p).current && location.search.includes(this.id) && this.open(), i(this, L, !0);
78
+ }), i(this, S, () => {
79
+ i(this, L, !1), e(this, d).current && e(this, p).current && !location.search.includes(this.id) ? this.close() : !e(this, d).current && e(this, p).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), i(this, L, !0);
79
80
  }), i(this, _, () => {
80
- this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, H).call(this);
81
- }), i(this, H, V(() => {
81
+ this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, O).call(this);
82
+ }), i(this, O, Q(() => {
82
83
  e(this, P).call(this);
83
84
  }, 10)), i(this, P, () => {
84
85
  this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
@@ -88,13 +89,13 @@ const a = class a extends HTMLElement {
88
89
  return e(this, p);
89
90
  }
90
91
  get restore() {
91
- return e(this, m);
92
+ return e(this, v);
92
93
  }
93
94
  get dominance() {
94
95
  return e(this, u);
95
96
  }
96
97
  get group() {
97
- return e(this, v);
98
+ return e(this, g);
98
99
  }
99
100
  get clickOutside() {
100
101
  return e(this, f);
@@ -108,49 +109,55 @@ const a = class a extends HTMLElement {
108
109
  get lastTrigger() {
109
110
  return e(this, w);
110
111
  }
112
+ get idWithValue() {
113
+ return `${this.id}${this.urlValue ? "=" + this.urlValue : ""}`;
114
+ }
115
+ updateUrlValue(t) {
116
+ this.urlValue = (t == null ? void 0 : t.toString()) || "", e(this, d).current && Y(this.id, t);
117
+ }
111
118
  connectedCallback() {
112
- e(this, p).observe(), e(this, m).observe(), e(this, u).observe(), e(this, v).observe(), e(this, f).observe(), e(this, y).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, C)), setTimeout(() => {
113
- e(this, m).current ? e(this, C).call(this) : (g(this, l, q).call(this), i(this, L, !0));
114
- }, 0), J.subscribe(e(this, _));
119
+ e(this, p).observe(), e(this, v).observe(), e(this, u).observe(), e(this, g).observe(), e(this, f).observe(), e(this, y).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, S)), setTimeout(() => {
120
+ e(this, v).current ? (this.urlValue = Z(location.search)[this.id], e(this, S).call(this)) : (m(this, l, N).call(this), i(this, L, !0));
121
+ }, 0), G.subscribe(e(this, _));
115
122
  }
116
123
  disconnectedCallback() {
117
- J.unsubscribe(e(this, _)), e(this, p).close(), e(this, m).close(), e(this, u).close(), e(this, v).close(), e(this, f).close(), e(this, y).close(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), a.__opened = a.__opened.filter((t) => t !== this), clearTimeout(e(this, O)), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, C)), removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), g(this, l, q).call(this);
124
+ G.unsubscribe(e(this, _)), e(this, p).close(), e(this, v).close(), e(this, u).close(), e(this, g).close(), e(this, f).close(), e(this, y).close(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), c.__opened = c.__opened.filter((t) => t !== this), clearTimeout(e(this, V)), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, S)), removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), m(this, l, N).call(this);
118
125
  }
119
126
  };
120
- x = new WeakMap(), d = new WeakMap(), O = new WeakMap(), T = new WeakMap(), p = new WeakMap(), m = new WeakMap(), u = new WeakMap(), v = new WeakMap(), f = new WeakMap(), y = new WeakMap(), L = new WeakMap(), w = new WeakMap(), l = new WeakSet(), K = function() {
121
- return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.id}`;
122
- }, k = new WeakMap(), q = function() {
127
+ x = new WeakMap(), d = new WeakMap(), V = new WeakMap(), T = new WeakMap(), p = new WeakMap(), v = new WeakMap(), u = new WeakMap(), g = new WeakMap(), f = new WeakMap(), y = new WeakMap(), L = new WeakMap(), w = new WeakMap(), l = new WeakSet(), J = function() {
128
+ return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
129
+ }, k = new WeakMap(), N = function() {
123
130
  if (e(this, p).current) {
124
131
  const t = new URL(location.href);
125
132
  t.searchParams.delete(this.id), history.replaceState(history.state, "", t.href);
126
133
  }
127
- }, A = new WeakMap(), U = function(t) {
128
- (a.__opened[e(this, x) - 1] || a.__opened.length === 1 || a.__opened.filter((h) => h !== this).every((h) => e(this, u).current > h.dominance.current)) && t();
129
- }, C = new WeakMap(), _ = new WeakMap(), H = new WeakMap(), P = new WeakMap(), W = function(t, h) {
130
- if (e(t, v).current === e(h, v).current && t.dominance.current >= h.dominance.current)
134
+ }, A = new WeakMap(), B = function(t) {
135
+ (c.__opened[e(this, x) - 1] || c.__opened.length === 1 || c.__opened.filter((h) => h !== this).every((h) => e(this, u).current > h.dominance.current)) && t();
136
+ }, S = new WeakMap(), _ = new WeakMap(), O = new WeakMap(), P = new WeakMap(), D = function(t, h) {
137
+ if (e(t, g).current === e(h, g).current && t.dominance.current >= h.dominance.current)
131
138
  return !0;
132
- }, a.__opened = [];
133
- let B = a;
134
- customElements.get("e-popover") || customElements.define("e-popover", B);
135
- var r, b, M, R, $, I;
136
- class Z extends HTMLElement {
139
+ }, c.__opened = [];
140
+ let W = c;
141
+ customElements.get("e-popover") || customElements.define("e-popover", W);
142
+ var r, b, $, H, M, R;
143
+ class te extends HTMLElement {
137
144
  constructor() {
138
145
  super();
139
146
  s(this, r);
140
147
  s(this, b, new E(this, "--type", "open"));
141
- s(this, M, () => {
148
+ s(this, $, () => {
142
149
  this.classList.add("triggered");
143
150
  });
144
- s(this, R, () => {
151
+ s(this, H, () => {
145
152
  this.classList.add("opened"), this.setAttribute("aria-expanded", "true");
146
153
  });
147
- s(this, $, () => {
154
+ s(this, M, () => {
148
155
  this.classList.remove("opened");
149
156
  });
150
- s(this, I, () => {
157
+ s(this, R, () => {
151
158
  this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false");
152
159
  });
153
- Y && (this.addEventListener("click", () => {
160
+ ee && (this.addEventListener("click", () => {
154
161
  if (e(this, r)) {
155
162
  const t = e(this, b).current;
156
163
  t === "open" || t === "toggle" && !e(this, r).opened.current ? e(this, r).open({ trigger: this }) : (t === "close" || t === "toggle" && e(this, r).opened.current) && e(this, r).close();
@@ -168,7 +175,7 @@ class Z extends HTMLElement {
168
175
  connectedCallback() {
169
176
  var h;
170
177
  e(this, b).subscribe((o) => {
171
- e(this, r) instanceof B && (o.current !== "close" ? (this.setAttribute("aria-has-popup", "true"), this.setAttribute(
178
+ e(this, r) instanceof W && (o.current !== "close" ? (this.setAttribute("aria-has-popup", "true"), this.setAttribute(
172
179
  "aria-expanded",
173
180
  e(this, r).opened.current ? "true" : "false"
174
181
  ), this.setAttribute("aria-controls", e(this, r).id || "")) : (this.removeAttribute("aria-has-popup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
@@ -177,26 +184,26 @@ class Z extends HTMLElement {
177
184
  if (t) {
178
185
  let o = null;
179
186
  if (t === "parent") {
180
- const z = this.closest("[popover-target]");
181
- if (z)
182
- o = z;
187
+ const I = this.closest("[popover-target]");
188
+ if (I)
189
+ o = I;
183
190
  else {
184
- const S = this.getRootNode();
185
- S instanceof ShadowRoot ? o = S.host.closest("[popover-target]") : S instanceof HTMLElement && (o = S.closest("[popover-target]"));
191
+ const C = this.getRootNode();
192
+ C instanceof ShadowRoot ? o = C.host.closest("[popover-target]") : C instanceof HTMLElement && (o = C.closest("[popover-target]"));
186
193
  }
187
194
  } else t === "sibling" ? o = (h = this.parentElement) == null ? void 0 : h.querySelector("[popover-target]") : o = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
188
195
  o instanceof HTMLElement ? (i(this, r, o), e(this, r).addEventListener(
189
196
  "popoverTriggered",
190
- e(this, M)
197
+ e(this, $)
191
198
  ), e(this, r).addEventListener(
192
199
  "popoverOpened",
193
- e(this, R)
200
+ e(this, H)
194
201
  ), e(this, r).addEventListener(
195
202
  "popoverClosing",
196
- e(this, $)
203
+ e(this, M)
197
204
  ), e(this, r).addEventListener(
198
205
  "popoverClosed",
199
- e(this, I)
206
+ e(this, R)
200
207
  )) : console.warn(this, `target ${t} not found`);
201
208
  }
202
209
  this.isConnected && e(this, b).observe();
@@ -204,22 +211,22 @@ class Z extends HTMLElement {
204
211
  disconnectedCallback() {
205
212
  e(this, b).unobserve(), this.removeAttribute("aria-has-popup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), e(this, r) && (e(this, r).removeEventListener(
206
213
  "popoverTriggered",
207
- e(this, M)
214
+ e(this, $)
208
215
  ), e(this, r).removeEventListener(
209
216
  "popoverOpened",
210
- e(this, R)
217
+ e(this, H)
211
218
  ), e(this, r).removeEventListener(
212
219
  "popoverClosing",
213
- e(this, $)
220
+ e(this, M)
214
221
  ), e(this, r).removeEventListener(
215
222
  "popoverClosed",
216
- e(this, I)
223
+ e(this, R)
217
224
  ));
218
225
  }
219
226
  }
220
- r = new WeakMap(), b = new WeakMap(), M = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), I = new WeakMap();
221
- customElements.get("e-popover-button") || customElements.define("e-popover-button", Z);
227
+ r = new WeakMap(), b = new WeakMap(), $ = new WeakMap(), H = new WeakMap(), M = new WeakMap(), R = new WeakMap();
228
+ customElements.get("e-popover-button") || customElements.define("e-popover-button", te);
222
229
  export {
223
- Z as PopoverButtonElement,
224
- B as PopoverElement
230
+ te as PopoverButtonElement,
231
+ W as PopoverElement
225
232
  };
@@ -1 +1 @@
1
- "use strict";var Z=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),$=n=>{throw TypeError(n)};var K=(n,e,s)=>e.has(n)||$("Cannot "+s);var t=(n,e,s)=>(K(n,e,"read from private field"),s?s.call(n):e.get(n)),r=(n,e,s)=>e.has(n)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,s),a=(n,e,s,i)=>(K(n,e,"write to private field"),i?i.call(n,s):e.set(n,s),s),W=(n,e,s)=>(K(n,e,"access private method"),s);var M=(n,e,s)=>new Promise((i,h)=>{var o=d=>{try{f(s.next(d))}catch(w){h(w)}},c=d=>{try{f(s.throw(d))}catch(w){h(w)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(o,c);f((s=s.apply(n,e)).next())});var Y=(n,e,s)=>(e=n[Z("asyncIterator")])?e.call(n):(n=n[Z("iterator")](),e={},s=(i,h)=>(h=n[i])&&(e[i]=o=>new Promise((c,f,d)=>(o=h.call(n,o),d=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:d}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-DELd-VFC.cjs"),ot=require("../object-CCiXnER2.cjs");var R,O,A,p,m,v,k,L,b,E,x,et;class ct{constructor(e,s){r(this,x);r(this,R);r(this,O);r(this,A);r(this,p);r(this,m);r(this,v);r(this,k);r(this,L,null);r(this,b,[]);r(this,E,[]);a(this,R,e),a(this,O,s),a(this,A,new URLPattern({pathname:t(this,R)})),a(this,p,null),a(this,m,null),a(this,v,!1),a(this,k,null),tt.isBrowser&&a(this,L,new MutationObserver(i=>{i[0].addedNodes.forEach(o=>{t(this,p)?t(this,E).push(o):t(this,b).push(o)})}))}get pattern(){return t(this,R)}get urlPattern(){return t(this,A)}get isActive(){return t(this,v)}get element(){return t(this,m)}get nest(){return t(this,k)}testPathname(e){return this.urlPattern.test({pathname:e})}render(e,s){return M(this,null,function*(){var i,h;if(t(this,L).observe(document.head,{childList:!0,subtree:!0}),t(this,p))t(this,b).forEach(o=>{document.head.appendChild(o)});else{const o=yield t(this,O).call(this);if(a(this,E,[...t(this,b)]),typeof o.default=="function"&&(a(this,p,o.default),ot.isESClass(o.default))){const c="e-"+((i=t(this,p))==null?void 0:i.name.toLowerCase());customElements.get(c)||customElements.define(c,o.default)}}if(yield W(this,x,et).call(this),t(this,p)){const o=t(this,A).exec({pathname:s}),c=(o==null?void 0:o.pathname.groups)||{},f=Object.fromEntries(new URLSearchParams(location.search)),d={pathnameParams:c,searchParams:f};a(this,m,new(t(this,p))(d)),e.appendChild(t(this,m)),a(this,k,t(this,m).querySelector("[data-nest]")||((h=t(this,m).shadowRoot)==null?void 0:h.querySelector("[data-nest]"))||t(this,m).shadowRoot||t(this,m)),a(this,v,!0)}t(this,L).disconnect()})}close(){var e;t(this,L).disconnect(),(e=t(this,m))==null||e.remove(),a(this,v,!1),t(this,E).forEach(s=>document.head.removeChild(s)),a(this,E,[])}getAnchorElements(){var s;let e=[];return t(this,m)&&(e=[...t(this,m).querySelectorAll("a")]),(s=t(this,m))!=null&&s.shadowRoot&&(e=[...e,...t(this,m).shadowRoot.querySelectorAll("a")]),e}}R=new WeakMap,O=new WeakMap,A=new WeakMap,p=new WeakMap,m=new WeakMap,v=new WeakMap,k=new WeakMap,L=new WeakMap,b=new WeakMap,E=new WeakMap,x=new WeakSet,et=function(){return M(this,null,function*(){const e=t(this,b).filter(c=>c instanceof HTMLElement?c.tagName==="STYLE"||c.tagName==="SCRIPT"||c.tagName==="LINK":!1);try{for(var s=Y(e),i,h,o;i=!(h=yield s.next()).done;i=!1){const c=h.value;yield new Promise(f=>{c.onload=()=>{f()}})}}catch(h){o=[h]}finally{try{i&&(h=s.return)&&(yield h.call(s))}finally{if(o)throw o[0]}}})};var S,u,P,U,q,j;class lt{constructor(e,s){r(this,S);r(this,u);r(this,P);r(this,U);r(this,q);r(this,j,e=>{e.preventDefault(),t(this,S).links.forEach(s=>{var i;t(this,P)===t(s,P)||(i=t(s,q))!=null&&i.includes(t(this,P))?t(s,u).classList.add("clicked"):t(s,u).classList.remove("clicked")}),t(this,S).navigate(t(this,P),t(this,U))});var o,c;a(this,S,e),a(this,u,s),a(this,P,t(this,u).getAttribute("href")||"/"),a(this,U,t(this,u).getAttribute("data-history-action")||"push"),t(this,u).addEventListener("click",t(this,j));const i=e.normalizePath(t(this,P)),h=e.normalizePath(location.pathname);a(this,q,(o=t(this,u).getAttribute("data-match-paths"))==null?void 0:o.split(",").map(f=>e.normalizePath(f.trim()).pathname)),t(this,u).hasAttribute("data-include")?h.pathname.includes(i.pathname)&&t(this,u).classList.add("current"):i.pathname===h.pathname||(c=t(this,q))!=null&&c.includes(h.pathname)?(t(this,u).classList.add("current"),t(this,u).classList.add("clicked")):t(this,u).classList.remove("clicked")}destroy(){t(this,u).removeEventListener("click",t(this,j)),t(this,u).classList.remove("current")}}S=new WeakMap,u=new WeakMap,P=new WeakMap,U=new WeakMap,q=new WeakMap,j=new WeakMap;globalThis.URLPattern=at.URLPattern;var N,C,g,z,T,y,H,B,I,_,st,D;class ut{constructor(e){r(this,_);r(this,N,null);r(this,C,null);r(this,g,[]);r(this,z,null);r(this,T,[]);r(this,y);r(this,H,null);r(this,B,new rt.Notifier);r(this,I,ht.debounce(()=>{const e=s=>s.split("/").length;a(this,g,t(this,g).sort((s,i)=>e(s.pattern)-e(i.pattern))),this.navigate(location.pathname)},0));r(this,D,e=>{e.state&&this.navigate(e.state,"none")});tt.isBrowser&&(e!=null&&e.base?a(this,C,F.normalizeBase(e.base)):a(this,C,"/"),a(this,N,(e==null?void 0:e.rootElement)||document.body),addEventListener("popstate",t(this,D)))}get currentPathname(){return t(this,H)}get candidatePathname(){return t(this,y)}get routes(){return t(this,g)}get links(){return t(this,T)}navigationEvent(e){return t(this,B).subscribe(e)}defineRoute(e,s){const i=new ct(e,s);t(this,g).push(i),t(this,I).call(this)}navigate(e,s="push"){return M(this,null,function*(){var Q,V;const i=this.normalizePath(e);let{pathname:h,hash:o,parameters:c,leaf:f}=i;if(t(this,y)===h||t(this,H)===h)return;a(this,y,h);const d=t(this,g).filter(l=>l.isActive),w=t(this,g).filter(l=>!d.includes(l)&&l.testPathname(f)),it=d.filter(l=>!l.testPathname(f)),G=d.filter(l=>l.testPathname(f));let J=!0;if(this.preprocessor)try{yield new Promise((l,nt)=>{var X;(X=this.preprocessor)==null||X.call(this,{path:i,resolve:l,reject:nt})})}catch(l){l?console.error(l):console.log("Route change canceled"),J=!1}if(J&&t(this,y)===h){a(this,z,G[G.length-1]),it.forEach(l=>{l.close()}),a(this,H,h),F.changeHistory(s,h,c,o);try{for(var ft=Y(w),pt,gt,Pt;pt=!(gt=yield ft.next()).done;pt=!1){const l=gt.value;yield l.render(((Q=t(this,z))==null?void 0:Q.nest)||t(this,N),h),a(this,z,l)}}catch(gt){Pt=[gt]}finally{try{pt&&(gt=ft.return)&&(yield gt.call(ft))}finally{if(Pt)throw Pt[0]}}W(this,_,st).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:h}),t(this,B).notify({pathname:h})}})}normalizePath(e){return F.splitPath(e,t(this,C))}}N=new WeakMap,C=new WeakMap,g=new WeakMap,z=new WeakMap,T=new WeakMap,y=new WeakMap,H=new WeakMap,B=new WeakMap,I=new WeakMap,_=new WeakSet,st=function(){const e=t(this,g).filter(i=>i.isActive),s=Array.from(new Set([...t(this,N).querySelectorAll("a"),...e.map(i=>i.getAnchorElements()).flat()].filter(i=>{var h;return(h=i.getAttribute("href"))==null?void 0:h.startsWith("/")})));t(this,T).forEach(i=>{i.destroy()}),a(this,T,s.map(i=>new lt(this,i)))},D=new WeakMap;exports.Router=ut;
1
+ "use strict";var Z=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),$=n=>{throw TypeError(n)};var K=(n,e,s)=>e.has(n)||$("Cannot "+s);var t=(n,e,s)=>(K(n,e,"read from private field"),s?s.call(n):e.get(n)),r=(n,e,s)=>e.has(n)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,s),a=(n,e,s,i)=>(K(n,e,"write to private field"),i?i.call(n,s):e.set(n,s),s),W=(n,e,s)=>(K(n,e,"access private method"),s);var M=(n,e,s)=>new Promise((i,h)=>{var o=d=>{try{f(s.next(d))}catch(w){h(w)}},c=d=>{try{f(s.throw(d))}catch(w){h(w)}},f=d=>d.done?i(d.value):Promise.resolve(d.value).then(o,c);f((s=s.apply(n,e)).next())});var Y=(n,e,s)=>(e=n[Z("asyncIterator")])?e.call(n):(n=n[Z("iterator")](),e={},s=(i,h)=>(h=n[i])&&(e[i]=o=>new Promise((c,f,d)=>(o=h.call(n,o),d=o.done,Promise.resolve(o.value).then(w=>c({value:w,done:d}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("urlpattern-polyfill"),rt=require("../notifier/index.cjs"),tt=require("../browser-CpzFX2xg.cjs"),ht=require("../function-MthRj-GJ.cjs"),F=require("../url-BiHPIsKq.cjs"),ot=require("../object-CCiXnER2.cjs");var R,O,A,p,m,v,k,L,b,E,x,et;class ct{constructor(e,s){r(this,x);r(this,R);r(this,O);r(this,A);r(this,p);r(this,m);r(this,v);r(this,k);r(this,L,null);r(this,b,[]);r(this,E,[]);a(this,R,e),a(this,O,s),a(this,A,new URLPattern({pathname:t(this,R)})),a(this,p,null),a(this,m,null),a(this,v,!1),a(this,k,null),tt.isBrowser&&a(this,L,new MutationObserver(i=>{i[0].addedNodes.forEach(o=>{t(this,p)?t(this,E).push(o):t(this,b).push(o)})}))}get pattern(){return t(this,R)}get urlPattern(){return t(this,A)}get isActive(){return t(this,v)}get element(){return t(this,m)}get nest(){return t(this,k)}testPathname(e){return this.urlPattern.test({pathname:e})}render(e,s){return M(this,null,function*(){var i,h;if(t(this,L).observe(document.head,{childList:!0,subtree:!0}),t(this,p))t(this,b).forEach(o=>{document.head.appendChild(o)});else{const o=yield t(this,O).call(this);if(a(this,E,[...t(this,b)]),typeof o.default=="function"&&(a(this,p,o.default),ot.isESClass(o.default))){const c="e-"+((i=t(this,p))==null?void 0:i.name.toLowerCase());customElements.get(c)||customElements.define(c,o.default)}}if(yield W(this,x,et).call(this),t(this,p)){const o=t(this,A).exec({pathname:s}),c=(o==null?void 0:o.pathname.groups)||{},f=Object.fromEntries(new URLSearchParams(location.search)),d={pathnameParams:c,searchParams:f};a(this,m,new(t(this,p))(d)),e.appendChild(t(this,m)),a(this,k,t(this,m).querySelector("[data-nest]")||((h=t(this,m).shadowRoot)==null?void 0:h.querySelector("[data-nest]"))||t(this,m).shadowRoot||t(this,m)),a(this,v,!0)}t(this,L).disconnect()})}close(){var e;t(this,L).disconnect(),(e=t(this,m))==null||e.remove(),a(this,v,!1),t(this,E).forEach(s=>document.head.removeChild(s)),a(this,E,[])}getAnchorElements(){var s;let e=[];return t(this,m)&&(e=[...t(this,m).querySelectorAll("a")]),(s=t(this,m))!=null&&s.shadowRoot&&(e=[...e,...t(this,m).shadowRoot.querySelectorAll("a")]),e}}R=new WeakMap,O=new WeakMap,A=new WeakMap,p=new WeakMap,m=new WeakMap,v=new WeakMap,k=new WeakMap,L=new WeakMap,b=new WeakMap,E=new WeakMap,x=new WeakSet,et=function(){return M(this,null,function*(){const e=t(this,b).filter(c=>c instanceof HTMLElement?c.tagName==="STYLE"||c.tagName==="SCRIPT"||c.tagName==="LINK":!1);try{for(var s=Y(e),i,h,o;i=!(h=yield s.next()).done;i=!1){const c=h.value;yield new Promise(f=>{c.onload=()=>{f()}})}}catch(h){o=[h]}finally{try{i&&(h=s.return)&&(yield h.call(s))}finally{if(o)throw o[0]}}})};var S,u,P,U,q,j;class lt{constructor(e,s){r(this,S);r(this,u);r(this,P);r(this,U);r(this,q);r(this,j,e=>{e.preventDefault(),t(this,S).links.forEach(s=>{var i;t(this,P)===t(s,P)||(i=t(s,q))!=null&&i.includes(t(this,P))?t(s,u).classList.add("clicked"):t(s,u).classList.remove("clicked")}),t(this,S).navigate(t(this,P),t(this,U))});var o,c;a(this,S,e),a(this,u,s),a(this,P,t(this,u).getAttribute("href")||"/"),a(this,U,t(this,u).getAttribute("data-history-action")||"push"),t(this,u).addEventListener("click",t(this,j));const i=e.normalizePath(t(this,P)),h=e.normalizePath(location.pathname);a(this,q,(o=t(this,u).getAttribute("data-match-paths"))==null?void 0:o.split(",").map(f=>e.normalizePath(f.trim()).pathname)),t(this,u).hasAttribute("data-include")?h.pathname.includes(i.pathname)&&t(this,u).classList.add("current"):i.pathname===h.pathname||(c=t(this,q))!=null&&c.includes(h.pathname)?(t(this,u).classList.add("current"),t(this,u).classList.add("clicked")):t(this,u).classList.remove("clicked")}destroy(){t(this,u).removeEventListener("click",t(this,j)),t(this,u).classList.remove("current")}}S=new WeakMap,u=new WeakMap,P=new WeakMap,U=new WeakMap,q=new WeakMap,j=new WeakMap;globalThis.URLPattern=at.URLPattern;var N,C,g,z,T,y,H,B,I,_,st,D;class ut{constructor(e){r(this,_);r(this,N,null);r(this,C,null);r(this,g,[]);r(this,z,null);r(this,T,[]);r(this,y);r(this,H,null);r(this,B,new rt.Notifier);r(this,I,ht.debounce(()=>{const e=s=>s.split("/").length;a(this,g,t(this,g).sort((s,i)=>e(s.pattern)-e(i.pattern))),this.navigate(location.pathname)},0));r(this,D,e=>{e.state&&this.navigate(e.state,"none")});tt.isBrowser&&(e!=null&&e.base?a(this,C,F.normalizeBase(e.base)):a(this,C,"/"),a(this,N,(e==null?void 0:e.rootElement)||document.body),addEventListener("popstate",t(this,D)))}get currentPathname(){return t(this,H)}get candidatePathname(){return t(this,y)}get routes(){return t(this,g)}get links(){return t(this,T)}navigationEvent(e){return t(this,B).subscribe(e)}defineRoute(e,s){const i=new ct(e,s);t(this,g).push(i),t(this,I).call(this)}navigate(e,s="push"){return M(this,null,function*(){var Q,V;const i=this.normalizePath(e);let{pathname:h,hash:o,parameters:c,leaf:f}=i;if(t(this,y)===h||t(this,H)===h)return;a(this,y,h);const d=t(this,g).filter(l=>l.isActive),w=t(this,g).filter(l=>!d.includes(l)&&l.testPathname(f)),it=d.filter(l=>!l.testPathname(f)),G=d.filter(l=>l.testPathname(f));let J=!0;if(this.preprocessor)try{yield new Promise((l,nt)=>{var X;(X=this.preprocessor)==null||X.call(this,{path:i,resolve:l,reject:nt})})}catch(l){l?console.error(l):console.log("Route change canceled"),J=!1}if(J&&t(this,y)===h){a(this,z,G[G.length-1]),it.forEach(l=>{l.close()}),a(this,H,h),F.changeHistory(s,h,c,o);try{for(var ft=Y(w),pt,gt,Pt;pt=!(gt=yield ft.next()).done;pt=!1){const l=gt.value;yield l.render(((Q=t(this,z))==null?void 0:Q.nest)||t(this,N),h),a(this,z,l)}}catch(gt){Pt=[gt]}finally{try{pt&&(gt=ft.return)&&(yield gt.call(ft))}finally{if(Pt)throw Pt[0]}}W(this,_,st).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:h}),t(this,B).notify({pathname:h})}})}normalizePath(e){return F.splitPath(e,t(this,C))}}N=new WeakMap,C=new WeakMap,g=new WeakMap,z=new WeakMap,T=new WeakMap,y=new WeakMap,H=new WeakMap,B=new WeakMap,I=new WeakMap,_=new WeakSet,st=function(){const e=t(this,g).filter(i=>i.isActive),s=Array.from(new Set([...t(this,N).querySelectorAll("a"),...e.map(i=>i.getAnchorElements()).flat()].filter(i=>{var h;return(h=i.getAttribute("href"))==null?void 0:h.startsWith("/")})));t(this,T).forEach(i=>{i.destroy()}),a(this,T,s.map(i=>new lt(this,i)))},D=new WeakMap;exports.Router=ut;
@@ -24,7 +24,7 @@ import { URLPattern as at } from "urlpattern-polyfill";
24
24
  import { Notifier as nt } from "../notifier/index.js";
25
25
  import { i as _ } from "../browser-0zX67oeU.js";
26
26
  import { d as ht } from "../function-C10DGppn.js";
27
- import { n as rt, c as ot, s as ct } from "../url-BnTGHSgP.js";
27
+ import { n as rt, c as ot, s as ct } from "../url-B5eH5z6S.js";
28
28
  import { i as lt } from "../object-D6MVWB4l.js";
29
29
  var y, U, A, p, d, L, k, v, E, R, M, tt;
30
30
  class ut {