aptechka 0.79.0 → 0.80.1

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.
Files changed (151) hide show
  1. package/lib/{Animation-BDEX44-i.js → Animation-C4tLEBGM.js} +2 -2
  2. package/lib/{Animation-hZcAchp_.cjs → Animation-jmvFcNfM.cjs} +1 -1
  3. package/lib/Composed-BB1MtFiT.js +70 -0
  4. package/lib/Composed-CSeUTRCg.cjs +1 -0
  5. package/lib/{Damped-z9Uaw2MJ.cjs → Damped-77Urmi3q.cjs} +1 -1
  6. package/lib/{Damped-CtQmJ52v.js → Damped-DVG5nrYV.js} +2 -2
  7. package/lib/DerivedArray-B8A0-8uT.cjs +1 -0
  8. package/lib/DerivedArray-D3scYQdp.js +59 -0
  9. package/lib/{DragControls-K67-diF5.cjs → DragControls-BlL26P1V.cjs} +1 -1
  10. package/lib/{DragControls-DyIrD3GV.js → DragControls-Cm_88cLt.js} +4 -4
  11. package/lib/{SourceElement-VVdVc1d-.cjs → SourceElement-BBfaAgwe.cjs} +1 -1
  12. package/lib/{SourceElement-BnMxiOqY.js → SourceElement-BiNNtaz9.js} +2 -2
  13. package/lib/Store-1JrMCgdX.cjs +1 -0
  14. package/lib/{Store-0BVty6AZ.js → Store-BtVtCGLk.js} +52 -35
  15. package/lib/{Tweened-BlZB0vl4.js → Tweened-C1lnK6n9.js} +2 -2
  16. package/lib/{Tweened-mvHucL4Y.cjs → Tweened-CXQrFQth.cjs} +1 -1
  17. package/lib/{Viewport-DB0qAZPJ.cjs → Viewport-Cx50Hufs.cjs} +1 -1
  18. package/lib/{Viewport-DA10iWAO.js → Viewport-DbN_JWBM.js} +2 -2
  19. package/lib/accordion/index.cjs +1 -1
  20. package/lib/accordion/index.js +1 -1
  21. package/lib/animation/index.cjs +1 -1
  22. package/lib/animation/index.js +3 -3
  23. package/lib/attribute/index.cjs +1 -1
  24. package/lib/attribute/index.js +3 -3
  25. package/lib/billboard/index.cjs +1 -1
  26. package/lib/billboard/index.js +2 -2
  27. package/lib/canvas/index.cjs +1 -1
  28. package/lib/canvas/index.js +2 -2
  29. package/lib/connector/index.cjs +1 -1
  30. package/lib/connector/index.js +2 -1
  31. package/lib/controls/index.cjs +1 -1
  32. package/lib/controls/index.js +1 -1
  33. package/lib/css-property/index.cjs +1 -1
  34. package/lib/css-property/index.js +3 -3
  35. package/lib/css-value-parser/index.cjs +1 -1
  36. package/lib/css-value-parser/index.js +1 -1
  37. package/lib/dev/index.cjs +1 -1
  38. package/lib/dev/index.js +2 -2
  39. package/lib/device/index.cjs +1 -1
  40. package/lib/device/index.js +1 -1
  41. package/lib/{dom-CVWzyXPH.js → dom-fgxIeFxm.js} +22 -7
  42. package/lib/dom-hTEdqeoj.cjs +1 -0
  43. package/lib/element-linked-store/index.cjs +1 -1
  44. package/lib/element-linked-store/index.js +2 -2
  45. package/lib/element-resizer/index.cjs +1 -1
  46. package/lib/element-resizer/index.js +2 -2
  47. package/lib/en3/En3.d.ts +1 -1
  48. package/lib/en3/index.cjs +2 -2
  49. package/lib/en3/index.js +13 -13
  50. package/lib/iframe/index.cjs +1 -1
  51. package/lib/iframe/index.js +3 -3
  52. package/lib/image/index.cjs +1 -1
  53. package/lib/image/index.js +4 -4
  54. package/lib/{index-DekP7OZe.cjs → index-CKTweR3M.cjs} +1 -1
  55. package/lib/{index-Bv9zgfdb.js → index-JqYHGoo6.js} +1 -1
  56. package/lib/intersector/index.cjs +1 -1
  57. package/lib/intersector/index.js +2 -2
  58. package/lib/jsx/ComponentElement.d.ts +13 -0
  59. package/lib/jsx/h.d.ts +3 -0
  60. package/lib/jsx/hooks/common.d.ts +1 -0
  61. package/lib/jsx/hooks/component/lifecycle.d.ts +4 -0
  62. package/lib/jsx/hooks/component/useInternals.d.ts +2 -0
  63. package/lib/jsx/hooks/component/useShadow.d.ts +2 -0
  64. package/lib/jsx/hooks/component/useStylesheet.d.ts +8 -0
  65. package/lib/jsx/hooks/store.d.ts +8 -0
  66. package/lib/jsx/index.cjs +1 -0
  67. package/lib/jsx/index.d.ts +9 -0
  68. package/lib/jsx/index.js +140 -0
  69. package/lib/jsx/render.d.ts +1 -0
  70. package/lib/jsx/type.d.ts +224 -0
  71. package/lib/jsx/utils/attributes/class.d.ts +5 -0
  72. package/lib/jsx/utils/attributes/setAttributes.d.ts +2 -0
  73. package/lib/jsx/utils/attributes/style.d.ts +6 -0
  74. package/lib/jsx/utils/children/filterChildren.d.ts +2 -0
  75. package/lib/jsx/utils/children/findTextNode.d.ts +1 -0
  76. package/lib/jsx/utils/children/removeChildren.d.ts +1 -0
  77. package/lib/jsx/utils/children/storeChildren.d.ts +2 -0
  78. package/lib/jsx/utils/elementStoreSubscription.d.ts +2 -0
  79. package/lib/ladder/index.cjs +1 -1
  80. package/lib/ladder/index.js +2 -2
  81. package/lib/layout-box/index.cjs +1 -1
  82. package/lib/layout-box/index.js +2 -2
  83. package/lib/loading/index.cjs +1 -1
  84. package/lib/loading/index.js +1 -1
  85. package/lib/masonry-layout/index.cjs +1 -1
  86. package/lib/masonry-layout/index.js +2 -2
  87. package/lib/media/index.cjs +1 -1
  88. package/lib/media/index.js +2 -2
  89. package/lib/morph/Morph.d.ts +4 -21
  90. package/lib/morph/index.cjs +1 -1
  91. package/lib/morph/index.js +235 -229
  92. package/lib/need_redo_tweaker/element-constructor/ElementConstructor.d.ts +1 -1
  93. package/lib/need_redo_tweaker/index.cjs +1 -1
  94. package/lib/need_redo_tweaker/index.js +8 -8
  95. package/lib/pixel-perfect/index.cjs +1 -1
  96. package/lib/pixel-perfect/index.js +3 -3
  97. package/lib/pointer/index.cjs +1 -1
  98. package/lib/pointer/index.js +4 -4
  99. package/lib/popover/index.cjs +1 -1
  100. package/lib/popover/index.js +3 -3
  101. package/lib/radio/index.cjs +1 -1
  102. package/lib/radio/index.js +1 -1
  103. package/lib/render-CMQbWthg.js +205 -0
  104. package/lib/render-DBQUdpsp.cjs +1 -0
  105. package/lib/router/Link.d.ts +3 -1
  106. package/lib/router/Route.d.ts +9 -10
  107. package/lib/router/Router.d.ts +13 -13
  108. package/lib/router/index.cjs +1 -1
  109. package/lib/router/index.d.ts +2 -2
  110. package/lib/router/index.js +267 -216
  111. package/lib/scroll/index.cjs +1 -1
  112. package/lib/scroll/index.js +8 -8
  113. package/lib/{scroll-DNGJVxa2.js → scroll-7JSxRKFK.js} +2 -2
  114. package/lib/{scroll-CIdNtj3G.cjs → scroll-DxcPU0vk.cjs} +1 -1
  115. package/lib/scroll-entries/index.cjs +1 -1
  116. package/lib/scroll-entries/index.js +1 -1
  117. package/lib/scroll-kit/index.cjs +1 -1
  118. package/lib/scroll-kit/index.js +7 -6
  119. package/lib/sequence/index.cjs +1 -1
  120. package/lib/sequence/index.js +3 -3
  121. package/lib/size-element/index.cjs +1 -1
  122. package/lib/size-element/index.js +1 -1
  123. package/lib/slicer/SlicerElement.d.ts +1 -1
  124. package/lib/slicer/index.cjs +1 -1
  125. package/lib/slicer/index.js +13 -13
  126. package/lib/source/index.cjs +1 -1
  127. package/lib/source/index.js +1 -1
  128. package/lib/store/DerivedArray.d.ts +11 -1
  129. package/lib/store/Store.d.ts +5 -0
  130. package/lib/store/index.cjs +1 -1
  131. package/lib/store/index.js +10 -87
  132. package/lib/{stylesheet-HWF2a3nr.cjs → stylesheet-BcwbfhBp.cjs} +1 -1
  133. package/lib/{stylesheet-DpnWNVyD.js → stylesheet-JlRFfJIc.js} +1 -1
  134. package/lib/ticker/index.cjs +1 -1
  135. package/lib/ticker/index.js +2 -2
  136. package/lib/url-C2kASACG.cjs +1 -0
  137. package/lib/{url-Ddgqz4Q_.js → url-CGbjOTU4.js} +17 -17
  138. package/lib/utils/dom.d.ts +2 -0
  139. package/lib/utils/index.cjs +1 -1
  140. package/lib/utils/index.js +102 -100
  141. package/lib/utils/url.d.ts +3 -2
  142. package/lib/video/index.cjs +1 -1
  143. package/lib/video/index.js +3 -3
  144. package/lib/window-resizer/index.cjs +1 -1
  145. package/lib/window-resizer/index.js +1 -1
  146. package/lib/youtube/index.cjs +1 -1
  147. package/lib/youtube/index.js +3 -3
  148. package/package.json +21 -11
  149. package/lib/Store-Cd1GlEmZ.cjs +0 -1
  150. package/lib/dom-JBOkFLTh.cjs +0 -1
  151. package/lib/url-VIZgwj_h.cjs +0 -1
