hyperliquid
Version:
SDK for Hyperliquid API
6 lines • 511 kB
JavaScript
"use strict";var HyperliquidSDK=(()=>{var Vl=Object.defineProperty;var ty=Object.getOwnPropertyDescriptor;var ry=Object.getOwnPropertyNames;var ny=Object.prototype.hasOwnProperty;var mp=n=>{throw TypeError(n)};var sy=(n,e,t)=>e in n?Vl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Wl=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var iy=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Kl=(n,e)=>{for(var t in e)Vl(n,t,{get:e[t],enumerable:!0})},oy=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ry(e))!ny.call(n,s)&&s!==t&&Vl(n,s,{get:()=>e[s],enumerable:!(r=ty(e,s))||r.enumerable});return n};var ay=n=>oy(Vl({},"__esModule",{value:!0}),n);var h=(n,e,t)=>sy(n,typeof e!="symbol"?e+"":e,t),dd=(n,e,t)=>e.has(n)||mp("Cannot "+t);var f=(n,e,t)=>(dd(n,e,"read from private field"),t?t.call(n):e.get(n)),w=(n,e,t)=>e.has(n)?mp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),p=(n,e,t,r)=>(dd(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),v=(n,e,t)=>(dd(n,e,"access private method"),t);var tn=(n,e,t,r)=>({set _(s){p(n,e,s,t)},get _(){return f(n,e,r)}});var lp=iy((bB,$b)=>{"use strict";$b.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}});var k3={};Kl(k3,{Hyperliquid:()=>fc,utils:()=>I3});var xo={PRODUCTION:"https://api.hyperliquid.xyz",TESTNET:"https://api.hyperliquid-testnet.xyz"},hd={PRODUCTION:"wss://api.hyperliquid.xyz/ws",TESTNET:"wss://api.hyperliquid-testnet.xyz/ws"},ne={ARBITRUM_MAINNET:"0xa4b1",ARBITRUM_TESTNET:"0x66eee"},go={INFO:"/info",EXCHANGE:"/exchange"};var xp="PLACEHOLDER";var Jl=class{constructor(e,t,r){this.httpApi=e;this.symbolConversion=t;h(this,"parent");this.parent=r}async getAllMids(e=!1){let t=await this.httpApi.makeRequest({type:"allMids"});if(e)return t;{let r={};for(let[s,i]of Object.entries(t)){let o=await this.symbolConversion.convertSymbol(s),a=parseFloat(i);r[o]=a}return r}}async getUserOpenOrders(e,t=!1){await this.parent.ensureInitialized();let r=await this.httpApi.makeRequest({type:"openOrders",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getFrontendOpenOrders(e,t=!1){let r=await this.httpApi.makeRequest({type:"frontendOpenOrders",user:e},20);return t?r:await this.symbolConversion.convertResponse(r)}async getUserFills(e,t=!1){let r=await this.httpApi.makeRequest({type:"userFills",user:e},20);return t?r:await this.symbolConversion.convertResponse(r)}async getUserFillsByTime(e,t,r,s=!1){let i={user:e,startTime:Math.round(t),type:"userFillsByTime"};r&&(i.endTime=Math.round(r));let o=await this.httpApi.makeRequest(i,20);return s?o:await this.symbolConversion.convertResponse(o)}async getUserRateLimit(e,t=!1){let r=await this.httpApi.makeRequest({type:"userRateLimit",user:e},20);return t?r:await this.symbolConversion.convertResponse(r)}async getOrderStatus(e,t,r=!1){let s=await this.httpApi.makeRequest({type:"orderStatus",user:e,oid:t});return r?s:await this.symbolConversion.convertResponse(s)}async getL2Book(e,t=!1,r=5,s){let i=await this.httpApi.makeRequest({type:"l2Book",coin:await this.symbolConversion.convertSymbol(e,"reverse"),nSigFigs:r,mantissa:s});return t?i:await this.symbolConversion.convertResponse(i)}async getCandleSnapshot(e,t,r,s,i=!1){let o=await this.httpApi.makeRequest({type:"candleSnapshot",req:{coin:await this.symbolConversion.convertSymbol(e,"reverse"),interval:t,startTime:r,endTime:s}});return i?o:await this.symbolConversion.convertResponse(o,["s"])}async getMaxBuilderFee(e,t,r=!1){let s=await this.httpApi.makeRequest({type:"maxBuilderFee",user:e,builder:t});return r?s:this.symbolConversion.convertToNumber(s)}async getHistoricalOrders(e,t=!1){let r=await this.httpApi.makeRequest({type:"historicalOrders",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getUserTwapSliceFills(e,t=!1){let r=await this.httpApi.makeRequest({type:"userTwapSliceFills",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getSubAccounts(e,t=!1){let r=await this.httpApi.makeRequest({type:"subAccounts",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getVaultDetails(e,t,r=!1){let s={type:"vaultDetails",vaultAddress:e};t&&(s.user=t);let i=await this.httpApi.makeRequest(s);return r?i:await this.symbolConversion.convertResponse(i)}async getUserVaultEquities(e,t=!1){let r=await this.httpApi.makeRequest({type:"userVaultEquities",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getUserRole(e,t=!1){let r=await this.httpApi.makeRequest({type:"userRole",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getDelegations(e,t=!1){let r=await this.httpApi.makeRequest({type:"delegations",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getDelegatorSummary(e,t=!1){let r=await this.httpApi.makeRequest({type:"delegatorSummary",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getDelegatorHistory(e,t=!1){let r=await this.httpApi.makeRequest({type:"delegatorHistory",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getDelegatorRewards(e,t=!1){let r=await this.httpApi.makeRequest({type:"delegatorRewards",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async validatorSummaries(e=!1){let t=await this.httpApi.makeRequest({type:"validatorSummaries"});return e?t:await this.symbolConversion.convertResponse(t)}async vaultSummaries(e=!1){let t=await this.httpApi.makeRequest({type:"vaultSummaries"});return e?t:await this.symbolConversion.convertResponse(t)}async userFees(e,t=!1){let r=await this.httpApi.makeRequest({type:"userFees",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async portfolio(e,t=!1){let r=await this.httpApi.makeRequest({type:"portfolio",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async preTransferCheck(e,t,r=!1){let s=await this.httpApi.makeRequest({type:"preTransferCheck",user:e,source:t});return r?s:await this.symbolConversion.convertResponse(s)}async referral(e,t=!1){let r=await this.httpApi.makeRequest({type:"referral",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async extraAgents(e,t=!1){let r=await this.httpApi.makeRequest({type:"extraAgents",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async isVip(e,t=!1){let r=await this.httpApi.makeRequest({type:"isVip",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async legalCheck(e,t=!1){let r=await this.httpApi.makeRequest({type:"legalCheck",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async userTwapSliceFillsByTime(e,t,r,s,i=!1){let o={type:"userTwapSliceFillsByTime",user:e,startTime:t};r!==void 0&&(o.endTime=r),s!==void 0&&(o.aggregateByTime=s);let a=await this.httpApi.makeRequest(o);return i?a:await this.symbolConversion.convertResponse(a)}async twapHistory(e,t=!1){let r=await this.httpApi.makeRequest({type:"twapHistory",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async userToMultiSigSigners(e,t=!1){let r=await this.httpApi.makeRequest({type:"userToMultiSigSigners",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getBuilderFeeApproval(e,t,r=!1){let s=await this.httpApi.makeRequest({type:"builderFeeApproval",user:e,builderAddress:t});return r?s:await this.symbolConversion.convertResponse(s)}async getUserOrderHistory(e,t,r,s=!1){let i={type:"userOrderHistory",user:e,startTime:Math.round(t)};r!==void 0&&(i.endTime=Math.round(r));let o=await this.httpApi.makeRequest(i,20);return s?o:await this.symbolConversion.convertResponse(o)}};var Ql=class{constructor(e,t){h(this,"httpApi");h(this,"symbolConversion");this.httpApi=e,this.symbolConversion=t}async getSpotMeta(e=!1){let t=await this.httpApi.makeRequest({type:"spotMeta"});return e?t:await this.symbolConversion.convertResponse(t,["name","coin","symbol"],"SPOT")}async getSpotClearinghouseState(e,t=!1){let r=await this.httpApi.makeRequest({type:"spotClearinghouseState",user:e});return t?r:await this.symbolConversion.convertResponse(r,["name","coin","symbol"],"SPOT")}async getSpotMetaAndAssetCtxs(e=!1){let t=await this.httpApi.makeRequest({type:"spotMetaAndAssetCtxs"});return e?t:await this.symbolConversion.convertResponse(t)}async getTokenDetails(e,t=!1){let r=await this.httpApi.makeRequest({type:"tokenDetails",tokenId:e},20);return t?r:await this.symbolConversion.convertResponse(r)}async getSpotDeployState(e,t=!1){let r=await this.httpApi.makeRequest({type:"spotDeployState",user:e},20);return t?r:await this.symbolConversion.convertResponse(r)}};var jl=class{constructor(e,t,r){h(this,"httpApi");h(this,"symbolConversion");h(this,"parent");this.httpApi=e,this.symbolConversion=t,this.parent=r}async getMeta(e=!1){let t=await this.httpApi.makeRequest({type:"meta"});return e?t:await this.symbolConversion.convertResponse(t,["name","coin","symbol"],"PERP")}async getMetaAndAssetCtxs(e=!1){let t=await this.httpApi.makeRequest({type:"metaAndAssetCtxs"});return e?t:await this.symbolConversion.convertResponse(t,["name","coin","symbol"],"PERP")}async getClearinghouseState(e,t=!1){let r=await this.httpApi.makeRequest({type:"clearinghouseState",user:e});return t?r:await this.symbolConversion.convertResponse(r)}async getUserFunding(e,t,r,s=!1){let i=await this.httpApi.makeRequest({type:"userFunding",user:e,startTime:t,endTime:r},20);return s?i:await this.symbolConversion.convertResponse(i)}async getUserNonFundingLedgerUpdates(e,t,r,s=!1){let i=await this.httpApi.makeRequest({type:"userNonFundingLedgerUpdates",user:e,startTime:t,endTime:r},20);return s?i:await this.symbolConversion.convertResponse(i)}async getFundingHistory(e,t,r,s=!1){await this.parent.ensureInitialized();let i=await this.httpApi.makeRequest({type:"fundingHistory",coin:await this.symbolConversion.convertSymbol(e,"reverse"),startTime:t,endTime:r},20);return s?i:await this.symbolConversion.convertResponse(i)}async getPredictedFundings(e=!1){let t=await this.httpApi.makeRequest({type:"predictedFundings"},20);return e?t:await this.symbolConversion.convertResponse(t)}async getPerpsAtOpenInterestCap(e=!1){let t=await this.httpApi.makeRequest({type:"perpsAtOpenInterestCap"});return e?t:await Promise.all(t.map(s=>this.symbolConversion.convertSymbol(s,"","PERP")))}async getPerpDexLimits(e,t=!1){let r=await this.httpApi.makeRequest({type:"perpDexLimits",dex:e});if(t)return r;let s=r,i={totalOiCap:s.totalOiCap,oiSzCapPerPerp:s.oiSzCapPerPerp,maxTransferNtl:s.maxTransferNtl,coinToOiCap:s.coinToOiCap};return i.coinToOiCap&&(i.coinToOiCap=await Promise.all(i.coinToOiCap.map(async([o,a])=>[await this.symbolConversion.convertSymbol(o,"","PERP"),a]))),i}};function hc(n,e){return function(){return n.apply(e,arguments)}}var{toString:cy}=Object.prototype,{getPrototypeOf:md}=Object,{iterator:Zl,toStringTag:bp}=Symbol,Xl=(n=>e=>{let t=cy.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Zt=n=>(n=n.toLowerCase(),e=>Xl(e)===n),$l=n=>e=>typeof e===n,{isArray:bo}=Array,pc=$l("undefined");function mc(n){return n!==null&&!pc(n)&&n.constructor!==null&&!pc(n.constructor)&&pt(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}var yp=Zt("ArrayBuffer");function ly(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&yp(n.buffer),e}var uy=$l("string"),pt=$l("function"),wp=$l("number"),xc=n=>n!==null&&typeof n=="object",fy=n=>n===!0||n===!1,Yl=n=>{if(Xl(n)!=="object")return!1;let e=md(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(bp in n)&&!(Zl in n)},dy=n=>{if(!xc(n)||mc(n))return!1;try{return Object.keys(n).length===0&&Object.getPrototypeOf(n)===Object.prototype}catch{return!1}},hy=Zt("Date"),py=Zt("File"),my=Zt("Blob"),xy=Zt("FileList"),gy=n=>xc(n)&&pt(n.pipe),by=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||pt(n.append)&&((e=Xl(n))==="formdata"||e==="object"&&pt(n.toString)&&n.toString()==="[object FormData]"))},yy=Zt("URLSearchParams"),[wy,Ay,Ey,Sy]=["ReadableStream","Request","Response","Headers"].map(Zt),Ty=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function gc(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,s;if(typeof n!="object"&&(n=[n]),bo(n))for(r=0,s=n.length;r<s;r++)e.call(null,n[r],r,n);else{if(mc(n))return;let i=t?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length,a;for(r=0;r<o;r++)a=i[r],e.call(null,n[a],a,n)}}function Ap(n,e){if(mc(n))return null;e=e.toLowerCase();let t=Object.keys(n),r=t.length,s;for(;r-- >0;)if(s=t[r],e===s.toLowerCase())return s;return null}var Gs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ep=n=>!pc(n)&&n!==Gs;function pd(){let{caseless:n}=Ep(this)&&this||{},e={},t=(r,s)=>{let i=n&&Ap(e,s)||s;Yl(e[i])&&Yl(r)?e[i]=pd(e[i],r):Yl(r)?e[i]=pd({},r):bo(r)?e[i]=r.slice():e[i]=r};for(let r=0,s=arguments.length;r<s;r++)arguments[r]&&gc(arguments[r],t);return e}var Ry=(n,e,t,{allOwnKeys:r}={})=>(gc(e,(s,i)=>{t&&pt(s)?n[i]=hc(s,t):n[i]=s},{allOwnKeys:r}),n),vy=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),Py=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},Ny=(n,e,t,r)=>{let s,i,o,a={};if(e=e||{},n==null)return e;do{for(s=Object.getOwnPropertyNames(n),i=s.length;i-- >0;)o=s[i],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&md(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},Cy=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;let r=n.indexOf(e,t);return r!==-1&&r===t},Iy=n=>{if(!n)return null;if(bo(n))return n;let e=n.length;if(!wp(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},ky=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&md(Uint8Array)),Oy=(n,e)=>{let r=(n&&n[Zl]).call(n),s;for(;(s=r.next())&&!s.done;){let i=s.value;e.call(n,i[0],i[1])}},By=(n,e)=>{let t,r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},Uy=Zt("HTMLFormElement"),Dy=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,s){return r.toUpperCase()+s}),gp=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),Fy=Zt("RegExp"),Sp=(n,e)=>{let t=Object.getOwnPropertyDescriptors(n),r={};gc(t,(s,i)=>{let o;(o=e(s,i,n))!==!1&&(r[i]=o||s)}),Object.defineProperties(n,r)},Ly=n=>{Sp(n,(e,t)=>{if(pt(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let r=n[t];if(pt(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},My=(n,e)=>{let t={},r=s=>{s.forEach(i=>{t[i]=!0})};return bo(n)?r(n):r(String(n).split(e)),t},_y=()=>{},Hy=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function zy(n){return!!(n&&pt(n.append)&&n[bp]==="FormData"&&n[Zl])}var Gy=n=>{let e=new Array(10),t=(r,s)=>{if(xc(r)){if(e.indexOf(r)>=0)return;if(mc(r))return r;if(!("toJSON"in r)){e[s]=r;let i=bo(r)?[]:{};return gc(r,(o,a)=>{let c=t(o,s+1);!pc(c)&&(i[a]=c)}),e[s]=void 0,i}}return r};return t(n,0)},Vy=Zt("AsyncFunction"),Wy=n=>n&&(xc(n)||pt(n))&&pt(n.then)&&pt(n.catch),Tp=((n,e)=>n?setImmediate:e?((t,r)=>(Gs.addEventListener("message",({source:s,data:i})=>{s===Gs&&i===t&&r.length&&r.shift()()},!1),s=>{r.push(s),Gs.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",pt(Gs.postMessage)),Ky=typeof queueMicrotask<"u"?queueMicrotask.bind(Gs):typeof process<"u"&&process.nextTick||Tp,qy=n=>n!=null&&pt(n[Zl]),T={isArray:bo,isArrayBuffer:yp,isBuffer:mc,isFormData:by,isArrayBufferView:ly,isString:uy,isNumber:wp,isBoolean:fy,isObject:xc,isPlainObject:Yl,isEmptyObject:dy,isReadableStream:wy,isRequest:Ay,isResponse:Ey,isHeaders:Sy,isUndefined:pc,isDate:hy,isFile:py,isBlob:my,isRegExp:Fy,isFunction:pt,isStream:gy,isURLSearchParams:yy,isTypedArray:ky,isFileList:xy,forEach:gc,merge:pd,extend:Ry,trim:Ty,stripBOM:vy,inherits:Py,toFlatObject:Ny,kindOf:Xl,kindOfTest:Zt,endsWith:Cy,toArray:Iy,forEachEntry:Oy,matchAll:By,isHTMLForm:Uy,hasOwnProperty:gp,hasOwnProp:gp,reduceDescriptors:Sp,freezeMethods:Ly,toObjectSet:My,toCamelCase:Dy,noop:_y,toFiniteNumber:Hy,findKey:Ap,global:Gs,isContextDefined:Ep,isSpecCompliantForm:zy,toJSONObject:Gy,isAsyncFn:Vy,isThenable:Wy,setImmediate:Tp,asap:Ky,isIterable:qy};function yo(n,e,t,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}T.inherits(yo,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:T.toJSONObject(this.config),code:this.code,status:this.status}}});var Rp=yo.prototype,vp={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{vp[n]={value:n}});Object.defineProperties(yo,vp);Object.defineProperty(Rp,"isAxiosError",{value:!0});yo.from=(n,e,t,r,s,i)=>{let o=Object.create(Rp);return T.toFlatObject(n,o,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),yo.call(o,n.message,e,t,r,s),o.cause=n,o.name=n.name,i&&Object.assign(o,i),o};var V=yo;var eu=null;function xd(n){return T.isPlainObject(n)||T.isArray(n)}function Np(n){return T.endsWith(n,"[]")?n.slice(0,-2):n}function Pp(n,e,t){return n?n.concat(e).map(function(s,i){return s=Np(s),!t&&i?"["+s+"]":s}).join(t?".":""):e}function Jy(n){return T.isArray(n)&&!n.some(xd)}var Qy=T.toFlatObject(T,{},null,function(e){return/^is[A-Z]/.test(e)});function jy(n,e,t){if(!T.isObject(n))throw new TypeError("target must be an object");e=e||new(eu||FormData),t=T.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,A){return!T.isUndefined(A[b])});let r=t.metaTokens,s=t.visitor||u,i=t.dots,o=t.indexes,c=(t.Blob||typeof Blob<"u"&&Blob)&&T.isSpecCompliantForm(e);if(!T.isFunction(s))throw new TypeError("visitor must be a function");function l(y){if(y===null)return"";if(T.isDate(y))return y.toISOString();if(T.isBoolean(y))return y.toString();if(!c&&T.isBlob(y))throw new V("Blob is not supported. Use a Buffer instead.");return T.isArrayBuffer(y)||T.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function u(y,b,A){let S=y;if(y&&!A&&typeof y=="object"){if(T.endsWith(b,"{}"))b=r?b:b.slice(0,-2),y=JSON.stringify(y);else if(T.isArray(y)&&Jy(y)||(T.isFileList(y)||T.endsWith(b,"[]"))&&(S=T.toArray(y)))return b=Np(b),S.forEach(function(N,D){!(T.isUndefined(N)||N===null)&&e.append(o===!0?Pp([b],D,i):o===null?b:b+"[]",l(N))}),!1}return xd(y)?!0:(e.append(Pp(A,b,i),l(y)),!1)}let d=[],x=Object.assign(Qy,{defaultVisitor:u,convertValue:l,isVisitable:xd});function g(y,b){if(!T.isUndefined(y)){if(d.indexOf(y)!==-1)throw Error("Circular reference detected in "+b.join("."));d.push(y),T.forEach(y,function(S,C){(!(T.isUndefined(S)||S===null)&&s.call(e,S,T.isString(C)?C.trim():C,b,x))===!0&&g(S,b?b.concat(C):[C])}),d.pop()}}if(!T.isObject(n))throw new TypeError("data must be an object");return g(n),e}var Gn=jy;function Cp(n){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Ip(n,e){this._pairs=[],n&&Gn(n,this,e)}var kp=Ip.prototype;kp.append=function(e,t){this._pairs.push([e,t])};kp.toString=function(e){let t=e?function(r){return e.call(this,r,Cp)}:Cp;return this._pairs.map(function(s){return t(s[0])+"="+t(s[1])},"").join("&")};var tu=Ip;function Yy(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function bc(n,e,t){if(!e)return n;let r=t&&t.encode||Yy;T.isFunction(t)&&(t={serialize:t});let s=t&&t.serialize,i;if(s?i=s(e,t):i=T.isURLSearchParams(e)?e.toString():new tu(e,t).toString(r),i){let o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}var gd=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){T.forEach(this.handlers,function(r){r!==null&&e(r)})}},bd=gd;var ru={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var Op=typeof URLSearchParams<"u"?URLSearchParams:tu;var Bp=typeof FormData<"u"?FormData:null;var Up=typeof Blob<"u"?Blob:null;var Dp={isBrowser:!0,classes:{URLSearchParams:Op,FormData:Bp,Blob:Up},protocols:["http","https","file","blob","url","data"]};var Ad={};Kl(Ad,{hasBrowserEnv:()=>wd,hasStandardBrowserEnv:()=>Zy,hasStandardBrowserWebWorkerEnv:()=>Xy,navigator:()=>yd,origin:()=>$y});var wd=typeof window<"u"&&typeof document<"u",yd=typeof navigator=="object"&&navigator||void 0,Zy=wd&&(!yd||["ReactNative","NativeScript","NS"].indexOf(yd.product)<0),Xy=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$y=wd&&window.location.href||"http://localhost";var Te={...Ad,...Dp};function Ed(n,e){return Gn(n,new Te.classes.URLSearchParams,{visitor:function(t,r,s,i){return Te.isNode&&T.isBuffer(t)?(this.append(r,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function ew(n){return T.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function tw(n){let e={},t=Object.keys(n),r,s=t.length,i;for(r=0;r<s;r++)i=t[r],e[i]=n[i];return e}function rw(n){function e(t,r,s,i){let o=t[i++];if(o==="__proto__")return!0;let a=Number.isFinite(+o),c=i>=t.length;return o=!o&&T.isArray(s)?s.length:o,c?(T.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!T.isObject(s[o]))&&(s[o]=[]),e(t,r,s[o],i)&&T.isArray(s[o])&&(s[o]=tw(s[o])),!a)}if(T.isFormData(n)&&T.isFunction(n.entries)){let t={};return T.forEachEntry(n,(r,s)=>{e(ew(r),s,t,0)}),t}return null}var nu=rw;function nw(n,e,t){if(T.isString(n))try{return(e||JSON.parse)(n),T.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}var Sd={transitional:ru,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){let r=t.getContentType()||"",s=r.indexOf("application/json")>-1,i=T.isObject(e);if(i&&T.isHTMLForm(e)&&(e=new FormData(e)),T.isFormData(e))return s?JSON.stringify(nu(e)):e;if(T.isArrayBuffer(e)||T.isBuffer(e)||T.isStream(e)||T.isFile(e)||T.isBlob(e)||T.isReadableStream(e))return e;if(T.isArrayBufferView(e))return e.buffer;if(T.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ed(e,this.formSerializer).toString();if((a=T.isFileList(e))||r.indexOf("multipart/form-data")>-1){let c=this.env&&this.env.FormData;return Gn(a?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(t.setContentType("application/json",!1),nw(e)):e}],transformResponse:[function(e){let t=this.transitional||Sd.transitional,r=t&&t.forcedJSONParsing,s=this.responseType==="json";if(T.isResponse(e)||T.isReadableStream(e))return e;if(e&&T.isString(e)&&(r&&!this.responseType||s)){let o=!(t&&t.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?V.from(a,V.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Te.classes.FormData,Blob:Te.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};T.forEach(["delete","get","head","post","put","patch"],n=>{Sd.headers[n]={}});var wo=Sd;var sw=T.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Fp=n=>{let e={},t,r,s;return n&&n.split(`
`).forEach(function(o){s=o.indexOf(":"),t=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!t||e[t]&&sw[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e};var Lp=Symbol("internals");function yc(n){return n&&String(n).trim().toLowerCase()}function su(n){return n===!1||n==null?n:T.isArray(n)?n.map(su):String(n)}function iw(n){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}var ow=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Td(n,e,t,r,s){if(T.isFunction(r))return r.call(this,e,t);if(s&&(e=t),!!T.isString(e)){if(T.isString(r))return e.indexOf(r)!==-1;if(T.isRegExp(r))return r.test(e)}}function aw(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function cw(n,e){let t=T.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(s,i,o){return this[r].call(this,e,s,i,o)},configurable:!0})})}var Ao=class{constructor(e){e&&this.set(e)}set(e,t,r){let s=this;function i(a,c,l){let u=yc(c);if(!u)throw new Error("header name must be a non-empty string");let d=T.findKey(s,u);(!d||s[d]===void 0||l===!0||l===void 0&&s[d]!==!1)&&(s[d||c]=su(a))}let o=(a,c)=>T.forEach(a,(l,u)=>i(l,u,c));if(T.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(T.isString(e)&&(e=e.trim())&&!ow(e))o(Fp(e),t);else if(T.isObject(e)&&T.isIterable(e)){let a={},c,l;for(let u of e){if(!T.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[l=u[0]]=(c=a[l])?T.isArray(c)?[...c,u[1]]:[c,u[1]]:u[1]}o(a,t)}else e!=null&&i(t,e,r);return this}get(e,t){if(e=yc(e),e){let r=T.findKey(this,e);if(r){let s=this[r];if(!t)return s;if(t===!0)return iw(s);if(T.isFunction(t))return t.call(this,s,r);if(T.isRegExp(t))return t.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=yc(e),e){let r=T.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||Td(this,this[r],r,t)))}return!1}delete(e,t){let r=this,s=!1;function i(o){if(o=yc(o),o){let a=T.findKey(r,o);a&&(!t||Td(r,r[a],a,t))&&(delete r[a],s=!0)}}return T.isArray(e)?e.forEach(i):i(e),s}clear(e){let t=Object.keys(this),r=t.length,s=!1;for(;r--;){let i=t[r];(!e||Td(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){let t=this,r={};return T.forEach(this,(s,i)=>{let o=T.findKey(r,i);if(o){t[o]=su(s),delete t[i];return}let a=e?aw(i):String(i).trim();a!==i&&delete t[i],t[a]=su(s),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return T.forEach(this,(r,s)=>{r!=null&&r!==!1&&(t[s]=e&&T.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let r=new this(e);return t.forEach(s=>r.set(s)),r}static accessor(e){let r=(this[Lp]=this[Lp]={accessors:{}}).accessors,s=this.prototype;function i(o){let a=yc(o);r[a]||(cw(s,o),r[a]=!0)}return T.isArray(e)?e.forEach(i):i(e),this}};Ao.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);T.reduceDescriptors(Ao.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});T.freezeMethods(Ao);var Fe=Ao;function wc(n,e){let t=this||wo,r=e||t,s=Fe.from(r.headers),i=r.data;return T.forEach(n,function(a){i=a.call(t,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function Ac(n){return!!(n&&n.__CANCEL__)}function Mp(n,e,t){V.call(this,n??"canceled",V.ERR_CANCELED,e,t),this.name="CanceledError"}T.inherits(Mp,V,{__CANCEL__:!0});var kr=Mp;function Ec(n,e,t){let r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new V("Request failed with status code "+t.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Rd(n){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function lw(n,e){n=n||10;let t=new Array(n),r=new Array(n),s=0,i=0,o;return e=e!==void 0?e:1e3,function(c){let l=Date.now(),u=r[i];o||(o=l),t[s]=c,r[s]=l;let d=i,x=0;for(;d!==s;)x+=t[d++],d=d%n;if(s=(s+1)%n,s===i&&(i=(i+1)%n),l-o<e)return;let g=u&&l-u;return g?Math.round(x*1e3/g):void 0}}var _p=lw;function uw(n,e){let t=0,r=1e3/e,s,i,o=(l,u=Date.now())=>{t=u,s=null,i&&(clearTimeout(i),i=null),n(...l)};return[(...l)=>{let u=Date.now(),d=u-t;d>=r?o(l,u):(s=l,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}var Hp=uw;var Eo=(n,e,t=3)=>{let r=0,s=_p(50,250);return Hp(i=>{let o=i.loaded,a=i.lengthComputable?i.total:void 0,c=o-r,l=s(c),u=o<=a;r=o;let d={loaded:o,total:a,progress:a?o/a:void 0,bytes:c,rate:l||void 0,estimated:l&&a&&u?(a-o)/l:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(d)},t)},vd=(n,e)=>{let t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},Pd=n=>(...e)=>T.asap(()=>n(...e));var zp=Te.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,Te.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(Te.origin),Te.navigator&&/(msie|trident)/i.test(Te.navigator.userAgent)):()=>!0;var Gp=Te.hasStandardBrowserEnv?{write(n,e,t,r,s,i){let o=[n+"="+encodeURIComponent(e)];T.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),T.isString(r)&&o.push("path="+r),T.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){let e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Nd(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Cd(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function Sc(n,e,t){let r=!Nd(e);return n&&(r||t==!1)?Cd(n,e):e}var Vp=n=>n instanceof Fe?{...n}:n;function Xt(n,e){e=e||{};let t={};function r(l,u,d,x){return T.isPlainObject(l)&&T.isPlainObject(u)?T.merge.call({caseless:x},l,u):T.isPlainObject(u)?T.merge({},u):T.isArray(u)?u.slice():u}function s(l,u,d,x){if(T.isUndefined(u)){if(!T.isUndefined(l))return r(void 0,l,d,x)}else return r(l,u,d,x)}function i(l,u){if(!T.isUndefined(u))return r(void 0,u)}function o(l,u){if(T.isUndefined(u)){if(!T.isUndefined(l))return r(void 0,l)}else return r(void 0,u)}function a(l,u,d){if(d in e)return r(l,u);if(d in n)return r(void 0,l)}let c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(l,u,d)=>s(Vp(l),Vp(u),d,!0)};return T.forEach(Object.keys({...n,...e}),function(u){let d=c[u]||s,x=d(n[u],e[u],u);T.isUndefined(x)&&d!==a||(t[u]=x)}),t}var iu=n=>{let e=Xt({},n),{data:t,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=e;e.headers=o=Fe.from(o),e.url=bc(Sc(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let c;if(T.isFormData(t)){if(Te.hasStandardBrowserEnv||Te.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){let[l,...u]=c?c.split(";").map(d=>d.trim()).filter(Boolean):[];o.setContentType([l||"multipart/form-data",...u].join("; "))}}if(Te.hasStandardBrowserEnv&&(r&&T.isFunction(r)&&(r=r(e)),r||r!==!1&&zp(e.url))){let l=s&&i&&Gp.read(i);l&&o.set(s,l)}return e};var fw=typeof XMLHttpRequest<"u",Wp=fw&&function(n){return new Promise(function(t,r){let s=iu(n),i=s.data,o=Fe.from(s.headers).normalize(),{responseType:a,onUploadProgress:c,onDownloadProgress:l}=s,u,d,x,g,y;function b(){g&&g(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let A=new XMLHttpRequest;A.open(s.method.toUpperCase(),s.url,!0),A.timeout=s.timeout;function S(){if(!A)return;let N=Fe.from("getAllResponseHeaders"in A&&A.getAllResponseHeaders()),k={data:!a||a==="text"||a==="json"?A.responseText:A.response,status:A.status,statusText:A.statusText,headers:N,config:n,request:A};Ec(function(M){t(M),b()},function(M){r(M),b()},k),A=null}"onloadend"in A?A.onloadend=S:A.onreadystatechange=function(){!A||A.readyState!==4||A.status===0&&!(A.responseURL&&A.responseURL.indexOf("file:")===0)||setTimeout(S)},A.onabort=function(){A&&(r(new V("Request aborted",V.ECONNABORTED,n,A)),A=null)},A.onerror=function(){r(new V("Network Error",V.ERR_NETWORK,n,A)),A=null},A.ontimeout=function(){let D=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded",k=s.transitional||ru;s.timeoutErrorMessage&&(D=s.timeoutErrorMessage),r(new V(D,k.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,n,A)),A=null},i===void 0&&o.setContentType(null),"setRequestHeader"in A&&T.forEach(o.toJSON(),function(D,k){A.setRequestHeader(k,D)}),T.isUndefined(s.withCredentials)||(A.withCredentials=!!s.withCredentials),a&&a!=="json"&&(A.responseType=s.responseType),l&&([x,y]=Eo(l,!0),A.addEventListener("progress",x)),c&&A.upload&&([d,g]=Eo(c),A.upload.addEventListener("progress",d),A.upload.addEventListener("loadend",g)),(s.cancelToken||s.signal)&&(u=N=>{A&&(r(!N||N.type?new kr(null,n,A):N),A.abort(),A=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));let C=Rd(s.url);if(C&&Te.protocols.indexOf(C)===-1){r(new V("Unsupported protocol "+C+":",V.ERR_BAD_REQUEST,n));return}A.send(i||null)})};var dw=(n,e)=>{let{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,s,i=function(l){if(!s){s=!0,a();let u=l instanceof Error?l:this.reason;r.abort(u instanceof V?u:new kr(u instanceof Error?u.message:u))}},o=e&&setTimeout(()=>{o=null,i(new V(`timeout ${e} of ms exceeded`,V.ETIMEDOUT))},e),a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(l=>{l.unsubscribe?l.unsubscribe(i):l.removeEventListener("abort",i)}),n=null)};n.forEach(l=>l.addEventListener("abort",i));let{signal:c}=r;return c.unsubscribe=()=>T.asap(a),c}},Kp=dw;var hw=function*(n,e){let t=n.byteLength;if(!e||t<e){yield n;return}let r=0,s;for(;r<t;)s=r+e,yield n.slice(r,s),r=s},pw=async function*(n,e){for await(let t of mw(n))yield*hw(t,e)},mw=async function*(n){if(n[Symbol.asyncIterator]){yield*n;return}let e=n.getReader();try{for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},Id=(n,e,t,r)=>{let s=pw(n,e),i=0,o,a=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{let{done:l,value:u}=await s.next();if(l){a(),c.close();return}let d=u.byteLength;if(t){let x=i+=d;t(x)}c.enqueue(new Uint8Array(u))}catch(l){throw a(l),l}},cancel(c){return a(c),s.return()}},{highWaterMark:2})};var au=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Jp=au&&typeof ReadableStream=="function",xw=au&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),Qp=(n,...e)=>{try{return!!n(...e)}catch{return!1}},gw=Jp&&Qp(()=>{let n=!1,e=new Request(Te.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),qp=64*1024,kd=Jp&&Qp(()=>T.isReadableStream(new Response("").body)),ou={stream:kd&&(n=>n.body)};au&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!ou[e]&&(ou[e]=T.isFunction(n[e])?t=>t[e]():(t,r)=>{throw new V(`Response type '${e}' is not supported`,V.ERR_NOT_SUPPORT,r)})})})(new Response);var bw=async n=>{if(n==null)return 0;if(T.isBlob(n))return n.size;if(T.isSpecCompliantForm(n))return(await new Request(Te.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(T.isArrayBufferView(n)||T.isArrayBuffer(n))return n.byteLength;if(T.isURLSearchParams(n)&&(n=n+""),T.isString(n))return(await xw(n)).byteLength},yw=async(n,e)=>{let t=T.toFiniteNumber(n.getContentLength());return t??bw(e)},jp=au&&(async n=>{let{url:e,method:t,data:r,signal:s,cancelToken:i,timeout:o,onDownloadProgress:a,onUploadProgress:c,responseType:l,headers:u,withCredentials:d="same-origin",fetchOptions:x}=iu(n);l=l?(l+"").toLowerCase():"text";let g=Kp([s,i&&i.toAbortSignal()],o),y,b=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),A;try{if(c&&gw&&t!=="get"&&t!=="head"&&(A=await yw(u,r))!==0){let k=new Request(e,{method:"POST",body:r,duplex:"half"}),U;if(T.isFormData(r)&&(U=k.headers.get("content-type"))&&u.setContentType(U),k.body){let[M,F]=vd(A,Eo(Pd(c)));r=Id(k.body,qp,M,F)}}T.isString(d)||(d=d?"include":"omit");let S="credentials"in Request.prototype;y=new Request(e,{...x,signal:g,method:t.toUpperCase(),headers:u.normalize().toJSON(),body:r,duplex:"half",credentials:S?d:void 0});let C=await fetch(y,x),N=kd&&(l==="stream"||l==="response");if(kd&&(a||N&&b)){let k={};["status","statusText","headers"].forEach(q=>{k[q]=C[q]});let U=T.toFiniteNumber(C.headers.get("content-length")),[M,F]=a&&vd(U,Eo(Pd(a),!0))||[];C=new Response(Id(C.body,qp,M,()=>{F&&F(),b&&b()}),k)}l=l||"text";let D=await ou[T.findKey(ou,l)||"text"](C,n);return!N&&b&&b(),await new Promise((k,U)=>{Ec(k,U,{data:D,headers:Fe.from(C.headers),status:C.status,statusText:C.statusText,config:n,request:y})})}catch(S){throw b&&b(),S&&S.name==="TypeError"&&/Load failed|fetch/i.test(S.message)?Object.assign(new V("Network Error",V.ERR_NETWORK,n,y),{cause:S.cause||S}):V.from(S,S&&S.code,n,y)}});var Od={http:eu,xhr:Wp,fetch:jp};T.forEach(Od,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});var Yp=n=>`- ${n}`,ww=n=>T.isFunction(n)||n===null||n===!1,cu={getAdapter:n=>{n=T.isArray(n)?n:[n];let{length:e}=n,t,r,s={};for(let i=0;i<e;i++){t=n[i];let o;if(r=t,!ww(t)&&(r=Od[(o=String(t)).toLowerCase()],r===void 0))throw new V(`Unknown adapter '${o}'`);if(r)break;s[o||"#"+i]=r}if(!r){let i=Object.entries(s).map(([a,c])=>`adapter ${a} `+(c===!1?"is not supported by the environment":"is not available in the build")),o=e?i.length>1?`since :
`+i.map(Yp).join(`
`):" "+Yp(i[0]):"as no adapter specified";throw new V("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:Od};function Bd(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new kr(null,n)}function lu(n){return Bd(n),n.headers=Fe.from(n.headers),n.data=wc.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),cu.getAdapter(n.adapter||wo.adapter)(n).then(function(r){return Bd(n),r.data=wc.call(n,n.transformResponse,r),r.headers=Fe.from(r.headers),r},function(r){return Ac(r)||(Bd(n),r&&r.response&&(r.response.data=wc.call(n,n.transformResponse,r.response),r.response.headers=Fe.from(r.response.headers))),Promise.reject(r)})}var uu="1.11.0";var fu={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{fu[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});var Zp={};fu.transitional=function(e,t,r){function s(i,o){return"[Axios v"+uu+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(e===!1)throw new V(s(o," has been removed"+(t?" in "+t:"")),V.ERR_DEPRECATED);return t&&!Zp[o]&&(Zp[o]=!0,console.warn(s(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(i,o,a):!0}};fu.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function Aw(n,e,t){if(typeof n!="object")throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);let r=Object.keys(n),s=r.length;for(;s-- >0;){let i=r[s],o=e[i];if(o){let a=n[i],c=a===void 0||o(a,i,n);if(c!==!0)throw new V("option "+i+" must be "+c,V.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new V("Unknown option "+i,V.ERR_BAD_OPTION)}}var Tc={assertOptions:Aw,validators:fu};var Or=Tc.validators,So=class{constructor(e){this.defaults=e||{},this.interceptors={request:new bd,response:new bd}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;let i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
`+i):r.stack=i}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Xt(this.defaults,t);let{transitional:r,paramsSerializer:s,headers:i}=t;r!==void 0&&Tc.assertOptions(r,{silentJSONParsing:Or.transitional(Or.boolean),forcedJSONParsing:Or.transitional(Or.boolean),clarifyTimeoutError:Or.transitional(Or.boolean)},!1),s!=null&&(T.isFunction(s)?t.paramsSerializer={serialize:s}:Tc.assertOptions(s,{encode:Or.function,serialize:Or.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Tc.assertOptions(t,{baseUrl:Or.spelling("baseURL"),withXsrfToken:Or.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&T.merge(i.common,i[t.method]);i&&T.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),t.headers=Fe.concat(o,i);let a=[],c=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(t)===!1||(c=c&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});let l=[];this.interceptors.response.forEach(function(b){l.push(b.fulfilled,b.rejected)});let u,d=0,x;if(!c){let y=[lu.bind(this),void 0];for(y.unshift(...a),y.push(...l),x=y.length,u=Promise.resolve(t);d<x;)u=u.then(y[d++],y[d++]);return u}x=a.length;let g=t;for(d=0;d<x;){let y=a[d++],b=a[d++];try{g=y(g)}catch(A){b.call(this,A);break}}try{u=lu.call(this,g)}catch(y){return Promise.reject(y)}for(d=0,x=l.length;d<x;)u=u.then(l[d++],l[d++]);return u}getUri(e){e=Xt(this.defaults,e);let t=Sc(e.baseURL,e.url,e.allowAbsoluteUrls);return bc(t,e.params,e.paramsSerializer)}};T.forEach(["delete","get","head","options"],function(e){So.prototype[e]=function(t,r){return this.request(Xt(r||{},{method:e,url:t,data:(r||{}).data}))}});T.forEach(["post","put","patch"],function(e){function t(r){return function(i,o,a){return this.request(Xt(a||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}So.prototype[e]=t(),So.prototype[e+"Form"]=t(!0)});var Rc=So;var Ud=class n{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(i){t=i});let r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i,o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},e(function(i,o,a){r.reason||(r.reason=new kr(i,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){let e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new n(function(s){e=s}),cancel:e}}},Xp=Ud;function Dd(n){return function(t){return n.apply(null,t)}}function Fd(n){return T.isObject(n)&&n.isAxiosError===!0}var Ld={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ld).forEach(([n,e])=>{Ld[e]=n});var $p=Ld;function em(n){let e=new Rc(n),t=hc(Rc.prototype.request,e);return T.extend(t,Rc.prototype,e,{allOwnKeys:!0}),T.extend(t,e,null,{allOwnKeys:!0}),t.create=function(s){return em(Xt(n,s))},t}var Ue=em(wo);Ue.Axios=Rc;Ue.CanceledError=kr;Ue.CancelToken=Xp;Ue.isCancel=Ac;Ue.VERSION=uu;Ue.toFormData=Gn;Ue.AxiosError=V;Ue.Cancel=Ue.CanceledError;Ue.all=function(e){return Promise.all(e)};Ue.spread=Dd;Ue.isAxiosError=Fd;Ue.mergeConfig=Xt;Ue.AxiosHeaders=Fe;Ue.formToJSON=n=>nu(T.isHTMLForm(n)?new FormData(n):n);Ue.getAdapter=cu.getAdapter;Ue.HttpStatusCode=$p;Ue.default=Ue;var du=Ue;var{Axios:H6,AxiosError:z6,CanceledError:G6,isCancel:V6,CancelToken:W6,VERSION:K6,all:q6,Cancel:J6,isAxiosError:Q6,spread:j6,toFormData:Y6,AxiosHeaders:Z6,HttpStatusCode:X6,formToJSON:$6,getAdapter:e5,mergeConfig:t5}=du;var vc=class extends Error{constructor(t,r){super(r);this.code=t;this.name="HyperliquidAPIError"}},hu=class extends Error{constructor(e){super(e),this.name="AuthenticationError"}};function tm(n){if(n.response){let e=n.response.data&&n.response.data.code?n.response.data.code:n.response.status||"UNKNOWN_ERROR",t=n.response.data?n.response.data.message||(typeof n.response.data=="string"?n.response.data:"An unknown error occurred"):"An unknown error occurred";throw new vc(e,t)}else throw n.request?new vc("NETWORK_ERROR","No response received from the server"):new vc("REQUEST_SETUP_ERROR",n.message||"Unknown error occurred")}var Vn=class{constructor(e,t="/",r){h(this,"client");h(this,"endpoint");h(this,"rateLimiter");this.endpoint=t,this.client=du.create({baseURL:e,headers:{"Content-Type":"application/json"}}),this.rateLimiter=r}async makeRequest(e,t=2,r=this.endpoint){try{await this.rateLimiter.waitForToken(t);let s=await this.client.post(r,e);if(s.data===null||s.data===void 0)throw new Error("Received null or undefined response data");return s.data}catch(s){tm(s)}}};var pu=class{constructor(e,t,r,s){h(this,"spot");h(this,"perpetuals");h(this,"httpApi");h(this,"generalAPI");h(this,"symbolConversion");h(this,"parent");this.httpApi=new Vn(e,go.INFO,t),this.symbolConversion=r,this.parent=s,this.generalAPI=new Jl(this.httpApi,this.symbolConversion,this.parent),this.spot=new Ql(this.httpApi,this.symbolConversion),this.perpetuals=new jl(this.httpApi,this.symbolConversion,this.parent)}async getAssetIndex(e){return await this.parent.ensureInitialized(),await this.symbolConversion.getAssetIndex(e)}async getInternalName(e){return await this.parent.ensureInitialized(),await this.symbolConversion.convertSymbol(e)}async getAllAssets(){return await this.parent.ensureInitialized(),await this.symbolConversion.getAllAssets()}async getAllMids(e=!1){return await this.parent.ensureInitialized(),this.generalAPI.getAllMids(e)}async getUserOpenOrders(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserOpenOrders(e,t)}async getFrontendOpenOrders(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getFrontendOpenOrders(e,t)}async getUserFills(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserFills(e,t)}async getUserFillsByTime(e,t,r,s=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserFillsByTime(e,t,r,s)}async getUserRateLimit(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserRateLimit(e,t)}async getOrderStatus(e,t,r=!1){return await this.parent.ensureInitialized(),this.generalAPI.getOrderStatus(e,t,r)}async getL2Book(e,t=!1,r=5,s){return await this.parent.ensureInitialized(),this.generalAPI.getL2Book(e,t,r,s)}async getCandleSnapshot(e,t,r,s,i=!1){return await this.parent.ensureInitialized(),this.generalAPI.getCandleSnapshot(e,t,r,s,i)}async getMaxBuilderFee(e,t,r=!1){return await this.parent.ensureInitialized(),this.generalAPI.getMaxBuilderFee(e,t,r)}async getHistoricalOrders(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getHistoricalOrders(e,t)}async getUserTwapSliceFills(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserTwapSliceFills(e,t)}async getSubAccounts(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getSubAccounts(e,t)}async getVaultDetails(e,t,r=!1){return await this.parent.ensureInitialized(),this.generalAPI.getVaultDetails(e,t,r)}async getUserVaultEquities(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserVaultEquities(e,t)}async getUserRole(e,t=!1){return await this.parent.ensureInitialized(),this.generalAPI.getUserRole(e,t)}async getDelegat