hypnagaga/docs/assets/index-b62d9356.js
Prasanta Kumar Dutta c523f6e003 build
2023-09-08 17:38:39 +05:30

2 lines
6.6 KiB
JavaScript
Raw Blame History

import{g as q}from"./_commonjsHelpers-de833af9.js";var p={},I=n=>encodeURIComponent(n).replace(/[!'()*]/g,c=>`%${c.charCodeAt(0).toString(16).toUpperCase()}`),N="%[a-f0-9]{2}",C=new RegExp("("+N+")|([^%]+?)","gi"),w=new RegExp("("+N+")+","gi");function x(n,c){try{return[decodeURIComponent(n.join(""))]}catch{}if(n.length===1)return n;c=c||1;var s=n.slice(0,c),u=n.slice(c);return Array.prototype.concat.call([],x(s),x(u))}function D(n){try{return decodeURIComponent(n)}catch{for(var c=n.match(C)||[],s=1;s<c.length;s++)n=x(c,s).join(""),c=n.match(C)||[];return n}}function L(n){for(var c={"%FE%FF":"<22><>","%FF%FE":"<22><>"},s=w.exec(n);s;){try{c[s[0]]=decodeURIComponent(s[0])}catch{var u=D(s[0]);u!==s[0]&&(c[s[0]]=u)}s=w.exec(n)}c["%C2"]="<22>";for(var m=Object.keys(c),g=0;g<m.length;g++){var o=m[g];n=n.replace(new RegExp(o,"g"),c[o])}return n}var T=function(n){if(typeof n!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof n+"`");try{return n=n.replace(/\+/g," "),decodeURIComponent(n)}catch{return L(n)}},P=(n,c)=>{if(!(typeof n=="string"&&typeof c=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(c==="")return[n];const s=n.indexOf(c);return s===-1?[n]:[n.slice(0,s),n.slice(s+c.length)]},B=function(n,c){for(var s={},u=Object.keys(n),m=Array.isArray(c),g=0;g<u.length;g++){var o=u[g],y=n[o];(m?c.indexOf(o)!==-1:c(o,y,n))&&(s[o]=y)}return s};(function(n){const c=I,s=T,u=P,m=B,g=r=>r==null;function o(r){switch(r.arrayFormat){case"index":return e=>(a,t)=>{const f=a.length;return t===void 0||r.skipNull&&t===null||r.skipEmptyString&&t===""?a:t===null?[...a,[l(e,r),"[",f,"]"].join("")]:[...a,[l(e,r),"[",l(f,r),"]=",l(t,r)].join("")]};case"bracket":return e=>(a,t)=>t===void 0||r.skipNull&&t===null||r.skipEmptyString&&t===""?a:t===null?[...a,[l(e,r),"[]"].join("")]:[...a,[l(e,r),"[]=",l(t,r)].join("")];case"comma":case"separator":return e=>(a,t)=>t==null||t.length===0?a:a.length===0?[[l(e,r),"=",l(t,r)].join("")]:[[a,l(t,r)].join(r.arrayFormatSeparator)];default:return e=>(a,t)=>t===void 0||r.skipNull&&t===null||r.skipEmptyString&&t===""?a:t===null?[...a,l(e,r)]:[...a,[l(e,r),"=",l(t,r)].join("")]}}function y(r){let e;switch(r.arrayFormat){case"index":return(a,t,f)=>{if(e=/\[(\d*)\]$/.exec(a),a=a.replace(/\[\d*\]$/,""),!e){f[a]=t;return}f[a]===void 0&&(f[a]={}),f[a][e[1]]=t};case"bracket":return(a,t,f)=>{if(e=/(\[\])$/.exec(a),a=a.replace(/\[\]$/,""),!e){f[a]=t;return}if(f[a]===void 0){f[a]=[t];return}f[a]=[].concat(f[a],t)};case"comma":case"separator":return(a,t,f)=>{const d=typeof t=="string"&&t.includes(r.arrayFormatSeparator),i=typeof t=="string"&&!d&&F(t,r).includes(r.arrayFormatSeparator);t=i?F(t,r):t;const O=d||i?t.split(r.arrayFormatSeparator).map(R=>F(R,r)):t===null?t:F(t,r);f[a]=O};default:return(a,t,f)=>{if(f[a]===void 0){f[a]=t;return}f[a]=[].concat(f[a],t)}}}function S(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function l(r,e){return e.encode?e.strict?c(r):encodeURIComponent(r):r}function F(r,e){return e.decode?s(r):r}function j(r){return Array.isArray(r)?r.sort():typeof r=="object"?j(Object.keys(r)).sort((e,a)=>Number(e)-Number(a)).map(e=>r[e]):r}function h(r){const e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}function E(r){let e="";const a=r.indexOf("#");return a!==-1&&(e=r.slice(a)),e}function b(r){r=h(r);const e=r.indexOf("?");return e===-1?"":r.slice(e+1)}function A(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function $(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),S(e.arrayFormatSeparator);const a=y(e),t=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return t;for(const f of r.split("&")){if(f==="")continue;let[d,i]=u(e.decode?f.replace(/\+/g," "):f,"=");i=i===void 0?null:["comma","separator"].includes(e.arrayFormat)?i:F(i,e),a(F(d,e),i,t)}for(const f of Object.keys(t)){const d=t[f];if(typeof d=="object"&&d!==null)for(const i of Object.keys(d))d[i]=A(d[i],e);else t[f]=A(d,e)}return e.sort===!1?t:(e.sort===!0?Object.keys(t).sort():Object.keys(t).sort(e.sort)).reduce((f,d)=>{const i=t[d];return i&&typeof i=="object"&&!Array.isArray(i)?f[d]=j(i):f[d]=i,f},Object.create(null))}n.extract=b,n.parse=$,n.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),S(e.arrayFormatSeparator);const a=i=>e.skipNull&&g(r[i])||e.skipEmptyString&&r[i]==="",t=o(e),f={};for(const i of Object.keys(r))a(i)||(f[i]=r[i]);const d=Object.keys(f);return e.sort!==!1&&d.sort(e.sort),d.map(i=>{const O=r[i];return O===void 0?"":O===null?l(i,e):Array.isArray(O)?O.reduce(t(i),[]).join("&"):l(i,e)+"="+l(O,e)}).filter(i=>i.length>0).join("&")},n.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);const[a,t]=u(r,"#");return Object.assign({url:a.split("?")[0]||"",query:$(b(r),e)},e&&e.parseFragmentIdentifier&&t?{fragmentIdentifier:F(t,e)}:{})},n.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0},e);const a=h(r.url).split("?")[0]||"",t=n.extract(r.url),f=n.parse(t,{sort:!1}),d=Object.assign(f,r.query);let i=n.stringify(d,e);i&&(i=`?${i}`);let O=E(r.url);return r.fragmentIdentifier&&(O=`#${l(r.fragmentIdentifier,e)}`),`${a}${i}${O}`},n.pick=(r,e,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:t,query:f,fragmentIdentifier:d}=n.parseUrl(r,a);return n.stringifyUrl({url:t,query:m(f,e),fragmentIdentifier:d},a)},n.exclude=(r,e,a)=>{const t=Array.isArray(e)?f=>!e.includes(f):(f,d)=>!e(f,d);return n.pick(r,t,a)}})(p);const U=q(p),M=/^(\w+:\/\/[^/?]+)?(.*?)(\?.+)?$/,H=/^(\/\/[^/?]+)(.*?)(\?.+)?$/,V=n=>n.filter(c=>typeof c=="string"||typeof c=="number").map(c=>`${c}`).filter(c=>c),z=(n,c)=>{const{protocolRelative:s}=c,u=n.join("/"),m=s?H:M,[,g="",o="",y=""]=u.match(m)||[];return{prefix:g,pathname:{parts:o.split("/").filter(S=>S!==""),hasLeading:y?/^\/\/+/.test(o):/^\/+/.test(o),hasTrailing:y?/\/\/+$/.test(o):/\/+$/.test(o)},suffix:y}},J=(n,c)=>{const{prefix:s,pathname:u,suffix:m}=n,{parts:g,hasLeading:o,hasTrailing:y}=u,{leadingSlash:S,trailingSlash:l}=c,F=S===!0||S==="keep"&&o,j=l===!0||l==="keep"&&y;let h=s;g.length>0&&((h||F)&&(h+="/"),h+=g.join("/")),j&&(h+="/"),!h&&F&&(h+="/");const E={...U.parse(m,c.queryOptions),...c.query},b=U.stringify(E,c.queryOptions);return b&&(h+=`?${b}`),h},_=(...n)=>{const c=n[n.length-1];let s;c&&typeof c=="object"&&(s=c,n=n.slice(0,-1)),s={leadingSlash:!0,trailingSlash:!1,protocolRelative:!1,...s},n=V(n);const u=z(n,s);return J(u,s)};export{_ as u};
//# sourceMappingURL=index-b62d9356.js.map