harperdb
Version:
HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.
1 lines • 24.1 kB
JavaScript
;(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[881],{6304:(e,t,r)=>{r.r(t),r.d(t,{default:()=>b});var n=r(9950),o=r(9708),s=r(1646),i=r(5488),a=r(3452),c=r(625),l=r(6713),u=r(4979),f=r(4319),p=r(5911),d=r(5553),m=r(4414);const b=function(){const e=(0,l.O$)(d.A,(e=>{var t;return null===(t=e.instances.find((e=>"local"===e.compute_stack_id)))||void 0===t?void 0:t.url})),[t,r]=(0,n.useState)({}),[b,y]=(0,n.useState)({}),[g,h]=(0,f.A)({}),v=(0,c.Zp)(),j=async()=>{r({submitted:!0});const{user:t,pass:n}=b;if(t&&n){const o=await(0,p.A)({auth:{user:t,pass:n},url:e});o.error&&"catch"===o.type?r({error:"SSL ERROR. ACCEPT SELF-SIGNED CERT?",url:e}):o.error&&"Login failed"===o.message||"Login failed"===o.error?r({error:"Login failed. Using instance credentials?",url:"https://harperdb.io/docs/harperdb-studio/instances/#instance-login"}):o.error?r({error:o.message||o.error}):(h({...g,local:{valid:!0,user:b.user,pass:b.pass,super:o.role.permission.super_user,structure:o.role.permission.structure_user}}),setTimeout(v("/o/local/i/local/browse"),0))}else r({error:"All fields are required"})},O=e=>{"Enter"===e.code&&j()};return(0,m.jsx)("div",{className:"login-form",children:t.submitted?(0,m.jsx)(u.A,{header:"Signing in",spinner:!0,relative:!0}):(0,m.jsxs)(o.A,{children:[(0,m.jsx)("h2",{className:"mb-2 instructions",children:"Please sign into Harper"}),t.error&&(0,m.jsxs)("a",{href:t.url||null,target:"_blank",rel:"noopener noreferrer",className:"my-2 text-center text-bold text-small d-block text-nowrap text-decoration-none",children:[(0,m.jsx)("span",{className:"login-nav-link error",children:t.error}),t.url&&(0,m.jsx)("i",{className:"ms-2 fa fa-lg fa-external-link-square text-danger"})]}),(0,m.jsxs)(s.A,{className:"mb-3 d-block",children:[(0,m.jsx)("span",{className:"mb-2 d-inline-block",children:"Instance user"}),(0,m.jsx)(i.A,{id:"username",autoComplete:"username",required:!0,onChange:e=>y({...b,user:e.target.value}),type:"text",title:"instance user",placeholder:"Instance user",value:b.user||"",disabled:t.submitted,onKeyDown:O})]}),(0,m.jsxs)(s.A,{className:"mb-4 d-block",children:[(0,m.jsx)("span",{className:"mb-2 d-inline-block",children:"Password"}),(0,m.jsx)(i.A,{id:"password",name:"password",required:!0,autoComplete:"current-password",onChange:e=>y({...b,pass:e.target.value}),className:"mb-2",type:"password",title:"instance password",placeholder:"Instance password",disabled:t.submitted,value:b.pass||"",onKeyDown:O})]}),(0,m.jsx)(a.A,{id:"signIn",className:"border-0 rounded-pill btn-gradient-blue",onClick:j,title:"Sign In My Account",block:!0,disabled:t.submitted,children:"Sign In"})]})})}},5559:(e,t,r)=>{r.r(t),r.d(t,{default:()=>g});var n=r(9950),o=r(9708),s=r(1646),i=r(5488),a=r(3452),c=r(625),l=r(6713),u=r(4283),f=r(5553),p=r(3304),d=r(1440),m=r(4979),b=r(5283),y=r(4414);const g=function(){const{search:e}=(0,c.zy)(),{user:t,token:r}=u.A.parse(e,{decode:!1}),g=(0,l.O$)(f.A,(e=>e.theme)),[h,v]=(0,n.useState)({}),[j,O]=(0,n.useState)({}),[x,w]=(0,b.A)({});return(0,n.useEffect)((()=>{t&&r&&(0,p.A)({email:t,pass:r,loggingIn:!0})}),[t,r]),(0,y.jsx)("div",{className:"login-form",children:h.processing?(0,y.jsx)(m.A,{header:"signing in",spinner:!0,relative:!0}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(o.A,{children:[(0,y.jsx)("h2",{className:"mb-2 instructions",children:"Sign in to Harper Studio"}),(0,y.jsx)("span",{className:"login-nav-link error d-inline-block",children:h.error}),(0,y.jsxs)(s.A,{className:"mb-3 d-block",children:[(0,y.jsx)("span",{className:"mb-2 d-inline-block",children:"Email"}),(0,y.jsx)(i.A,{name:"email",autoComplete:"email",required:!0,id:"email",onChange:e=>{e.currentTarget.focus(),O({...j,email:e.target.value.trim().toLowerCase()})},value:j.email||"",disabled:h.submitted,type:"text",title:"email",placeholder:"email address"})]}),(0,y.jsxs)(s.A,{className:"mb-4 d-block",children:[(0,y.jsx)("span",{className:"mb-2 d-inline-block",children:"Password"}),(0,y.jsx)(i.A,{id:"password",required:!0,onChange:e=>{e.currentTarget.focus(),O({...j,pass:e.target.value})},value:j.pass||"",disabled:h.submitted,type:"password",title:"password",name:"password",autoComplete:"current-password",placeholder:"password"})]}),(0,y.jsx)(a.A,{id:"signIn",type:"submit",className:"border-0 rounded-pill btn-gradient-blue",onClick:async()=>{v({submitted:!0});const{email:e,pass:t}=j;if((0,d.A)(e))if(t)if("akamai"===g&&-1===j.email.indexOf("harperdb.io")&&-1===j.email.indexOf("akamai.com")&&-1===j.email.indexOf("walmart.com"))v({error:"Portal access denied"});else{v({processing:!0});const r=await(0,p.A)({email:e,pass:t,loggingIn:!0});if(!r||null!==r&&void 0!==r&&r.error)v({error:["Unauthorized","User does not exist"].includes(null===r||void 0===r?void 0:r.message)?"Login Failed":(null===r||void 0===r?void 0:r.message)||"Login Failed"}),setTimeout((()=>v({})),5e3);else{w({...x,email:e,pass:t});const r={username:e,type:"email",company:e.split("@")[1]};Reo.identify(r)}}else v({error:"Password is required"});else v({error:"A valid email is required"})},title:"Sign In My Account",block:!0,disabled:h.submitted,children:"Sign In"})]}),(0,y.jsxs)("div",{className:"px-4 mt-3 d-flex justify-content-between",children:[(0,y.jsx)(c.k2,{to:"/sign-up",className:"login-nav-link d-inline-block",children:"Sign Up for Free"}),(0,y.jsx)(c.k2,{to:"/reset-password",className:"login-nav-link d-inline-block",children:"Reset Password"})]})]})})}},5911:(e,t,r)=>{r.d(t,{A:()=>o});var n=r(127);const o=async e=>{let{auth:t,url:r}=e;return(0,n.A)({operation:{operation:"user_info"},auth:t,url:r,timeout:5e3})}},127:(e,t,r)=>{r.d(t,{A:()=>o});var n=r(4038);const o=async e=>{let{operation:t,auth:r,url:o,timeout:s=0,authType:i,signal:a}=e;try{const e=new AbortController,u=setTimeout((()=>s?e.abort():null),s),f={"Content-Type":"application/json"};"token"===i?f.Authorization=`Bearer ${r.token}`:null!==r&&void 0!==r&&r.pass&&(f.Authorization=`Basic ${btoa(`${r.user}:${r.pass}`)}`);const p=await(0,n.hd)(o,{signal:a||e.signal,method:"POST",body:JSON.stringify(t),headers:f,credentials:f.Authorization?"omit":"include"});clearTimeout(u);const d=await p.json();var c,l;return d.error?{error:!0,message:d.error,type:"response",status:p.status,role_errors:null===(c=d.main_permissions)||void 0===c?void 0:c.join(", "),access_errors:null===(l=d.unauthorized_access)||void 0===l?void 0:l.map((e=>{var t,r,n,o,s,i;return{schema:e.schema,table:e.table,type:null!==(t=e.required_attribute_permissions)&&void 0!==t&&t.length?"attribute":"table",entity:null!==(r=e.required_attribute_permissions)&&void 0!==r&&r.length?null===(n=e.required_attribute_permissions[0])||void 0===n?void 0:n.attribute_name:e.table,permission:null!==(o=e.required_attribute_permissions)&&void 0!==o&&o.length?null===(s=e.required_attribute_permissions[0])||void 0===s?void 0:s.required_permissions.join(", "):null===(i=e.required_table_permissions)||void 0===i?void 0:i.join(", ")}}))}:200!==p.status?{error:!0,message:`Error of type ${p.status}`,type:"status"}:d}catch(u){return{error:!0,message:u.message,type:"catch"}}}},4319:(e,t,r)=>{r.d(t,{A:()=>n});const n=(0,r(6997).A)("instanceAuths")},1440:(e,t,r)=>{r.d(t,{A:()=>n});const n=e=>/^\S+@\S+\.\S+$/.test(String(e).toLowerCase())},9708:(e,t,r)=>{r.d(t,{A:()=>h});var n=r(9950),o=r(1942),s=r.n(o),i=r(1497);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}var c=["className","cssModule","tag","innerRef"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l.apply(this,arguments)}function u(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function d(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b(e);if(t){var o=b(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===a(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}(this,r)}}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var y={children:s().node,tag:i.Wx,innerRef:s().oneOfType([s().object,s().func,s().string]),className:s().string,cssModule:s().object},g=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(a,e);var t,r,o,s=d(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=s.call(this,e)).getRef=t.getRef.bind(m(t)),t.submit=t.submit.bind(m(t)),t}return t=a,(r=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"submit",value:function(){this.ref&&this.ref.submit()}},{key:"render",value:function(){var e=this.props,t=e.className,r=e.cssModule,o=e.tag,s=void 0===o?"form":o,a=e.innerRef,f=u(e,c),p=(0,i.qO)(t,r);return n.createElement(s,l({},f,{ref:a,className:p}))}}])&&f(t.prototype,r),o&&f(t,o),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Component);g.propTypes=y;const h=g},5488:(e,t,r)=>{r.d(t,{A:()=>j});var n=r(9950),o=r(1942),s=r.n(o),i=r(8738),a=r.n(i),c=r(1497);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}var u=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function f(){return f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f.apply(this,arguments)}function p(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}function b(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g(e);if(t){var o=g(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===l(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}(this,r)}}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}var h={children:s().node,type:s().string,size:s().oneOfType([s().number,s().string]),bsSize:s().string,valid:s().bool,invalid:s().bool,tag:c.Wx,innerRef:s().oneOfType([s().object,s().func,s().string]),plaintext:s().bool,addon:s().bool,className:s().string,cssModule:s().object},v=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}(i,e);var t,r,o,s=b(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=s.call(this,e)).getRef=t.getRef.bind(y(t)),t.focus=t.focus.bind(y(t)),t}return t=i,(r=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,t=e.className,r=e.cssModule,o=e.type,s=void 0===o?"text":o,i=e.bsSize,l=e.valid,d=e.invalid,m=e.tag,b=e.addon,y=e.plaintext,g=e.innerRef,h=p(e,u),v=["switch","radio","checkbox"].indexOf(s)>-1,j="select"===s,O="range"===s,x=m||(j||"textarea"===s?s:"input"),w="form-control";y?(w="".concat(w,"-plaintext"),x=m||"input"):O?w="form-range":j?w="form-select":v&&(w=b?null:"form-check-input"),h.size&&/\D/g.test(h.size)&&((0,c.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),i=h.size,delete h.size);var k=(0,c.qO)(a()(t,d&&"is-invalid",l&&"is-valid",!!i&&(j?"form-select-".concat(i):"form-control-".concat(i)),w),r);return("input"===x||m&&"function"===typeof m)&&(h.type="switch"===s?"checkbox":s),h.children&&!y&&"select"!==s&&"string"===typeof x&&"select"!==x&&((0,c.mc)('Input with a type of "'.concat(s,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete h.children),n.createElement(x,f({},h,{ref:g,className:k,"aria-invalid":d}))}}])&&d(t.prototype,r),o&&d(t,o),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.Component);v.propTypes=h;const j=v},1646:(e,t,r)=>{r.d(t,{A:()=>v});var n=r(9950),o=r(1942),s=r.n(o),i=r(8738),a=r.n(i),c=r(1497),l=["className","cssModule","hidden","widths","tag","check","size","for"];function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u.apply(this,arguments)}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var d=["xs","sm","md","lg","xl","xxl"],m=s().oneOfType([s().number,s().string]),b=s().oneOfType([s().bool,s().string,s().number,s().shape({size:m,order:m,offset:m})]),y={children:s().node,hidden:s().bool,check:s().bool,size:s().string,for:s().string,tag:c.Wx,className:s().string,cssModule:s().object,xs:b,sm:b,md:b,lg:b,xl:b,xxl:b,widths:s().array},g=function(e,t,r){return!0===r||""===r?e?"col":"col-".concat(t):"auto"===r?e?"col-auto":"col-".concat(t,"-auto"):e?"col-".concat(r):"col-".concat(t,"-").concat(r)};function h(e){var t=e.className,r=e.cssModule,o=e.hidden,s=e.widths,i=void 0===s?d:s,m=e.tag,b=void 0===m?"label":m,y=e.check,h=e.size,v=e.for,j=p(e,l),O=[];i.forEach((function(t,n){var o=e[t];if(delete j[t],o||""===o){var s,i=!n;if((0,c.Gv)(o)){var l,u=i?"-":"-".concat(t,"-");s=g(i,t,o.size),O.push((0,c.qO)(a()((f(l={},s,o.size||""===o.size),f(l,"order".concat(u).concat(o.order),o.order||0===o.order),f(l,"offset".concat(u).concat(o.offset),o.offset||0===o.offset),l))),r)}else s=g(i,t,o),O.push(s)}}));var x=h||O.length,w=!(y||x),k=(0,c.qO)(a()(t,!!o&&"visually-hidden",!!y&&"form-check-label",!!h&&"col-form-label-".concat(h),O,!!x&&"col-form-label",!!w&&"form-label"),r);return n.createElement(b,u({htmlFor:v},j,{className:k}))}h.propTypes=y;const v=h},4283:(e,t,r)=>{r.d(t,{A:()=>R});var n={};r.r(n),r.d(n,{exclude:()=>N,extract:()=>O,parse:()=>x,parseUrl:()=>k,pick:()=>A,stringify:()=>w,stringifyUrl:()=>S});const o="%[a-f0-9]{2}",s=new RegExp("("+o+")|([^%]+?)","gi"),i=new RegExp("("+o+")+","gi");function a(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(1===e.length)return e;t=t||1;const r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],a(r),a(n))}function c(e){try{return decodeURIComponent(e)}catch{let t=e.match(s)||[];for(let r=1;r<t.length;r++)t=(e=a(t,r).join("")).match(s)||[];return e}}function l(e){if("string"!==typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return function(e){const t={"%FE%FF":"\ufffd\ufffd","%FF%FE":"\ufffd\ufffd"};let r=i.exec(e);for(;r;){try{t[r[0]]=decodeURIComponent(r[0])}catch{const e=c(r[0]);e!==r[0]&&(t[r[0]]=e)}r=i.exec(e)}t["%C2"]="\ufffd";const n=Object.keys(t);for(const o of n)e=e.replace(new RegExp(o,"g"),t[o]);return e}(e)}}function u(e,t){const r={};if(Array.isArray(t))for(const n of t){const t=Object.getOwnPropertyDescriptor(e,n);t?.enumerable&&Object.defineProperty(r,n,t)}else for(const n of Reflect.ownKeys(e)){const o=Object.getOwnPropertyDescriptor(e,n);if(o.enumerable){t(n,e[n],e)&&Object.defineProperty(r,n,o)}}return r}function f(e,t){if("string"!==typeof e||"string"!==typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===e||""===t)return[];const r=e.indexOf(t);return-1===r?[]:[e.slice(0,r),e.slice(r+t.length)]}const p=e=>null===e||void 0===e,d=e=>encodeURIComponent(e).replaceAll(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),m=Symbol("encodeFragmentIdentifier");function b(e){if("string"!==typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function y(e,t){return t.encode?t.strict?d(e):encodeURIComponent(e):e}function g(e,t){return t.decode?l(e):e}function h(e){return Array.isArray(e)?e.sort():"object"===typeof e?h(Object.keys(e)).sort(((e,t)=>Number(e)-Number(t))).map((t=>e[t])):e}function v(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function j(e,t,r){return"string"===r&&"string"===typeof e?e:"function"===typeof r&&"string"===typeof e?r(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()?"number"!==r||Number.isNaN(Number(e))||"string"!==typeof e||""===e.trim()?t.parseNumbers&&!Number.isNaN(Number(e))&&"string"===typeof e&&""!==e.trim()?Number(e):e:Number(e):"true"===e.toLowerCase()}function O(e){const t=(e=v(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function x(e,t){b((t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,types:Object.create(null),...t}).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)]$/.exec(e),e=e.replace(/\[\d*]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[])$/.exec(e),e=e.replace(/\[]$/,""),t?void 0!==n[e]?n[e]=[...n[e],r]:n[e]=[r]:n[e]=r};case"colon-list-separator":return(e,r,n)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==n[e]?n[e]=[...n[e],r]:n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const o="string"===typeof r&&r.includes(e.arrayFormatSeparator),s="string"===typeof r&&!o&&g(r,e).includes(e.arrayFormatSeparator);r=s?g(r,e):r;const i=o||s?r.split(e.arrayFormatSeparator).map((t=>g(t,e))):null===r?r:g(r,e);n[t]=i};case"bracket-separator":return(t,r,n)=>{const o=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!o)return void(n[t]=r?g(r,e):r);const s=null===r?[]:g(r,e).split(e.arrayFormatSeparator);void 0!==n[t]?n[t]=[...n[t],...s]:n[t]=s};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[...[r[e]].flat(),t]:r[e]=t}}}(t),n=Object.create(null);if("string"!==typeof e)return n;if(!(e=e.trim().replace(/^[?#&]/,"")))return n;for(const o of e.split("&")){if(""===o)continue;const e=t.decode?o.replaceAll("+"," "):o;let[s,i]=f(e,"=");void 0===s&&(s=e),i=void 0===i?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?i:g(i,t),r(g(s,t),i,n)}for(const[o,s]of Object.entries(n))if("object"===typeof s&&null!==s&&"string"!==t.types[o])for(const[e,r]of Object.entries(s)){const n=t.types[o]?t.types[o].replace("[]",""):void 0;s[e]=j(r,t,n)}else"object"===typeof s&&null!==s&&"string"===t.types[o]?n[o]=Object.values(s).join(t.arrayFormatSeparator):n[o]=j(s,t,t.types[o]);return!1===t.sort?n:(!0===t.sort?Object.keys(n).sort():Object.keys(n).sort(t.sort)).reduce(((e,t)=>{const r=n[t];return e[t]=Boolean(r)&&"object"===typeof r&&!Array.isArray(r)?h(r):r,e}),Object.create(null))}function w(e,t){if(!e)return"";b((t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t}).arrayFormatSeparator);const r=r=>t.skipNull&&p(e[r])||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const o=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[y(t,e),"[",o,"]"].join("")]:[...r,[y(t,e),"[",y(o,e),"]=",y(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[y(t,e),"[]"].join("")]:[...r,[y(t,e),"[]=",y(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[y(t,e),":list="].join("")]:[...r,[y(t,e),":list=",y(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(n,o)=>void 0===o||e.skipNull&&null===o||e.skipEmptyString&&""===o?n:(o=null===o?"":o,0===n.length?[[y(r,e),t,y(o,e)].join("")]:[[n,y(o,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,y(t,e)]:[...r,[y(t,e),"=",y(n,e)].join("")]}}(t),o={};for(const[i,a]of Object.entries(e))r(i)||(o[i]=a);const s=Object.keys(o);return!1!==t.sort&&s.sort(t.sort),s.map((r=>{const o=e[r];return void 0===o?"":null===o?y(r,t):Array.isArray(o)?0===o.length&&"bracket-separator"===t.arrayFormat?y(r,t)+"[]":o.reduce(n(r),[]).join("&"):y(r,t)+"="+y(o,t)})).filter((e=>e.length>0)).join("&")}function k(e,t){t={decode:!0,...t};let[r,n]=f(e,"#");return void 0===r&&(r=e),{url:r?.split("?")?.[0]??"",query:x(O(e),t),...t&&t.parseFragmentIdentifier&&n?{fragmentIdentifier:g(n,t)}:{}}}function S(e,t){t={encode:!0,strict:!0,[m]:!0,...t};const r=v(e.url).split("?")[0]||"";let n=w({...x(O(e.url),{sort:!1}),...e.query},t);n&&=`?${n}`;let o=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);if("string"===typeof e.fragmentIdentifier){const n=new URL(r);n.hash=e.fragmentIdentifier,o=t[m]?n.hash:`#${e.fragmentIdentifier}`}return`${r}${n}${o}`}function A(e,t,r){r={parseFragmentIdentifier:!0,[m]:!1,...r};const{url:n,query:o,fragmentIdentifier:s}=k(e,r);return S({url:n,query:u(o,t),fragmentIdentifier:s},r)}function N(e,t,r){return A(e,Array.isArray(t)?e=>!t.includes(e):(e,r)=>!t(e,r),r)}const R=n}}]);