(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[418],{770418(__unused_webpack_module,__webpack_exports__,__webpack_require__){(function(){if(!this.ST)return()=>{};with(this.ST)with(this.RH)with(this.G)return function(){"use strict";__webpack_require__.d(__webpack_exports__,{BZ:()=>I,HV:()=>n,Hg:()=>E});var e=__webpack_require__(585609);let t={[e.t.CLIENT_NOT_INITIALIZED]:"somethingWentWrong",[e.t.CLIENT_REINITIALIZING]:"somethingWentWrong",[e.t.PROVIDER_NOT_AVAILABLE]:"somethingWentWrong",[e.t.TOKEN_NOT_SUPPORTED]:"somethingWentWrong",[e.t.BRIDGE_CONTRACT_NOT_FOUND]:"somethingWentWrong",[e.t.WITHDRAW_FAILED]:"perpsWithdrawFailed",[e.t.POSITIONS_FAILED]:"somethingWentWrong",[e.t.ACCOUNT_STATE_FAILED]:"somethingWentWrong",[e.t.MARKETS_FAILED]:"somethingWentWrong",[e.t.UNKNOWN_ERROR]:"somethingWentWrong",[e.t.ORDER_LEVERAGE_REDUCTION_FAILED]:"perpsOrderFailed",[e.t.IOC_CANCEL]:"perpsOrderFailed",[e.t.CONNECTION_TIMEOUT]:"perpsConnectionTimeout",[e.t.WITHDRAW_ASSET_ID_REQUIRED]:"perpsWithdrawInvalidAmount",[e.t.WITHDRAW_AMOUNT_REQUIRED]:"perpsWithdrawInvalidAmount",[e.t.WITHDRAW_AMOUNT_POSITIVE]:"perpsWithdrawInvalidAmount",[e.t.WITHDRAW_INVALID_DESTINATION]:"perpsWithdrawInvalidAddress",[e.t.WITHDRAW_ASSET_NOT_SUPPORTED]:"somethingWentWrong",[e.t.WITHDRAW_INSUFFICIENT_BALANCE]:"perpsWithdrawInsufficient",[e.t.DEPOSIT_ASSET_ID_REQUIRED]:"perpsDepositFailed",[e.t.DEPOSIT_AMOUNT_REQUIRED]:"perpsDepositFailed",[e.t.DEPOSIT_AMOUNT_POSITIVE]:"perpsDepositFailed",[e.t.DEPOSIT_MINIMUM_AMOUNT]:"perpsDepositFailed",[e.t.ORDER_COIN_REQUIRED]:"perpsOrderFailed",[e.t.ORDER_LIMIT_PRICE_REQUIRED]:"perpsOrderFailed",[e.t.ORDER_PRICE_POSITIVE]:"perpsOrderFailed",[e.t.ORDER_UNKNOWN_COIN]:"perpsOrderFailed",[e.t.ORDER_SIZE_POSITIVE]:"perpsOrderFailed",[e.t.ORDER_PRICE_REQUIRED]:"perpsOrderFailed",[e.t.ORDER_SIZE_MIN]:"perpsOrderFailed",[e.t.ORDER_LEVERAGE_INVALID]:"perpsOrderFailed",[e.t.ORDER_LEVERAGE_BELOW_POSITION]:"perpsOrderFailed",[e.t.ORDER_MAX_VALUE_EXCEEDED]:"perpsOrderFailed",[e.t.EXCHANGE_CLIENT_NOT_AVAILABLE]:"somethingWentWrong",[e.t.INFO_CLIENT_NOT_AVAILABLE]:"somethingWentWrong",[e.t.SUBSCRIPTION_CLIENT_NOT_AVAILABLE]:"somethingWentWrong",[e.t.NO_ACCOUNT_SELECTED]:"perpsWithdrawNoAccount",[e.t.KEYRING_LOCKED]:"somethingWentWrong",[e.t.INVALID_ADDRESS_FORMAT]:"perpsWithdrawInvalidAddress",[e.t.TRANSFER_FAILED]:"somethingWentWrong",[e.t.SWAP_FAILED]:"somethingWentWrong",[e.t.SPOT_PAIR_NOT_FOUND]:"somethingWentWrong",[e.t.PRICE_UNAVAILABLE]:"somethingWentWrong",[e.t.UNSUPPORTED_COLLATERAL]:"perpsUnsupportedCollateral",[e.t.BATCH_CANCEL_FAILED]:"perpsBatchCancelFailed",[e.t.BATCH_CLOSE_FAILED]:"perpsBatchCloseFailed",[e.t.INSUFFICIENT_MARGIN]:"perpsInsufficientMargin",[e.t.INSUFFICIENT_BALANCE]:"perpsWithdrawInsufficient",[e.t.REDUCE_ONLY_VIOLATION]:"perpsOrderFailed",[e.t.POSITION_WOULD_FLIP]:"perpsOrderFailed",[e.t.MARGIN_ADJUSTMENT_FAILED]:"somethingWentWrong",[e.t.TPSL_UPDATE_FAILED]:"somethingWentWrong",[e.t.ORDER_REJECTED]:"perpsOrderRejected",[e.t.SLIPPAGE_EXCEEDED]:"perpsSlippageExceeded",[e.t.RATE_LIMIT_EXCEEDED]:"perpsRateLimitExceeded",[e.t.SERVICE_UNAVAILABLE]:"perpsServiceUnavailable",[e.t.NETWORK_ERROR]:"perpsNetworkError"};let E={perpsOrderFailed:"perpsCancelOrderFailed"};let r=[{pattern:/insufficient margin/iu,code:e.t.INSUFFICIENT_MARGIN},{pattern:/insufficient balance/iu,code:e.t.INSUFFICIENT_BALANCE},{pattern:/order rejected/iu,code:e.t.ORDER_REJECTED},{pattern:/ioc cancel/iu,code:e.t.IOC_CANCEL},{pattern:/reduce only/iu,code:e.t.REDUCE_ONLY_VIOLATION},{pattern:/would flip/iu,code:e.t.POSITION_WOULD_FLIP},{pattern:/slippage/iu,code:e.t.SLIPPAGE_EXCEEDED},{pattern:/rate limit/iu,code:e.t.RATE_LIMIT_EXCEEDED},{pattern:/too many requests/iu,code:e.t.RATE_LIMIT_EXCEEDED},{pattern:/leverage.*reduction/iu,code:e.t.ORDER_LEVERAGE_REDUCTION_FAILED},{pattern:/leverage.*below.*position/iu,code:e.t.ORDER_LEVERAGE_BELOW_POSITION},{pattern:/invalid leverage/iu,code:e.t.ORDER_LEVERAGE_INVALID},{pattern:/min.*notional/iu,code:e.t.ORDER_SIZE_MIN},{pattern:/max.*value.*exceeded/iu,code:e.t.ORDER_MAX_VALUE_EXCEEDED},{pattern:/service.*unavailable/iu,code:e.t.SERVICE_UNAVAILABLE},{pattern:/connection.*timed? out/iu,code:e.t.CONNECTION_TIMEOUT},{pattern:/network.*error/iu,code:e.t.NETWORK_ERROR},{pattern:/unknown.*coin|asset.*not.*found/iu,code:e.t.ORDER_UNKNOWN_COIN}];function n(e,E,n){let I=e=>E(n?.[e]??e);let i=e instanceof Error?e:null;let _=i&&"code"in i&&typeof i.code=="string"?i.code:null;if(_&&_ in t)return I(t[_]);let O=i?.message??"";if(O&&O in t)return I(t[O]);if(O){for(let{pattern:e,code:E}of r)if(e.test(O))return I(t[E])}return null}function I(e,t){return n(e,t)??t("somethingWentWrong")}}}).call(__webpack_require__._LM_("$root$",{__webpack_require__,__webpack_exports__}))()}}]);