@bgscore/react-router
Version:
Automatic React Router generator for Vite with TypeScript support
2 lines (1 loc) • 28 kB
JavaScript
;Object.defineProperty(exports,"t",{value:!0});var t,e,r,n,o,i,u,f,a,c,l=require("react-router-dom"),s=require("side-channel"),p=require("react");function v(t){return t&&t.t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function d(){if(e)return t;e=1;var r=String.prototype.replace,n=/%20/g,o="RFC3986";return t={default:o,formatters:{RFC1738:function(t){return r.call(t,n,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:o}}function y(){if(n)return r;n=1;var t=d(),e=Object.prototype.hasOwnProperty,o=Array.isArray,i=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),u=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},n=0;n<t.length;++n)void 0!==t[n]&&(r[n]=t[n]);return r},f=1024;return r={arrayToObject:u,assign:function(t,e){return Object.keys(e).reduce((function(t,r){return t[r]=e[r],t}),t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],n=0;n<e.length;++n)for(var i=e[n],u=i.obj[i.prop],f=Object.keys(u),a=0;a<f.length;++a){var c=f[a],l=u[c];"object"==typeof l&&null!==l&&-1===r.indexOf(l)&&(e.push({obj:u,prop:c}),r.push(l))}return function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(o(r)){for(var n=[],i=0;i<r.length;++i)void 0!==r[i]&&n.push(r[i]);e.obj[e.prop]=n}}}(e),t},decode:function(t,e,r){var n=t.replace(/\+/g," ");if("iso-8859-1"===r)return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch(t){return n}},encode:function(e,r,n,o,u){if(0===e.length)return e;var a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===n)return escape(a).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var c="",l=0;l<a.length;l+=f){for(var s=a.length>=f?a.slice(l,l+f):a,p=[],v=0;v<s.length;++v){var d=s.charCodeAt(v);45===d||46===d||95===d||126===d||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||u===t.RFC1738&&(40===d||41===d)?p[p.length]=s.charAt(v):d<128?p[p.length]=i[d]:d<2048?p[p.length]=i[192|d>>6]+i[128|63&d]:d<55296||d>=57344?p[p.length]=i[224|d>>12]+i[128|d>>6&63]+i[128|63&d]:(v+=1,d=65536+((1023&d)<<10|1023&s.charCodeAt(v)),p[p.length]=i[240|d>>18]+i[128|d>>12&63]+i[128|d>>6&63]+i[128|63&d])}c+=p.join("")}return c},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(o(t)){for(var r=[],n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)},merge:function t(r,n,i){if(!n)return r;if("object"!=typeof n&&"function"!=typeof n){if(o(r))r.push(n);else{if(!r||"object"!=typeof r)return[r,n];(i&&(i.plainObjects||i.allowPrototypes)||!e.call(Object.prototype,n))&&(r[n]=!0)}return r}if(!r||"object"!=typeof r)return[r].concat(n);var f=r;return o(r)&&!o(n)&&(f=u(r,i)),o(r)&&o(n)?(n.forEach((function(n,o){if(e.call(r,o)){var u=r[o];u&&"object"==typeof u&&n&&"object"==typeof n?r[o]=t(u,n,i):r.push(n)}else r[o]=n})),r):Object.keys(n).reduce((function(r,o){var u=n[o];return e.call(r,o)?r[o]=t(r[o],u,i):r[o]=u,r}),f)}},r}function b(){if(f)return u;f=1;var t=y(),e=Object.prototype.hasOwnProperty,r=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:t.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},o=function(t){return t.replace(/&#(\d+);/g,(function(t,e){return String.fromCharCode(parseInt(e,10))}))},i=function(t,e,r){if(t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1)return t.split(",");if(e.throwOnLimitExceeded&&r>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(1===e.arrayLimit?"":"s")+" allowed in an array.");return t},a=function(r,n,o,u){if(r){var f=o.allowDots?r.replace(/\.([^.[]+)/g,"[$1]"):r,a=/(\[[^[\]]*])/g,c=o.depth>0&&/(\[[^[\]]*])/.exec(f),l=c?f.slice(0,c.index):f,s=[];if(l){if(!o.plainObjects&&e.call(Object.prototype,l)&&!o.allowPrototypes)return;s.push(l)}for(var p=0;o.depth>0&&null!==(c=a.exec(f))&&p<o.depth;){if(p+=1,!o.plainObjects&&e.call(Object.prototype,c[1].slice(1,-1))&&!o.allowPrototypes)return;s.push(c[1])}if(c){if(!0===o.strictDepth)throw new RangeError("Input depth exceeded depth option of "+o.depth+" and strictDepth is true");s.push("["+f.slice(c.index)+"]")}return function(e,r,n,o){var u=0;if(e.length>0&&"[]"===e[e.length-1]){var f=e.slice(0,-1).join("");u=Array.isArray(r)&&r[f]?r[f].length:0}for(var a=o?r:i(r,n,u),c=e.length-1;c>=0;--c){var l,s=e[c];if("[]"===s&&n.parseArrays)l=n.allowEmptyArrays&&(""===a||n.strictNullHandling&&null===a)?[]:t.combine([],a);else{l=n.plainObjects?{__proto__:null}:{};var p="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,v=n.decodeDotInKeys?p.replace(/%2E/g,"."):p,d=parseInt(v,10);n.parseArrays||""!==v?!isNaN(d)&&s!==v&&String(d)===v&&d>=0&&n.parseArrays&&d<=n.arrayLimit?(l=[])[d]=a:"__proto__"!==v&&(l[v]=a):l={0:a}}a=l}return a}(s,n,o,u)}};return u=function(u,f){var c=function(e){if(!e)return n;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==e.throwOnLimitExceeded&&"boolean"!=typeof e.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var r=void 0===e.charset?n.charset:e.charset,o=void 0===e.duplicates?n.duplicates:e.duplicates;if("combine"!==o&&"first"!==o&&"last"!==o)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||n.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:n.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:n.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:n.arrayLimit,charset:r,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:n.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:n.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:n.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:n.decoder,delimiter:"string"==typeof e.delimiter||t.isRegExp(e.delimiter)?e.delimiter:n.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:n.depth,duplicates:o,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:n.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:n.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:n.strictDepth,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:n.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}}(f);if(""===u||null==u)return c.plainObjects?{__proto__:null}:{};for(var l="string"==typeof u?function(u,f){var a={__proto__:null},c=f.ignoreQueryPrefix?u.replace(/^\?/,""):u;c=c.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var l=f.parameterLimit===1/0?void 0:f.parameterLimit,s=c.split(f.delimiter,f.throwOnLimitExceeded?l+1:l);if(f.throwOnLimitExceeded&&s.length>l)throw new RangeError("Parameter limit exceeded. Only "+l+" parameter"+(1===l?"":"s")+" allowed.");var p,v=-1,d=f.charset;if(f.charsetSentinel)for(p=0;p<s.length;++p)0===s[p].indexOf("utf8=")&&("utf8=%E2%9C%93"===s[p]?d="utf-8":"utf8=%26%2310003%3B"===s[p]&&(d="iso-8859-1"),v=p,p=s.length);for(p=0;p<s.length;++p)if(p!==v){var y,b,m=s[p],h=m.indexOf("]="),g=-1===h?m.indexOf("="):h+1;-1===g?(y=f.decoder(m,n.decoder,d,"key"),b=f.strictNullHandling?null:""):(y=f.decoder(m.slice(0,g),n.decoder,d,"key"),b=t.maybeMap(i(m.slice(g+1),f,r(a[y])?a[y].length:0),(function(t){return f.decoder(t,n.decoder,d,"value")}))),b&&f.interpretNumericEntities&&"iso-8859-1"===d&&(b=o(String(b))),m.indexOf("[]=")>-1&&(b=r(b)?[b]:b);var w=e.call(a,y);w&&"combine"===f.duplicates?a[y]=t.combine(a[y],b):w&&"last"!==f.duplicates||(a[y]=b)}return a}(u,c):u,s=c.plainObjects?{__proto__:null}:{},p=Object.keys(l),v=0;v<p.length;++v){var d=p[v],y=a(d,l[d],c,"string"==typeof u);s=t.merge(s,y,c)}return!0===c.allowSparse?s:t.compact(s)}}function m(){if(c)return a;c=1;var t=function(){if(i)return o;i=1;var t=s,e=y(),r=d(),n=Object.prototype.hasOwnProperty,u={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},f=Array.isArray,a=Array.prototype.push,c=function(t,e){a.apply(t,f(e)?e:[e])},l=Date.prototype.toISOString,p=r.default,v={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:e.encode,encodeValuesOnly:!1,filter:void 0,format:p,formatter:r.formatters[p],indices:!1,serializeDate:function(t){return l.call(t)},skipNulls:!1,strictNullHandling:!1},b={},m=function r(n,o,i,u,a,l,s,p,d,y,m,h,g,w,j,O,_,E){for(var x,A=n,R=E,S=0,D=!1;void 0!==(R=R.get(b))&&!D;){var $=R.get(n);if(S+=1,void 0!==$){if($===S)throw new RangeError("Cyclic object value");D=!0}void 0===R.get(b)&&(S=0)}if("function"==typeof y?A=y(o,A):A instanceof Date?A=g(A):"comma"===i&&f(A)&&(A=e.maybeMap(A,(function(t){return t instanceof Date?g(t):t}))),null===A){if(l)return d&&!O?d(o,v.encoder,_,"key",w):o;A=""}if("string"==typeof(x=A)||"number"==typeof x||"boolean"==typeof x||"symbol"==typeof x||"bigint"==typeof x||e.isBuffer(A))return d?[j(O?o:d(o,v.encoder,_,"key",w))+"="+j(d(A,v.encoder,_,"value",w))]:[j(o)+"="+j(String(A))];var T,C=[];if(void 0===A)return C;if("comma"===i&&f(A))O&&d&&(A=e.maybeMap(A,d)),T=[{value:A.length>0?A.join(",")||null:void 0}];else if(f(y))T=y;else{var F=Object.keys(A);T=m?F.sort(m):F}var I=p?String(o).replace(/\./g,"%2E"):String(o),k=u&&f(A)&&1===A.length?I+"[]":I;if(a&&f(A)&&0===A.length)return k+"[]";for(var N=0;N<T.length;++N){var P=T[N],L="object"==typeof P&&P&&void 0!==P.value?P.value:A[P];if(!s||null!==L){var B=h&&p?String(P).replace(/\./g,"%2E"):String(P),U=f(A)?"function"==typeof i?i(k,B):k:k+(h?"."+B:"["+B+"]");E.set(n,S);var K=t();K.set(b,E),c(C,r(L,U,i,u,a,l,s,p,"comma"===i&&O&&f(A)?null:d,y,m,h,g,w,j,O,_,K))}}return C};return o=function(e,o){var i,a=e,l=function(t){if(!t)return v;if(void 0!==t.allowEmptyArrays&&"boolean"!=typeof t.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==t.encodeDotInKeys&&"boolean"!=typeof t.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||v.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var o=r.default;if(void 0!==t.format){if(!n.call(r.formatters,t.format))throw new TypeError("Unknown format option provided.");o=t.format}var i,a=r.formatters[o],c=v.filter;if(("function"==typeof t.filter||f(t.filter))&&(c=t.filter),i=t.arrayFormat in u?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":v.arrayFormat,"commaRoundTrip"in t&&"boolean"!=typeof t.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var l=void 0===t.allowDots?!0===t.encodeDotInKeys||v.allowDots:!!t.allowDots;return{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:v.addQueryPrefix,allowDots:l,allowEmptyArrays:"boolean"==typeof t.allowEmptyArrays?!!t.allowEmptyArrays:v.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:v.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:void 0===t.delimiter?v.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:v.encode,encodeDotInKeys:"boolean"==typeof t.encodeDotInKeys?t.encodeDotInKeys:v.encodeDotInKeys,encoder:"function"==typeof t.encoder?t.encoder:v.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:v.encodeValuesOnly,filter:c,format:o,formatter:a,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:v.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:v.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:v.strictNullHandling}}(o);"function"==typeof l.filter?a=(0,l.filter)("",a):f(l.filter)&&(i=l.filter);var s=[];if("object"!=typeof a||null===a)return"";var p=u[l.arrayFormat],d="comma"===p&&l.commaRoundTrip;i||(i=Object.keys(a)),l.sort&&i.sort(l.sort);for(var y=t(),b=0;b<i.length;++b){var h=i[b],g=a[h];l.skipNulls&&null===g||c(s,m(g,h,p,d,l.allowEmptyArrays,l.strictNullHandling,l.skipNulls,l.encodeDotInKeys,l.encode?l.encoder:null,l.filter,l.sort,l.allowDots,l.serializeDate,l.format,l.formatter,l.encodeValuesOnly,l.charset,y))}var w=s.join(l.delimiter),j=!0===l.addQueryPrefix?"?":"";return l.charsetSentinel&&("iso-8859-1"===l.charset?j+="utf8=%26%2310003%3B&":j+="utf8=%E2%9C%93&"),w.length>0?j+w:""}}(),e=b(),r=d();return a={formats:r,parse:e,stringify:t}}var h=v(m());function g(t,e){return t===e||t!=t&&e!=e}function w(t,e){for(var r=t.length;r--;)if(g(t[r][0],e))return r;return-1}var j=Array.prototype.splice;function O(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}O.prototype.clear=function(){this.i=[],this.size=0},O.prototype.delete=function(t){var e=this.i,r=w(e,t);return!(r<0||(r==e.length-1?e.pop():j.call(e,r,1),--this.size,0))},O.prototype.get=function(t){var e=this.i,r=w(e,t);return r<0?void 0:e[r][1]},O.prototype.has=function(t){return w(this.i,t)>-1},O.prototype.set=function(t,e){var r=this.i,n=w(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var _="object"==typeof global&&global&&global.Object===Object&&global,E="object"==typeof self&&self&&self.Object===Object&&self,x=_||E||Function("return this")(),A=x.Symbol,R=Object.prototype,S=R.hasOwnProperty,D=R.toString,$=A?A.toStringTag:void 0,T=Object.prototype.toString,C=A?A.toStringTag:void 0;function F(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":C&&C in Object(t)?function(t){var e=S.call(t,$),r=t[$];try{t[$]=void 0;var n=!0}catch(t){}var o=D.call(t);return n&&(e?t[$]=r:delete t[$]),o}(t):function(t){return T.call(t)}(t)}function I(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function k(t){if(!I(t))return!1;var e=F(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var N,P=x["u"],L=(N=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||""))?"Symbol(src)_1."+N:"",B=Function.prototype.toString,U=/^\[object .+?Constructor\]$/,K=Function.prototype,Q=Object.prototype,q=K.toString,H=Q.hasOwnProperty,M=RegExp("^"+q.call(H).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function z(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!I(t)||(e=t,L&&L in e))&&(k(t)?M:U).test(function(t){if(null!=t){try{return B.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}(r)?r:void 0}var V=z(x,"Map"),G=z(Object,"create"),J=Object.prototype.hasOwnProperty,W=Object.prototype.hasOwnProperty;function X(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Y(t,e){var r,n,o=t.i;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof e?"string":"hash"]:o.map}function Z(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function tt(t){var e=this.i=new O(t);this.size=e.size}X.prototype.clear=function(){this.i=G?G(null):{},this.size=0},X.prototype.delete=function(t){var e=this.has(t)&&delete this.i[t];return this.size-=e?1:0,e},X.prototype.get=function(t){var e=this.i;if(G){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return J.call(e,t)?e[t]:void 0},X.prototype.has=function(t){var e=this.i;return G?void 0!==e[t]:W.call(e,t)},X.prototype.set=function(t,e){var r=this.i;return this.size+=this.has(t)?0:1,r[t]=G&&void 0===e?"__lodash_hash_undefined__":e,this},Z.prototype.clear=function(){this.size=0,this.i={hash:new X,map:new(V||O),string:new X}},Z.prototype.delete=function(t){var e=Y(this,t).delete(t);return this.size-=e?1:0,e},Z.prototype.get=function(t){return Y(this,t).get(t)},Z.prototype.has=function(t){return Y(this,t).has(t)},Z.prototype.set=function(t,e){var r=Y(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},tt.prototype.clear=function(){this.i=new O,this.size=0},tt.prototype.delete=function(t){var e=this.i,r=e.delete(t);return this.size=e.size,r},tt.prototype.get=function(t){return this.i.get(t)},tt.prototype.has=function(t){return this.i.has(t)},tt.prototype.set=function(t,e){var r=this.i;if(r instanceof O){var n=r.i;if(!V||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.i=new Z(n)}return r.set(t,e),this.size=r.size,this};var et=function(){try{var t=z(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();function rt(t,e,r){"__proto__"==e&&et?et(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function nt(t,e,r){(void 0!==r&&!g(t[e],r)||void 0===r&&!(e in t))&&rt(t,e,r)}var ot="object"==typeof exports&&exports&&!exports.nodeType&&exports,it=ot&&"object"==typeof module&&module&&!module.nodeType&&module,ut=it&&it.exports===ot?x.Buffer:void 0;ut&&ut.allocUnsafe;var ft,at,ct=x.Uint8Array,lt=Object.create,st=function(){function t(){}return function(e){if(!I(e))return{};if(lt)return lt(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}(),pt=(ft=Object.getPrototypeOf,at=Object,function(t){return ft(at(t))}),vt=Object.prototype;function dt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||vt)}function yt(t){return null!=t&&"object"==typeof t}function bt(t){return yt(t)&&"[object Arguments]"==F(t)}var mt=Object.prototype,ht=mt.hasOwnProperty,gt=mt.propertyIsEnumerable,wt=bt(function(){return arguments}())?bt:function(t){return yt(t)&&ht.call(t,"callee")&&!gt.call(t,"callee")},jt=Array.isArray;function Ot(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function _t(t){return null!=t&&Ot(t.length)&&!k(t)}var Et="object"==typeof exports&&exports&&!exports.nodeType&&exports,xt=Et&&"object"==typeof module&&module&&!module.nodeType&&module,At=xt&&xt.exports===Et?x.Buffer:void 0,Rt=(At?At.isBuffer:void 0)||function(){return!1},St=Function.prototype,Dt=Object.prototype,$t=St.toString,Tt=Dt.hasOwnProperty,Ct=$t.call(Object),Ft={};Ft["[object Float32Array]"]=Ft["[object Float64Array]"]=Ft["[object Int8Array]"]=Ft["[object Int16Array]"]=Ft["[object Int32Array]"]=Ft["[object Uint8Array]"]=Ft["[object Uint8ClampedArray]"]=Ft["[object Uint16Array]"]=Ft["[object Uint32Array]"]=!0,Ft["[object Arguments]"]=Ft["[object Array]"]=Ft["[object ArrayBuffer]"]=Ft["[object Boolean]"]=Ft["[object DataView]"]=Ft["[object Date]"]=Ft["[object Error]"]=Ft["[object Function]"]=Ft["[object Map]"]=Ft["[object Number]"]=Ft["[object Object]"]=Ft["[object RegExp]"]=Ft["[object Set]"]=Ft["[object String]"]=Ft["[object WeakMap]"]=!1;var It="object"==typeof exports&&exports&&!exports.nodeType&&exports,kt=It&&"object"==typeof module&&module&&!module.nodeType&&module,Nt=kt&&kt.exports===It&&_.process,Pt=function(){try{return kt&&kt.require&&kt.require("util").types||Nt&&Nt.binding&&Nt.binding("util")}catch(t){}}(),Lt=Pt&&Pt.isTypedArray,Bt=Lt?function(t){return function(e){return t(e)}}(Lt):function(t){return yt(t)&&Ot(t.length)&&!!Ft[F(t)]};function Ut(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Kt=Object.prototype.hasOwnProperty;function Qt(t,e,r){var n=t[e];Kt.call(t,e)&&g(n,r)&&(void 0!==r||e in t)||rt(t,e,r)}var qt=/^(?:0|[1-9]\d*)$/;function Ht(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&qt.test(t))&&t>-1&&t%1==0&&t<e}var Mt=Object.prototype.hasOwnProperty;function zt(t){return _t(t)?function(t){var e=jt(t),r=!e&&wt(t),n=!e&&!r&&Rt(t),o=!e&&!r&&!n&&Bt(t),i=e||r||n||o,u=i?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],f=u.length;for(var a in t)i&&("length"==a||n&&("offset"==a||"parent"==a)||o&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||Ht(a,f))||u.push(a);return u}(t):function(t){if(!I(t))return function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}(t);var e=dt(t),r=[];for(var n in t)("constructor"!=n||!e&&Mt.call(t,n))&&r.push(n);return r}(t)}function Vt(t,e,r,n,o){t!==e&&function(t,e,r){for(var n=-1,o=Object(t),i=r(t),u=i.length;u--;){var f=i[++n];if(!1===e(o[f],f))break}}(e,(function(i,u){if(o||(o=new tt),I(i))!function(t,e,r,n,o,i,u){var f,a,c,l,s=Ut(t,r),p=Ut(e,r),v=u.get(p);if(v)nt(t,r,v);else{var d,y=i?i(s,p,r+"",t,e,u):void 0,b=void 0===y;if(b){var m=jt(p),h=!m&&Rt(p),g=!m&&!h&&Bt(p);y=p,m||h||g?jt(s)?y=s:yt(d=s)&&_t(d)?y=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}(s):h?(b=!1,y=p.slice()):g?(b=!1,c=new(a=(f=p).buffer).constructor(a.byteLength),new ct(c).set(new ct(a)),l=c,y=new f.constructor(l,f.byteOffset,f.length)):y=[]:function(t){if(!yt(t)||"[object Object]"!=F(t))return!1;var e=pt(t);if(null===e)return!0;var r=Tt.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&$t.call(r)==Ct}(p)||wt(p)?(y=s,wt(s)?y=function(t){return function(t,e,r){var n=!r;r||(r={});for(var o=-1,i=e.length;++o<i;){var u=e[o],f=void 0;void 0===f&&(f=t[u]),n?rt(r,u,f):Qt(r,u,f)}return r}(t,zt(t))}(s):I(s)&&!k(s)||(y=function(t){return"function"!=typeof t.constructor||dt(t)?{}:st(pt(t))}(p))):b=!1}b&&(u.set(p,y),o(y,p,n,i,u),u.delete(p)),nt(t,r,y)}}(t,e,u,r,Vt,n,o);else{var f=n?n(Ut(t,u),i,u+"",t,e,o):void 0;void 0===f&&(f=i),nt(t,u,f)}}),zt)}function Gt(t){return t}var Jt,Wt=Math.max,Xt=et?function(t,e){return et(t,"toString",{configurable:!0,enumerable:!1,value:(r=e,function(){return r}),writable:!0});var r}:Gt,Yt=Date.now,Zt=function(t){var e=0,r=0;return function(){var n=Yt(),o=16-(n-r);if(r=n,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(Xt),te=(Jt=function(t,e,r){Vt(t,e,r)},function(t){return Zt(function(t,e,r){return e=Wt(void 0===e?t.length-1:e,0),function(){for(var n=arguments,o=-1,i=Wt(n.length-e,0),u=Array(i);++o<i;)u[o]=n[e+o];o=-1;for(var f=Array(e+1);++o<e;)f[o]=n[o];return f[e]=r(u),function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}(t,this,f)}}(t,void 0,Gt),t+"")}((function(t,e){var r=-1,n=e.length,o=n>1?e[n-1]:void 0,i=n>2?e[2]:void 0;for(o=Jt.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,e,r){if(!I(r))return!1;var n=typeof e;return!!("number"==n?_t(r)&&Ht(e,r.length):"string"==n&&e in r)&&g(r[e],t)}(e[0],e[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++r<n;){var u=e[r];u&&Jt(t,u,r)}return t})));function ee(){const t=l.useParams(),e=l.useLocation(),r=l.useNavigate(),n=l.useNavigation(),o=l.useRouteError(),i=l.useMatches(),u=i[i.length-1],f=u?.id??"",a=l.useRouteLoaderData(f)||{};return p.useMemo((()=>{const u=h.parse(e.search,{ignoreQueryPrefix:!0}),c=oe({...t,...u}),l=i.find((t=>t.pathname===e.pathname&&t.data))?.data||{},s={...l?.metadata,...a?.metadata},p={...l?.data,...a?.data};return s&&(delete s?.loader,delete s?.errorElement),{push:(t,n)=>{if("string"==typeof t){let o=t;const{preserveQuery:i,replaceSameName:u,query:f,...a}=n||{};if(i&&e.search&&!f&&(o+=e.search),f){const t=u?{...c,...f}:te({},i?c:{},f);o+=`${o.includes("?")?"&":"?"}${re(t)}`}r(o,a)}else r(t,n)},pathname:e.pathname,query:c,location:e,navigate:r,goBack:function(t){try{window.history.length>1?r(-1):t&&r(t,{replace:!0})}catch(t){}},metadata:s,data:p,navigation:n,loading:"loading"===n.state,idle:"idle"===n.state,submitting:"submitting"===n.state,error:o,matches:i,id:f}}),[t,e,r,i])}function re(t,e=""){const r=[];for(const n in t)if(t.hasOwnProperty(n)){const o=t[n],i=e?`${e}[${encodeURIComponent(n)}]`:encodeURIComponent(n);if(!ne(o))continue;Array.isArray(o)?o.forEach((t=>{r.push(`${i}=${encodeURIComponent(t)}`)})):"object"==typeof o&&null!==o?r.push(re(o,i)):r.push(`${i}=${encodeURIComponent(o)}`)}return r.join("&")}function ne(t){return!(null==t||"string"==typeof t&&""===t.trim()||Array.isArray(t)&&0===t.length||"object"==typeof t&&null!==t&&!Array.isArray(t)&&0===Object.keys(t).length)}function oe(t){if("null"===t)return null;if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=oe(t[e]);else if(t&&"object"==typeof t)for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=oe(t[e]));return t}exports.default=ee,exports.useMetadata=function(t,e,r=" | "){const n=p.useRef(document.title);p.useEffect((()=>{const o=n.current,i=[],u=document.head,f=t.templateTitle?t.templateTitle:!0===e?o:e,a=t.sparatorTitle||r;return t.title?document.title=f?`${t.title}${a}${f}`:t.title:document.title=`${f||""}`,[{name:"description",content:t.description},{name:"application-name",content:t.applicationName},{name:"keywords",content:t.keywords?.join(", ")},{name:"robots",content:"string"==typeof t.robots?t.robots:t.robots?[t.robots.index?"index":"noindex",t.robots.follow?"follow":"nofollow",t.robots.nocache&&"nocache",t.robots.noimageindex&&"noimageindex",t.robots.nosnippet&&"nosnippet"].filter(Boolean).join(", "):null}].forEach((({name:t,content:e})=>{if(!e)return;let r=document.querySelector(`meta[name="${t}"]`);r||(r=document.createElement("meta"),r.setAttribute("name",t),u.appendChild(r),i.push(r)),r.setAttribute("content",e)})),document.querySelectorAll('meta[name="author"], link[rel="author"]').forEach((t=>t.remove())),t.authors?.forEach((t=>{const e=document.createElement("meta");if(e.name="author",e.content=t.name,u.appendChild(e),i.push(e),t.url){const e=document.createElement("link");e.rel="author",e.href=t.url,u.appendChild(e),i.push(e)}})),document.querySelectorAll('meta[property^="og:"]').forEach((t=>t.remove())),t.openGraph&&([{property:"og:type",content:t.openGraph.type||"website"},{property:"og:title",content:t.openGraph.title||t.title},{property:"og:description",content:t.openGraph.description||t.description},{property:"og:url",content:t.openGraph.url},{property:"og:site_name",content:t.openGraph.siteName}].forEach((({property:t,content:e})=>{if(!e)return;const r=document.createElement("meta");r.setAttribute("property",t),r.content=e,u.appendChild(r),i.push(r)})),t.openGraph.images?.forEach((t=>{[{property:"og:image",content:t.url},{property:"og:image:width",content:t.width?.toString()},{property:"og:image:height",content:t.height?.toString()},{property:"og:image:alt",content:t.alt}].forEach((({property:t,content:e})=>{if(!e)return;const r=document.createElement("meta");r.setAttribute("property",t),r.content=e,u.appendChild(r),i.push(r)}))}))),()=>{i.forEach((t=>t.remove())),t.title&&(document.title="")}}),[t])},exports.useRouter=ee;