@ordercloud/react-sdk
Version:
This is a developer library for OrderCloud developers utilizing React for their frontend development. It is essentially a wrapper for Tanstack query, which provides a lot of good functionality out of the box for background refreshes, request de-duplicatio
27 lines (25 loc) • 677 kB
JavaScript
(function($t,Be){typeof exports=="object"&&typeof module<"u"?Be(exports,require("react"),require("ordercloud-javascript-sdk"),require("@tanstack/react-query"),require("@tanstack/react-table")):typeof define=="function"&&define.amd?define(["exports","react","ordercloud-javascript-sdk","@tanstack/react-query","@tanstack/react-table"],Be):($t=typeof globalThis<"u"?globalThis:$t||self,Be($t["@ordercloud/react-sdk"]={},$t.React,$t.ordercloud,$t.ReactQuery,$t.ReactTable))})(this,function($t,Be,lt,ni,V_){"use strict";function H_(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const ho=H_(Be);var gt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function es(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function gp(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var a=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,a.get?a:{enumerable:!0,get:function(){return e[i]}})}),r}function W_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vp={exports:{}},qt=vp.exports={},rn,nn;function Ku(){throw new Error("setTimeout has not been defined")}function Gu(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?rn=setTimeout:rn=Ku}catch{rn=Ku}try{typeof clearTimeout=="function"?nn=clearTimeout:nn=Gu}catch{nn=Gu}})();function bp(e){if(rn===setTimeout)return setTimeout(e,0);if((rn===Ku||!rn)&&setTimeout)return rn=setTimeout,setTimeout(e,0);try{return rn(e,0)}catch{try{return rn.call(null,e,0)}catch{return rn.call(this,e,0)}}}function z_(e){if(nn===clearTimeout)return clearTimeout(e);if((nn===Gu||!nn)&&clearTimeout)return nn=clearTimeout,clearTimeout(e);try{return nn(e)}catch{try{return nn.call(null,e)}catch{return nn.call(this,e)}}}var wn=[],Ri=!1,ii,ts=-1;function K_(){!Ri||!ii||(Ri=!1,ii.length?wn=ii.concat(wn):ts=-1,wn.length&&wp())}function wp(){if(!Ri){var e=bp(K_);Ri=!0;for(var t=wn.length;t;){for(ii=wn,wn=[];++ts<t;)ii&&ii[ts].run();ts=-1,t=wn.length}ii=null,Ri=!1,z_(e)}}qt.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];wn.push(new _p(e,t)),wn.length===1&&!Ri&&bp(wp)};function _p(e,t){this.fun=e,this.array=t}_p.prototype.run=function(){this.fun.apply(null,this.array)},qt.title="browser",qt.browser=!0,qt.env={},qt.argv=[],qt.version="",qt.versions={};function _n(){}qt.on=_n,qt.addListener=_n,qt.once=_n,qt.off=_n,qt.removeListener=_n,qt.removeAllListeners=_n,qt.emit=_n,qt.prependListener=_n,qt.prependOnceListener=_n,qt.listeners=function(e){return[]},qt.binding=function(e){throw new Error("process.binding is not supported")},qt.cwd=function(){return"/"},qt.chdir=function(e){throw new Error("process.chdir is not supported")},qt.umask=function(){return 0};var G_=vp.exports;const Ge=W_(G_);var rs={exports:{}},mo={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var $p;function Y_(){if($p)return mo;$p=1;var e=Be,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(f,c,d){var l,g={},$=null,w=null;d!==void 0&&($=""+d),c.key!==void 0&&($=""+c.key),c.ref!==void 0&&(w=c.ref);for(l in c)i.call(c,l)&&!s.hasOwnProperty(l)&&(g[l]=c[l]);if(f&&f.defaultProps)for(l in c=f.defaultProps,c)g[l]===void 0&&(g[l]=c[l]);return{$$typeof:t,type:f,key:$,ref:w,props:g,_owner:a.current}}return mo.Fragment=r,mo.jsx=u,mo.jsxs=u,mo}var yo={},Ep;function J_(){return Ep||(Ep=1,Ge.env.NODE_ENV!=="production"&&function(){var e=Be,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),w=Symbol.for("react.offscreen"),v=Symbol.iterator,x="@@iterator";function y(ae){if(ae===null||typeof ae!="object")return null;var je=v&&ae[v]||ae[x];return typeof je=="function"?je:null}var h=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(ae){{for(var je=arguments.length,He=new Array(je>1?je-1:0),Je=1;Je<je;Je++)He[Je-1]=arguments[Je];b("error",ae,He)}}function b(ae,je,He){{var Je=h.ReactDebugCurrentFrame,ht=Je.getStackAddendum();ht!==""&&(je+="%s",He=He.concat([ht]));var yt=He.map(function(st){return String(st)});yt.unshift("Warning: "+je),Function.prototype.apply.call(console[ae],console,yt)}}var P=!1,_=!1,I=!1,C=!1,U=!1,J;J=Symbol.for("react.module.reference");function te(ae){return!!(typeof ae=="string"||typeof ae=="function"||ae===i||ae===s||U||ae===a||ae===d||ae===l||C||ae===w||P||_||I||typeof ae=="object"&&ae!==null&&(ae.$$typeof===$||ae.$$typeof===g||ae.$$typeof===u||ae.$$typeof===f||ae.$$typeof===c||ae.$$typeof===J||ae.getModuleId!==void 0))}function pe(ae,je,He){var Je=ae.displayName;if(Je)return Je;var ht=je.displayName||je.name||"";return ht!==""?He+"("+ht+")":He}function se(ae){return ae.displayName||"Context"}function _e(ae){if(ae==null)return null;if(typeof ae.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof ae=="function")return ae.displayName||ae.name||null;if(typeof ae=="string")return ae;switch(ae){case i:return"Fragment";case r:return"Portal";case s:return"Profiler";case a:return"StrictMode";case d:return"Suspense";case l:return"SuspenseList"}if(typeof ae=="object")switch(ae.$$typeof){case f:var je=ae;return se(je)+".Consumer";case u:var He=ae;return se(He._context)+".Provider";case c:return pe(ae,ae.render,"ForwardRef");case g:var Je=ae.displayName||null;return Je!==null?Je:_e(ae.type)||"Memo";case $:{var ht=ae,yt=ht._payload,st=ht._init;try{return _e(st(yt))}catch{return null}}}return null}var ge=Object.assign,Ce=0,Ue,$e,we,Le,ue,ee,K;function V(){}V.__reactDisabledLog=!0;function q(){{if(Ce===0){Ue=console.log,$e=console.info,we=console.warn,Le=console.error,ue=console.group,ee=console.groupCollapsed,K=console.groupEnd;var ae={configurable:!0,enumerable:!0,value:V,writable:!0};Object.defineProperties(console,{info:ae,log:ae,warn:ae,error:ae,group:ae,groupCollapsed:ae,groupEnd:ae})}Ce++}}function G(){{if(Ce--,Ce===0){var ae={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ge({},ae,{value:Ue}),info:ge({},ae,{value:$e}),warn:ge({},ae,{value:we}),error:ge({},ae,{value:Le}),group:ge({},ae,{value:ue}),groupCollapsed:ge({},ae,{value:ee}),groupEnd:ge({},ae,{value:K})})}Ce<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=h.ReactCurrentDispatcher,Z;function oe(ae,je,He){{if(Z===void 0)try{throw Error()}catch(ht){var Je=ht.stack.trim().match(/\n( *(at )?)/);Z=Je&&Je[1]||""}return`
`+Z+ae}}var ve=!1,Ee;{var D=typeof WeakMap=="function"?WeakMap:Map;Ee=new D}function N(ae,je){if(!ae||ve)return"";{var He=Ee.get(ae);if(He!==void 0)return He}var Je;ve=!0;var ht=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var yt;yt=H.current,H.current=null,q();try{if(je){var st=function(){throw Error()};if(Object.defineProperty(st.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(st,[])}catch(Wt){Je=Wt}Reflect.construct(ae,[],st)}else{try{st.call()}catch(Wt){Je=Wt}ae.call(st.prototype)}}else{try{throw Error()}catch(Wt){Je=Wt}ae()}}catch(Wt){if(Wt&&Je&&typeof Wt.stack=="string"){for(var et=Wt.stack.split(`
`),kt=Je.stack.split(`
`),Pt=et.length-1,Ot=kt.length-1;Pt>=1&&Ot>=0&&et[Pt]!==kt[Ot];)Ot--;for(;Pt>=1&&Ot>=0;Pt--,Ot--)if(et[Pt]!==kt[Ot]){if(Pt!==1||Ot!==1)do if(Pt--,Ot--,Ot<0||et[Pt]!==kt[Ot]){var mr=`
`+et[Pt].replace(" at new "," at ");return ae.displayName&&mr.includes("<anonymous>")&&(mr=mr.replace("<anonymous>",ae.displayName)),typeof ae=="function"&&Ee.set(ae,mr),mr}while(Pt>=1&&Ot>=0);break}}}finally{ve=!1,H.current=yt,G(),Error.prepareStackTrace=ht}var Xr=ae?ae.displayName||ae.name:"",Pn=Xr?oe(Xr):"";return typeof ae=="function"&&Ee.set(ae,Pn),Pn}function re(ae,je,He){return N(ae,!1)}function ce(ae){var je=ae.prototype;return!!(je&&je.isReactComponent)}function Oe(ae,je,He){if(ae==null)return"";if(typeof ae=="function")return N(ae,ce(ae));if(typeof ae=="string")return oe(ae);switch(ae){case d:return oe("Suspense");case l:return oe("SuspenseList")}if(typeof ae=="object")switch(ae.$$typeof){case c:return re(ae.render);case g:return Oe(ae.type,je,He);case $:{var Je=ae,ht=Je._payload,yt=Je._init;try{return Oe(yt(ht),je,He)}catch{}}}return""}var L=Object.prototype.hasOwnProperty,F={},R=h.ReactDebugCurrentFrame;function k(ae){if(ae){var je=ae._owner,He=Oe(ae.type,ae._source,je?je.type:null);R.setExtraStackFrame(He)}else R.setExtraStackFrame(null)}function Y(ae,je,He,Je,ht){{var yt=Function.call.bind(L);for(var st in ae)if(yt(ae,st)){var et=void 0;try{if(typeof ae[st]!="function"){var kt=Error((Je||"React class")+": "+He+" type `"+st+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof ae[st]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw kt.name="Invariant Violation",kt}et=ae[st](je,st,Je,He,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Pt){et=Pt}et&&!(et instanceof Error)&&(k(ht),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Je||"React class",He,st,typeof et),k(null)),et instanceof Error&&!(et.message in F)&&(F[et.message]=!0,k(ht),p("Failed %s type: %s",He,et.message),k(null))}}}var fe=Array.isArray;function de(ae){return fe(ae)}function Se(ae){{var je=typeof Symbol=="function"&&Symbol.toStringTag,He=je&&ae[Symbol.toStringTag]||ae.constructor.name||"Object";return He}}function S(ae){try{return ie(ae),!1}catch{return!0}}function ie(ae){return""+ae}function be(ae){if(S(ae))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Se(ae)),ie(ae)}var Ae=h.ReactCurrentOwner,xe={key:!0,ref:!0,__self:!0,__source:!0},Me,A;function E(ae){if(L.call(ae,"ref")){var je=Object.getOwnPropertyDescriptor(ae,"ref").get;if(je&&je.isReactWarning)return!1}return ae.ref!==void 0}function O(ae){if(L.call(ae,"key")){var je=Object.getOwnPropertyDescriptor(ae,"key").get;if(je&&je.isReactWarning)return!1}return ae.key!==void 0}function B(ae,je){typeof ae.ref=="string"&&Ae.current}function Q(ae,je){{var He=function(){Me||(Me=!0,p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",je))};He.isReactWarning=!0,Object.defineProperty(ae,"key",{get:He,configurable:!0})}}function j(ae,je){{var He=function(){A||(A=!0,p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",je))};He.isReactWarning=!0,Object.defineProperty(ae,"ref",{get:He,configurable:!0})}}var W=function(ae,je,He,Je,ht,yt,st){var et={$$typeof:t,type:ae,key:je,ref:He,props:st,_owner:yt};return et._store={},Object.defineProperty(et._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(et,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Je}),Object.defineProperty(et,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ht}),Object.freeze&&(Object.freeze(et.props),Object.freeze(et)),et};function me(ae,je,He,Je,ht){{var yt,st={},et=null,kt=null;He!==void 0&&(be(He),et=""+He),O(je)&&(be(je.key),et=""+je.key),E(je)&&(kt=je.ref,B(je,ht));for(yt in je)L.call(je,yt)&&!xe.hasOwnProperty(yt)&&(st[yt]=je[yt]);if(ae&&ae.defaultProps){var Pt=ae.defaultProps;for(yt in Pt)st[yt]===void 0&&(st[yt]=Pt[yt])}if(et||kt){var Ot=typeof ae=="function"?ae.displayName||ae.name||"Unknown":ae;et&&Q(st,Ot),kt&&j(st,Ot)}return W(ae,et,kt,ht,Je,Ae.current,st)}}var Te=h.ReactCurrentOwner,Ne=h.ReactDebugCurrentFrame;function Fe(ae){if(ae){var je=ae._owner,He=Oe(ae.type,ae._source,je?je.type:null);Ne.setExtraStackFrame(He)}else Ne.setExtraStackFrame(null)}var Ye;Ye=!1;function vt(ae){return typeof ae=="object"&&ae!==null&&ae.$$typeof===t}function Yt(){{if(Te.current){var ae=_e(Te.current.type);if(ae)return`
Check the render method of \``+ae+"`."}return""}}function Fr(ae){return""}var zn={};function mn(ae){{var je=Yt();if(!je){var He=typeof ae=="string"?ae:ae.displayName||ae.name;He&&(je=`
Check the top-level render call using <`+He+">.")}return je}}function Zt(ae,je){{if(!ae._store||ae._store.validated||ae.key!=null)return;ae._store.validated=!0;var He=mn(je);if(zn[He])return;zn[He]=!0;var Je="";ae&&ae._owner&&ae._owner!==Te.current&&(Je=" It was passed a child from "+_e(ae._owner.type)+"."),Fe(ae),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',He,Je),Fe(null)}}function mi(ae,je){{if(typeof ae!="object")return;if(de(ae))for(var He=0;He<ae.length;He++){var Je=ae[He];vt(Je)&&Zt(Je,je)}else if(vt(ae))ae._store&&(ae._store.validated=!0);else if(ae){var ht=y(ae);if(typeof ht=="function"&&ht!==ae.entries)for(var yt=ht.call(ae),st;!(st=yt.next()).done;)vt(st.value)&&Zt(st.value,je)}}}function Ji(ae){{var je=ae.type;if(je==null||typeof je=="string")return;var He;if(typeof je=="function")He=je.propTypes;else if(typeof je=="object"&&(je.$$typeof===c||je.$$typeof===g))He=je.propTypes;else return;if(He){var Je=_e(je);Y(He,ae.props,"prop",Je,ae)}else if(je.PropTypes!==void 0&&!Ye){Ye=!0;var ht=_e(je);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ht||"Unknown")}typeof je.getDefaultProps=="function"&&!je.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Xi(ae){{for(var je=Object.keys(ae.props),He=0;He<je.length;He++){var Je=je[He];if(Je!=="children"&&Je!=="key"){Fe(ae),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Je),Fe(null);break}}ae.ref!==null&&(Fe(ae),p("Invalid attribute `ref` supplied to `React.Fragment`."),Fe(null))}}var kr={};function Kn(ae,je,He,Je,ht,yt){{var st=te(ae);if(!st){var et="";(ae===void 0||typeof ae=="object"&&ae!==null&&Object.keys(ae).length===0)&&(et+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var kt=Fr();kt?et+=kt:et+=Yt();var Pt;ae===null?Pt="null":de(ae)?Pt="array":ae!==void 0&&ae.$$typeof===t?(Pt="<"+(_e(ae.type)||"Unknown")+" />",et=" Did you accidentally export a JSX literal instead of a component?"):Pt=typeof ae,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Pt,et)}var Ot=me(ae,je,He,ht,yt);if(Ot==null)return Ot;if(st){var mr=je.children;if(mr!==void 0)if(Je)if(de(mr)){for(var Xr=0;Xr<mr.length;Xr++)mi(mr[Xr],ae);Object.freeze&&Object.freeze(mr)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else mi(mr,ae)}if(L.call(je,"key")){var Pn=_e(ae),Wt=Object.keys(je).filter(function(sd){return sd!=="key"}),jo=Wt.length>0?"{key: someKey, "+Wt.join(": ..., ")+": ...}":"{key: someKey}";if(!kr[Pn+jo]){var od=Wt.length>0?"{"+Wt.join(": ..., ")+": ...}":"{}";p(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,jo,Pn,od,Pn),kr[Pn+jo]=!0}}return ae===i?Xi(Ot):Ji(Ot),Ot}}function yn(ae,je,He){return Kn(ae,je,He,!0)}function yi(ae,je,He){return Kn(ae,je,He,!1)}var gi=yi,Qi=yn;yo.Fragment=i,yo.jsx=gi,yo.jsxs=Qi}()),yo}var Sp;function X_(){return Sp||(Sp=1,Ge.env.NODE_ENV==="production"?rs.exports=Y_():rs.exports=J_()),rs.exports}var ns=X_();function xp(e){return e}function Q_(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function Z_(e,t){var r;return{state:{...e.state,...e.state.data!==void 0&&{data:t(e.state.data)}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status==="pending"&&{promise:(r=e.promise)==null?void 0:r.then(t).catch(i=>(Ge.env.NODE_ENV!=="production"&&console.error(`A query that was dehydrated as pending ended up rejecting. [${e.queryHash}]: ${i}; The error will be redacted in production builds`),Promise.reject(new Error("redacted"))))},...e.meta&&{meta:e.meta}}}function e$(e){return e.state.isPaused}function t$(e){return e.state.status==="success"}function r$(e,t={}){var f,c,d;const r=t.shouldDehydrateMutation??((f=e.getDefaultOptions().dehydrate)==null?void 0:f.shouldDehydrateMutation)??e$,i=e.getMutationCache().getAll().flatMap(l=>r(l)?[Q_(l)]:[]),a=t.shouldDehydrateQuery??((c=e.getDefaultOptions().dehydrate)==null?void 0:c.shouldDehydrateQuery)??t$,s=t.serializeData??((d=e.getDefaultOptions().dehydrate)==null?void 0:d.serializeData)??xp,u=e.getQueryCache().getAll().flatMap(l=>a(l)?[Z_(l,s)]:[]);return{mutations:i,queries:u}}function n$(e,t,r){var c,d;if(typeof t!="object"||t===null)return;const i=e.getMutationCache(),a=e.getQueryCache(),s=((c=r==null?void 0:r.defaultOptions)==null?void 0:c.deserializeData)??((d=e.getDefaultOptions().hydrate)==null?void 0:d.deserializeData)??xp,u=t.mutations||[],f=t.queries||[];u.forEach(({state:l,...g})=>{var $,w;i.build(e,{...($=e.getDefaultOptions().hydrate)==null?void 0:$.mutations,...(w=r==null?void 0:r.defaultOptions)==null?void 0:w.mutations,...g},l)}),f.forEach(({queryKey:l,state:g,queryHash:$,meta:w,promise:v})=>{var h,p;let x=a.get($);const y=g.data===void 0?g.data:s(g.data);if(x){if(x.state.dataUpdatedAt<g.dataUpdatedAt){const{fetchStatus:b,...P}=g;x.setState({...P,data:y})}}else x=a.build(e,{...(h=e.getDefaultOptions().hydrate)==null?void 0:h.queries,...(p=r==null?void 0:r.defaultOptions)==null?void 0:p.queries,queryKey:l,queryHash:$,meta:w},{...g,data:y,fetchStatus:"idle"});if(v){const b=Promise.resolve(v).then(s);x.fetch(void 0,{initialPromise:b})}})}var i$=["added","removed","updated"];function Ap(e){return i$.includes(e)}async function o$({queryClient:e,persister:t,maxAge:r=1e3*60*60*24,buster:i="",hydrateOptions:a}){try{const s=await t.restoreClient();if(s)if(s.timestamp){const u=Date.now()-s.timestamp>r,f=s.buster!==i;u||f?t.removeClient():n$(e,s.clientState,a)}else t.removeClient()}catch(s){Ge.env.NODE_ENV!=="production"&&(console.error(s),console.warn("Encountered an error attempting to restore client cache from persisted location. As a precaution, the persisted cache will be discarded.")),t.removeClient()}}async function Rp({queryClient:e,persister:t,buster:r="",dehydrateOptions:i}){const a={buster:r,timestamp:Date.now(),clientState:r$(e,i)};await t.persistClient(a)}function s$(e){const t=e.queryClient.getQueryCache().subscribe(i=>{Ap(i.type)&&Rp(e)}),r=e.queryClient.getMutationCache().subscribe(i=>{Ap(i.type)&&Rp(e)});return()=>{t(),r()}}var a$=({client:e,children:t,persistOptions:r,onSuccess:i,...a})=>{const[s,u]=ho.useState(!0),f=ho.useRef({persistOptions:r,onSuccess:i}),c=ho.useRef(!1);return ho.useEffect(()=>{f.current={persistOptions:r,onSuccess:i}}),ho.useEffect(()=>{const d={...f.current.persistOptions,queryClient:e};return c.current||(c.current=!0,o$(d).then(async()=>{var l,g;try{await((g=(l=f.current).onSuccess)==null?void 0:g.call(l))}finally{u(!1)}})),s?void 0:s$(d)},[e,s]),ns.jsx(ni.QueryClientProvider,{client:e,...a,children:ns.jsx(ni.IsRestoringProvider,{value:s,children:t})})};const u$={isAuthenticated:!1,isLoggedIn:!1,logout:()=>{},login:async(e,t,r)=>Promise.reject({username:e,password:t,rememberMe:r}),loginWithOpenIdConnect:e=>{throw new Error(`loginWithOpenIdConnect is not implemented. ${e}`)},setToken:async e=>Promise.reject({accessToken:e}),newAnonSession:async()=>Promise.reject(),baseApiUrl:"https://api.ordercloud.io/v1",clientId:"",allowAnonymous:!1,token:void 0,autoApplyPromotions:!1,xpSchemas:{},authLoading:!0,currencyDefaults:{}},Pp=Be.createContext(u$);function Yu(){}function f$(e,{interval:t=1e3,onError:r=Yu}={}){if(typeof e!="function")throw new Error("argument is not function.");let i=0,a=null,s=!1,u=!1;return async(...f)=>{if(a=f,!u){for(u=!0;s;)await new Promise(c=>setTimeout(c,t));for(;Date.now()<i;)await new Promise(c=>setTimeout(c,i-Date.now()));u=!1,s=!0;try{await e(...a)}catch(c){try{r(c)}catch{}}i=Date.now()+t,s=!1}}}var l$=({storage:e,key:t="REACT_QUERY_OFFLINE_CACHE",throttleTime:r=1e3,serialize:i=JSON.stringify,deserialize:a=JSON.parse,retry:s})=>{if(e){const u=async f=>{try{const c=await i(f);await e.setItem(t,c);return}catch(c){return c}};return{persistClient:f$(async f=>{let c=f,d=await u(c),l=0;for(;d&&c;)l++,c=await(s==null?void 0:s({persistedClient:c,error:d,errorCount:l})),c&&(d=await u(c))},{interval:r}),restoreClient:async()=>{const f=await e.getItem(t);if(f)return await a(f)},removeClient:()=>e.removeItem(t)}}return{persistClient:Yu,restoreClient:()=>Promise.resolve(void 0),removeClient:Yu}};class go extends Error{}go.prototype.name="InvalidTokenError";function c$(e){return decodeURIComponent(atob(e).replace(/(.)/g,(t,r)=>{let i=r.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i}))}function d$(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return c$(t)}catch{return atob(t)}}function Ju(e,t){if(typeof e!="string")throw new go("Invalid token specified: must be a string");t||(t={});const r=t.header===!0?0:1,i=e.split(".")[r];if(typeof i!="string")throw new go(`Invalid token specified: missing part #${r+1}`);let a;try{a=d$(i)}catch(s){throw new go(`Invalid token specified: invalid base64 for part #${r+1} (${s.message})`)}try{return JSON.parse(a)}catch(s){throw new go(`Invalid token specified: invalid json for part #${r+1} (${s.message})`)}}const p$=e=>Ju(e),Xu=e=>!!Ju(e).orderid,h$=e=>e?Ju(e).role:void 0,m$=(e,t)=>{const{status:r}=t;switch(r){case 401:case 403:return!1}return e<3},Op=(e,t)=>e.parameters&&e.parameters.filter(r=>r.in==="path").map(r=>r.name).includes(t),jn=(e,t)=>{let r=e==null?void 0:e.path;if(!r)return"";const i=t;return r.indexOf("{")>-1&&Object.entries(i).filter(([a])=>Op(e,a)).forEach(([a,s])=>{s&&(r=r.replace(`{${a}}`,s))}),r},is=e=>{if(e)return`${Object.entries(e).filter(([,t])=>typeof t=="object"?!!t.length||!!Object.values(t).length:!!t).map(([t,r])=>t==="filters"?Object.entries(r).filter(([i,a])=>i.length&&a.length).map(([i,a])=>`${i}=${encodeURIComponent(a)}`).join("&"):typeof r=="object"&&(t==="searchOn"||t==="sortBy")?`${t}=${r.map(encodeURIComponent).join(",")}`:typeof r=="object"?`${t}=${r.map(i=>encodeURIComponent(i)).join("|")}`:`${t}=${encodeURIComponent(r)}`).join("&")}`},y$=e=>e&&(e!=null&&e.parameters)?e.parameters.filter(r=>r.in==="path"&&r.required).map(r=>r.name):[],Pr=new ni.QueryClient({defaultOptions:{queries:{retry:m$}}}),g$=l$({storage:window.localStorage}),v$=globalThis||void 0||self;function Tp(e,t){return function(){return e.apply(t,arguments)}}const{toString:b$}=Object.prototype,{getPrototypeOf:Qu}=Object,{iterator:os,toStringTag:Ip}=Symbol,ss=(e=>t=>{const r=b$.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),Vr=e=>(e=e.toLowerCase(),t=>ss(t)===e),as=e=>t=>typeof t===e,{isArray:Pi}=Array,vo=as("undefined");function w$(e){return e!==null&&!vo(e)&&e.constructor!==null&&!vo(e.constructor)&&lr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Cp=Vr("ArrayBuffer");function _$(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Cp(e.buffer),t}const $$=as("string"),lr=as("function"),Fp=as("number"),us=e=>e!==null&&typeof e=="object",E$=e=>e===!0||e===!1,fs=e=>{if(ss(e)!=="object")return!1;const t=Qu(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ip in e)&&!(os in e)},S$=Vr("Date"),x$=Vr("File"),A$=Vr("Blob"),R$=Vr("FileList"),P$=e=>us(e)&&lr(e.pipe),O$=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||lr(e.append)&&((t=ss(e))==="formdata"||t==="object"&&lr(e.toString)&&e.toString()==="[object FormData]"))},T$=Vr("URLSearchParams"),[I$,C$,F$,k$]=["ReadableStream","Request","Response","Headers"].map(Vr),D$=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function bo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,a;if(typeof e!="object"&&(e=[e]),Pi(e))for(i=0,a=e.length;i<a;i++)t.call(null,e[i],i,e);else{const s=r?Object.getOwnPropertyNames(e):Object.keys(e),u=s.length;let f;for(i=0;i<u;i++)f=s[i],t.call(null,e[f],f,e)}}function kp(e,t){t=t.toLowerCase();const r=Object.keys(e);let i=r.length,a;for(;i-- >0;)if(a=r[i],t===a.toLowerCase())return a;return null}const oi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:v$,Dp=e=>!vo(e)&&e!==oi;function Zu(){const{caseless:e}=Dp(this)&&this||{},t={},r=(i,a)=>{const s=e&&kp(t,a)||a;fs(t[s])&&fs(i)?t[s]=Zu(t[s],i):fs(i)?t[s]=Zu({},i):Pi(i)?t[s]=i.slice():t[s]=i};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&bo(arguments[i],r);return t}const q$=(e,t,r,{allOwnKeys:i}={})=>(bo(t,(a,s)=>{r&&lr(a)?e[s]=Tp(a,r):e[s]=a},{allOwnKeys:i}),e),N$=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),j$=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},M$=(e,t,r,i)=>{let a,s,u;const f={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),s=a.length;s-- >0;)u=a[s],(!i||i(u,e,t))&&!f[u]&&(t[u]=e[u],f[u]=!0);e=r!==!1&&Qu(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},L$=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const i=e.indexOf(t,r);return i!==-1&&i===r},B$=e=>{if(!e)return null;if(Pi(e))return e;let t=e.length;if(!Fp(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},U$=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Qu(Uint8Array)),V$=(e,t)=>{const i=(e&&e[os]).call(e);let a;for(;(a=i.next())&&!a.done;){const s=a.value;t.call(e,s[0],s[1])}},H$=(e,t)=>{let r;const i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},W$=Vr("HTMLFormElement"),z$=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,a){return i.toUpperCase()+a}),qp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),K$=Vr("RegExp"),Np=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};bo(r,(a,s)=>{let u;(u=t(a,s,e))!==!1&&(i[s]=u||a)}),Object.defineProperties(e,i)},G$=e=>{Np(e,(t,r)=>{if(lr(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const i=e[r];if(lr(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},Y$=(e,t)=>{const r={},i=a=>{a.forEach(s=>{r[s]=!0})};return Pi(e)?i(e):i(String(e).split(t)),r},J$=()=>{},X$=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Q$(e){return!!(e&&lr(e.append)&&e[Ip]==="FormData"&&e[os])}const Z$=e=>{const t=new Array(10),r=(i,a)=>{if(us(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[a]=i;const s=Pi(i)?[]:{};return bo(i,(u,f)=>{const c=r(u,a+1);!vo(c)&&(s[f]=c)}),t[a]=void 0,s}}return i};return r(e,0)},e1=Vr("AsyncFunction"),t1=e=>e&&(us(e)||lr(e))&&lr(e.then)&&lr(e.catch),jp=((e,t)=>e?setImmediate:t?((r,i)=>(oi.addEventListener("message",({source:a,data:s})=>{a===oi&&s===r&&i.length&&i.shift()()},!1),a=>{i.push(a),oi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",lr(oi.postMessage)),r1=typeof queueMicrotask<"u"?queueMicrotask.bind(oi):typeof Ge<"u"&&Ge.nextTick||jp,Pe={isArray:Pi,isArrayBuffer:Cp,isBuffer:w$,isFormData:O$,isArrayBufferView:_$,isString:$$,isNumber:Fp,isBoolean:E$,isObject:us,isPlainObject:fs,isReadableStream:I$,isRequest:C$,isResponse:F$,isHeaders:k$,isUndefined:vo,isDate:S$,isFile:x$,isBlob:A$,isRegExp:K$,isFunction:lr,isStream:P$,isURLSearchParams:T$,isTypedArray:U$,isFileList:R$,forEach:bo,merge:Zu,extend:q$,trim:D$,stripBOM:N$,inherits:j$,toFlatObject:M$,kindOf:ss,kindOfTest:Vr,endsWith:L$,toArray:B$,forEachEntry:V$,matchAll:H$,isHTMLForm:W$,hasOwnProperty:qp,hasOwnProp:qp,reduceDescriptors:Np,freezeMethods:G$,toObjectSet:Y$,toCamelCase:z$,noop:J$,toFiniteNumber:X$,findKey:kp,global:oi,isContextDefined:Dp,isSpecCompliantForm:Q$,toJSONObject:Z$,isAsyncFn:e1,isThenable:t1,setImmediate:jp,asap:r1,isIterable:e=>e!=null&&lr(e[os])};var Mp={},ls={};ls.byteLength=o1,ls.toByteArray=a1,ls.fromByteArray=l1;for(var on=[],Or=[],n1=typeof Uint8Array<"u"?Uint8Array:Array,ef="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Oi=0,i1=ef.length;Oi<i1;++Oi)on[Oi]=ef[Oi],Or[ef.charCodeAt(Oi)]=Oi;Or[45]=62,Or[95]=63;function Lp(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var i=r===t?0:4-r%4;return[r,i]}function o1(e){var t=Lp(e),r=t[0],i=t[1];return(r+i)*3/4-i}function s1(e,t,r){return(t+r)*3/4-r}function a1(e){var t,r=Lp(e),i=r[0],a=r[1],s=new n1(s1(e,i,a)),u=0,f=a>0?i-4:i,c;for(c=0;c<f;c+=4)t=Or[e.charCodeAt(c)]<<18|Or[e.charCodeAt(c+1)]<<12|Or[e.charCodeAt(c+2)]<<6|Or[e.charCodeAt(c+3)],s[u++]=t>>16&255,s[u++]=t>>8&255,s[u++]=t&255;return a===2&&(t=Or[e.charCodeAt(c)]<<2|Or[e.charCodeAt(c+1)]>>4,s[u++]=t&255),a===1&&(t=Or[e.charCodeAt(c)]<<10|Or[e.charCodeAt(c+1)]<<4|Or[e.charCodeAt(c+2)]>>2,s[u++]=t>>8&255,s[u++]=t&255),s}function u1(e){return on[e>>18&63]+on[e>>12&63]+on[e>>6&63]+on[e&63]}function f1(e,t,r){for(var i,a=[],s=t;s<r;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),a.push(u1(i));return a.join("")}function l1(e){for(var t,r=e.length,i=r%3,a=[],s=16383,u=0,f=r-i;u<f;u+=s)a.push(f1(e,u,u+s>f?f:u+s));return i===1?(t=e[r-1],a.push(on[t>>2]+on[t<<4&63]+"==")):i===2&&(t=(e[r-2]<<8)+e[r-1],a.push(on[t>>10]+on[t>>4&63]+on[t<<2&63]+"=")),a.join("")}var tf={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */tf.read=function(e,t,r,i,a){var s,u,f=a*8-i-1,c=(1<<f)-1,d=c>>1,l=-7,g=r?a-1:0,$=r?-1:1,w=e[t+g];for(g+=$,s=w&(1<<-l)-1,w>>=-l,l+=f;l>0;s=s*256+e[t+g],g+=$,l-=8);for(u=s&(1<<-l)-1,s>>=-l,l+=i;l>0;u=u*256+e[t+g],g+=$,l-=8);if(s===0)s=1-d;else{if(s===c)return u?NaN:(w?-1:1)*(1/0);u=u+Math.pow(2,i),s=s-d}return(w?-1:1)*u*Math.pow(2,s-i)},tf.write=function(e,t,r,i,a,s){var u,f,c,d=s*8-a-1,l=(1<<d)-1,g=l>>1,$=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=i?0:s-1,v=i?1:-1,x=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,u=l):(u=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-u))<1&&(u--,c*=2),u+g>=1?t+=$/c:t+=$*Math.pow(2,1-g),t*c>=2&&(u++,c/=2),u+g>=l?(f=0,u=l):u+g>=1?(f=(t*c-1)*Math.pow(2,a),u=u+g):(f=t*Math.pow(2,g-1)*Math.pow(2,a),u=0));a>=8;e[r+w]=f&255,w+=v,f/=256,a-=8);for(u=u<<a|f,d+=a;d>0;e[r+w]=u&255,w+=v,u/=256,d-=8);e[r+w-v]|=x*128};/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/(function(e){const t=ls,r=tf,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=l,e.SlowBuffer=_,e.INSPECT_MAX_BYTES=50;const a=2147483647;e.kMaxLength=a;const{Uint8Array:s,ArrayBuffer:u,SharedArrayBuffer:f}=globalThis;l.TYPED_ARRAY_SUPPORT=c(),!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{const A=new s(1),E={foo:function(){return 42}};return Object.setPrototypeOf(E,s.prototype),Object.setPrototypeOf(A,E),A.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function d(A){if(A>a)throw new RangeError('The value "'+A+'" is invalid for option "size"');const E=new s(A);return Object.setPrototypeOf(E,l.prototype),E}function l(A,E,O){if(typeof A=="number"){if(typeof E=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(A)}return g(A,E,O)}l.poolSize=8192;function g(A,E,O){if(typeof A=="string")return x(A,E);if(u.isView(A))return h(A);if(A==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof A);if(ie(A,u)||A&&ie(A.buffer,u)||typeof f<"u"&&(ie(A,f)||A&&ie(A.buffer,f)))return p(A,E,O);if(typeof A=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const B=A.valueOf&&A.valueOf();if(B!=null&&B!==A)return l.from(B,E,O);const Q=b(A);if(Q)return Q;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof A[Symbol.toPrimitive]=="function")return l.from(A[Symbol.toPrimitive]("string"),E,O);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof A)}l.from=function(A,E,O){return g(A,E,O)},Object.setPrototypeOf(l.prototype,s.prototype),Object.setPrototypeOf(l,s);function $(A){if(typeof A!="number")throw new TypeError('"size" argument must be of type number');if(A<0)throw new RangeError('The value "'+A+'" is invalid for option "size"')}function w(A,E,O){return $(A),A<=0?d(A):E!==void 0?typeof O=="string"?d(A).fill(E,O):d(A).fill(E):d(A)}l.alloc=function(A,E,O){return w(A,E,O)};function v(A){return $(A),d(A<0?0:P(A)|0)}l.allocUnsafe=function(A){return v(A)},l.allocUnsafeSlow=function(A){return v(A)};function x(A,E){if((typeof E!="string"||E==="")&&(E="utf8"),!l.isEncoding(E))throw new TypeError("Unknown encoding: "+E);const O=I(A,E)|0;let B=d(O);const Q=B.write(A,E);return Q!==O&&(B=B.slice(0,Q)),B}function y(A){const E=A.length<0?0:P(A.length)|0,O=d(E);for(let B=0;B<E;B+=1)O[B]=A[B]&255;return O}function h(A){if(ie(A,s)){const E=new s(A);return p(E.buffer,E.byteOffset,E.byteLength)}return y(A)}function p(A,E,O){if(E<0||A.byteLength<E)throw new RangeError('"offset" is outside of buffer bounds');if(A.byteLength<E+(O||0))throw new RangeError('"length" is outside of buffer bounds');let B;return E===void 0&&O===void 0?B=new s(A):O===void 0?B=new s(A,E):B=new s(A,E,O),Object.setPrototypeOf(B,l.prototype),B}function b(A){if(l.isBuffer(A)){const E=P(A.length)|0,O=d(E);return O.length===0||A.copy(O,0,0,E),O}if(A.length!==void 0)return typeof A.length!="number"||be(A.length)?d(0):y(A);if(A.type==="Buffer"&&Array.isArray(A.data))return y(A.data)}function P(A){if(A>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return A|0}function _(A){return+A!=A&&(A=0),l.alloc(+A)}l.isBuffer=function(E){return E!=null&&E._isBuffer===!0&&E!==l.prototype},l.compare=function(E,O){if(ie(E,s)&&(E=l.from(E,E.offset,E.byteLength)),ie(O,s)&&(O=l.from(O,O.offset,O.byteLength)),!l.isBuffer(E)||!l.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(E===O)return 0;let B=E.length,Q=O.length;for(let j=0,W=Math.min(B,Q);j<W;++j)if(E[j]!==O[j]){B=E[j],Q=O[j];break}return B<Q?-1:Q<B?1:0},l.isEncoding=function(E){switch(String(E).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(E,O){if(!Array.isArray(E))throw new TypeError('"list" argument must be an Array of Buffers');if(E.length===0)return l.alloc(0);let B;if(O===void 0)for(O=0,B=0;B<E.length;++B)O+=E[B].length;const Q=l.allocUnsafe(O);let j=0;for(B=0;B<E.length;++B){let W=E[B];if(ie(W,s))j+W.length>Q.length?(l.isBuffer(W)||(W=l.from(W)),W.copy(Q,j)):s.prototype.set.call(Q,W,j);else if(l.isBuffer(W))W.copy(Q,j);else throw new TypeError('"list" argument must be an Array of Buffers');j+=W.length}return Q};function I(A,E){if(l.isBuffer(A))return A.length;if(u.isView(A)||ie(A,u))return A.byteLength;if(typeof A!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof A);const O=A.length,B=arguments.length>2&&arguments[2]===!0;if(!B&&O===0)return 0;let Q=!1;for(;;)switch(E){case"ascii":case"latin1":case"binary":return O;case"utf8":case"utf-8":return Y(A).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O*2;case"hex":return O>>>1;case"base64":return Se(A).length;default:if(Q)return B?-1:Y(A).length;E=(""+E).toLowerCase(),Q=!0}}l.byteLength=I;function C(A,E,O){let B=!1;if((E===void 0||E<0)&&(E=0),E>this.length||((O===void 0||O>this.length)&&(O=this.length),O<=0)||(O>>>=0,E>>>=0,O<=E))return"";for(A||(A="utf8");;)switch(A){case"hex":return K(this,E,O);case"utf8":case"utf-8":return $e(this,E,O);case"ascii":return ue(this,E,O);case"latin1":case"binary":return ee(this,E,O);case"base64":return Ue(this,E,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,E,O);default:if(B)throw new TypeError("Unknown encoding: "+A);A=(A+"").toLowerCase(),B=!0}}l.prototype._isBuffer=!0;function U(A,E,O){const B=A[E];A[E]=A[O],A[O]=B}l.prototype.swap16=function(){const E=this.length;if(E%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;O<E;O+=2)U(this,O,O+1);return this},l.prototype.swap32=function(){const E=this.length;if(E%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let O=0;O<E;O+=4)U(this,O,O+3),U(this,O+1,O+2);return this},l.prototype.swap64=function(){const E=this.length;if(E%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let O=0;O<E;O+=8)U(this,O,O+7),U(this,O+1,O+6),U(this,O+2,O+5),U(this,O+3,O+4);return this},l.prototype.toString=function(){const E=this.length;return E===0?"":arguments.length===0?$e(this,0,E):C.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(E){if(!l.isBuffer(E))throw new TypeError("Argument must be a Buffer");return this===E?!0:l.compare(this,E)===0},l.prototype.inspect=function(){let E="";const O=e.INSPECT_MAX_BYTES;return E=this.toString("hex",0,O).replace(/(.{2})/g,"$1 ").trim(),this.length>O&&(E+=" ... "),"<Buffer "+E+">"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(E,O,B,Q,j){if(ie(E,s)&&(E=l.from(E,E.offset,E.byteLength)),!l.isBuffer(E))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof E);if(O===void 0&&(O=0),B===void 0&&(B=E?E.length:0),Q===void 0&&(Q=0),j===void 0&&(j=this.length),O<0||B>E.length||Q<0||j>this.length)throw new RangeError("out of range index");if(Q>=j&&O>=B)return 0;if(Q>=j)return-1;if(O>=B)return 1;if(O>>>=0,B>>>=0,Q>>>=0,j>>>=0,this===E)return 0;let W=j-Q,me=B-O;const Te=Math.min(W,me),Ne=this.slice(Q,j),Fe=E.slice(O,B);for(let Ye=0;Ye<Te;++Ye)if(Ne[Ye]!==Fe[Ye]){W=Ne[Ye],me=Fe[Ye];break}return W<me?-1:me<W?1:0};function J(A,E,O,B,Q){if(A.length===0)return-1;if(typeof O=="string"?(B=O,O=0):O>2147483647?O=2147483647:O<-2147483648&&(O=-2147483648),O=+O,be(O)&&(O=Q?0:A.length-1),O<0&&(O=A.length+O),O>=A.length){if(Q)return-1;O=A.length-1}else if(O<0)if(Q)O=0;else return-1;if(typeof E=="string"&&(E=l.from(E,B)),l.isBuffer(E))return E.length===0?-1:te(A,E,O,B,Q);if(typeof E=="number")return E=E&255,typeof s.prototype.indexOf=="function"?Q?s.prototype.indexOf.call(A,E,O):s.prototype.lastIndexOf.call(A,E,O):te(A,[E],O,B,Q);throw new TypeError("val must be string, number or Buffer")}function te(A,E,O,B,Q){let j=1,W=A.length,me=E.length;if(B!==void 0&&(B=String(B).toLowerCase(),B==="ucs2"||B==="ucs-2"||B==="utf16le"||B==="utf-16le")){if(A.length<2||E.length<2)return-1;j=2,W/=2,me/=2,O/=2}function Te(Fe,Ye){return j===1?Fe[Ye]:Fe.readUInt16BE(Ye*j)}let Ne;if(Q){let Fe=-1;for(Ne=O;Ne<W;Ne++)if(Te(A,Ne)===Te(E,Fe===-1?0:Ne-Fe)){if(Fe===-1&&(Fe=Ne),Ne-Fe+1===me)return Fe*j}else Fe!==-1&&(Ne-=Ne-Fe),Fe=-1}else for(O+me>W&&(O=W-me),Ne=O;Ne>=0;Ne--){let Fe=!0;for(let Ye=0;Ye<me;Ye++)if(Te(A,Ne+Ye)!==Te(E,Ye)){Fe=!1;break}if(Fe)return Ne}return-1}l.prototype.includes=function(E,O,B){return this.indexOf(E,O,B)!==-1},l.prototype.indexOf=function(E,O,B){return J(this,E,O,B,!0)},l.prototype.lastIndexOf=function(E,O,B){return J(this,E,O,B,!1)};function pe(A,E,O,B){O=Number(O)||0;const Q=A.length-O;B?(B=Number(B),B>Q&&(B=Q)):B=Q;const j=E.length;B>j/2&&(B=j/2);let W;for(W=0;W<B;++W){const me=parseInt(E.substr(W*2,2),16);if(be(me))return W;A[O+W]=me}return W}function se(A,E,O,B){return S(Y(E,A.length-O),A,O,B)}function _e(A,E,O,B){return S(fe(E),A,O,B)}function ge(A,E,O,B){return S(Se(E),A,O,B)}function Ce(A,E,O,B){return S(de(E,A.length-O),A,O,B)}l.prototype.write=function(E,O,B,Q){if(O===void 0)Q="utf8",B=this.length,O=0;else if(B===void 0&&typeof O=="string")Q=O,B=this.length,O=0;else if(isFinite(O))O=O>>>0,isFinite(B)?(B=B>>>0,Q===void 0&&(Q="utf8")):(Q=B,B=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const j=this.length-O;if((B===void 0||B>j)&&(B=j),E.length>0&&(B<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");Q||(Q="utf8");let W=!1;for(;;)switch(Q){case"hex":return pe(this,E,O,B);case"utf8":case"utf-8":return se(this,E,O,B);case"ascii":case"latin1":case"binary":return _e(this,E,O,B);case"base64":return ge(this,E,O,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ce(this,E,O,B);default:if(W)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),W=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ue(A,E,O){return E===0&&O===A.length?t.fromByteArray(A):t.fromByteArray(A.slice(E,O))}function $e(A,E,O){O=Math.min(A.length,O);const B=[];let Q=E;for(;Q<O;){const j=A[Q];let W=null,me=j>239?4:j>223?3:j>191?2:1;if(Q+me<=O){let Te,Ne,Fe,Ye;switch(me){case 1:j<128&&(W=j);break;case 2:Te=A[Q+1],(Te&192)===128&&(Ye=(j&31)<<6|Te&63,Ye>127&&(W=Ye));break;case 3:Te=A[Q+1],Ne=A[Q+2],(Te&192)===128&&(Ne&192)===128&&(Ye=(j&15)<<12|(Te&63)<<6|Ne&63,Ye>2047&&(Ye<55296||Ye>57343)&&(W=Ye));break;case 4:Te=A[Q+1],Ne=A[Q+2],Fe=A[Q+3],(Te&192)===128&&(Ne&192)===128&&(Fe&192)===128&&(Ye=(j&15)<<18|(Te&63)<<12|(Ne&63)<<6|Fe&63,Ye>65535&&Ye<1114112&&(W=Ye))}}W===null?(W=65533,me=1):W>65535&&(W-=65536,B.push(W>>>10&1023|55296),W=56320|W&1023),B.push(W),Q+=me}return Le(B)}const we=4096;function Le(A){const E=A.length;if(E<=we)return String.fromCharCode.apply(String,A);let O="",B=0;for(;B<E;)O+=String.fromCharCode.apply(String,A.slice(B,B+=we));return O}function ue(A,E,O){let B="";O=Math.min(A.length,O);for(let Q=E;Q<O;++Q)B+=String.fromCharCode(A[Q]&127);return B}function ee(A,E,O){let B="";O=Math.min(A.length,O);for(let Q=E;Q<O;++Q)B+=String.fromCharCode(A[Q]);return B}function K(A,E,O){const B=A.length;(!E||E<0)&&(E=0),(!O||O<0||O>B)&&(O=B);let Q="";for(let j=E;j<O;++j)Q+=Ae[A[j]];return Q}function V(A,E,O){const B=A.slice(E,O);let Q="";for(let j=0;j<B.length-1;j+=2)Q+=String.fromCharCode(B[j]+B[j+1]*256);return Q}l.prototype.slice=function(E,O){const B=this.length;E=~~E,O=O===void 0?B:~~O,E<0?(E+=B,E<0&&(E=0)):E>B&&(E=B),O<0?(O+=B,O<0&&(O=0)):O>B&&(O=B),O<E&&(O=E);const Q=this.subarray(E,O);return Object.setPrototypeOf(Q,l.prototype),Q};function q(A,E,O){if(A%1!==0||A<0)throw new RangeError("offset is not uint");if(A+E>O)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(E,O,B){E=E>>>0,O=O>>>0,B||q(E,O,this.length);let Q=this[E],j=1,W=0;for(;++W<O&&(j*=256);)Q+=this[E+W]*j;return Q},l.prototype.readUintBE=l.prototype.readUIntBE=function(E,O,B){E=E>>>0,O=O>>>0,B||q(E,O,this.length);let Q=this[E+--O],j=1;for(;O>0&&(j*=256);)Q+=this[E+--O]*j;return Q},l.prototype.readUint8=l.prototype.readUInt8=function(E,O){return E=E>>>0,O||q(E,1,this.length),this[E]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(E,O){return E=E>>>0,O||q(E,2,this.length),this[E]|this[E+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(E,O){return E=E>>>0,O||q(E,2,this.length),this[E]<<8|this[E+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(E,O){return E=E>>>0,O||q(E,4,this.length),(this[E]|this[E+1]<<8|this[E+2]<<16)+this[E+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(E,O){return E=E>>>0,O||q(E,4,this.length),this[E]*16777216+(this[E+1]<<16|this[E+2]<<8|this[E+3])},l.prototype.readBigUInt64LE=xe(function(E){E=E>>>0,L(E,"offset");const O=this[E],B=this[E+7];(O===void 0||B===void 0)&&F(E,this.length-8);const Q=O+this[++E]*2**8+this[++E]*2**16+this[++E]*2**24,j=this[++E]+this[++E]*2**8+this[++E]*2**16+B*2**24;return BigInt(Q)+(BigInt(j)<<BigInt(32))}),l.prototype.readBigUInt64BE=xe(function(E){E=E>>>0,L(E,"offset");const O=this[E],B=this[E+7];(O===void 0||B===void 0)&&F(E,this.length-8);const Q=O*2**24+this[++E]*2**16+this[++E]*2**8+this[++E],j=this[++E]*2**24+this[++E]*2**16+this[++E]*2**8+B;return(BigInt(Q)<<BigInt(32))+BigInt(j)}),l.prototype.readIntLE=function(E,O,B){E=E>>>0,O=O>>>0,B||q(E,O,this.length);let Q=this[E],j=1,W=0;for(;++W<O&&(j*=256);)Q+=this[E+W]*j;return j*=128,Q>=j&&(Q-=Math.pow(2,8*O)),Q},l.prototype.readIntBE=function(E,O,B){E=E>>>0,O=O>>>0,B||q(E,O,this.length);let Q=O,j=1,W=this[E+--Q];for(;Q>0&&(j*=256);)W+=this[E+--Q]*j;return j*=128,W>=j&&(W-=Math.pow(2,8*O)),W},l.prototype.readInt8=function(E,O){return E=E>>>0,O||q(E,1,this.length),this[E]&128?(255-this[E]+1)*-1:this[E]},l.prototype.readInt16LE=function(E,O){E=E>>>0,O||q(E,2,this.length);const B=this[E]|this[E+1]<<8;return B&32768?B|4294901760:B},l.prototype.readInt16BE=function(E,O){E=E>>>0,O||q(E,2,this.length);const B=this[E+1]|this[E]<<8;return B&32768?B|4294901760:B},l.prototype.readInt32LE=function(E,O){return E=E>>>0,O||q(E,4,this.length),this[E]|this[E+1]<<8|this[E+2]<<16|this[E+3]<<24},l.prototype.readInt32BE=function(E,O){return E=E>>>0,O||q(E,4,this.length),this[E]<<24|this[E+1]<<16|this[E+2]<<8|this[E+3]},l.prototype.readBigInt64LE=xe(function(E){E=E>>>0,L(E,"offset");const O=this[E],B=this[E+7];(O===void 0||B===void 0)&&F(E,this.length-8);const Q=this[E+4]+this[E+5]*2**8+this[E+6]*2**16+(B<<24);return(BigInt(Q)<<BigInt(32))+BigInt(O+this[++E]*2**8+this[++E]*2**16+this[++E]*2**24)}),l.prototype.readBigInt64BE=xe(function(E){E=E>>>0,L(E,"offset");const O=this[E],B=this[E+7];(O===void 0||B===void 0)&&F(E,this.length-8);const Q=(O<<24)+this[++E]*2**16+this[++E]*2**8+this[++E];return(BigInt(Q)<<BigInt(32))+BigInt(this[++E]*2**24+this[++E]*2**16+this[++E]*2**8+B)}),l.prototype.readFloatLE=function(E,O){return E=E>>>0,O||q(E,4,this.length),r.read(this,E,!0,23,4)},l.prototype.readFloatBE=function(E,O){return E=E>>>0,O||q(E,4,this.length),r.read(this,E,!1,23,4)},l.prototype.readDoubleLE=function(E,O){return E=E>>>0,O||q(E,8,this.length),r.read(this,E,!0,52,8)},l.prototype.readDoubleBE=function(E,O){return E=E>>>0,O||q(E,8,this.length),r.read(this,E,!1,52,8)};function G(A,E,O,B,Q,j){if(!l.isBuffer(A))throw new TypeError('"buffer" argument must be a Buffer instance');if(E>Q||E<j)throw new RangeError('"value" argument is out of bounds');if(O+B>A.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(E,O,B,Q){if(E=+E,O=O>>>0,B=B>>>0,!Q){const me=Math.pow(2,8*B)-1;G(this,E,O,B,me,0)}let j=1,W=0;for(this[O]=E&255;++W<B&&(j*=256);)this[O+W]=E/j&255;return O+B},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(E,O,B,Q){if(E=+E,O=O>>>0,B=B>>>0,!Q){const me=Math.pow(2,8*B)-1;G(this,E,O,B,me,0)}let j=B-1,W=1;for(this[O+j]=E&255;--j>=0&&(W*=256);)this[O+j]=E/W&255;return O+B},l.prototype.writeUint8=l.prototype.writeUInt8=function(E,O,B){return E=+E,O=O>>>0,B||G(this,E,O,1,255,0),this[O]=E&255,O+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(E,O,B){return E=+E,O=O>>>0,B||G(this,E,O,2,65535,0),this[O]=E&255,this[O+1]=E>>>8,O+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(E,O,B){return E=+E,O=O>>>0,B||G(this,E,O,2,65535,0),this[O]=E>>>8,this[O+1]=E&255,O+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(E,O,B){return E=+E,O=O>>>0,B||G(this,E,O,4,4294967295,0),this[O+3]=E>>>24,this[O+2]=E>>>16,this[O+1]=E>>>8,this[O]=E&255,O+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(E,O,B){return E=+E,O=O>>>0,B||G(this,E,O,4,4294967295,0),this[O]=E>>>24,this[O+1]=E>>>1