@jasonshimmy/custom-elements-runtime 3.2.0 → 3.2.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.
- package/dist/{css-utils-Cg4o1MqY.js → css-utils-CC43BbEy.js} +20 -21
- package/dist/css-utils-CC43BbEy.js.map +1 -0
- package/dist/{css-utils-RqkyBWft.cjs → css-utils-mgjmH8qX.cjs} +5 -4
- package/dist/css-utils-mgjmH8qX.cjs.map +1 -0
- package/dist/custom-elements-runtime.cjs.js +4 -3
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.colors.cjs.js +3 -2
- package/dist/custom-elements-runtime.colors.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.colors.es.js +3 -2
- package/dist/custom-elements-runtime.colors.es.js.map +1 -1
- package/dist/custom-elements-runtime.directive-enhancements.cjs.js +3 -2
- package/dist/custom-elements-runtime.directive-enhancements.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.directive-enhancements.es.js +86 -100
- package/dist/custom-elements-runtime.directive-enhancements.es.js.map +1 -1
- package/dist/custom-elements-runtime.directives.cjs.js +3 -2
- package/dist/custom-elements-runtime.directives.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.directives.es.js +40 -43
- package/dist/custom-elements-runtime.directives.es.js.map +1 -1
- package/dist/custom-elements-runtime.dom-jit-css.cjs.js +7 -6
- package/dist/custom-elements-runtime.dom-jit-css.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.dom-jit-css.es.js +58 -76
- package/dist/custom-elements-runtime.dom-jit-css.es.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +162 -186
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.event-bus.cjs.js +3 -2
- package/dist/custom-elements-runtime.event-bus.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.event-bus.es.js +48 -103
- package/dist/custom-elements-runtime.event-bus.es.js.map +1 -1
- package/dist/custom-elements-runtime.jit-css.cjs.js +3 -2
- package/dist/custom-elements-runtime.jit-css.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.jit-css.es.js +29 -30
- package/dist/custom-elements-runtime.jit-css.es.js.map +1 -1
- package/dist/custom-elements-runtime.router.cjs.js +20 -19
- package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.router.es.js +585 -603
- package/dist/custom-elements-runtime.router.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js +5 -4
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.ssr-middleware.es.js +44 -37
- package/dist/custom-elements-runtime.ssr-middleware.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr.cjs.js +1 -4
- package/dist/custom-elements-runtime.ssr.es.js +11 -176
- package/dist/custom-elements-runtime.store.cjs.js +3 -2
- package/dist/custom-elements-runtime.store.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.store.es.js +17 -11
- package/dist/custom-elements-runtime.store.es.js.map +1 -1
- package/dist/custom-elements-runtime.transitions.cjs.js +3 -2
- package/dist/custom-elements-runtime.transitions.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.transitions.es.js +55 -120
- package/dist/custom-elements-runtime.transitions.es.js.map +1 -1
- package/dist/custom-elements-runtime.vite-plugin.cjs.js +3 -2
- package/dist/custom-elements-runtime.vite-plugin.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.vite-plugin.es.js +54 -75
- package/dist/custom-elements-runtime.vite-plugin.es.js.map +1 -1
- package/dist/hooks-_3xP4G2N.js +1189 -0
- package/dist/hooks-_3xP4G2N.js.map +1 -0
- package/dist/hooks-fYQgZk2g.cjs +7 -0
- package/dist/hooks-fYQgZk2g.cjs.map +1 -0
- package/dist/logger-BYIN7ysT.cjs +3 -0
- package/dist/logger-BYIN7ysT.cjs.map +1 -0
- package/dist/logger-L25axmB-.js +41 -0
- package/dist/logger-L25axmB-.js.map +1 -0
- package/dist/namespace-helpers-Bf7rm9JV.cjs +3 -0
- package/dist/namespace-helpers-Bf7rm9JV.cjs.map +1 -0
- package/dist/namespace-helpers-BucDdgz_.js +61 -0
- package/dist/namespace-helpers-BucDdgz_.js.map +1 -0
- package/dist/reset.css +1 -1
- package/dist/ssr-B3lxl1vr.js +165 -0
- package/dist/ssr-B3lxl1vr.js.map +1 -0
- package/dist/ssr-DtD9e5iA.cjs +5 -0
- package/dist/ssr-DtD9e5iA.cjs.map +1 -0
- package/dist/style-Bjn8zDiZ.cjs +56 -0
- package/dist/style-Bjn8zDiZ.cjs.map +1 -0
- package/dist/{style-BmyOIMcU.js → style-DuDoj_xK.js} +724 -876
- package/dist/style-DuDoj_xK.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/template-compiler-BB4JJdqk.cjs +23 -0
- package/dist/template-compiler-BB4JJdqk.cjs.map +1 -0
- package/dist/template-compiler-Cs5axmn4.js +3236 -0
- package/dist/template-compiler-Cs5axmn4.js.map +1 -0
- package/dist/variables.css +1 -1
- package/package.json +7 -7
- package/dist/css-utils-Cg4o1MqY.js.map +0 -1
- package/dist/css-utils-RqkyBWft.cjs.map +0 -1
- package/dist/custom-elements-runtime.ssr.cjs.js.map +0 -1
- package/dist/custom-elements-runtime.ssr.es.js.map +0 -1
- package/dist/hooks-BH-CpUun.js +0 -1474
- package/dist/hooks-BH-CpUun.js.map +0 -1
- package/dist/hooks-NOFG9QRQ.cjs +0 -6
- package/dist/hooks-NOFG9QRQ.cjs.map +0 -1
- package/dist/logger-BvkEbVM4.js +0 -48
- package/dist/logger-BvkEbVM4.js.map +0 -1
- package/dist/logger-CSALKaYm.cjs +0 -2
- package/dist/logger-CSALKaYm.cjs.map +0 -1
- package/dist/namespace-helpers-D4wC2-qA.js +0 -61
- package/dist/namespace-helpers-D4wC2-qA.js.map +0 -1
- package/dist/namespace-helpers-ckeEOxpR.cjs +0 -2
- package/dist/namespace-helpers-ckeEOxpR.cjs.map +0 -1
- package/dist/style-BmyOIMcU.js.map +0 -1
- package/dist/style-D40DsIqJ.cjs +0 -55
- package/dist/style-D40DsIqJ.cjs.map +0 -1
- package/dist/template-compiler-CDvhsHia.cjs +0 -22
- package/dist/template-compiler-CDvhsHia.cjs.map +0 -1
- package/dist/template-compiler-DiE69FLO.js +0 -3724
- package/dist/template-compiler-DiE69FLO.js.map +0 -1
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./logger-CSALKaYm.cjs"),S=require("./hooks-NOFG9QRQ.cjs"),D=require("./template-compiler-CDvhsHia.cjs"),ct=require("./custom-elements-runtime.store.cjs.js"),St=require("./custom-elements-runtime.directives.cjs.js"),at={enabled:!0,offset:0,timeoutMs:2e3},et=t=>t?typeof URLSearchParams>"u"?{}:Object.fromEntries(new URLSearchParams(t)):{},ht=t=>{if(!t||Object.keys(t).length===0)return"";try{return"?"+new URLSearchParams(t).toString()}catch{return""}},ot=t=>t?/^\s*javascript\s*:/i.test(t):!1,H=t=>/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(t)||t.startsWith("//"),pt=t=>{try{return decodeURIComponent(t)}catch{return t}};function x(t){if(!t)return"/";let r=t.replace(/\/+/g,"/");return r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),r}const yt=t=>{if(!t)return"";const r=x(t);return r==="/"?"":r},it=new WeakMap;function Rt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Et(t){const r=t.path||"/",p=x(r),o=p==="/"?[]:p.split("/").filter(Boolean),i=[],a=[];for(let g=0;g<o.length;g++){const u=o[g];if(u==="*"){if(g!==o.length-1)return c.devWarn(`Route '${t.path}' contains a '*' splat in a non-terminal position; splats must be the last segment. This route will be ignored.`),{invalid:!0};const R=`splat${i.length}`;i.push(R),a.push("__SPLAT__");continue}const y=u.match(/^:([A-Za-z0-9_-]+)(\*)?$/);if(y){const R=y[1],A=!!y[2];if(A&&g!==o.length-1)return c.devWarn(`Route '${t.path}' contains a splat param ':${R}*' in a non-terminal position; splats must be the last segment. This route will be ignored.`),{invalid:!0};i.push(R),a.push(A?"__SPLAT__":"([^/]+)");continue}a.push(Rt(u))}let v;if(a.length===0)v="^/$";else if(a[a.length-1]==="__SPLAT__"){const u=a.slice(0,-1).join("/");u?v=`^/${u}(?:/(.*))?(?:/)?$`:v="^(?:/(.*))?(?:/)?$"}else v=`^/${a.join("/")}(?:/)?$`;try{return{regex:new RegExp(v),paramNames:i}}catch(g){return c.devWarn(`Failed to compile route regex for '${t.path}': ${String(g)}`),{invalid:!0}}}const V=(t,r)=>{const p=x(r);for(const o of t){let i=it.get(o);if(i||(i=Et(o),it.set(o,i)),i.invalid)continue;const{regex:a,paramNames:v}=i,g=a.exec(p);if(g){const u={};for(let y=0;y<v.length;y++){const R=g[y+1]||"";u[v[y]]=R?pt(R):""}return{route:o,params:u}}}return{route:null,params:{}}};function G(t,r){for(const p of t)if(V([p],r).route!==null)return p;return null}function $t(t,r){const p=r.split("?")[0].split("#")[0];return V(t,p)}const lt=50;let J={},K={};function mt(){J={},K={}}function Ct(){const t=Object.entries(J);if(t.length<=lt)return;const p=t.sort(([,o],[,i])=>o.lastAccessed-i.lastAccessed).slice(0,t.length-lt);for(const[o]of p)delete J[o]}async function vt(t){if(t.component)return t.component;if(t.load){const r=J[t.path];if(r)return r.lastAccessed=Date.now(),r.component;if(K[t.path]!==void 0)return K[t.path];const p=typeof window>"u";try{const o=t.load().then(i=>{Ct();const a=i.default;return J[t.path]={component:a,lastAccessed:Date.now()},delete K[t.path],a}).catch(i=>{delete K[t.path];const a=i instanceof Error?i.message:String(i);throw p&&c.devError(`SSR component load failed for route: ${t.path}. ${a}`),new Error(`Failed to load component for route: ${t.path}. ${a}`)});return K[t.path]=o,await o}catch(o){const i=o instanceof Error?o.message:String(o);throw new Error(`Failed to load component for route: ${t.path}. ${i}`,{cause:o})}}throw new Error(`No component or loader defined for route: ${t.path}`)}let m=null;function xt(t){m=t}function ut(){return m}const Q=new Set;let L=null;function gt(){if(L){try{L()}catch{}L=null}if(m)try{let t=!1;L=m.subscribe(r=>{t=!0;for(const p of Q)try{p(r)}catch{}});try{P.base=m.base}catch{}if(t){const r=m.getCurrent();for(const p of Q)try{p(r)}catch{}}else{const r=m.getCurrent();for(const p of Q)try{p(r)}catch{}}try{typeof window<"u"&&S.flushDOMUpdates()}catch{}}catch{L=null}}function At(){gt()}const P={store:{subscribe(t){if(m)return m.store.subscribe(t);try{t({path:"/",params:{},query:{}})}catch{}return()=>{}},getState(){return m?m.getCurrent():{path:"/",params:{},query:{}}},setState(t){if(m)try{m.store.setState(t)}catch{}}},subscribe(t){if(typeof t!="function")return c.devWarn("activeRouterProxy.subscribe: listener must be a function"),()=>{};if(Q.add(t),m)if(!L)gt();else try{const r=m.getCurrent();r&&t(r)}catch(r){c.devWarn("activeRouterProxy subscription failed",r)}else try{t({path:"/",params:{},query:{}})}catch(r){c.devWarn("activeRouterProxy fallback state delivery failed",r)}return()=>{try{if(Q.delete(t),Q.size===0&&L){try{L()}catch(r){c.devWarn("activeRouterProxy inner unsubscribe failed",r)}L=null}}catch(r){c.devWarn("activeRouterProxy unsubscribe failed",r)}}},getCurrent(){return m?m.getCurrent():{path:"/",params:{},query:{}}},async push(t){return m?m.push(t):Promise.resolve()},async replace(t){return m?m.replace(t):Promise.resolve()},back(){if(m)return m.back()},matchRoute(t){return m?m.matchRoute(t):{route:null,params:{}}},resolveRouteComponent(t){return m?m.resolveRouteComponent(t):Promise.reject(new Error("No active router"))},base:"",scrollToFragment(t){return m?m.scrollToFragment(t):Promise.resolve(!1)},destroy(){m&&m.destroy()}};function bt(t){const{routes:r,base:p="",initialUrl:o,scrollToFragment:i=!0}=t,a=yt(p),v=typeof i=="boolean"?{...at,enabled:i}:{...at,...i};let g,u,y,R,A,O,F,N=()=>{};const _=new Set,j=10;let q=0;const X=async(s,l)=>{const e=G(r,s.path);if(!e||!e.beforeEnter)return!0;try{const n=await e.beforeEnter(s,l);if(typeof n=="string"){const d=`${s.path}->${n}`;return _.has(d)||q>=j?(c.devError(`Redirect loop detected: ${d}`),!1):n}return n!==!1}catch(n){c.devError("beforeEnter error",n);try{y.setState(l)}catch{}throw n}},rt=async(s,l)=>{const e=G(r,s.path);if(!e||!e.onEnter)return!0;try{const n=await e.onEnter(s,l);if(typeof n=="string"){const d=`${s.path}->${n}`;return _.has(d)||q>=j?(c.devError(`Redirect loop detected: ${d}`),!1):n}return n!==!1}catch(n){c.devError("onEnter error",n);try{y.setState(l)}catch{}throw n}},Y=(s,l)=>{const e=G(r,s.path);if(!(!e||!e.afterEnter))try{const n=e.afterEnter(s,l);n instanceof Promise&&n.catch(d=>{c.devError("afterEnter async error",d)})}catch(n){c.devError("afterEnter error",n)}},W=new Map,B=100,M=s=>{if(W.has(s))return W.get(s);const l=V(r,s);if(W.size>=B){const e=Math.floor(B*.25),n=Array.from(W.keys());for(let d=0;d<e&&d<n.length;d++)W.delete(n[d])}return W.set(s,l),l},tt=()=>{};async function h(s,l=0){try{const e=document.getElementById(s);if(!e)return!1;if(l>0)try{const n=e.getBoundingClientRect(),d=Math.max(0,window.scrollY+n.top-l);typeof window.scrollTo=="function"&&window.scrollTo({top:d,behavior:"auto"})}catch{try{e.scrollIntoView()}catch{return!1}}else if(typeof e.scrollIntoView=="function")try{e.scrollIntoView({behavior:"auto",block:"start",inline:"nearest"})}catch{try{e.scrollIntoView()}catch{return!1}}return!0}catch{return!1}}function $(s,l=0,e=2e3){return new Promise(n=>{let d=!1,b=null,w=null;const C=Date.now(),E=I=>{d||(d=!0,b&&clearTimeout(b),w!==null&&cancelAnimationFrame(w),n(I))},U=async()=>{if(!d)try{if(await h(s,l))return E(!0);const I=async()=>{if(d)return;if(Date.now()-C>=e)return E(!1);try{if(await h(s,l))return E(!0);w=requestAnimationFrame(I)}catch(wt){c.devWarn("Scroll retry attempt failed:",wt),w=requestAnimationFrame(I)}};w=requestAnimationFrame(I)}catch(I){c.devWarn("Initial scroll attempt failed:",I),E(!1)}};b=setTimeout(()=>{E(!1)},e),U().catch(I=>{c.devWarn("Scroll attempt failed:",I),E(!1)})})}let f=!1;const k=async(s,l=!1)=>{if(f){c.devWarn(`Navigation to ${s} blocked - navigation already in progress`);return}f=!0,q=0,_.clear();try{await z(s,l)}finally{f=!1,q=0,_.clear()}},T=s=>{const l=s.indexOf("#"),e=l>=0?s.slice(l+1):"",n=l>=0?s.slice(0,l):s,d=n.indexOf("?"),b=d>=0?n.slice(0,d):n,w=d>=0?et(n.slice(d)):{},C=b.startsWith(a)?b.slice(a.length):b;return{path:x(C||"/"),query:w,fragment:e}},z=async(s,l=!1)=>{try{const e=T(s),n=M(e.path);if(!n.route)throw new Error(`No route found for ${e.path}`);const d=y.getState(),b={path:e.path,params:n.params,query:e.query,fragment:e.fragment},w=await X(b,d);if(w===!1)return;if(typeof w=="string"){q++;const E=`${b.path}->${w}`;_.add(E),await z(w,!0);return}const C=await rt(b,d);if(C===!1)return;if(typeof C=="string"){q++;const E=`${b.path}->${C}`;_.add(E),await z(C,!0);return}if(typeof window<"u"&&typeof document<"u"){const E=ht(e.query),U=a+e.path+(E||"")+(e.fragment?"#"+e.fragment:"");l?window.history.replaceState({},"",U):window.history.pushState({},"",U)}if(y.setState(b),Y(b,d),typeof window<"u"&&typeof document<"u")try{const E=b.fragment;v.enabled&&E&&$(String(E),v.offset,v.timeoutMs).catch(()=>{})}catch{}}catch(e){if(c.devError("Navigation error:",e),e instanceof Error&&(e.stack?.includes("runBeforeEnter")||e.stack?.includes("runOnEnter")))throw e;try{const n=y.getState();if(!V(r,n.path).route){let b=r.find(w=>w.path==="/");if(b||(b=r.find(w=>!w.path.includes(":")&&!w.path.includes("*"))),!b&&r.length>0&&(b=r[0]),b){const w=V(r,b.path);y.setState({path:b.path,params:w.params,query:{}})}else c.devError("No fallback route available for error recovery")}}catch(n){c.devWarn("State recovery failed during navigation error:",n)}}};if((s=>{if(!s||s.length===0)return c.devError("Router configuration error: No routes provided"),!1;const l=new Set;for(const e of s){if(!e.path)return c.devError("Router configuration error: Route missing path",e),!1;l.has(e.path)&&c.devWarn(`Duplicate route path detected: ${e.path}`),l.add(e.path),!e.component&&!e.load&&c.devWarn(`Route '${e.path}' has no component or load function`)}return!0})(r),typeof window>"u"||typeof o<"u"){for(const s of r)M(s.path);c.devWarn(`Pre-compiled ${r.length} routes for SSR`)}if(typeof window<"u"&&typeof document<"u"&&typeof o>"u"){g=()=>{try{const e=new URL(window.location.href),n=e.pathname,d=n.startsWith(a)?n.slice(a.length):n,b=x(d||"/"),w=et(e.search),C=e.hash&&e.hash.length?e.hash.slice(1):"";return{path:b,query:w,fragment:C}}catch(e){return c.devWarn("Invalid URL detected, falling back to safe defaults",e),{path:"/",query:{},fragment:""}}},u=g();const s=M(u.path);y=ct.createStore({path:u.path,params:s.params,query:u.query,fragment:u.fragment}),R=async(e=!1)=>{const n=g();await k(n.path,e)};const l=()=>R(!0);window.addEventListener("popstate",l),N=()=>window.removeEventListener("popstate",l),A=e=>k(e,!1),O=e=>k(e,!0),F=()=>window.history.back(),queueMicrotask(()=>{k(u.path,!0).catch(e=>{c.devError("Initial navigation error:",e)})})}else{g=()=>{try{const e=new URL(o||"/","http://localhost"),n=e.pathname,d=n.startsWith(a)?n.slice(a.length):n,b=x(d||"/"),w=et(e.search),C=e.hash&&e.hash.length?e.hash.slice(1):"";return{path:b,query:w,fragment:C}}catch(e){return c.devWarn("Invalid SSR URL detected, falling back to safe defaults",e),{path:"/",query:{},fragment:""}}},u=g();const s=M(u.path);y=ct.createStore({path:u.path,params:s.params,query:u.query,fragment:u.fragment}),R=async()=>{const e=g();await l(e.path)};const l=async e=>{if(q++,q>j){c.devError(`SSR redirect depth exceeded for path: ${e}`);return}try{const n=T(e),d=M(n.path);if(!d.route)throw new Error(`No route found for ${n.path}`);const b=y.getState(),w={path:n.path,params:d.params,query:n.query,fragment:n.fragment},C=G(r,w.path);if(C?.beforeEnter){const E=await C.beforeEnter(w,b);if(typeof E=="string"){const U=`${w.path}->${E}`;_.add(U),await l(E);return}if(E===!1)return}if(C?.onEnter){const E=await C.onEnter(w,b);if(typeof E=="string"){const U=`${w.path}->${E}`;_.add(U),await l(E);return}if(E===!1)return}y.setState(w),C?.afterEnter&&C.afterEnter(w,b)}catch(n){throw c.devError("SSR navigation error:",n),n}};A=async e=>(q=0,_.clear(),l(e)),O=async e=>(q=0,_.clear(),l(e)),F=()=>{}}return{_cleanupScrollState:tt,destroy:N,store:y,push:A,replace:O,back:F,subscribe:y.subscribe,matchRoute:s=>M(s),getCurrent:()=>y.getState(),resolveRouteComponent:vt,base:a,scrollToFragment:s=>{const l=s||y.getState().fragment;return!l||typeof window>"u"||typeof document>"u"?Promise.resolve(!1):$(l,v.offset,v.timeoutMs)}}}function Pt(t){mt();const r=bt(t),p=ut();if(p){try{p.destroy()}catch{}try{p._cleanupScrollState?.()}catch{}}xt(r);try{At();try{typeof window<"u"&&S.flushDOMUpdates()}catch{}try{typeof window<"u"&&queueMicrotask(()=>{try{S.flushDOMUpdates()}catch{}})}catch{}}catch{}return D.component("router-view",async()=>{const i=S.getCurrentComponentContext()?._router,a=i??P;if(!ut()&&!i)return D.html`<div>Router not initialized.</div>`;const v=S.ref(a.getCurrent()),g=typeof window>"u";let u;g||(S.useOnConnected(()=>{try{typeof a.subscribe=="function"&&(u=a.subscribe(R=>{try{R&&typeof R=="object"&&typeof R.path=="string"?v.value=R:(c.devWarn("router-view received invalid state",R),v.value={path:"/",params:{},query:{}})}catch(A){c.devWarn("router-view subscription update failed",A);try{v.value={path:"/",params:{},query:{}}}catch{}}}))}catch(R){c.devWarn("router-view subscribe failed",R)}}),S.useOnDisconnected(()=>{if(typeof u=="function"){try{u()}catch(R){c.devWarn("router-view unsubscribe failed",R)}u=void 0}}));const y=a.matchRoute(v.value.path);if(!y||!y.route)return D.html`<div>Not found</div>`;try{const A=await a.resolveRouteComponent(y.route);if(typeof A=="string")return{tag:A,props:{attrs:{...v.value.params}},children:[]};if(typeof A=="function"){const O=A();return(O instanceof Promise?O:Promise.resolve(O)).then(N=>typeof N=="string"?{tag:N,props:{},children:[]}:N)}return D.html`<div>Invalid route component</div>`}catch{return D.html`<div>Invalid route component</div>`}}),D.component("router-link",()=>{const o=S.useProps({to:"",tag:"a",replace:!1,exact:!1,activeClass:"active",exactActiveClass:"exact-active",ariaCurrentValue:"page",disabled:!1,external:!1,class:"",style:""}),i=typeof window>"u",a=S.ref(P.getCurrent()),v=a.value?.path||"/",g=String(o.to||""),u=i?{isExactActive:ft(v,g,P.base),isActive:dt(v,g,P.base),isExternal:H(g)||!!o.external}:null;let y;S.useStyle(()=>"a,button{display:inline-block;}");const R=S.ref(o.class||""),A=S.ref(o.style||"");if(!i){let h=null;S.useOnConnected($=>{try{if(typeof P.subscribe=="function"){y=P.subscribe(f=>{try{f&&typeof f=="object"&&typeof f.path=="string"?a.value=f:(c.devWarn("router-link received invalid state",f),a.value={path:"/",params:{},query:{}})}catch(k){c.devWarn("router-link subscription update failed",k);try{a.value={path:"/",params:{},query:{}}}catch{}}});try{const f=P.getCurrent();f&&typeof f.path=="string"&&(a.value=f)}catch(f){c.devWarn("router-link initial state sync failed",f)}h=setInterval(()=>{try{const f=P.getCurrent();f&&typeof f.path=="string"&&JSON.stringify(a.value)!==JSON.stringify(f)&&(a.value=f)}catch{}},100)}}catch(f){c.devWarn("router-link subscribe failed",f)}try{const f=$?._host;if(typeof HTMLElement<"u"&&f instanceof HTMLElement){const k=f.getAttribute("class"),T=f.getAttribute("style");k&&(R.value=k),T&&(A.value=T),k!==null&&f.removeAttribute("class"),T!==null&&f.removeAttribute("style");try{$?._requestRender?.();try{S.flushDOMUpdates()}catch{}}catch{}}}catch(f){c.devWarn("router-link host migration failed",f)}}),S.useOnDisconnected(()=>{if(typeof y=="function")try{y()}catch($){c.devWarn("router-link unsubscribe failed",$)}finally{y=void 0}if(h)try{clearInterval(h)}catch($){c.devWarn("router-link sync interval cleanup failed",$)}finally{h=null}})}const O=S.computed(()=>{if(i&&u)return u.isExactActive;try{const h=P.base??"",$=o.to||"";return!a.value||typeof a.value.path!="string"?!1:ft(a.value.path,$,h)}catch(h){return c.devWarn("isExactActive computation error",h),!1}}),F=S.computed(()=>{if(i&&u)return u.isActive;try{const h=P.base??"",$=o.to||"";return!a.value||typeof a.value.path!="string"?!1:o.exact?O.value:dt(a.value.path,$,h)}catch(h){return c.devWarn("isActive computation error",h),!1}}),N=S.computed(()=>{const h=String(o.to||"");if(ot(h))return null;if(H(h))return h;const[$,f]=h.split("#"),[k,T]=($||"").split("?"),z=P.base??"";let Z=k||"/";if(z&&z!=="/"){const nt=x(z),s=x(Z);s.startsWith(nt)?Z=s.slice(nt.length)||"/":Z=s}const st=x(Z||"/");return z+st+(T?"?"+T:"")+(f?"#"+f:"")}),_=S.computed(()=>{const $=(R&&R.value||o.class||"").split(/\s+/).filter(Boolean),f={};for(const k of $)f[k]=!0;return f}),j=S.computed(()=>({..._.value,[o.activeClass||"active"]:F.value,[o.exactActiveClass||"exact-active"]:O.value})),q=S.computed(()=>Object.keys(j.value).filter(h=>j.value[h]).join(" ")),X=S.computed(()=>o.tag||"a"),rt=S.computed(()=>X.value==="button"),Y=S.computed(()=>O.value?o.ariaCurrentValue:null),W=S.computed(()=>!!o.disabled),B=S.computed(()=>{const h=String(o.to||"");return(H(h)||!!o.external)&&X.value==="a"}),M=S.computed(()=>A&&A.value||o.style||""),tt=h=>{if(h.defaultPrevented||h.button!==0||h.metaKey||h.altKey||h.ctrlKey||h.shiftKey)return;if(W.value){h.preventDefault();return}const $=String(o.to||"");if(ot($)){try{h.preventDefault()}catch{}c.devWarn("Blocked unsafe javascript: URI in router-link.to");return}B.value||(h.preventDefault(),o.replace?P.replace(o.to):P.push(o.to))};return D.html`
|
|
2
|
-
${
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./logger-BYIN7ysT.cjs"),g=require("./hooks-fYQgZk2g.cjs"),I=require("./template-compiler-BB4JJdqk.cjs"),be=require("./custom-elements-runtime.directives.cjs.js"),oe=require("./custom-elements-runtime.store.cjs.js");var ne={enabled:!0,offset:0,timeoutMs:2e3},te=e=>e?typeof URLSearchParams>"u"?{}:Object.fromEntries(new URLSearchParams(e)):{},fe=e=>{if(!e||Object.keys(e).length===0)return"";try{return"?"+new URLSearchParams(e).toString()}catch{return""}},ae=e=>e?/^\s*javascript\s*:/i.test(e):!1,B=e=>/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e)||e.startsWith("//"),de=e=>{try{return decodeURIComponent(e)}catch{return e}};function C(e){if(!e)return"/";let r=e.replace(/\/+/g,"/");return r.startsWith("/")||(r="/"+r),r.length>1&&r.endsWith("/")&&(r=r.slice(0,-1)),r}var he=e=>{if(!e)return"";const r=C(e);return r==="/"?"":r},se=new WeakMap;function we(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Se(e){const r=C(e.path||"/"),d=r==="/"?[]:r.split("/").filter(Boolean),a=[],c=[];for(let y=0;y<d.length;y++){const b=d[y];if(b==="*"){if(y!==d.length-1)return i.devWarn(`Route '${e.path}' contains a '*' splat in a non-terminal position; splats must be the last segment. This route will be ignored.`),{invalid:!0};const l=`splat${a.length}`;a.push(l),c.push("__SPLAT__");continue}const m=b.match(/^:([A-Za-z0-9_-]+)(\*)?$/);if(m){const l=m[1],R=!!m[2];if(R&&y!==d.length-1)return i.devWarn(`Route '${e.path}' contains a splat param ':${l}*' in a non-terminal position; splats must be the last segment. This route will be ignored.`),{invalid:!0};a.push(l),c.push(R?"__SPLAT__":"([^/]+)");continue}c.push(we(b))}let o;if(c.length===0)o="^/$";else if(c[c.length-1]==="__SPLAT__"){const y=c.slice(0,-1).join("/");y?o=`^/${y}(?:/(.*))?(?:/)?$`:o="^(?:/(.*))?(?:/)?$"}else o=`^/${c.join("/")}(?:/)?$`;try{return{regex:new RegExp(o),paramNames:a}}catch(y){return i.devWarn(`Failed to compile route regex for '${e.path}': ${String(y)}`),{invalid:!0}}}var K=(e,r)=>{const d=C(r);for(const a of e){let c=se.get(a);if(c||(c=Se(a),se.set(a,c)),c.invalid)continue;const{regex:o,paramNames:y}=c,b=o.exec(d);if(b){const m={};for(let l=0;l<y.length;l++){const R=b[l+1]||"";m[y[l]]=R?de(R):""}return{route:a,params:m}}}return{route:null,params:{}}};function Z(e,r){for(const d of e)if(K([d],r).route!==null)return d;return null}function Re(e,r){const d=r.split("?")[0].split("#")[0];return K(e,d)}var ie=50,G={},j={};function pe(){G={},j={}}function Ee(){const e=Object.entries(G);if(e.length<=ie)return;const r=e.sort(([,d],[,a])=>d.lastAccessed-a.lastAccessed).slice(0,e.length-ie);for(const[d]of r)delete G[d]}async function ve(e){if(e.component)return e.component;if(e.load){const r=G[e.path];if(r)return r.lastAccessed=Date.now(),r.component;if(j[e.path]!==void 0)return j[e.path];const d=typeof window>"u";try{const a=e.load().then(c=>{Ee();const o=c.default;return G[e.path]={component:o,lastAccessed:Date.now()},delete j[e.path],o}).catch(c=>{delete j[e.path];const o=c instanceof Error?c.message:String(c);throw d&&i.devError(`SSR component load failed for route: ${e.path}. ${o}`),new Error(`Failed to load component for route: ${e.path}. ${o}`)});return j[e.path]=a,await a}catch(a){const c=a instanceof Error?a.message:String(a);throw new Error(`Failed to load component for route: ${e.path}. ${c}`,{cause:a})}}throw new Error(`No component or loader defined for route: ${e.path}`)}var v=null;function $e(e){v=e}function ce(){return v}var V=new Set,D=null;function ye(){if(D){try{D()}catch{}D=null}if(v)try{let e=!1;D=v.subscribe(r=>{e=!0;for(const d of V)try{d(r)}catch{}});try{W.base=v.base}catch{}if(e){const r=v.getCurrent();for(const d of V)try{d(r)}catch{}}else{const r=v.getCurrent();for(const d of V)try{d(r)}catch{}}try{typeof window<"u"&&g.flushDOMUpdates()}catch{}}catch{D=null}}function Ce(){ye()}var W={store:{subscribe(e){if(v)return v.store.subscribe(e);try{e({path:"/",params:{},query:{}})}catch{}return()=>{}},getState(){return v?v.getCurrent():{path:"/",params:{},query:{}}},setState(e){if(v)try{v.store.setState(e)}catch{}}},subscribe(e){if(typeof e!="function")return i.devWarn("activeRouterProxy.subscribe: listener must be a function"),()=>{};if(V.add(e),v)if(!D)ye();else try{const r=v.getCurrent();r&&e(r)}catch(r){i.devWarn("activeRouterProxy subscription failed",r)}else try{e({path:"/",params:{},query:{}})}catch(r){i.devWarn("activeRouterProxy fallback state delivery failed",r)}return()=>{try{if(V.delete(e),V.size===0&&D){try{D()}catch(r){i.devWarn("activeRouterProxy inner unsubscribe failed",r)}D=null}}catch(r){i.devWarn("activeRouterProxy unsubscribe failed",r)}}},getCurrent(){return v?v.getCurrent():{path:"/",params:{},query:{}}},async push(e){return v?v.push(e):Promise.resolve()},async replace(e){return v?v.replace(e):Promise.resolve()},back(){if(v)return v.back()},matchRoute(e){return v?v.matchRoute(e):{route:null,params:{}}},resolveRouteComponent(e){return v?v.resolveRouteComponent(e):Promise.reject(new Error("No active router"))},base:"",scrollToFragment(e){return v?v.scrollToFragment(e):Promise.resolve(!1)},destroy(){v&&v.destroy()}};function me(e){const{routes:r,base:d="",initialUrl:a,scrollToFragment:c=!0}=e,o=he(d),y=typeof c=="boolean"?{...ne,enabled:c}:{...ne,...c};let b,m,l,R,_,U,H,J=()=>{};const k=new Set,F=10;let x=0;const X=async(s,u)=>{const t=Z(r,s.path);if(!t||!t.beforeEnter)return!0;try{const n=await t.beforeEnter(s,u);if(typeof n=="string"){const f=`${s.path}->${n}`;return k.has(f)||x>=F?(i.devError(`Redirect loop detected: ${f}`),!1):n}return n!==!1}catch(n){i.devError("beforeEnter error",n);try{l.setState(u)}catch{}throw n}},re=async(s,u)=>{const t=Z(r,s.path);if(!t||!t.onEnter)return!0;try{const n=await t.onEnter(s,u);if(typeof n=="string"){const f=`${s.path}->${n}`;return k.has(f)||x>=F?(i.devError(`Redirect loop detected: ${f}`),!1):n}return n!==!1}catch(n){i.devError("onEnter error",n);try{l.setState(u)}catch{}throw n}},Y=(s,u)=>{const t=Z(r,s.path);if(!(!t||!t.afterEnter))try{const n=t.afterEnter(s,u);n instanceof Promise&&n.catch(f=>{i.devError("afterEnter async error",f)})}catch(n){i.devError("afterEnter error",n)}},A=new Map,z=100,T=s=>{if(A.has(s))return A.get(s);const u=K(r,s);if(A.size>=z){const t=Math.floor(z*.25),n=Array.from(A.keys());for(let f=0;f<t&&f<n.length;f++)A.delete(n[f])}return A.set(s,u),u},ee=()=>{};async function p(s,u=0){try{const t=document.getElementById(s);if(!t)return!1;if(u>0)try{const n=t.getBoundingClientRect(),f=Math.max(0,window.scrollY+n.top-u);typeof window.scrollTo=="function"&&window.scrollTo({top:f,behavior:"auto"})}catch{try{t.scrollIntoView()}catch{return!1}}else if(typeof t.scrollIntoView=="function")try{t.scrollIntoView({behavior:"auto",block:"start",inline:"nearest"})}catch{try{t.scrollIntoView()}catch{return!1}}return!0}catch{return!1}}function $(s,u=0,t=2e3){return new Promise(n=>{let f=!1,E=null,S=null;const P=Date.now(),w=M=>{f||(f=!0,E&&clearTimeout(E),S!==null&&cancelAnimationFrame(S),n(M))},N=async()=>{if(!f)try{if(await p(s,u))return w(!0);const M=async()=>{if(!f){if(Date.now()-P>=t)return w(!1);try{if(await p(s,u))return w(!0);S=requestAnimationFrame(M)}catch(ge){i.devWarn("Scroll retry attempt failed:",ge),S=requestAnimationFrame(M)}}};S=requestAnimationFrame(M)}catch(M){i.devWarn("Initial scroll attempt failed:",M),w(!1)}};E=setTimeout(()=>{w(!1)},t),N().catch(M=>{i.devWarn("Scroll attempt failed:",M),w(!1)})})}let h=!1;const q=async(s,u=!1)=>{if(h){i.devWarn(`Navigation to ${s} blocked - navigation already in progress`);return}h=!0,x=0,k.clear();try{await L(s,u)}finally{h=!1,x=0,k.clear()}},O=s=>{const u=s.indexOf("#"),t=u>=0?s.slice(u+1):"",n=u>=0?s.slice(0,u):s,f=n.indexOf("?"),E=f>=0?n.slice(0,f):n,S=f>=0?te(n.slice(f)):{};return{path:C((E.startsWith(o)?E.slice(o.length):E)||"/"),query:S,fragment:t}},L=async(s,u=!1)=>{try{const t=O(s),n=T(t.path);if(!n.route)throw new Error(`No route found for ${t.path}`);const f=l.getState(),E={path:t.path,params:n.params,query:t.query,fragment:t.fragment},S=await X(E,f);if(S===!1)return;if(typeof S=="string"){x++;const w=`${E.path}->${S}`;k.add(w),await L(S,!0);return}const P=await re(E,f);if(P===!1)return;if(typeof P=="string"){x++;const w=`${E.path}->${P}`;k.add(w),await L(P,!0);return}if(typeof window<"u"&&typeof document<"u"){const w=fe(t.query),N=o+t.path+(w||"")+(t.fragment?"#"+t.fragment:"");u?window.history.replaceState({},"",N):window.history.pushState({},"",N)}if(l.setState(E),Y(E,f),typeof window<"u"&&typeof document<"u")try{const w=E.fragment;y.enabled&&w&&$(String(w),y.offset,y.timeoutMs).catch(()=>{})}catch{}}catch(t){if(i.devError("Navigation error:",t),t instanceof Error&&(t.stack?.includes("runBeforeEnter")||t.stack?.includes("runOnEnter")))throw t;try{if(!K(r,l.getState().path).route){let n=r.find(f=>f.path==="/");if(n||(n=r.find(f=>!f.path.includes(":")&&!f.path.includes("*"))),!n&&r.length>0&&(n=r[0]),n){const f=K(r,n.path);l.setState({path:n.path,params:f.params,query:{}})}else i.devError("No fallback route available for error recovery")}}catch(n){i.devWarn("State recovery failed during navigation error:",n)}}};if((s=>{if(!s||s.length===0)return i.devError("Router configuration error: No routes provided"),!1;const u=new Set;for(const t of s){if(!t.path)return i.devError("Router configuration error: Route missing path",t),!1;u.has(t.path)&&i.devWarn(`Duplicate route path detected: ${t.path}`),u.add(t.path),!t.component&&!t.load&&i.devWarn(`Route '${t.path}' has no component or load function`)}return!0})(r),typeof window>"u"||typeof a<"u"){for(const s of r)T(s.path);i.devWarn(`Pre-compiled ${r.length} routes for SSR`)}if(typeof window<"u"&&typeof document<"u"&&typeof a>"u"){b=()=>{try{const t=new URL(window.location.href),n=t.pathname;return{path:C((n.startsWith(o)?n.slice(o.length):n)||"/"),query:te(t.search),fragment:t.hash&&t.hash.length?t.hash.slice(1):""}}catch(t){return i.devWarn("Invalid URL detected, falling back to safe defaults",t),{path:"/",query:{},fragment:""}}},m=b();const s=T(m.path);l=oe.createStore({path:m.path,params:s.params,query:m.query,fragment:m.fragment}),R=async(t=!1)=>{await q(b().path,t)};const u=()=>R(!0);window.addEventListener("popstate",u),J=()=>window.removeEventListener("popstate",u),_=t=>q(t,!1),U=t=>q(t,!0),H=()=>window.history.back(),queueMicrotask(()=>{q(m.path,!0).catch(t=>{i.devError("Initial navigation error:",t)})})}else{b=()=>{try{const t=new URL(a||"/","http://localhost"),n=t.pathname;return{path:C((n.startsWith(o)?n.slice(o.length):n)||"/"),query:te(t.search),fragment:t.hash&&t.hash.length?t.hash.slice(1):""}}catch(t){return i.devWarn("Invalid SSR URL detected, falling back to safe defaults",t),{path:"/",query:{},fragment:""}}},m=b();const s=T(m.path);l=oe.createStore({path:m.path,params:s.params,query:m.query,fragment:m.fragment}),R=async()=>{await u(b().path)};const u=async t=>{if(x++,x>F){i.devError(`SSR redirect depth exceeded for path: ${t}`);return}try{const n=O(t),f=T(n.path);if(!f.route)throw new Error(`No route found for ${n.path}`);const E=l.getState(),S={path:n.path,params:f.params,query:n.query,fragment:n.fragment},P=Z(r,S.path);if(P?.beforeEnter){const w=await P.beforeEnter(S,E);if(typeof w=="string"){const N=`${S.path}->${w}`;k.add(N),await u(w);return}if(w===!1)return}if(P?.onEnter){const w=await P.onEnter(S,E);if(typeof w=="string"){const N=`${S.path}->${w}`;k.add(N),await u(w);return}if(w===!1)return}l.setState(S),P?.afterEnter&&P.afterEnter(S,E)}catch(n){throw i.devError("SSR navigation error:",n),n}};_=async t=>(x=0,k.clear(),u(t)),U=async t=>(x=0,k.clear(),u(t)),H=()=>{}}return{_cleanupScrollState:ee,destroy:J,store:l,push:_,replace:U,back:H,subscribe:l.subscribe,matchRoute:s=>T(s),getCurrent:()=>l.getState(),resolveRouteComponent:ve,base:o,scrollToFragment:s=>{const u=s||l.getState().fragment;return!u||typeof window>"u"||typeof document>"u"?Promise.resolve(!1):$(u,y.offset,y.timeoutMs)}}}function We(e){pe();const r=me(e),d=ce();if(d){try{d.destroy()}catch{}try{d._cleanupScrollState?.()}catch{}}$e(r);try{Ce();try{typeof window<"u"&&g.flushDOMUpdates()}catch{}try{typeof window<"u"&&queueMicrotask(()=>{try{g.flushDOMUpdates()}catch{}})}catch{}}catch{}return I.component("router-view",async()=>{const a=g.getCurrentComponentContext()?._router,c=a??W;if(!ce()&&!a)return I.html`<div>Router not initialized.</div>`;const o=g.ref(c.getCurrent()),y=typeof window>"u";let b;y||(g.useOnConnected(()=>{try{typeof c.subscribe=="function"&&(b=c.subscribe(l=>{try{l&&typeof l=="object"&&typeof l.path=="string"?o.value=l:(i.devWarn("router-view received invalid state",l),o.value={path:"/",params:{},query:{}})}catch(R){i.devWarn("router-view subscription update failed",R);try{o.value={path:"/",params:{},query:{}}}catch{}}}))}catch(l){i.devWarn("router-view subscribe failed",l)}}),g.useOnDisconnected(()=>{if(typeof b=="function"){try{b()}catch(l){i.devWarn("router-view unsubscribe failed",l)}b=void 0}}));const m=c.matchRoute(o.value.path);if(!m||!m.route)return I.html`<div>Not found</div>`;try{const l=await c.resolveRouteComponent(m.route);if(typeof l=="string")return{tag:l,props:{attrs:{...o.value.params}},children:[]};if(typeof l=="function"){const R=l();return(R instanceof Promise?R:Promise.resolve(R)).then(_=>typeof _=="string"?{tag:_,props:{},children:[]}:_)}return I.html`<div>Invalid route component</div>`}catch{return I.html`<div>Invalid route component</div>`}}),I.component("router-link",()=>{const a=g.useProps({to:"",tag:"a",replace:!1,exact:!1,activeClass:"active",exactActiveClass:"exact-active",ariaCurrentValue:"page",disabled:!1,external:!1,class:"",style:""}),c=typeof window>"u",o=g.ref(W.getCurrent()),y=o.value?.path||"/",b=String(a.to||""),m=c?{isExactActive:le(y,b,W.base),isActive:ue(y,b,W.base),isExternal:B(b)||!!a.external}:null;let l;g.useStyle(()=>"a,button{display:inline-block;}");const R=g.ref(a.class||""),_=g.ref(a.style||"");if(!c){let p=null;g.useOnConnected($=>{try{if(typeof W.subscribe=="function"){l=W.subscribe(h=>{try{h&&typeof h=="object"&&typeof h.path=="string"?o.value=h:(i.devWarn("router-link received invalid state",h),o.value={path:"/",params:{},query:{}})}catch(q){i.devWarn("router-link subscription update failed",q);try{o.value={path:"/",params:{},query:{}}}catch{}}});try{const h=W.getCurrent();h&&typeof h.path=="string"&&(o.value=h)}catch(h){i.devWarn("router-link initial state sync failed",h)}p=setInterval(()=>{try{const h=W.getCurrent();h&&typeof h.path=="string"&&JSON.stringify(o.value)!==JSON.stringify(h)&&(o.value=h)}catch{}},100)}}catch(h){i.devWarn("router-link subscribe failed",h)}try{const h=$?._host;if(typeof HTMLElement<"u"&&h instanceof HTMLElement){const q=h.getAttribute("class"),O=h.getAttribute("style");q&&(R.value=q),O&&(_.value=O),q!==null&&h.removeAttribute("class"),O!==null&&h.removeAttribute("style");try{$?._requestRender?.();try{g.flushDOMUpdates()}catch{}}catch{}}}catch(h){i.devWarn("router-link host migration failed",h)}}),g.useOnDisconnected(()=>{if(typeof l=="function")try{l()}catch($){i.devWarn("router-link unsubscribe failed",$)}finally{l=void 0}if(p)try{clearInterval(p)}catch($){i.devWarn("router-link sync interval cleanup failed",$)}finally{p=null}})}const U=g.computed(()=>{if(c&&m)return m.isExactActive;try{const p=W.base??"",$=a.to||"";return!o.value||typeof o.value.path!="string"?!1:le(o.value.path,$,p)}catch(p){return i.devWarn("isExactActive computation error",p),!1}}),H=g.computed(()=>{if(c&&m)return m.isActive;try{const p=W.base??"",$=a.to||"";return!o.value||typeof o.value.path!="string"?!1:a.exact?U.value:ue(o.value.path,$,p)}catch(p){return i.devWarn("isActive computation error",p),!1}}),J=g.computed(()=>{const p=String(a.to||"");if(ae(p))return null;if(B(p))return p;const[$,h]=p.split("#"),[q,O]=($||"").split("?"),L=W.base??"";let Q=q||"/";if(L&&L!=="/"){const s=C(L),u=C(Q);u.startsWith(s)?Q=u.slice(s.length)||"/":Q=u}return L+C(Q||"/")+(O?"?"+O:"")+(h?"#"+h:"")}),k=g.computed(()=>{const p=(R&&R.value||a.class||"").split(/\s+/).filter(Boolean),$={};for(const h of p)$[h]=!0;return $}),F=g.computed(()=>({...k.value,[a.activeClass||"active"]:H.value,[a.exactActiveClass||"exact-active"]:U.value})),x=g.computed(()=>Object.keys(F.value).filter(p=>F.value[p]).join(" ")),X=g.computed(()=>a.tag||"a"),re=g.computed(()=>X.value==="button"),Y=g.computed(()=>U.value?a.ariaCurrentValue:null),A=g.computed(()=>!!a.disabled),z=g.computed(()=>(B(String(a.to||""))||!!a.external)&&X.value==="a"),T=g.computed(()=>_&&_.value||a.style||""),ee=p=>{if(!(p.defaultPrevented||p.button!==0||p.metaKey||p.altKey||p.ctrlKey||p.shiftKey)){if(A.value){p.preventDefault();return}if(ae(String(a.to||""))){try{p.preventDefault()}catch{}i.devWarn("Blocked unsafe javascript: URI in router-link.to");return}z.value||(p.preventDefault(),a.replace?W.replace(a.to):W.push(a.to))}};return I.html`
|
|
2
|
+
${be.match().when(re.value,I.html`
|
|
3
3
|
<button
|
|
4
4
|
part="button"
|
|
5
|
-
class="${
|
|
6
|
-
style="${
|
|
5
|
+
class="${x.value}"
|
|
6
|
+
style="${T.value||null}"
|
|
7
7
|
aria-current="${Y.value}"
|
|
8
|
-
disabled="${
|
|
9
|
-
aria-disabled="${
|
|
10
|
-
tabindex="${
|
|
11
|
-
@click="${
|
|
8
|
+
disabled="${A.value?"":null}"
|
|
9
|
+
aria-disabled="${A.value?"true":null}"
|
|
10
|
+
tabindex="${A.value?"-1":null}"
|
|
11
|
+
@click="${ee}"
|
|
12
12
|
>
|
|
13
13
|
<slot></slot>
|
|
14
14
|
</button>
|
|
15
|
-
`).otherwise(
|
|
15
|
+
`).otherwise(I.html`
|
|
16
16
|
<a
|
|
17
17
|
part="link"
|
|
18
|
-
href="${
|
|
19
|
-
class="${
|
|
20
|
-
style="${
|
|
18
|
+
href="${A.value?null:J.value}"
|
|
19
|
+
class="${x.value}"
|
|
20
|
+
style="${T.value||null}"
|
|
21
21
|
aria-current="${Y.value}"
|
|
22
|
-
aria-disabled="${
|
|
23
|
-
tabindex="${
|
|
24
|
-
target="${
|
|
25
|
-
rel="${
|
|
26
|
-
@click="${
|
|
22
|
+
aria-disabled="${A.value?"true":null}"
|
|
23
|
+
tabindex="${A.value?"-1":null}"
|
|
24
|
+
target="${z.value?"_blank":null}"
|
|
25
|
+
rel="${z.value?"noopener noreferrer":null}"
|
|
26
|
+
@click="${ee}"
|
|
27
27
|
><slot></slot
|
|
28
28
|
></a>
|
|
29
29
|
`).done()}
|
|
30
|
-
`}),r}function
|
|
31
|
-
|
|
30
|
+
`}),r}function le(e,r,d){if(B(r))return!1;let a=(r.split("#")[0]||"/").split("?")[0];if(d&&d!=="/"){const c=C(d),o=C(a);o.startsWith(c)?a=o.slice(c.length)||"/":a=o}return C(e)===C(a)}function ue(e,r,d){if(B(r))return!1;let a=(r.split("#")[0]||"/").split("?")[0];if(d&&d!=="/"){const y=C(d),b=C(a);b.startsWith(y)?a=b.slice(y.length)||"/":a=b}const c=C(e),o=C(a);return o==="/"?c==="/":c===o?!0:c.startsWith(o.endsWith("/")?o:o+"/")}exports.DEFAULT_SCROLL_CONFIG=ne;exports.activeRouterProxy=W;exports.canonicalizeBase=he;exports.clearComponentCache=pe;exports.findMatchedRoute=Z;exports.initRouter=We;exports.isAbsoluteUrl=B;exports.isDangerousScheme=ae;exports.matchRoute=K;exports.matchRouteSSR=Re;exports.normalizePathForRoute=C;exports.parseQuery=te;exports.resolveRouteComponent=ve;exports.safeDecode=de;exports.serializeQuery=fe;exports.useRouter=me;
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=custom-elements-runtime.router.cjs.js.map
|