UNPKG

mcrm-svelte-navigator

Version:
2 lines (1 loc) 19.6 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("svelte/internal"),require("svelte"),require("svelte/store")):"function"==typeof define&&define.amd?define(["exports","svelte/internal","svelte","svelte/store"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).SvelteNavigator={},t.internal,t.svelte,t.store)}(this,(function(t,e,n,o){"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function s(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){a(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const i=t=>void 0===t,c=t=>"function"==typeof t,u=t=>"number"==typeof t;function l(t){return!t.defaultPrevented&&0===t.button&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function p(){let t=0;return()=>t++}const d="undefined"==typeof window;function f(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}const h=(t,e)=>t?{}:{style:e},m=t=>s({"aria-hidden":"true"},h(t,"display:none;")),g=t=>"@@svnav-ctx__"+t,_=g("LOCATION"),b=g("ROUTER"),v=g("ROUTE"),y=g("ROUTE_PARAMS"),$=g("FOCUS_ELEM"),w=/^:(.+)/,x=(t,e,n)=>t.substr(e,n),P=(t,e)=>x(t,0,e.length)===e,O=t=>"*"===t[0],R=t=>t.replace(/(^\/+|\/+$)/g,"");function C(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=R(t).split("/");return e?n.filter(Boolean):n}const S=(t,e)=>t+(e?"?"+e:""),E=t=>"/"+R(t);function j(){const t=t=>C(t,!0).join("/");for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];const r=n.map(t).join("/");return E(r)}const k={1:"Link",2:"Route",3:"Router",4:"useFocus",5:"useLocation",6:"useMatch",7:"useNavigate",8:"useParams",9:"useResolvable",10:"useResolve",11:"navigate"},I=t=>k[t];function A(t,e,n,o){const r=n&&function(t,e){let n;return 2===t?n=e.path?'path="'+e.path+'"':"default":1===t?n='to="'+e.to+'"':3===t&&(n='basepath="'+(e.basepath||"")+'"'),"<"+I(t)+" "+(n||"")+" />"}(o||t,n),s=r?"\n\nOccurred in: "+r:"",a=I(t);return"<"+a+"> "+(c(e)?e(a):e)+s}const N=t=>function(){return t(A(...arguments))},L=N((t=>{throw new Error(t)})),D=N(console.warn);function M(t,e){return{route:t,score:t.default?0:C(t.fullPath).reduce(((t,e)=>{let n=t;return n+=4,(t=>""===t)(e)?n+=1:(t=>w.test(t))(e)?n+=2:O(e)?n-=5:n+=3,n}),0),index:e}}function U(t,e){let n,o;const[r]=e.split("?"),a=C(r),c=""===a[0],u=function(t){return t.map(M).sort(((t,e)=>t.score<e.score?1:t.score>e.score?-1:t.index-e.index))}(t);for(let t=0,r=u.length;t<r;t++){const{route:r}=u[t];let l=!1;const p={},d=t=>s(s({},r),{},{params:p,uri:t});if(r.default){o=d(e);continue}const f=C(r.fullPath),h=Math.max(a.length,f.length);let m=0;for(;m<h;m++){const t=f[m],e=a[m];if(!i(t)&&O(t)){const e="*"===t?"*":t.slice(1);p[e]=a.slice(m).map(decodeURIComponent).join("/");break}if(i(e)){l=!0;break}const n=w.exec(t);if(n&&!c){const t=decodeURIComponent(e);p[n[1]]=t}else if(t!==e){l=!0;break}}if(!l){n=d(j(...a.slice(0,m)));break}}return n||o||null}function q(t,e){return U([t],e)}function T(t,e){const{pathname:n,hash:o="",search:r="",state:s}=t,a=C(e,!0),i=C(n,!0);for(;a.length;)a[0]!==i[0]&&L(3,'Invalid state: All locations must begin with the basepath "'+e+'", found "'+n+'"'),a.shift(),i.shift();return{pathname:j(...i),hash:o,search:r,state:s}}const F=t=>1===t.length?"":t,H=t=>{const e=t.indexOf("?"),n=t.indexOf("#"),o=-1!==e,r=-1!==n,s=r?F(x(t,n)):"",a=r?x(t,0,n):t,i=o?F(x(a,e)):"";return{pathname:(o?x(a,0,e):a)||"/",search:i,hash:s}};function K(t,e,n){return j(n,function(t,e){if(P(t,"/"))return t;const[n,o]=t.split("?"),[r]=e.split("?"),s=C(n),a=C(r);if(""===s[0])return S(r,o);if(!P(s[0],".")){const t=a.concat(s).join("/");return S(("/"===r?"":"/")+t,o)}const i=a.concat(s),c=[];return i.forEach((t=>{".."===t?c.pop():"."!==t&&c.push(t)})),S("/"+c.join("/"),o)}(t,e))}function Y(t,e){const n=E(t.replace(/\*.*$/,""));const o=C(n,!0),r=q({fullPath:n},j(...C(e,!0).slice(0,o.length)));return r&&r.uri}const B="POP";function z(t){return s(s({},t.location),{},{pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"})}function G(t){let e=[],n=z(t),o=B;const r=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e;return t.forEach((t=>t({location:n,action:o})))};return{get location(){return n},listen(s){e.push(s);r([s]);const a=f(t,"popstate",(()=>{n=z(t),o=B,r([s])}));return()=>{a(),e=e.filter((t=>t!==s))}},navigate(e,a){const{state:i={},replace:c=!1}=a||{};if(o=c?"REPLACE":"PUSH",u(e))a&&D(11,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),o=B,t.history.go(e);else{const n=s(s({},i),{},{_key:Math.random().toString(36).substring(2)});try{t.history[c?"replaceState":"pushState"](n,"",e)}catch(n){t.location[c?"replace":"assign"](e)}}n=z(t),r()}}}function J(t,e){return s(s({},H(e)),{},{state:t})}function Q(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",e=0,n=[J(null,t)];return{get entries(){return n},get location(){return n[e]},addEventListener(){},removeEventListener(){},history:{get state(){return n[e].state},pushState(t,o,r){e++,n=n.slice(0,e),n.push(J(t,r))},replaceState(t,o,r){n[e]=J(t,r)},go(t){const o=e+t;o<0||o>n.length-1||(e=o)}}}}const V=!(d||!window.document||!window.document.createElement),W=!d&&"null"===window.location.origin,X=G(V&&!W?window:Q()),{navigate:Z}=X;let tt=null,et=!0;function nt(t){(!tt||t.level>tt.level||t.level===tt.level&&function(t,e){const n=document.querySelectorAll("[data-svnav-router]");for(let o=0;o<n.length;o++){const r=n[o],s=Number(r.dataset.svnavRouter);if(s===t)return!0;if(s===e)return!1}return!1}(t.routerId,tt.routerId))&&(tt=t)}function ot(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){let n;t.setAttribute(e,"-1");const o=()=>{t.removeAttribute(e),n()};n=f(t,"blur",o)}return t.focus(),document.activeElement===t}catch(t){return!1}}function rt(t,e){return Number(t.dataset.svnavRouteEnd)===e}function st(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return e.querySelector(t)}function at(t){Promise.resolve(o.get(t.focusElement)).then((e=>{const n=e||function(t){let e=st('[data-svnav-route-start="'+t+'"]').nextElementSibling;for(;!rt(e,t);){if(/^H[1-6]$/i.test(e.tagName))return e;const t=st("h1,h2,h3,h4,h5,h6",e);if(t)return t;e=e.nextElementSibling}return null}(t.id);n||D(3,'Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don\'t want this Route or Router to manage focus, pass "primary={false}" to it.',t,2);ot(n)||ot(document.documentElement)}))}const it=(t,e,r)=>(s,a)=>n.tick().then((()=>{if(tt&&!et){if(s&&at(tt.route),t.announcements&&a){const{path:n,fullPath:s,meta:a,params:i,uri:c}=tt.route,u=t.createAnnouncement({path:n,fullPath:s,meta:a,params:i,uri:c},o.get(r));Promise.resolve(u).then((t=>{e.set(t)}))}tt=null}else et=!1}));function ct(t){let n,o,r,s,a,i=[m(t[6]),{"data-svnav-router":t[3]}],c={};for(let t=0;t<i.length;t+=1)c=e.assign(c,i[t]);const u=t[22].default,l=e.create_slot(u,t,t[21],null);let p=t[2]&&t[4]&&t[1].announcements&&function(t){let n,o,r=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},h(t[6],"position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;")],s={};for(let t=0;t<r.length;t+=1)s=e.assign(s,r[t]);return{c(){n=e.element("div"),o=e.text(t[0]),e.set_attributes(n,s)},m(t,r){e.insert(t,n,r),e.append(n,o)},p(t,n){1&n[0]&&e.set_data_maybe_contenteditable(o,t[0],s.contenteditable)},d(t){t&&e.detach(n)}}}(t);return{c(){n=e.element("div"),o=e.space(),l&&l.c(),r=e.space(),p&&p.c(),s=e.empty(),e.set_attributes(n,c)},m(t,i){e.insert(t,n,i),e.insert(t,o,i),l&&l.m(t,i),e.insert(t,r,i),p&&p.m(t,i),e.insert(t,s,i),a=!0},p(t,n){l&&l.p&&(!a||2097152&n[0])&&e.update_slot_base(l,u,t,t[21],a?e.get_slot_changes(u,t[21],n,null):e.get_all_dirty_from_scope(t[21]),null),t[2]&&t[4]&&t[1].announcements&&p.p(t,n)},i(t){a||(e.transition_in(l,t),a=!0)},o(t){e.transition_out(l,t),a=!1},d(t){t&&(e.detach(n),e.detach(o),e.detach(r),e.detach(s)),l&&l.d(t),p&&p.d(t)}}}const ut=p(),lt="/";function pt(t,r,a){let i,c,u,l,p,{$$slots:f={},$$scope:h}=r,{basepath:m=lt}=r,{url:g=null}=r,{history:v=X}=r,{primary:y=!0}=r,{a11y:$={}}=r,{disableInlineStyles:w=!1}=r;const x=s({createAnnouncement:t=>"Navigated to "+t.uri,announcements:!0},$),P=m,O=E(m),R=n.getContext(_),C=n.getContext(b),S=!R,j=ut(),k=y&&!(C&&!C.manageFocus),I=o.writable("");e.component_subscribe(t,I,(t=>a(0,p=t)));const A=C?C.disableInlineStyles:w,N=o.writable([]);e.component_subscribe(t,N,(t=>a(20,l=t)));const L=o.writable(null);e.component_subscribe(t,L,(t=>a(18,c=t)));let M=!1;const F=S?0:C.level+1,K=S?o.writable(T(d?H(g):v.location,O)):R;e.component_subscribe(t,K,(t=>a(17,i=t)));const Y=o.writable(i);e.component_subscribe(t,Y,(t=>a(19,u=t)));const B=it(x,I,K),z=t=>e=>e.filter((e=>e.id!==t));return S||m===lt||D(3,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),S&&(n.onMount((()=>v.listen((t=>{const e=T(t.location,O);Y.set(i),K.set(e)})))),n.setContext(_,K)),n.setContext(b,{activeRoute:L,registerRoute:function(t){if(d){if(M)return;const e=q(t,i.pathname);if(e)return M=!0,e}else N.update((e=>{const n=z(t.id)(e);return n.push(t),n}))},unregisterRoute:function(t){N.update(z(t))},manageFocus:k,level:F,id:j,history:S?v:C.history,basepath:S?O:C.basepath,disableInlineStyles:A}),t.$$set=t=>{"basepath"in t&&a(11,m=t.basepath),"url"in t&&a(12,g=t.url),"history"in t&&a(13,v=t.history),"primary"in t&&a(14,y=t.primary),"a11y"in t&&a(15,$=t.a11y),"disableInlineStyles"in t&&a(16,w=t.disableInlineStyles),"$$scope"in t&&a(21,h=t.$$scope)},t.$$.update=()=>{if(2048&t.$$.dirty[0]&&m!==P&&D(3,'You cannot change the "basepath" prop. It is ignored.'),1179648&t.$$.dirty[0]){const t=U(l,i.pathname);L.set(t)}if(655360&t.$$.dirty[0]&&S){const t=!!i.hash,e=!t&&k,n=!t||i.pathname!==u.pathname;B(e,n)}262144&t.$$.dirty[0]&&k&&c&&c.primary&&nt({level:F,routerId:j,route:c})},[p,x,S,j,k,I,A,N,L,K,Y,m,g,v,y,$,w,i,c,u,l,h,f]}class dt extends e.SvelteComponent{constructor(t){super(),e.init(this,t,pt,ct,e.safe_not_equal,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}var ft=dt;function ht(t,e){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:b,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3;const s=n.getContext(o);s||L(t,(t=>"You cannot use "+t+" outside of a "+I(r)+"."),e)}const mt=t=>{const{subscribe:e}=n.getContext(t);return{subscribe:e}};function gt(){return ht(5),mt(_)}function _t(){const{history:t}=n.getContext(b);return t}function bt(){const t=n.getContext(v);return t?o.derived(t,(t=>t.base)):o.writable("/")}function vt(){ht(10);const t=bt(),{basepath:e}=n.getContext(b);return n=>K(n,o.get(t),e)}function yt(){ht(7);const t=vt(),{navigate:e}=_t();return(n,o)=>{const r=u(n)?n:t(n);return e(r,o)}}const $t=t=>({params:16&t,location:8&t}),wt=t=>({params:d?o.get(t[10]):t[4],location:t[3],navigate:t[11]});function xt(t){let n,o;return n=new ft({props:{primary:t[1],$$slots:{default:[Rt]},$$scope:{ctx:t}}}),{c(){e.create_component(n.$$.fragment)},m(t,r){e.mount_component(n,t,r),o=!0},p(t,e){const o={};2&e&&(o.primary=t[1]),528409&e&&(o.$$scope={dirty:e,ctx:t}),n.$set(o)},i(t){o||(e.transition_in(n.$$.fragment,t),o=!0)},o(t){e.transition_out(n.$$.fragment,t),o=!1},d(t){e.destroy_component(n,t)}}}function Pt(t){let n;const o=t[18].default,r=e.create_slot(o,t,t[19],wt);return{c(){r&&r.c()},m(t,e){r&&r.m(t,e),n=!0},p(t,s){r&&r.p&&(!n||524312&s)&&e.update_slot_base(r,o,t,t[19],n?e.get_slot_changes(o,t[19],s,$t):e.get_all_dirty_from_scope(t[19]),wt)},i(t){n||(e.transition_in(r,t),n=!0)},o(t){e.transition_out(r,t),n=!1},d(t){r&&r.d(t)}}}function Ot(t){let n,r,s;const a=[{location:t[3]},{navigate:t[11]},d?o.get(t[10]):t[4],t[12]];var i=t[0];function c(t,n){let r={};if(void 0!==n&&7192&n)r=e.get_spread_update(a,[8&n&&{location:t[3]},2048&n&&{navigate:t[11]},1040&n&&e.get_spread_object(d?o.get(t[10]):t[4]),4096&n&&e.get_spread_object(t[12])]);else for(let t=0;t<a.length;t+=1)r=e.assign(r,a[t]);return{props:r}}return i&&(n=e.construct_svelte_component(i,c(t))),{c(){n&&e.create_component(n.$$.fragment),r=e.empty()},m(t,o){n&&e.mount_component(n,t,o),e.insert(t,r,o),s=!0},p(t,s){if(1&s&&i!==(i=t[0])){if(n){e.group_outros();const t=n;e.transition_out(t.$$.fragment,1,0,(()=>{e.destroy_component(t,1)})),e.check_outros()}i?(n=e.construct_svelte_component(i,c(t,s)),e.create_component(n.$$.fragment),e.transition_in(n.$$.fragment,1),e.mount_component(n,r.parentNode,r)):n=null}else if(i){const r=7192&s?e.get_spread_update(a,[8&s&&{location:t[3]},2048&s&&{navigate:t[11]},1040&s&&e.get_spread_object(d?o.get(t[10]):t[4]),4096&s&&e.get_spread_object(t[12])]):{};n.$set(r)}},i(t){s||(n&&e.transition_in(n.$$.fragment,t),s=!0)},o(t){n&&e.transition_out(n.$$.fragment,t),s=!1},d(t){t&&e.detach(r),n&&e.destroy_component(n,t)}}}function Rt(t){let n,o,r,s;const a=[Ot,Pt],i=[];function c(t,e){return null!==t[0]?0:1}return n=c(t),o=i[n]=a[n](t),{c(){o.c(),r=e.empty()},m(t,o){i[n].m(t,o),e.insert(t,r,o),s=!0},p(t,s){let u=n;n=c(t),n===u?i[n].p(t,s):(e.group_outros(),e.transition_out(i[u],1,1,(()=>{i[u]=null})),e.check_outros(),o=i[n],o?o.p(t,s):(o=i[n]=a[n](t),o.c()),e.transition_in(o,1),o.m(r.parentNode,r))},i(t){s||(e.transition_in(o),s=!0)},o(t){e.transition_out(o),s=!1},d(t){t&&e.detach(r),i[n].d(t)}}}function Ct(t){let n,o,r,s,a,i=[m(t[7]),{"data-svnav-route-start":t[5]}],c={};for(let t=0;t<i.length;t+=1)c=e.assign(c,i[t]);let u=t[2]&&xt(t),l=[m(t[7]),{"data-svnav-route-end":t[5]}],p={};for(let t=0;t<l.length;t+=1)p=e.assign(p,l[t]);return{c(){n=e.element("div"),o=e.space(),u&&u.c(),r=e.space(),s=e.element("div"),e.set_attributes(n,c),e.set_attributes(s,p)},m(t,i){e.insert(t,n,i),e.insert(t,o,i),u&&u.m(t,i),e.insert(t,r,i),e.insert(t,s,i),a=!0},p(t,n){let[o]=n;t[2]?u?(u.p(t,o),4&o&&e.transition_in(u,1)):(u=xt(t),u.c(),e.transition_in(u,1),u.m(r.parentNode,r)):u&&(e.group_outros(),e.transition_out(u,1,1,(()=>{u=null})),e.check_outros())},i(t){a||(e.transition_in(u),a=!0)},o(t){e.transition_out(u),a=!1},d(t){t&&(e.detach(n),e.detach(o),e.detach(r),e.detach(s)),u&&u.d(t)}}}const St=p();function Et(t,r,s){let a;const i=["path","component","meta","primary"];let c,u,l,p,f=e.compute_rest_props(r,i),{$$slots:h={},$$scope:m}=r,{path:g=""}=r,{component:_=null}=r,{meta:w={}}=r,{primary:x=!0}=r;ht(2,r);const P=St(),{registerRoute:O,unregisterRoute:R,activeRoute:C,disableInlineStyles:S}=n.getContext(b);e.component_subscribe(t,C,(t=>s(16,c=t)));const E=bt();e.component_subscribe(t,E,(t=>s(17,l=t)));const k=gt();e.component_subscribe(t,k,(t=>s(3,u=t)));const I=o.writable(null);let A;const N=o.writable(),L=o.writable({});e.component_subscribe(t,L,(t=>s(4,p=t))),n.setContext(v,N),n.setContext(y,L),n.setContext($,I);const D=yt();return d||n.onDestroy((()=>R(P))),t.$$set=t=>{s(24,r=e.assign(e.assign({},r),e.exclude_internal_props(t))),s(12,f=e.compute_rest_props(r,i)),"path"in t&&s(13,g=t.path),"component"in t&&s(0,_=t.component),"meta"in t&&s(14,w=t.meta),"primary"in t&&s(1,x=t.primary),"$$scope"in t&&s(19,m=t.$$scope)},t.$$.update=()=>{if(155658&t.$$.dirty){const t=""===g,e=j(l,g),n={id:P,path:g,meta:w,default:t,fullPath:t?"":e,base:t?l:Y(e,u.pathname),primary:x,focusElement:I};N.set(n),s(15,A=O(n))}if(98304&t.$$.dirty&&s(2,a=!!(A||c&&c.id===P)),98308&t.$$.dirty&&a){const{params:t}=A||c;L.set(t)}},r=e.exclude_internal_props(r),[_,x,a,u,p,P,C,S,E,k,L,D,f,g,w,A,c,l,h,m]}class jt extends e.SvelteComponent{constructor(t){super(),e.init(this,t,Et,Ct,e.safe_not_equal,{path:13,component:0,meta:14,primary:1})}}var kt=jt;function It(t){let n,o,r,s;const a=t[13].default,i=e.create_slot(a,t,t[12],null);let c=[{href:t[0]},t[2],t[1]],u={};for(let t=0;t<c.length;t+=1)u=e.assign(u,c[t]);return{c(){n=e.element("a"),i&&i.c(),e.set_attributes(n,u)},m(a,c){e.insert(a,n,c),i&&i.m(n,null),o=!0,r||(s=e.listen(n,"click",t[4]),r=!0)},p(t,r){let[s]=r;i&&i.p&&(!o||4096&s)&&e.update_slot_base(i,a,t,t[12],o?e.get_slot_changes(a,t[12],s,null):e.get_all_dirty_from_scope(t[12]),null),e.set_attributes(n,u=e.get_spread_update(c,[(!o||1&s)&&{href:t[0]},4&s&&t[2],2&s&&t[1]]))},i(t){o||(e.transition_in(i,t),o=!0)},o(t){e.transition_out(i,t),o=!1},d(t){t&&e.detach(n),i&&i.d(t),r=!1,s()}}}function At(t,o,r){let a,i,u,p,d,f;const h=["to","replace","state","getProps"];let m,g=e.compute_rest_props(o,h),{$$slots:_={},$$scope:b}=o,{to:v}=o,{replace:y=!1}=o,{state:$={}}=o,{getProps:w=null}=o;ht(1,o);const x=gt();e.component_subscribe(t,x,(t=>r(11,m=t)));const O=n.createEventDispatcher(),R=vt(),{navigate:C}=_t();return t.$$set=t=>{r(19,o=e.assign(e.assign({},o),e.exclude_internal_props(t))),r(18,g=e.compute_rest_props(o,h)),"to"in t&&r(5,v=t.to),"replace"in t&&r(6,y=t.replace),"state"in t&&r(7,$=t.state),"getProps"in t&&r(8,w=t.getProps),"$$scope"in t&&r(12,b=t.$$scope)},t.$$.update=()=>{2080&t.$$.dirty&&r(0,a=R(v,m)),2049&t.$$.dirty&&r(10,i=P(m.pathname,a)),2049&t.$$.dirty&&r(9,u=a===m.pathname),2049&t.$$.dirty&&(p=H(a)===(t=>{const{pathname:e,search:n,hash:o}=t;return e+n+o})(m)),512&t.$$.dirty&&r(2,d=u?{"aria-current":"page"}:{}),r(1,f=(()=>{if(c(w)){const t=w({location:m,href:a,isPartiallyCurrent:i,isCurrent:u});return s(s({},g),t)}return g})())},o=e.exclude_internal_props(o),[a,f,d,x,function(t){if(O("click",t),l(t)){t.preventDefault();C(a,{state:$,replace:p||y})}},v,y,$,w,u,i,m,b,_]}class Nt extends e.SvelteComponent{constructor(t){super(),e.init(this,t,At,It,e.safe_not_equal,{to:5,replace:6,state:7,getProps:8})}}var Lt=Nt;const Dt=t=>function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Z;const o=e=>{const o=t(e);if(o&&""===o.target&&l(e)){e.preventDefault();const t=o.pathname+o.search+o.hash;n(t,{replace:o.hasAttribute("replace")})}},r=f(e,"click",o);return{destroy:r}},Mt=Dt((t=>t.currentTarget)),Ut=Dt((t=>{const e=function(t,e){for(;e&&e.tagName!==t;)e=e.parentNode;return e}("A",t.target);return e&&c(e.hasAttribute)&&!e.hasAttribute("noroute")?e:null}));t.Link=Lt,t.Route=kt,t.Router=ft,t.createHistory=G,t.createMemorySource=Q,t.globalHistory=X,t.link=Mt,t.links=Ut,t.navigate=Z,t.useFocus=function(){ht(4,null,v,2);const t=gt(),e=n.getContext($);let o;const r=t.subscribe((()=>{const t=new Promise((t=>{o=t}));e.set(t)}));return n.onDestroy(r),e=>{let r=!1;const s=t.subscribe((()=>{n.tick().then((()=>{r||o(e)}))}));return{destroy(){r=!0,s()}}}},t.useLocation=gt,t.useMatch=function(t){ht(6);const e=gt(),r=vt(),{basepath:s}=n.getContext(b),a=r(t),{pathname:i}=T({pathname:a},s);return o.derived(e,(e=>q({fullPath:i,path:t},e.pathname)))},t.useNavigate=yt,t.useParams=function(){return ht(8,null,v,2),mt(y)},t.useResolvable=function(t){ht(9);const e=bt(),{basepath:r}=n.getContext(b);return o.derived(e,(e=>K(t,e,r)))},t.useResolve=vt,Object.defineProperty(t,"__esModule",{value:!0})}));