momentum-trail
Version:
Fully typed frontend route helper for Laravel apps
2 lines (1 loc) • 18.6 kB
JavaScript
(function(g,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(g=typeof globalThis<"u"?globalThis:g||self,E(g["Momentum Trail"]={}))})(this,function(g){"use strict";var E=String.prototype.replace,oe=/%20/g,C={RFC1738:"RFC1738",RFC3986:"RFC3986"},D={default:C.RFC3986,formatters:{RFC1738:function(a){return E.call(a,oe,"+")},RFC3986:function(a){return String(a)}},RFC1738:C.RFC1738,RFC3986:C.RFC3986},fe=D,T=Object.prototype.hasOwnProperty,O=Array.isArray,w=function(){for(var a=[],e=0;e<256;++e)a.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return a}(),le=function(e){for(;e.length>1;){var r=e.pop(),t=r.obj[r.prop];if(O(t)){for(var l=[],n=0;n<t.length;++n)typeof t[n]<"u"&&l.push(t[n]);r.obj[r.prop]=l}}},I=function(e,r){for(var t=r&&r.plainObjects?Object.create(null):{},l=0;l<e.length;++l)typeof e[l]<"u"&&(t[l]=e[l]);return t},ce=function a(e,r,t){if(!r)return e;if(typeof r!="object"){if(O(e))e.push(r);else if(e&&typeof e=="object")(t&&(t.plainObjects||t.allowPrototypes)||!T.call(Object.prototype,r))&&(e[r]=!0);else return[e,r];return e}if(!e||typeof e!="object")return[e].concat(r);var l=e;return O(e)&&!O(r)&&(l=I(e,t)),O(e)&&O(r)?(r.forEach(function(n,i){if(T.call(e,i)){var u=e[i];u&&typeof u=="object"&&n&&typeof n=="object"?e[i]=a(u,n,t):e.push(n)}else e[i]=n}),e):Object.keys(r).reduce(function(n,i){var u=r[i];return T.call(n,i)?n[i]=a(n[i],u,t):n[i]=u,n},l)},se=function(e,r){return Object.keys(r).reduce(function(t,l){return t[l]=r[l],t},e)},de=function(a,e,r){var t=a.replace(/\+/g," ");if(r==="iso-8859-1")return t.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(t)}catch{return t}},he=function(e,r,t,l,n){if(e.length===0)return e;var i=e;if(typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e)),t==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});for(var u="",f=0;f<i.length;++f){var o=i.charCodeAt(f);if(o===45||o===46||o===95||o===126||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||n===fe.RFC1738&&(o===40||o===41)){u+=i.charAt(f);continue}if(o<128){u=u+w[o];continue}if(o<2048){u=u+(w[192|o>>6]+w[128|o&63]);continue}if(o<55296||o>=57344){u=u+(w[224|o>>12]+w[128|o>>6&63]+w[128|o&63]);continue}f+=1,o=65536+((o&1023)<<10|i.charCodeAt(f)&1023),u+=w[240|o>>18]+w[128|o>>12&63]+w[128|o>>6&63]+w[128|o&63]}return u},pe=function(e){for(var r=[{obj:{o:e},prop:"o"}],t=[],l=0;l<r.length;++l)for(var n=r[l],i=n.obj[n.prop],u=Object.keys(i),f=0;f<u.length;++f){var o=u[f],c=i[o];typeof c=="object"&&c!==null&&t.indexOf(c)===-1&&(r.push({obj:i,prop:o}),t.push(c))}return le(r),e},ye=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},ve=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},me=function(e,r){return[].concat(e,r)},be=function(e,r){if(O(e)){for(var t=[],l=0;l<e.length;l+=1)t.push(r(e[l]));return t}return r(e)},U={arrayToObject:I,assign:se,combine:me,compact:pe,decode:de,encode:he,isBuffer:ve,isRegExp:ye,maybeMap:be,merge:ce},$=U,F=D,ge=Object.prototype.hasOwnProperty,q={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},j=Array.isArray,we=String.prototype.split,Oe=Array.prototype.push,Z=function(a,e){Oe.apply(a,j(e)?e:[e])},je=Date.prototype.toISOString,V=F.default,v={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:$.encode,encodeValuesOnly:!1,format:V,formatter:F.formatters[V],indices:!1,serializeDate:function(e){return je.call(e)},skipNulls:!1,strictNullHandling:!1},xe=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Se=function a(e,r,t,l,n,i,u,f,o,c,d,y,p,s){var h=e;if(typeof u=="function"?h=u(r,h):h instanceof Date?h=c(h):t==="comma"&&j(h)&&(h=$.maybeMap(h,function(z){return z instanceof Date?c(z):z})),h===null){if(l)return i&&!p?i(r,v.encoder,s,"key",d):r;h=""}if(xe(h)||$.isBuffer(h)){if(i){var te=p?r:i(r,v.encoder,s,"key",d);if(t==="comma"&&p){for(var ne=we.call(String(h),","),ie="",A=0;A<ne.length;++A)ie+=(A===0?"":",")+y(i(ne[A],v.encoder,s,"value",d));return[y(te)+"="+ie]}return[y(te)+"="+y(i(h,v.encoder,s,"value",d))]}return[y(r)+"="+y(String(h))]}var H=[];if(typeof h>"u")return H;var R;if(t==="comma"&&j(h))R=[{value:h.length>0?h.join(",")||null:void 0}];else if(j(u))R=u;else{var ae=Object.keys(h);R=f?ae.sort(f):ae}for(var M=0;M<R.length;++M){var S=R[M],ue=typeof S=="object"&&typeof S.value<"u"?S.value:h[S];if(!(n&&ue===null)){var qe=j(h)?typeof t=="function"?t(r,S):r:r+(o?"."+S:"["+S+"]");Z(H,a(ue,qe,t,l,n,i,u,f,o,c,d,y,p,s))}}return H},Pe=function(e){if(!e)return v;if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||v.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=F.default;if(typeof e.format<"u"){if(!ge.call(F.formatters,e.format))throw new TypeError("Unknown format option provided.");t=e.format}var l=F.formatters[t],n=v.filter;return(typeof e.filter=="function"||j(e.filter))&&(n=e.filter),{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:v.addQueryPrefix,allowDots:typeof e.allowDots>"u"?v.allowDots:!!e.allowDots,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:v.charsetSentinel,delimiter:typeof e.delimiter>"u"?v.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:v.encode,encoder:typeof e.encoder=="function"?e.encoder:v.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:v.encodeValuesOnly,filter:n,format:t,formatter:l,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:v.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:v.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:v.strictNullHandling}},Ee=function(a,e){var r=a,t=Pe(e),l,n;typeof t.filter=="function"?(n=t.filter,r=n("",r)):j(t.filter)&&(n=t.filter,l=n);var i=[];if(typeof r!="object"||r===null)return"";var u;e&&e.arrayFormat in q?u=e.arrayFormat:e&&"indices"in e?u=e.indices?"indices":"repeat":u="indices";var f=q[u];l||(l=Object.keys(r)),t.sort&&l.sort(t.sort);for(var o=0;o<l.length;++o){var c=l[o];t.skipNulls&&r[c]===null||Z(i,Se(r[c],c,f,t.strictNullHandling,t.skipNulls,t.encode?t.encoder:null,t.filter,t.sort,t.allowDots,t.serializeDate,t.format,t.formatter,t.encodeValuesOnly,t.charset))}var d=i.join(t.delimiter),y=t.addQueryPrefix===!0?"?":"";return t.charsetSentinel&&(t.charset==="iso-8859-1"?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),d.length>0?y+d:""},P=U,L=Object.prototype.hasOwnProperty,Fe=Array.isArray,m={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:P.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Ne=function(a){return a.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},G=function(a,e){return a&&typeof a=="string"&&e.comma&&a.indexOf(",")>-1?a.split(","):a},Re="utf8=%26%2310003%3B",Ae="utf8=%E2%9C%93",Ce=function(e,r){var t={},l=r.ignoreQueryPrefix?e.replace(/^\?/,""):e,n=r.parameterLimit===1/0?void 0:r.parameterLimit,i=l.split(r.delimiter,n),u=-1,f,o=r.charset;if(r.charsetSentinel)for(f=0;f<i.length;++f)i[f].indexOf("utf8=")===0&&(i[f]===Ae?o="utf-8":i[f]===Re&&(o="iso-8859-1"),u=f,f=i.length);for(f=0;f<i.length;++f)if(f!==u){var c=i[f],d=c.indexOf("]="),y=d===-1?c.indexOf("="):d+1,p,s;y===-1?(p=r.decoder(c,m.decoder,o,"key"),s=r.strictNullHandling?null:""):(p=r.decoder(c.slice(0,y),m.decoder,o,"key"),s=P.maybeMap(G(c.slice(y+1),r),function(h){return r.decoder(h,m.decoder,o,"value")})),s&&r.interpretNumericEntities&&o==="iso-8859-1"&&(s=Ne(s)),c.indexOf("[]=")>-1&&(s=Fe(s)?[s]:s),L.call(t,p)?t[p]=P.combine(t[p],s):t[p]=s}return t},De=function(a,e,r,t){for(var l=t?e:G(e,r),n=a.length-1;n>=0;--n){var i,u=a[n];if(u==="[]"&&r.parseArrays)i=[].concat(l);else{i=r.plainObjects?Object.create(null):{};var f=u.charAt(0)==="["&&u.charAt(u.length-1)==="]"?u.slice(1,-1):u,o=parseInt(f,10);!r.parseArrays&&f===""?i={0:l}:!isNaN(o)&&u!==f&&String(o)===f&&o>=0&&r.parseArrays&&o<=r.arrayLimit?(i=[],i[o]=l):f!=="__proto__"&&(i[f]=l)}l=i}return l},Te=function(e,r,t,l){if(!!e){var n=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/,u=/(\[[^[\]]*])/g,f=t.depth>0&&i.exec(n),o=f?n.slice(0,f.index):n,c=[];if(o){if(!t.plainObjects&&L.call(Object.prototype,o)&&!t.allowPrototypes)return;c.push(o)}for(var d=0;t.depth>0&&(f=u.exec(n))!==null&&d<t.depth;){if(d+=1,!t.plainObjects&&L.call(Object.prototype,f[1].slice(1,-1))&&!t.allowPrototypes)return;c.push(f[1])}return f&&c.push("["+n.slice(f.index)+"]"),De(c,r,t,l)}},$e=function(e){if(!e)return m;if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=typeof e.charset>"u"?m.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?m.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:m.allowPrototypes,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:m.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:m.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:m.comma,decoder:typeof e.decoder=="function"?e.decoder:m.decoder,delimiter:typeof e.delimiter=="string"||P.isRegExp(e.delimiter)?e.delimiter:m.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:m.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:m.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:m.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:m.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:m.strictNullHandling}},Le=function(a,e){var r=$e(e);if(a===""||a===null||typeof a>"u")return r.plainObjects?Object.create(null):{};for(var t=typeof a=="string"?Ce(a,r):a,l=r.plainObjects?Object.create(null):{},n=Object.keys(t),i=0;i<n.length;++i){var u=n[i],f=Te(u,t[u],r,typeof a=="string");l=P.merge(l,f,r)}return P.compact(l)},_e=Ee,Qe=Le,ke=D,K={formats:ke,parse:Qe,stringify:_e};function W(a,e){for(var r=0;r<e.length;r++){var t=e[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(a,t.key,t)}}function X(a,e,r){return e&&W(a.prototype,e),r&&W(a,r),Object.defineProperty(a,"prototype",{writable:!1}),a}function b(){return b=Object.assign?Object.assign.bind():function(a){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(a[t]=r[t])}return a},b.apply(this,arguments)}function _(a){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(a)}function N(a,e){return N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,t){return r.__proto__=t,r},N(a,e)}function Be(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Q(a,e,r){return Q=Be()?Reflect.construct.bind():function(t,l,n){var i=[null];i.push.apply(i,l);var u=new(Function.bind.apply(t,i));return n&&N(u,n.prototype),u},Q.apply(null,arguments)}function k(a){var e=typeof Map=="function"?new Map:void 0;return k=function(r){if(r===null||Function.toString.call(r).indexOf("[native code]")===-1)return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(r))return e.get(r);e.set(r,t)}function t(){return Q(r,arguments,_(this).constructor)}return t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),N(t,r)},k(a)}var B=function(){function a(r,t,l){var n,i;this.name=r,this.definition=t,this.bindings=(n=t.bindings)!=null?n:{},this.wheres=(i=t.wheres)!=null?i:{},this.config=l}var e=a.prototype;return e.matchesUrl=function(r){var t=this;if(!this.definition.methods.includes("GET"))return!1;var l=this.template.replace(/(\/?){([^}?]*)(\??)}/g,function(o,c,d,y){var p,s="(?<"+d+">"+(((p=t.wheres[d])==null?void 0:p.replace(/(^\^)|(\$$)/g,""))||"[^/?]+")+")";return y?"("+c+s+")?":""+c+s}).replace(/^\w+:\/\//,""),n=r.replace(/^\w+:\/\//,"").split("?"),i=n[0],u=n[1],f=new RegExp("^"+l+"/?$").exec(i);return!!f&&{params:f.groups,query:K.parse(u)}},e.compile=function(r){var t=this,l=this.parameterSegments;return l.length?this.template.replace(/{([^}?]+)(\??)}/g,function(n,i,u){var f,o,c;if(!u&&[null,void 0].includes(r[i]))throw new Error("Ziggy error: '"+i+"' parameter is required for route '"+t.name+"'.");if(l[l.length-1].name===i&&t.wheres[i]===".*")return encodeURIComponent((c=r[i])!=null?c:"").replace(/%2F/g,"/");if(t.wheres[i]&&!new RegExp("^"+(u?"("+t.wheres[i]+")?":t.wheres[i])+"$").test((f=r[i])!=null?f:""))throw new Error("Ziggy error: '"+i+"' parameter does not match required format '"+t.wheres[i]+"' for route '"+t.name+"'.");return encodeURIComponent((o=r[i])!=null?o:"")}).replace(/\/+$/,""):this.template},X(a,[{key:"template",get:function(){return((this.config.absolute?this.definition.domain?""+this.config.url.match(/^\w+:\/\//)[0]+this.definition.domain+(this.config.port?":"+this.config.port:""):this.config.url:"")+"/"+this.definition.uri).replace(/\/+$/,"")}},{key:"parameterSegments",get:function(){var r,t;return(r=(t=this.template.match(/{[^}?]+\??}/g))==null?void 0:t.map(function(l){return{name:l.replace(/{|\??}/g,""),required:!/\?}$/.test(l)}}))!=null?r:[]}}]),a}(),He=function(a){var e,r;function t(n,i,u,f){var o;if(u===void 0&&(u=!0),(o=a.call(this)||this).t=f!=null?f:typeof Ziggy<"u"?Ziggy:globalThis==null?void 0:globalThis.Ziggy,o.t=b({},o.t,{absolute:u}),n){if(!o.t.routes[n])throw new Error("Ziggy error: route '"+n+"' is not in the route list.");o.i=new B(n,o.t.routes[n],o.t),o.u=o.o(i)}return o}r=a,(e=t).prototype=Object.create(r.prototype),e.prototype.constructor=e,N(e,r);var l=t.prototype;return l.toString=function(){var n=this,i=Object.keys(this.u).filter(function(u){return!n.i.parameterSegments.some(function(f){return f.name===u})}).filter(function(u){return u!=="_query"}).reduce(function(u,f){var o;return b({},u,((o={})[f]=n.u[f],o))},{});return this.i.compile(this.u)+K.stringify(b({},i,this.u._query),{addQueryPrefix:!0,arrayFormat:"indices",encodeValuesOnly:!0,skipNulls:!0,encoder:function(u,f){return typeof u=="boolean"?Number(u):f(u)}})},l.l=function(n){var i=this;n?this.t.absolute&&n.startsWith("/")&&(n=this.h().host+n):n=this.v();var u={},f=Object.entries(this.t.routes).find(function(o){return u=new B(o[0],o[1],i.t).matchesUrl(n)})||[void 0,void 0];return b({name:f[0]},u,{route:f[1]})},l.v=function(){var n=this.h(),i=n.pathname,u=n.search;return(this.t.absolute?n.host+i:i.replace(this.t.url.replace(/^\w*:\/\/[^/]+/,""),"").replace(/^\/+/,"/"))+u},l.current=function(n,i){var u=this.l(),f=u.name,o=u.params,c=u.query,d=u.route;if(!n)return f;var y=new RegExp("^"+n.replace(/\./g,"\\.").replace(/\*/g,".*")+"$").test(f);if([null,void 0].includes(i)||!y)return y;var p=new B(f,d,this.t);i=this.o(i,p);var s=b({},o,c);return!(!Object.values(i).every(function(h){return!h})||Object.values(s).some(function(h){return h!==void 0}))||Object.entries(i).every(function(h){return s[h[0]]==h[1]})},l.h=function(){var n,i,u,f,o,c,d=typeof window<"u"?window.location:{},y=d.host,p=d.pathname,s=d.search;return{host:(n=(i=this.t.location)==null?void 0:i.host)!=null?n:y===void 0?"":y,pathname:(u=(f=this.t.location)==null?void 0:f.pathname)!=null?u:p===void 0?"":p,search:(o=(c=this.t.location)==null?void 0:c.search)!=null?o:s===void 0?"":s}},l.has=function(n){return Object.keys(this.t.routes).includes(n)},l.o=function(n,i){var u=this;n===void 0&&(n={}),i===void 0&&(i=this.i),n!=null||(n={}),n=["string","number"].includes(typeof n)?[n]:n;var f=i.parameterSegments.filter(function(c){return!u.t.defaults[c.name]});if(Array.isArray(n))n=n.reduce(function(c,d,y){var p,s;return b({},c,f[y]?((p={})[f[y].name]=d,p):typeof d=="object"?d:((s={})[d]="",s))},{});else if(f.length===1&&!n[f[0].name]&&(n.hasOwnProperty(Object.values(i.bindings)[0])||n.hasOwnProperty("id"))){var o;(o={})[f[0].name]=n,n=o}return b({},this.g(i),this.p(n,i))},l.g=function(n){var i=this;return n.parameterSegments.filter(function(u){return i.t.defaults[u.name]}).reduce(function(u,f,o){var c,d=f.name;return b({},u,((c={})[d]=i.t.defaults[d],c))},{})},l.p=function(n,i){var u=i.bindings,f=i.parameterSegments;return Object.entries(n).reduce(function(o,c){var d,y,p=c[0],s=c[1];if(!s||typeof s!="object"||Array.isArray(s)||!f.some(function(h){return h.name===p}))return b({},o,((y={})[p]=s,y));if(!s.hasOwnProperty(u[p])){if(!s.hasOwnProperty("id"))throw new Error("Ziggy error: object passed as '"+p+"' parameter is missing route model binding key '"+u[p]+"'.");u[p]="id"}return b({},o,((d={})[p]=s[u[p]],d))},{})},l.valueOf=function(){return this.toString()},l.check=function(n){return this.has(n)},X(t,[{key:"params",get:function(){var n=this.l();return b({},n.params,n.query)}}]),t}(k(String));function Me(a,e,r,t){var l=new He(a,e,r,t);return a?l.toString():l}let Y,J,ee=!0;const x={setRoutes:a=>Y=a,getRoutes:()=>typeof window<"u"&&window.trail?window.trail:Y,setLocation:(a,e)=>{J=e?new URL(e,a):void 0},getLocation:()=>J,getAbsolute:()=>ee,setAbsolute:a=>ee=a};function re(a,e){const{url:r,routes:t,defaults:l}=x.getRoutes(),n=x.getAbsolute();return Me(a,e,n,{url:r,routes:t,defaults:l})}function ze(a,e){return re().current(a,e)}function Ie(a){x.setRoutes(a)}const Ue=(a,e)=>{e!=null&&e.routes&&x.setRoutes(e.routes),e!=null&&e.url&&x.setLocation(e.routes.url,e.url),(e==null?void 0:e.absolute)!==void 0&&x.setAbsolute(e.absolute)};g.current=ze,g.defineRoutes=Ie,g.route=re,g.store=x,g.trail=Ue,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});