"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.queryString=void 0;class QueryString{parse(e){const t={};if(!e)return t;const o=e.startsWith("?")?e.substring(1).split("&"):e.split("&");for(const e of o){const[o,n]=e.split("=");if(o&&n){const e=decodeURIComponent(o),r=decodeURIComponent(n);if(e in t)Array.isArray(t[e])?t[e].push(r):t[e]=[t[e],r];else{const o=[",","|"].find((e=>r.includes(e)));t[e]=o?r.split(o):r}}}return t}stringify(e,t={encode:!0,sort:!0}){const o=[];for(const[n,r]of Object.entries(e))if(Object.prototype.hasOwnProperty.call(e,n)){const e=t.encode?encodeURIComponent(n):n;if(Array.isArray(r)){for(const n of r)if(n){const r=t.encode?encodeURIComponent(n):n;o.push(`${e}=${r}`)}}else if(r){const n=t.encode?encodeURIComponent(r):r;o.push(`${e}=${n}`)}}return t.sort&&o.sort(),o.join("&")}}const queryString=new QueryString;exports.queryString=queryString;
//# sourceMappingURL=queryString.js.map