@@ -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 B=(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("../index-DekP7OZe.cjs"),ht=require("../function-MthRj-GJ.cjs");require("construct-style-sheets-polyfill");const F=require("../url-VIZgwj_h.cjs"),ot=require("../object-CCiXnER2.cjs");var R,O,A,p,m,v,k,L,b,E,M,et;class ct{constructor(e,s){r(this,M);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 B(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,M,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,M=new WeakSet,et=function(){return B(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,x,_,I,st,D;class ut{constructor(e){r(this,I);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,x,new rt.Notifier);r(this,_,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=>{var s;(s=e.state)!=null&&s.path&&this.navigate(e.state.path,"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,x).subscribe(e)}defineRoute(e,s){const i=new ct(e,s);t(this,g).push(i),t(this,_).call(this)}navigate(e,s="push"){return B(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({action:s,pathname:h,searchParameters:c,hash: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,I,st).call(this),(V=this.postprocessor)==null||V.call(this,{pathname:h}),t(this,x).notify({pathname:h})}})}normalizePath(e){return F.splitPath(e,{base:t(this,C)})}}N=new WeakMap,C=new WeakMap,g=new WeakMap,z=new WeakMap,T=new WeakMap,y=new WeakMap,H=new WeakMap,x=new WeakMap,_=new WeakMap,I=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 Y=c=>{throw TypeError(c)};var F=(c,t,s)=>t.has(c)||Y("Cannot "+s);var e=(c,t,s)=>(F(c,t,"read from private field"),s?s.call(c):t.get(c)),a=(c,t,s)=>t.has(c)?Y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(c):t.set(c,s),h=(c,t,s,i)=>(F(c,t,"write to private field"),i?i.call(c,s):t.set(c,s),s),n=(c,t,s)=>(F(c,t,"access private method"),s);var g=(c,t,s)=>new Promise((i,l)=>{var m=f=>{try{L(s.next(f))}catch(D){l(D)}},w=f=>{try{L(s.throw(f))}catch(D){l(D)}},L=f=>f.done?i(f.value):Promise.resolve(f.value).then(m,w);L((s=s.apply(c,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pt=require("../notifier/index.cjs");require("construct-style-sheets-polyfill");require("../index-CKTweR3M.cjs");const x=require("../url-C2kASACG.cjs"),ft=require("urlpattern-polyfill"),gt=require("../render-DBQUdpsp.cjs"),Rt=require("../dom-hTEdqeoj.cjs"),_=require("../object-CCiXnER2.cjs");var b,y,B,G,H;class yt{constructor(t,s){a(this,B);a(this,b);a(this,y);a(this,H,t=>{t.preventDefault();const s=e(this,B,G),i=e(this,y).getAttribute("data-history-action")||"push";e(this,b).navigate(s,{historyAction:i})});h(this,b,t),h(this,y,s),e(this,y).addEventListener("click",e(this,H))}checkCurrent(t){}destroy(){e(this,y).removeEventListener("click",e(this,H)),e(this,y).classList.remove("current")}}b=new WeakMap,y=new WeakMap,B=new WeakSet,G=function(){const t=new URL(e(this,y).href);return e(this,b).normalizePath(t.pathname+t.search+t.hash).path},H=new WeakMap;var C,T,S,d,u,k,M,P,A,N,o,J,Q,V,X,Z,$,tt,et,st,K;class vt{constructor(t,s){a(this,o);a(this,C);a(this,T);a(this,S);a(this,d,null);a(this,u,null);a(this,k,!1);a(this,M,null);a(this,P);a(this,A,[]);a(this,N,[]);h(this,C,t),h(this,T,s),h(this,S,new URLPattern({pathname:e(this,C)})),h(this,P,new MutationObserver(n(this,o,et).bind(this)))}get pattern(){return e(this,C)}get isActive(){return e(this,k)}get element(){return e(this,u)}get nest(){return e(this,M)}testPathname(t){return e(this,S).test({pathname:t})}render(t,s){return g(this,null,function*(){e(this,P).observe(document.head,{childList:!0,subtree:!0}),e(this,d)?n(this,o,V).call(this):yield n(this,o,J).call(this),yield n(this,o,st).call(this),e(this,d)&&(yield n(this,o,X).call(this,t,s)),e(this,P).disconnect()})}close(){n(this,o,$).call(this)}getAnchorElements(){const t=[];return e(this,u)&&(t.push(...e(this,u).querySelectorAll("a")),Rt.traverseShadowRoots(e(this,u),s=>{t.push(...s.shadowRoot.querySelectorAll("a"))})),t}}C=new WeakMap,T=new WeakMap,S=new WeakMap,d=new WeakMap,u=new WeakMap,k=new WeakMap,M=new WeakMap,P=new WeakMap,A=new WeakMap,N=new WeakMap,o=new WeakSet,J=function(){return g(this,null,function*(){const t=yield e(this,T).call(this);h(this,N,[...e(this,A)]),typeof t.default=="function"&&(h(this,d,t.default),yield n(this,o,Q).call(this))})},Q=function(){return g(this,null,function*(){if(e(this,d)&&_.isESClass(e(this,d))){const t=`e-${e(this,d).name.toLowerCase()}`;customElements.get(t)||customElements.define(t,e(this,d))}})},V=function(){e(this,A).forEach(t=>{document.head.appendChild(t.cloneNode(!0))})},X=function(t,s){return g(this,null,function*(){const l={urlPatternResult:e(this,S).exec({pathname:s})};_.isESClass(e(this,d))?(h(this,u,new(e(this,d))(l)),t.appendChild(e(this,u))):h(this,u,gt.render(t,e(this,d),l)),n(this,o,Z).call(this),h(this,k,!0)})},Z=function(){var t;e(this,u)&&h(this,M,e(this,u).querySelector("[data-nest]")||((t=e(this,u).shadowRoot)==null?void 0:t.querySelector("[data-nest]"))||e(this,u).shadowRoot||e(this,u))},$=function(){var t;e(this,P).disconnect(),(t=e(this,u))==null||t.remove(),h(this,k,!1),n(this,o,tt).call(this)},tt=function(){e(this,N).forEach(t=>{t.parentNode===document.head&&document.head.removeChild(t)}),h(this,N,[])},et=function(t){t.forEach(s=>{s.addedNodes.forEach(i=>{e(this,d)?e(this,N).push(i):e(this,A).push(i)})})},st=function(){return g(this,null,function*(){const t=e(this,A).filter(n(this,o,K));yield Promise.all(t.map(s=>new Promise(i=>{n(this,o,K).call(this,s)?s.onload=()=>i():i()})))})},K=function(t){return t instanceof HTMLElement&&(t.tagName==="STYLE"||t.tagName==="SCRIPT"||t.tagName==="LINK")};globalThis.URLPattern=ft.URLPattern;var q,I,R,U,E,v,j,p,z,r,it,at,rt,ht,nt,ot,ct,lt,ut,W,dt,mt,O;class wt{constructor(t){a(this,r);a(this,q);a(this,I);a(this,R,[]);a(this,U,null);a(this,E,[]);a(this,v,null);a(this,j,null);a(this,p,null);a(this,z,new pt.Notifier);a(this,O,t=>{var s;(s=t.state)!=null&&s.path&&this.navigate(t.state.path,{historyAction:"none"})});var s;h(this,I,t!=null&&t.base?x.normalizeBase(t.base):"/"),h(this,q,(s=t==null?void 0:t.rootElement)!=null?s:document.body),h(this,p,this.normalizePath(location.pathname+location.search+location.hash)),n(this,r,it).call(this)}get candidateURL(){return e(this,v)}get currentURL(){return e(this,p)}get routes(){return e(this,R)}get links(){return e(this,E)}run(){n(this,r,lt).call(this),this.navigate(e(this,p).path,{revalidate:!0})}destroy(){removeEventListener("popstate",e(this,O)),n(this,r,W).call(this),e(this,R).forEach(t=>t.close()),e(this,z).close()}navigationEvent(t){return e(this,z).subscribe(t)}defineRoute(t,s){const i=new vt(t,s);e(this,R).push(i)}navigate(t,s){return g(this,null,function*(){var l,m,w;const i=this.normalizePath(t);if(!(s!=null&&s.revalidate)&&(((l=e(this,v))==null?void 0:l.pathname)===i.pathname||e(this,p).pathname===i.pathname)){((m=e(this,p))==null?void 0:m.parameters)!==i.parameters&&(h(this,j,e(this,p)),h(this,p,i),x.changeHistory({action:((w=e(this,p))==null?void 0:w.hash)!==i.hash?"replace":(s==null?void 0:s.historyAction)||"push",pathname:i.pathname,searchParameters:i.parameters,hash:i.hash})),e(this,E).forEach(L=>{L.checkCurrent(i)});return}h(this,v,i),(yield n(this,r,at).call(this,e(this,v)))&&i.path===e(this,v).path&&(yield n(this,r,rt).call(this,e(this,v),s))})}normalizePath(t){return x.splitPath(t,{base:e(this,I)})}}q=new WeakMap,I=new WeakMap,R=new WeakMap,U=new WeakMap,E=new WeakMap,v=new WeakMap,j=new WeakMap,p=new WeakMap,z=new WeakMap,r=new WeakSet,it=function(){addEventListener("popstate",e(this,O))},at=function(t){return g(this,null,function*(){if(!this.preprocessor)return!0;try{return yield new Promise((s,i)=>{var l;(l=this.preprocessor)==null||l.call(this,{path:t,resolve:s,reject:i})}),!0}catch(s){return console.error(s!=null?s:"Route change canceled"),!1}})},rt=function(i){return g(this,arguments,function*(t,s={}){var f;const{activeRoutes:l,newRoutes:m,oldRoutes:w,keepRoutes:L}=n(this,r,ht).call(this,t.leaf);h(this,U,(f=L[L.length-1])!=null?f:null),n(this,r,nt).call(this,w),h(this,p,t),x.changeHistory({action:s.historyAction||"push",pathname:t.pathname,searchParameters:t.parameters,hash:t.hash}),yield n(this,r,ot).call(this,m,t.leaf),n(this,r,ut).call(this),n(this,r,ct).call(this,t.pathname)})},ht=function(t){const s=e(this,R).filter(i=>i.isActive);return{activeRoutes:s,newRoutes:e(this,R).filter(i=>!s.includes(i)&&i.testPathname(t)),oldRoutes:s.filter(i=>!i.testPathname(t)),keepRoutes:s.filter(i=>i.testPathname(t))}},nt=function(t){t.forEach(s=>s.close())},ot=function(t,s){return g(this,null,function*(){var i,l;for(const m of t){const w=(l=(i=e(this,U))==null?void 0:i.nest)!=null?l:e(this,q);yield m.render(w,s),h(this,U,m)}})},ct=function(t){var s;(s=this.postprocessor)==null||s.call(this,{pathname:t}),e(this,z).notify({pathname:t})},lt=function(){e(this,R).sort((t,s)=>{const i=t.pattern.split("/").length,l=s.pattern.split("/").length;return i-l})},ut=function(){n(this,r,W).call(this),n(this,r,dt).call(this)},W=function(){e(this,E).forEach(t=>t.destroy()),h(this,E,[])},dt=function(){const t=e(this,R).filter(i=>i.isActive),s=n(this,r,mt).call(this,t);h(this,E,s.map(i=>new yt(this,i)))},mt=function(t){const s=Array.from(e(this,q).querySelectorAll("a")),i=t.flatMap(l=>l.getAnchorElements());return Array.from(new Set([...s,...i].filter(l=>{var m;return(m=l.getAttribute("href"))==null?void 0:m.startsWith("/")})))},O=new WeakMap;exports.Router=wt;
@@ -1,2 +1,2 @@
1
- export { Router, type RouterPreprocessorEntry, type RouterPreprocessor, type RouterPostprocessor, type RouterAfterNavigationCallback, type RouterParameters, } from './Router';
2
- export { type RouteModule, type RouteParameters, type RouteURLParams, } from './Route';
1
+ export { Router, type RouterAfterNavigationCallback, type RouterParameters, type RouterPostprocessor, type RouterPreprocessor, type RouterPreprocessorEntry, } from './Router';
2
+ export { type RouteModule, type RouteParameters } from './Route';
@@ -1,268 +1,319 @@
1
- var X = (a, e) => (e = Symbol[a]) ? e : Symbol.for("Symbol." + a), Z = (a) => {
2
- throw TypeError(a);
1
+ var W = (c) => {
2
+ throw TypeError(c);
3
3
  };
4
- var W = (a, e, s) => e.has(a) || Z("Cannot " + s);
5
- var t = (a, e, s) => (W(a, e, "read from private field"), s ? s.call(a) : e.get(a)), h = (a, e, s) => e.has(a) ? Z("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, s), n = (a, e, s, i) => (W(a, e, "write to private field"), i ? i.call(a, s) : e.set(a, s), s), Y = (a, e, s) => (W(a, e, "access private method"), s);
6
- var I = (a, e, s) => new Promise((i, r) => {
7
- var o = (m) => {
4
+ var $ = (c, t, s) => t.has(c) || W("Cannot " + s);
5
+ var e = (c, t, s) => ($(c, t, "read from private field"), s ? s.call(c) : t.get(c)), a = (c, t, s) => t.has(c) ? W("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(c) : t.set(c, s), r = (c, t, s, i) => ($(c, t, "write to private field"), i ? i.call(c, s) : t.set(c, s), s), n = (c, t, s) => ($(c, t, "access private method"), s);
6
+ var R = (c, t, s) => new Promise((i, l) => {
7
+ var m = (f) => {
8
8
  try {
9
- f(s.next(m));
10
- } catch (w) {
11
- r(w);
9
+ y(s.next(f));
10
+ } catch (D) {
11
+ l(D);
12
12
  }
13
- }, c = (m) => {
13
+ }, w = (f) => {
14
14
  try {
15
- f(s.throw(m));
16
- } catch (w) {
17
- r(w);
15
+ y(s.throw(f));
16
+ } catch (D) {
17
+ l(D);
18
18
  }
19
- }, f = (m) => m.done ? i(m.value) : Promise.resolve(m.value).then(o, c);
20
- f((s = s.apply(a, e)).next());
19
+ }, y = (f) => f.done ? i(f.value) : Promise.resolve(f.value).then(m, w);
20
+ y((s = s.apply(c, t)).next());
21
21
  });
22
- var $ = (a, e, s) => (e = a[X("asyncIterator")]) ? e.call(a) : (a = a[X("iterator")](), e = {}, s = (i, r) => (r = a[i]) && (e[i] = (o) => new Promise((c, f, m) => (o = r.call(a, o), m = o.done, Promise.resolve(o.value).then((w) => c({ value: w, done: m }), f)))), s("next"), s("return"), e);
23
- import { URLPattern as at } from "urlpattern-polyfill";
24
- import { Notifier as nt } from "../notifier/index.js";
25
- import { i as _ } from "../index-Bv9zgfdb.js";
26
- import { d as ht } from "../function-C10DGppn.js";
22
+ import { Notifier as pt } from "../notifier/index.js";
27
23
  import "construct-style-sheets-polyfill";
28
- import { n as rt, c as ot, s as ct } from "../url-Ddgqz4Q_.js";
29
- import { i as lt } from "../object-D6MVWB4l.js";
30
- var y, U, A, p, d, L, k, v, E, R, M, tt;
31
- class ut {
32
- constructor(e, s) {
33
- h(this, M);
34
- h(this, y);
35
- h(this, U);
36
- h(this, A);
37
- h(this, p);
38
- h(this, d);
39
- h(this, L);
40
- h(this, k);
41
- h(this, v, null);
42
- h(this, E, []);
43
- h(this, R, []);
44
- n(this, y, e), n(this, U, s), n(this, A, new URLPattern({ pathname: t(this, y) })), n(this, p, null), n(this, d, null), n(this, L, !1), n(this, k, null), _ && n(this, v, new MutationObserver((i) => {
45
- i[0].addedNodes.forEach((o) => {
46
- t(this, p) ? t(this, R).push(o) : t(this, E).push(o);
24
+ import "../index-JqYHGoo6.js";
25
+ import { n as ft, c as Y, s as Rt } from "../url-CGbjOTU4.js";
26
+ import { URLPattern as gt } from "urlpattern-polyfill";
27
+ import { r as vt } from "../render-CMQbWthg.js";
28
+ import { t as Lt } from "../dom-fgxIeFxm.js";
29
+ import { i as j } from "../object-D6MVWB4l.js";
30
+ var b, v, B, G, T;
31
+ class wt {
32
+ constructor(t, s) {
33
+ a(this, B);
34
+ a(this, b);
35
+ a(this, v);
36
+ a(this, T, (t) => {
37
+ t.preventDefault();
38
+ const s = e(this, B, G), i = e(this, v).getAttribute(
39
+ "data-history-action"
40
+ ) || "push";
41
+ e(this, b).navigate(s, {
42
+ historyAction: i
47
43
  });
48
- }));
44
+ });
45
+ r(this, b, t), r(this, v, s), e(this, v).addEventListener("click", e(this, T));
49
46
  }
50
- get pattern() {
51
- return t(this, y);
47
+ checkCurrent(t) {
48
+ }
49
+ destroy() {
50
+ e(this, v).removeEventListener("click", e(this, T)), e(this, v).classList.remove("current");
52
51
  }
53
- get urlPattern() {
54
- return t(this, A);
52
+ }
53
+ b = new WeakMap(), v = new WeakMap(), B = new WeakSet(), G = function() {
54
+ const t = new URL(e(this, v).href);
55
+ return e(this, b).normalizePath(
56
+ t.pathname + t.search + t.hash
57
+ ).path;
58
+ }, T = new WeakMap();
59
+ var k, q, C, d, u, U, M, P, A, N, o, J, Q, V, X, Z, _, tt, et, st, F;
60
+ class yt {
61
+ constructor(t, s) {
62
+ a(this, o);
63
+ a(this, k);
64
+ a(this, q);
65
+ a(this, C);
66
+ a(this, d, null);
67
+ a(this, u, null);
68
+ a(this, U, !1);
69
+ a(this, M, null);
70
+ a(this, P);
71
+ a(this, A, []);
72
+ a(this, N, []);
73
+ r(this, k, t), r(this, q, s), r(this, C, new URLPattern({ pathname: e(this, k) })), r(this, P, new MutationObserver(
74
+ n(this, o, et).bind(this)
75
+ ));
76
+ }
77
+ get pattern() {
78
+ return e(this, k);
55
79
  }
56
80
  get isActive() {
57
- return t(this, L);
81
+ return e(this, U);
58
82
  }
59
83
  get element() {
60
- return t(this, d);
84
+ return e(this, u);
61
85
  }
62
86
  get nest() {
63
- return t(this, k);
87
+ return e(this, M);
64
88
  }
65
- testPathname(e) {
66
- return this.urlPattern.test({ pathname: e });
89
+ testPathname(t) {
90
+ return e(this, C).test({ pathname: t });
67
91
  }
68
- render(e, s) {
69
- return I(this, null, function* () {
70
- var i, r;
71
- if (t(this, v).observe(document.head, {
92
+ render(t, s) {
93
+ return R(this, null, function* () {
94
+ e(this, P).observe(document.head, {
72
95
  childList: !0,
73
96
  subtree: !0
74
- }), t(this, p))
75
- t(this, E).forEach((o) => {
76
- document.head.appendChild(o);
77
- });
78
- else {
79
- const o = yield t(this, U).call(this);
80
- if (n(this, R, [...t(this, E)]), typeof o.default == "function" && (n(this, p, o.default), lt(o.default))) {
81
- const c = "e-" + ((i = t(this, p)) == null ? void 0 : i.name.toLowerCase());
82
- customElements.get(c) || customElements.define(c, o.default);
83
- }
84
- }
85
- if (yield Y(this, M, tt).call(this), t(this, p)) {
86
- const o = t(this, A).exec({ pathname: s }), c = (o == null ? void 0 : o.pathname.groups) || {}, f = Object.fromEntries(
87
- new URLSearchParams(location.search)
88
- ), m = {
89
- pathnameParams: c,
90
- searchParams: f
91
- };
92
- n(this, d, new (t(this, p))(m)), e.appendChild(t(this, d)), n(this, k, t(this, d).querySelector("[data-nest]") || ((r = t(this, d).shadowRoot) == null ? void 0 : r.querySelector("[data-nest]")) || t(this, d).shadowRoot || t(this, d)), n(this, L, !0);
93
- }
94
- t(this, v).disconnect();
97
+ }), e(this, d) ? n(this, o, V).call(this) : yield n(this, o, J).call(this), yield n(this, o, st).call(this), e(this, d) && (yield n(this, o, X).call(this, t, s)), e(this, P).disconnect();
95
98
  });
96
99
  }
97
100
  close() {
98
- var e;
99
- t(this, v).disconnect(), (e = t(this, d)) == null || e.remove(), n(this, L, !1), t(this, R).forEach((s) => document.head.removeChild(s)), n(this, R, []);
101
+ n(this, o, _).call(this);
100
102
  }
101
103
  getAnchorElements() {
102
- var s;
103
- let e = [];
104
- return t(this, d) && (e = [...t(this, d).querySelectorAll("a")]), (s = t(this, d)) != null && s.shadowRoot && (e = [
105
- ...e,
106
- ...t(this, d).shadowRoot.querySelectorAll("a")
107
- ]), e;
104
+ const t = [];
105
+ return e(this, u) && (t.push(...e(this, u).querySelectorAll("a")), Lt(e(this, u), (s) => {
106
+ t.push(...s.shadowRoot.querySelectorAll("a"));
107
+ })), t;
108
108
  }
109
109
  }
110
- y = new WeakMap(), U = new WeakMap(), A = new WeakMap(), p = new WeakMap(), d = new WeakMap(), L = new WeakMap(), k = new WeakMap(), v = new WeakMap(), E = new WeakMap(), R = new WeakMap(), M = new WeakSet(), tt = function() {
111
- return I(this, null, function* () {
112
- const e = t(this, E).filter((c) => c instanceof HTMLElement ? c.tagName === "STYLE" || c.tagName === "SCRIPT" || c.tagName === "LINK" : !1);
113
- try {
114
- for (var s = $(e), i, r, o; i = !(r = yield s.next()).done; i = !1) {
115
- const c = r.value;
116
- yield new Promise((f) => {
117
- c.onload = () => {
118
- f();
119
- };
120
- });
121
- }
122
- } catch (r) {
123
- o = [r];
124
- } finally {
125
- try {
126
- i && (r = s.return) && (yield r.call(s));
127
- } finally {
128
- if (o)
129
- throw o[0];
130
- }
110
+ k = new WeakMap(), q = new WeakMap(), C = new WeakMap(), d = new WeakMap(), u = new WeakMap(), U = new WeakMap(), M = new WeakMap(), P = new WeakMap(), A = new WeakMap(), N = new WeakMap(), o = new WeakSet(), J = function() {
111
+ return R(this, null, function* () {
112
+ const t = yield e(this, q).call(this);
113
+ r(this, N, [...e(this, A)]), typeof t.default == "function" && (r(this, d, t.default), yield n(this, o, Q).call(this));
114
+ });
115
+ }, Q = function() {
116
+ return R(this, null, function* () {
117
+ if (e(this, d) && j(e(this, d))) {
118
+ const t = `e-${e(this, d).name.toLowerCase()}`;
119
+ customElements.get(t) || customElements.define(
120
+ t,
121
+ e(this, d)
122
+ );
131
123
  }
132
124
  });
133
- };
134
- var S, u, P, O, N, x;
135
- class mt {
136
- constructor(e, s) {
137
- h(this, S);
138
- h(this, u);
139
- h(this, P);
140
- h(this, O);
141
- h(this, N);
142
- h(this, x, (e) => {
143
- e.preventDefault(), t(this, S).links.forEach((s) => {
144
- var i;
145
- t(this, P) === t(s, P) || (i = t(s, N)) != null && i.includes(t(this, P)) ? t(s, u).classList.add("clicked") : t(s, u).classList.remove("clicked");
146
- }), t(this, S).navigate(t(this, P), t(this, O));
125
+ }, V = function() {
126
+ e(this, A).forEach((t) => {
127
+ document.head.appendChild(t.cloneNode(!0));
128
+ });
129
+ }, X = function(t, s) {
130
+ return R(this, null, function* () {
131
+ const l = { urlPatternResult: e(this, C).exec({ pathname: s }) };
132
+ j(e(this, d)) ? (r(this, u, new (e(this, d))(l)), t.appendChild(e(this, u))) : r(this, u, vt(
133
+ t,
134
+ e(this, d),
135
+ l
136
+ )), n(this, o, Z).call(this), r(this, U, !0);
137
+ });
138
+ }, Z = function() {
139
+ var t;
140
+ e(this, u) && r(this, M, e(this, u).querySelector("[data-nest]") || ((t = e(this, u).shadowRoot) == null ? void 0 : t.querySelector("[data-nest]")) || e(this, u).shadowRoot || e(this, u));
141
+ }, _ = function() {
142
+ var t;
143
+ e(this, P).disconnect(), (t = e(this, u)) == null || t.remove(), r(this, U, !1), n(this, o, tt).call(this);
144
+ }, tt = function() {
145
+ e(this, N).forEach((t) => {
146
+ t.parentNode === document.head && document.head.removeChild(t);
147
+ }), r(this, N, []);
148
+ }, et = function(t) {
149
+ t.forEach((s) => {
150
+ s.addedNodes.forEach((i) => {
151
+ e(this, d) ? e(this, N).push(i) : e(this, A).push(i);
147
152
  });
148
- var o, c;
149
- n(this, S, e), n(this, u, s), n(this, P, t(this, u).getAttribute("href") || "/"), n(this, O, t(this, u).getAttribute(
150
- "data-history-action"
151
- ) || "push"), t(this, u).addEventListener("click", t(this, x));
152
- const i = e.normalizePath(t(this, P)), r = e.normalizePath(location.pathname);
153
- n(this, N, (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") ? r.pathname.includes(i.pathname) && t(this, u).classList.add("current") : i.pathname === r.pathname || (c = t(this, N)) != null && c.includes(r.pathname) ? (t(this, u).classList.add("current"), t(this, u).classList.add("clicked")) : t(this, u).classList.remove("clicked");
154
- }
155
- destroy() {
156
- t(this, u).removeEventListener("click", t(this, x)), t(this, u).classList.remove("current");
157
- }
158
- }
159
- S = new WeakMap(), u = new WeakMap(), P = new WeakMap(), O = new WeakMap(), N = new WeakMap(), x = new WeakMap();
160
- globalThis.URLPattern = at;
161
- var C, z, g, q, H, b, T, B, j, D, et, K;
162
- class Et {
163
- constructor(e) {
164
- h(this, D);
165
- h(this, C, null);
166
- h(this, z, null);
167
- h(this, g, []);
168
- h(this, q, null);
169
- h(this, H, []);
170
- h(this, b);
171
- h(this, T, null);
172
- h(this, B, new nt());
173
- h(this, j, ht(() => {
174
- const e = (s) => s.split("/").length;
175
- n(this, g, t(this, g).sort((s, i) => e(s.pattern) - e(i.pattern))), this.navigate(location.pathname);
176
- }, 0));
177
- h(this, K, (e) => {
153
+ });
154
+ }, st = function() {
155
+ return R(this, null, function* () {
156
+ const t = e(this, A).filter(n(this, o, F));
157
+ yield Promise.all(
158
+ t.map(
159
+ (s) => new Promise((i) => {
160
+ n(this, o, F).call(this, s) ? s.onload = () => i() : i();
161
+ })
162
+ )
163
+ );
164
+ });
165
+ }, F = function(t) {
166
+ return t instanceof HTMLElement && (t.tagName === "STYLE" || t.tagName === "SCRIPT" || t.tagName === "LINK");
167
+ };
168
+ globalThis.URLPattern = gt;
169
+ var S, I, g, z, E, L, O, p, H, h, it, at, ht, rt, nt, ot, ct, lt, ut, K, dt, mt, x;
170
+ class zt {
171
+ constructor(t) {
172
+ a(this, h);
173
+ a(this, S);
174
+ a(this, I);
175
+ a(this, g, []);
176
+ a(this, z, null);
177
+ a(this, E, []);
178
+ a(this, L, null);
179
+ a(this, O, null);
180
+ a(this, p, null);
181
+ a(this, H, new pt());
182
+ a(this, x, (t) => {
178
183
  var s;
179
- (s = e.state) != null && s.path && this.navigate(e.state.path, "none");
184
+ (s = t.state) != null && s.path && this.navigate(t.state.path, {
185
+ historyAction: "none"
186
+ });
180
187
  });
181
- _ && (e != null && e.base ? n(this, z, rt(e.base)) : n(this, z, "/"), n(this, C, (e == null ? void 0 : e.rootElement) || document.body), addEventListener("popstate", t(this, K)));
188
+ var s;
189
+ r(this, I, t != null && t.base ? ft(t.base) : "/"), r(this, S, (s = t == null ? void 0 : t.rootElement) != null ? s : document.body), r(this, p, this.normalizePath(
190
+ location.pathname + location.search + location.hash
191
+ )), n(this, h, it).call(this);
182
192
  }
183
- get currentPathname() {
184
- return t(this, T);
193
+ get candidateURL() {
194
+ return e(this, L);
185
195
  }
186
- get candidatePathname() {
187
- return t(this, b);
196
+ get currentURL() {
197
+ return e(this, p);
188
198
  }
189
199
  get routes() {
190
- return t(this, g);
200
+ return e(this, g);
191
201
  }
192
202
  get links() {
193
- return t(this, H);
203
+ return e(this, E);
204
+ }
205
+ run() {
206
+ n(this, h, lt).call(this), this.navigate(e(this, p).path, { revalidate: !0 });
194
207
  }
195
- navigationEvent(e) {
196
- return t(this, B).subscribe(e);
208
+ destroy() {
209
+ removeEventListener("popstate", e(this, x)), n(this, h, K).call(this), e(this, g).forEach((t) => t.close()), e(this, H).close();
197
210
  }
198
- defineRoute(e, s) {
199
- const i = new ut(e, s);
200
- t(this, g).push(i), t(this, j).call(this);
211
+ navigationEvent(t) {
212
+ return e(this, H).subscribe(t);
201
213
  }
202
- navigate(e, s = "push") {
203
- return I(this, null, function* () {
204
- var J, Q;
205
- const i = this.normalizePath(e);
206
- let { pathname: r, hash: o, parameters: c, leaf: f } = i;
207
- if (t(this, b) === r || t(this, T) === r)
214
+ defineRoute(t, s) {
215
+ const i = new yt(t, s);
216
+ e(this, g).push(i);
217
+ }
218
+ navigate(t, s) {
219
+ return R(this, null, function* () {
220
+ var l, m, w;
221
+ const i = this.normalizePath(t);
222
+ if (!(s != null && s.revalidate) && (((l = e(this, L)) == null ? void 0 : l.pathname) === i.pathname || e(this, p).pathname === i.pathname)) {
223
+ ((m = e(this, p)) == null ? void 0 : m.parameters) !== i.parameters && (r(this, O, e(this, p)), r(this, p, i), Y({
224
+ action: ((w = e(this, p)) == null ? void 0 : w.hash) !== i.hash ? "replace" : (s == null ? void 0 : s.historyAction) || "push",
225
+ pathname: i.pathname,
226
+ searchParameters: i.parameters,
227
+ hash: i.hash
228
+ })), e(this, E).forEach((y) => {
229
+ y.checkCurrent(i);
230
+ });
208
231
  return;
209
- n(this, b, r);
210
- const m = t(this, g).filter((l) => l.isActive), w = t(this, g).filter(
211
- (l) => !m.includes(l) && l.testPathname(f)
212
- ), st = m.filter((l) => !l.testPathname(f)), F = m.filter((l) => l.testPathname(f));
213
- let G = !0;
214
- if (this.preprocessor)
215
- try {
216
- yield new Promise((l, it) => {
217
- var V;
218
- (V = this.preprocessor) == null || V.call(this, { path: i, resolve: l, reject: it });
219
- });
220
- } catch (l) {
221
- l ? console.error(l) : console.log("Route change canceled"), G = !1;
222
- }
223
- if (G && t(this, b) === r) {
224
- n(this, q, F[F.length - 1]), st.forEach((l) => {
225
- l.close();
226
- }), n(this, T, r), ot({ action: s, pathname: r, searchParameters: c, hash: o });
227
- try {
228
- for (var yt = $(w), At, kt, St; At = !(kt = yield yt.next()).done; At = !1) {
229
- const l = kt.value;
230
- yield l.render(((J = t(this, q)) == null ? void 0 : J.nest) || t(this, C), r), n(this, q, l);
231
- }
232
- } catch (kt) {
233
- St = [kt];
234
- } finally {
235
- try {
236
- At && (kt = yt.return) && (yield kt.call(yt));
237
- } finally {
238
- if (St)
239
- throw St[0];
240
- }
241
- }
242
- Y(this, D, et).call(this), (Q = this.postprocessor) == null || Q.call(this, { pathname: r }), t(this, B).notify({ pathname: r });
243
232
  }
233
+ r(this, L, i), (yield n(this, h, at).call(this, e(this, L))) && i.path === e(this, L).path && (yield n(this, h, ht).call(this, e(this, L), s));
244
234
  });
245
235
  }
246
- normalizePath(e) {
247
- return ct(e, { base: t(this, z) });
236
+ normalizePath(t) {
237
+ return Rt(t, { base: e(this, I) });
248
238
  }
249
239
  }
250
- C = new WeakMap(), z = new WeakMap(), g = new WeakMap(), q = new WeakMap(), H = new WeakMap(), b = new WeakMap(), T = new WeakMap(), B = new WeakMap(), j = new WeakMap(), D = new WeakSet(), et = function() {
251
- const e = t(this, g).filter((i) => i.isActive), s = Array.from(
240
+ S = new WeakMap(), I = new WeakMap(), g = new WeakMap(), z = new WeakMap(), E = new WeakMap(), L = new WeakMap(), O = new WeakMap(), p = new WeakMap(), H = new WeakMap(), h = new WeakSet(), it = function() {
241
+ addEventListener("popstate", e(this, x));
242
+ }, at = function(t) {
243
+ return R(this, null, function* () {
244
+ if (!this.preprocessor) return !0;
245
+ try {
246
+ return yield new Promise((s, i) => {
247
+ var l;
248
+ (l = this.preprocessor) == null || l.call(this, { path: t, resolve: s, reject: i });
249
+ }), !0;
250
+ } catch (s) {
251
+ return console.error(s != null ? s : "Route change canceled"), !1;
252
+ }
253
+ });
254
+ }, ht = function(i) {
255
+ return R(this, arguments, function* (t, s = {}) {
256
+ var f;
257
+ const { activeRoutes: l, newRoutes: m, oldRoutes: w, keepRoutes: y } = n(this, h, rt).call(this, t.leaf);
258
+ r(this, z, (f = y[y.length - 1]) != null ? f : null), n(this, h, nt).call(this, w), r(this, p, t), Y({
259
+ action: s.historyAction || "push",
260
+ pathname: t.pathname,
261
+ searchParameters: t.parameters,
262
+ hash: t.hash
263
+ }), yield n(this, h, ot).call(this, m, t.leaf), n(this, h, ut).call(this), n(this, h, ct).call(this, t.pathname);
264
+ });
265
+ }, rt = function(t) {
266
+ const s = e(this, g).filter((i) => i.isActive);
267
+ return {
268
+ activeRoutes: s,
269
+ newRoutes: e(this, g).filter(
270
+ (i) => !s.includes(i) && i.testPathname(t)
271
+ ),
272
+ oldRoutes: s.filter((i) => !i.testPathname(t)),
273
+ keepRoutes: s.filter((i) => i.testPathname(t))
274
+ };
275
+ }, nt = function(t) {
276
+ t.forEach((s) => s.close());
277
+ }, ot = function(t, s) {
278
+ return R(this, null, function* () {
279
+ var i, l;
280
+ for (const m of t) {
281
+ const w = (l = (i = e(this, z)) == null ? void 0 : i.nest) != null ? l : e(this, S);
282
+ yield m.render(w, s), r(this, z, m);
283
+ }
284
+ });
285
+ }, ct = function(t) {
286
+ var s;
287
+ (s = this.postprocessor) == null || s.call(this, { pathname: t }), e(this, H).notify({ pathname: t });
288
+ }, lt = function() {
289
+ e(this, g).sort((t, s) => {
290
+ const i = t.pattern.split("/").length, l = s.pattern.split("/").length;
291
+ return i - l;
292
+ });
293
+ }, ut = function() {
294
+ n(this, h, K).call(this), n(this, h, dt).call(this);
295
+ }, K = function() {
296
+ e(this, E).forEach((t) => t.destroy()), r(this, E, []);
297
+ }, dt = function() {
298
+ const t = e(this, g).filter((i) => i.isActive), s = n(this, h, mt).call(this, t);
299
+ r(this, E, s.map((i) => new wt(this, i)));
300
+ }, mt = function(t) {
301
+ const s = Array.from(
302
+ e(this, S).querySelectorAll("a")
303
+ ), i = t.flatMap(
304
+ (l) => l.getAnchorElements()
305
+ );
306
+ return Array.from(
252
307
  new Set(
253
- [
254
- ...t(this, C).querySelectorAll("a"),
255
- ...e.map((i) => i.getAnchorElements()).flat()
256
- ].filter((i) => {
257
- var r;
258
- return (r = i.getAttribute("href")) == null ? void 0 : r.startsWith("/");
259
- })
308
+ [...s, ...i].filter(
309
+ (l) => {
310
+ var m;
311
+ return (m = l.getAttribute("href")) == null ? void 0 : m.startsWith("/");
312
+ }
313
+ )
260
314
  )
261
315
  );
262
- t(this, H).forEach((i) => {
263
- i.destroy();
264
- }), n(this, H, s.map((i) => new mt(this, i)));
265
- }, K = new WeakMap();
316
+ }, x = new WeakMap();
266
317
  export {
267
- Et as Router
318
+ zt as Router
268
319
  };