1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="861a4a5d-5997-4aa5-aeb0-d143106a74f5",e._sentryDebugIdIdentifier="sentry-dbid-861a4a5d-5997-4aa5-aeb0-d143106a74f5")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6806],{559:(e,t,r)=>{r.d(t,{b:()=>v});var n=r(81742),a=r(66960),i=r(4362),l=r(41760),s=r(96620),o=r(19490),c=r(52293),d=r(51025),u=r(10022),m=r(35263),p=r(59189),x=r(25749),g=r(24558),h=r(28598),b=r(68699),y=r(21219),f=r(97430);function v(){var e;let{locale:t}=(0,a.B)(),{theme:r,setTheme:v}=(0,n.W)(),N=(0,y.T)(),j=(0,c.bZ)(e=>e.symbolsConfigBySymbol[N]),C=(0,l.N1)(s.p.USDT.SIMPLE_TICKER(N)),{unit:w,getQuantity:T}=(0,f.A)({symbol:N}),k=(0,m.W)(N),P=(0,d.k)(e=>e.user),S=(0,d.k)(e=>e.gotoLogin),L=(0,u.ZC)(e=>e.changeTheme),M=(0,b.n)(e=>e.requestLayoutReset),O=(0,x.TH)(),_=!!(null==P?void 0:P.userId),A=Number(null==C?void 0:C.volume),I=Number(null==C?void 0:C.oi),q=(0,p.c)(null==C?void 0:C.change,null==C?void 0:C.absChange,null!=(e=null==j?void 0:j.precision)?e:2);return{summary:{symbol:N,displaySymbol:(0,h.Hp)(N),rawticker:C,lastPrice:(null==C?void 0:C.last)?(0,o.iT)(C.last):"--",lastPriceClassName:"up"===k?"text-p2":"down"===k?"text-p3":"text-t1",changeText:q.text,changePercentText:q.percentText,changeClassName:q.className,markPrice:(null==C?void 0:C.markPrice)?(0,o.iT)(C.markPrice):"--",indexPrice:(null==C?void 0:C.indexPrice)?(0,o.iT)(C.indexPrice):"--",highPrice:(null==C?void 0:C.high)?(0,o.iT)(C.high):"--",lowPrice:(null==C?void 0:C.low)?(0,o.iT)(C.low):"--",volumeText:isNaN(A)?"--":(0,o.iT)(T(A,N,null==C?void 0:C.last))||"--",volumeUnit:w,openInterestText:(0,o.iT)(T(isNaN(I)?0:I,N,null==C?void 0:C.last))||"0",openInterestUnit:w},state:{isLogged:_,liveTradingHref:(0,g.Cv)(t,N),theme:r},actions:{handleSettingsClick:()=>{if(!_)return void S();O.showLayer()},handleThemeClick:()=>{let e="dark"===r?"light":"dark";v(e),(0,i.hx)(r,e,"demo"),L(e)},handleLayoutReset:M}}}},812:(e,t,r)=>{r.d(t,{Y:()=>T});var n=r(79237),a=r(24983),i=r(85002),l=r(66960),s=r(90477),o=r(88518),c=r(18746),d=r(39042),u=r(17305),m=r(81407),p=r(23209),x=r(99251),g=r(66249),h=r(38113),b=r(76656),y=r(97450),f=r(72219),v=r(36106),N=r(50791),j=r(34957),C=r(43487);function w(e){return{slot:"item",labelClassName:"text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",valueClassName:(0,s.cn)("text-cm12 text-t1 flex-1 [&_span]:!text-cm12",e)}}function T(e){let{mode:t="pc"}=e,{$t:r,locale:T}=(0,l.B)(),k="h5"===t,P=(0,h.useMemo)(()=>(0,p.Y)(r),[r]),S=(0,f.Z)(),L=(0,y.D)(),M=(0,v.e)(),O=(0,N.T3)(),{initialized:_,loading:A,pagination:I,rawItems:q,setPageNum:U}=(0,C.dw)((0,b.k)(e=>({initialized:e.initialized,loading:e.loading,pagination:e.pagination,rawItems:e.items,setPageNum:e.setPageNum}))),E=(0,h.useMemo)(()=>q.map(e=>{var t;return{...e,quantity:L(null!=(t=e.quantity)?t:0,e.symbol||"",e.averagePrice),calcQuantity:L(e.filledQuantity||0,e.symbol||"",e.averagePrice),unit:M(e.symbol)}}),[L,M,q]),Q=!!(S.userReady&&S.isLogged&&!_)||!!A,{hasNextPage:D,shouldShowPagination:R}=(0,u.d)({pageNum:I.pageNum,pageSize:I.pageSize,currentSize:E.length}),z=R?(0,n.jsx)("div",{className:(0,s.cn)("py-s3 flex",k?"justify-center px-4":"justify-end px-[10px]"),children:(0,n.jsxs)(a.Pagination,{variant:"number",children:[(0,n.jsx)(a.PaginationItem,{type:"button",icon:"first",disabled:Q||1===I.pageNum,onClick:()=>{Q||U(1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"prev",disabled:Q||1===I.pageNum,onClick:()=>{Q||U(Math.max(1,I.pageNum-1))}}),(0,n.jsx)(a.PaginationItem,{type:"number",active:!0,children:I.pageNum}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"next",disabled:Q||!D,onClick:()=>{!Q&&D&&U(I.pageNum+1)}})]})}):null,[B,F]=(0,h.useState)(!1),[H,V]=(0,h.useState)(null),Z=async e=>{if(!e.orderId||!e.symbol)return;let t=await (0,o.SR)({locale:T,params:{orderId:e.orderId,symbol:e.symbol}});if((null==t?void 0:t.code)!==200)return;let n=Number(t.data||0),a=Number(e.averagePrice||0),i=Number(e.leverage||0),l="closeLong"===e.direction,s=i?n/i:0,
1c=s?(l?a-n:n-a)/s:0;V({theme:document.documentElement.classList.contains("dark")?"dark":"light",type:"perpetual",template:"historyEntrustMain",header:{label:"Perpetual"},top:{symbol:{coin:(e.symbol||"").replace("-SWAP","USDT"),tags:[{type:"other",class:l?"is-up":"is-down",label:l?r("Long"):r("Short")},{type:"leverage",class:"is-primary",label:(0,m.Uy)(e.leverage)}]},inset:{type:"perpetual"}},core:{rate:[{type:"roe",label:r("ROE"),value:Number.isFinite(c)?c:0},{type:"pnl",label:"".concat(r("PNL"),"(USDT)"),value:Number(e.profit||0)}],menu:[{type:"default",label:r("Entry Price"),value:n},{type:"default",label:r("Close Price"),value:a}]},referral:{link:"".concat(window.location.origin,"/").concat(T,"/invite/{0}")},check:{leverage:!0,pnl:!0,referral:!0}}),F(!0)},K=e=>{O.showLayer({item:e,mode:t})},W=(0,h.useMemo)(()=>[{title:(0,n.jsx)("span",{className:x.CZ,children:r("Symbol")}),key:"symbol",dataIndex:"symbol",width:176,fixed:"left",render:(e,t)=>(0,n.jsx)(j.JE,{item:t}),mobile:{slot:"header",label:(e,t)=>(0,n.jsx)(j.JE,{item:t}),value:(e,t)=>(0,n.jsx)(j.QA,{item:t,onShare:Z,onCheck:K,unavailableFallback:null}),labelClassName:"min-w-0 flex-1",valueClassName:"flex-none justify-end"}},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Side")}),key:"direction",width:112,render:(e,t)=>(0,n.jsx)("span",{className:(0,s.cn)(x._U,(0,m.N)(t.direction)),children:(0,m.Tz)(t.direction,P.direction)}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Margin Mode")}),key:"marginMode",width:120,render:(e,t)=>(0,n.jsx)("span",{className:x.pd,children:(0,m.Tz)(t.marginMode,P.mode)}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Leverage")}),key:"leverage",width:100,render:(e,t)=>(0,n.jsx)("span",{className:x.pd,children:(0,m.Uy)(t.leverage)}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Type")}),key:"orderType",width:108,render:(e,t)=>(0,n.jsx)("span",{className:x.pd,children:(0,d.N7)(t,P)}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Quantity_1")}),key:"quantity",width:132,render:(e,t)=>{let r=(0,m.ac)(t.quantity);return(0,n.jsx)("span",{className:x.pd,children:"--"===r?r:"".concat(r," ").concat(t.unit||"").trim()})},mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Price_3")}),key:"orderPrice",width:120,render:(e,t)=>(0,n.jsx)("span",{className:x.pd,children:(0,m.Iz)({marketLabel:r("Market"),orderPrice:t.orderPrice,orderType:t.orderType})}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Filled Qty")}),key:"filledQuantity",width:132,render:(e,t)=>(0,n.jsx)("span",{className:x.pd,children:(0,m.ac)(t.calcQuantity)}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Filled Price")}),key:"averagePrice",width:112,render:(e,t)=>(0,n.jsx)("span",{className:x.pd,children:"liquidation"===t.orderType?"--":(0,m.ac)(t.averagePrice)}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Fee")}),key:"fee",width:100,render:(e,t)=>(0,n.jsx)("span",{className:x.pd,children:(0,m.ac)(t.fee)}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:"".concat(r("Profit_1"),"(USDT)")}),key:"profit",width:108,render:(e,t)=>(0,n.jsx)("span",{className:(0,s.cn)(x.pd,"direction-ltr"),children:(0,d.fb)(t.profit)}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Status")}),key:"status",width:120,render:(e,t)=>(0,n.jsx)("span",{className:x.pd,children:(0,m.Tz)(t.status,P.orderStatus)}),mobile:w()},{title:(0,n.jsx)("span",{className:x.CZ,children:r("Time_r_1")}),key:"orderTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:x.pd,children:(0,m.r6)(t.orderTime)}),mobile:w()},{title:(0,n.jsx)("span",{className:"".concat(x.CZ," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",width:108,fixed:"right",render:(e,t)=>(0,n.jsx)(j.QA,{item:t,onShare:Z,onCheck:K}),mobile:{hidden:!0}}],[r,K,Z,P]);return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsx)(i.AdvancedTable,{columns:W,dataSource:E,locale:T,rowKey:"orderId",loading:Q,className:k?"[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-div
1ider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0":g.hL,outlined:!1,containerClassName:k?void 0:g.CL,tableClassName:k?void 0:"[&_tbody_tr]:!h-14",fixedCellClassName:k?void 0:g.dA,pagination:!1,scroll:k?void 0:{x:1760},responsive:k,mobileMode:k?"card":"table",mobileCardClassName:k?"bg-bg7":void 0}),z,B&&H?(0,n.jsx)(c.A,{config:H,onClose:()=>{F(!1),V(null)}}):null]})}},2621:(e,t,r)=>{r.d(t,{a:()=>s});var n=r(60173),a=r(3529);let i="gridSurface";function l(e){let t=Number(e);return Number.isFinite(t)?t:0}function s(e){var t,r,s,o,c;let{item:d,$t:u,locale:m,origin:p,theme:x,variant:g}=e;return{theme:x,type:"grid",template:"running"===g?"positionGridMain":"historyGridMain",payload:{menuBackground:i,posterBackground:"gridPoster",referralBackground:i},header:{label:"Grid Trading Perp"},top:{symbol:{coin:(0,a.A2)(d.contract||"","")||"--",tags:[{type:"other",class:"LONG"===(o=d.direction)?"is-up":"SHORT"===o?"is-down":"is-primary",label:(c=d.direction,u("LONG"===c?"Long":"SHORT"===c?"Short":"Neutral"))},{type:"leverage",class:"is-primary",label:void 0!==d.leverage&&null!==d.leverage?"".concat(d.leverage,"X"):"--"}]},inset:{type:"grid"}},core:{rate:[{type:"roe",label:u("ROE"),value:l(d.totalPnlRate)},{type:"pnl",label:"".concat(u("PNL"),"(USDT)"),value:l(d.totalPnl)}],menu:[{type:"default",label:u("Lower Price"),value:null!=(t=d.lowerPrice)?t:"--"},{type:"default",label:u("Upper Price"),value:null!=(r=d.upperPrice)?r:"--"},{type:"multiple",data:[{label:u("Mode"),value:u("GEOMETRIC"===d.type?"Geometric":"Arithmetic")},{label:u("Grid Qty"),value:null!=(s=d.gridCount)?s:"--"}]}]},referral:{link:"".concat(p).concat((0,n.wf)("/invite/{0}",m))},check:{leverage:!0,pnl:!0,referral:!0}}}},2639:(e,t,r)=>{r.d(t,{J:()=>o});var n=r(41809),a=r(91474);let i={orderBookLayoutMode:1,orderBookView:"all",mergedPrec:{},layouts:void 0,activeContractTab:"positions"},l=["positions","openOrders","triggerOrders","ordersHistory","tpsl"];function s(e){return l.includes(e)?e:"positions"}let o=(0,n.v)()((0,a.Zr)(e=>({...i,setOrderBookLayoutMode:t=>e({orderBookLayoutMode:t}),setOrderBookView:t=>e({orderBookView:t}),setMergedPrec:(t,r)=>e(e=>({mergedPrec:{...e.mergedPrec,[t]:r}})),setCoreLayouts:t=>e({layouts:t}),setActiveContractTab:t=>e({activeContractTab:s(t)}),resetCoreLayouts:()=>e({layouts:void 0}),clearMergedPrec:t=>e(e=>{let r={...e.mergedPrec};return delete r[t],{mergedPrec:r}})}),{name:"demo-trading-core-config-storage",version:5,storage:(0,a.KU)(()=>localStorage),migrate:e=>({...e,layouts:void 0}),partialize:e=>({orderBookLayoutMode:e.orderBookLayoutMode,orderBookView:e.orderBookView,mergedPrec:e.mergedPrec,layouts:e.layouts,activeContractTab:e.activeContractTab}),merge:(e,t)=>{var r,n,a,i,l;let o=e||{};return{...t,orderBookLayoutMode:null!=(r=o.orderBookLayoutMode)?r:t.orderBookLayoutMode,orderBookView:null!=(n=o.orderBookView)?n:t.orderBookView,mergedPrec:null!=(a=o.mergedPrec)?a:t.mergedPrec,activeContractTab:s(null!=(i=o.activeContractTab)?i:t.activeContractTab),layouts:null!=(l=o.layouts)?l:t.layouts}}}))},3060:(e,t,r)=>{r.d(t,{Bw:()=>u,Jv:()=>o,cf:()=>c,lD:()=>d,mK:()=>m,oV:()=>l,pz:()=>s});var n=r(19490),a=r(122),i=r(39679);function l(e,t){if(!e)return"";let r=new a.A(e).toDecimalPlaces(t,a.A.ROUND_DOWN).toFixed(t);return t>0?r.replace(/\.?0+$/,""):r}function s(e,t){return e?new a.A(e).toDecimalPlaces(t,a.A.ROUND_UP).toFixed(t):""}function o(e,t,r){return e&&t?new a.A(e).mul(t).div(100).toDecimalPlaces(r,a.A.ROUND_UP).toFixed(r):""}function c(e){return(0,n.iT)(new a.A((0,i.IQ)(e,0)).toDecimalPlaces(2,a.A.ROUND_UP).toFixed(2))}function d(e,t){return(0,n.iT)(new a.A((0,i.IQ)(e,0)).toDecimalPlaces(t,a.A.ROUND_UP).toFixed(t))}function u(e){let t="2"===e.tradeUnit?"â":"=",r=Number(e.quantity||0);if("open"===e.activeTab){let n=e.longQuantity||r,a=e.shortQuantity;return"".concat(t," ").concat(e.getBaseAssetHintValue(n,"buy")).concat(a?" / ".concat(e.getBaseAssetHintValue(a,"sell")):"")}let n=e.shortQuantity||r,a=e.longQuantity;return"".concat(t," ").concat(e.getBaseAssetHintValue(n,"sell")).concat(a?" / ".concat(e.getBaseAssetHintValue(a,"buy")):"")}function m(e){if(e.isPercentage)return Math.min(Math.max(Number(e.percentage||0),0),100);if("open"===e.activeTab){let t=Number(e.longQuantity||0),r=Number(e.shortQuantity||0);if(!e.maxQuantityDisplay&&!t&&!r)return 0;if(!e.maxQuantityDisplay&&(t>0||r>0))return 100;let n=e.maxOpenBuy?100*t/e.maxOpenBuy:0,a=e.maxOpenSell?100*r/e.maxOpenSell:0;return Math.min(Math.round(n||a),100)}let t=Number(e.longQuantity||0),r=Number(e.shortQuantity||0);if(!e.maxQuantityDisplay&&!t&&!r)return 0;if(!e.maxQuantityDisplay&&(t>0||r>0))return 100;let n=e.maxCloseLong?100*t/e.maxCloseLong:0;return Math.min(Math.round((e.maxCloseShort?100*r/e.maxCloseShort:0)||n),100)}},7126:(e,t,r)=>{r.d(t,{$:()=>n,w:()=>a});let n="focus-within:!border-p1 focus-within:!bg-white dark:focus-within:!bg-bg3",a="!bg-bg2 !border-transparent ".concat(n)},8188:(e,t,r)=>{r.d(t,{K:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>
1(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,n.jsx)("path",{d:"M481.834667 140.501333a42.666667 42.666667 0 0 1 60.330666 0l256 256a42.666667 42.666667 0 0 1-60.330666 60.330667L554.666667 273.664V853.333333a42.666667 42.666667 0 1 1-85.333334 0V273.664l-183.168 183.168a42.666667 42.666667 0 0 1-60.330666-60.330667l256-256z"})}));l.displayName="ArrowUpIcon"},9106:(e,t,r)=>{r.d(t,{b:()=>o});var n=r(79237),a=r(76562),i=r(69938),l=r(66960),s=r(9238);function o(){let{$t:e,locale:t}=(0,l.B)();return(0,n.jsxs)(i.Popover,{trigger:"hover",children:[(0,n.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,n.jsx)("span",{className:"border-p1/30 bg-p1/10 text-p1 rounded-r1 inline-flex h-4 shrink-0 cursor-help items-center border px-1 text-[12px] leading-4 font-medium",children:"Pre-IPO"})}),(0,n.jsxs)(i.PopoverContent,{side:"bottom",align:"start",className:"w-[320px] max-w-[calc(100vw-32px)] p-3",children:[(0,n.jsx)("div",{className:"text-b14 text-t1 font-semibold",children:e("Pre-IPO Perpetuals")}),(0,n.jsx)("div",{className:"text-b14 text-t2 mt-2 leading-5",children:e("Pre-IPO Perpetuals allow you to trade market expectations of private companies before their official IPO listing.")}),(0,n.jsxs)("a",{href:"https://tapbitcex.zendesk.com/hc/".concat((0,s.FQ)(t),"/articles/16830886547855"),target:"_blank",rel:"noreferrer",className:"text-b14 text-p1 mt-2 inline-flex items-center gap-1 leading-5",children:[e("Learn More About Pre-IPO Perpetuals"),(0,n.jsx)(a.Y,{className:"size-3 rtl:rotate-180"})]})]})]})}},10209:(e,t,r)=>{r.d(t,{Hk:()=>a,Kv:()=>s,Qx:()=>l,bh:()=>c,jO:()=>i,vC:()=>o});var n=r(67666);function a(e){let t=Number.isFinite(Number(e.orderPrice))&&Number(e.orderPrice)>0,r=Number.isFinite(Number(e.triggerPrice))&&Number(e.triggerPrice)>0;return("limit"!==e.orderType&&"postOnly"!==e.orderType||!!t)&&("planLimit"!==e.orderType||!!r&&!!t)&&("planMarket"!==e.orderType||!!r)}function i(e){return"separated"===e}function l(e){let t=Number("openLong"===e.direction?e.longQuantity||e.quantity||0:e.shortQuantity||e.quantity||0);return(0,n.DG)({quantity:t,tradeUnit:e.tradeUnit,multiplier:e.multiplier,price:e.calcPrice,usdtCost:e.usdtCost,costOne:"openLong"===e.direction?e.oneContCostBuy:e.oneContCostSell})}function s(e){let t=Number("closeLong"===e.direction?e.longQuantity||e.quantity||0:e.shortQuantity||e.quantity||0);return(0,n.DG)({quantity:t,tradeUnit:e.tradeUnit,multiplier:e.multiplier,price:e.calcPrice,usdtCost:e.usdtCost})}function o(e){return("limit"===e.orderType||"market"===e.orderType||"postOnly"===e.orderType)&&e.availableBalance<=0?{valid:!1,errorCode:"INSUFFICIENT_AVAILABLE_BALANCE"}:!Number.isFinite(e.quantityCont)||e.quantityCont<=0?{valid:!1,errorCode:"ORDER_QUANTITY_REQUIRED"}:{valid:!0}}function c(e){return e.quantityCont<=0?{valid:!1,errorCode:"ORDER_QUANTITY_REQUIRED"}:e.quantityCont>e.maxCont?{valid:!1,errorCode:"EXCEEDS_AVAILABLE_SIZE"}:{valid:!0,submitQuantityCont:e.quantityCont}}},11834:(e,t,r)=>{r.d(t,{_:()=>l});var n=r(38113),a=r(74494);let i=new WeakMap;function l(e,t){let[r,l]=(0,n.useState)(()=>performance.now()),[s,o]=(0,n.useState)(!1),[c,d]=(0,n.useState)(!1),u=(0,n.useRef)(null),m=(0,n.useCallback)(r=>{let n=i.get(t);return n||(n=(0,a.ee)(),i.set(t,n)),n(e,r,t)},[e,t]),p=(0,n.useCallback)(async e=>{d(!0);try{await m(e),o(!1)}catch(e){o(!0)}finally{d(!1)}},[m,e,t]);return(0,n.useEffect)(()=>{let t=()=>{var t;let r=performance.now();l(r);let n=null==(t=(0,a.qv)(e))?void 0:t.startsAtMs;n&&0===(0,a.Lj)(e,r)&&u.current!==n&&(u.current=n,p("boundary"))},r=()=>{"visible"===document.visibilityState&&(l(performance.now()),p("foreground"))};t();let n=window.setInterval(t,1e3);return window.addEventListener("focus",r),document.addEventListener("visibilitychange",r),()=>{window.clearInterval(n),window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",r)}},[e,p]),{remainingMs:(0,a.Lj)(e,r),failed:s,refreshing:c,retry:()=>p("retry")}}},12724:(e,t,r)=>{r.d(t,{oM:()=>s});var n=r(66960),a=r(39720),i=r(51025),l=r(4390);function s(){let{locale:e}=(0,n.B)(),t=(0,i.k)(e=>{var t,r;return null!=(r=null==(t=e.user)?void 0:t.userId)?r:null});return(0,l.useQuery)({queryKey:["demo-activity-info",e,t],queryFn:()=>(0,a.RE)({locale:e,params:{}}),enabled:!!e&&!!t,retry:!1,throwOnError:!1,staleTime:3e4})}},13207:(e,t,r)=>{r.d(t,{V:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>
1(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,n.jsx)("path",{d:"M512 77.738667a67.541333 67.541333 0 0 1 62.421333 41.728l89.898667 216.234666 233.514667 18.730667c58.026667 4.650667 82.645333 75.008 42.624 114.901333l-4.096 3.754667-177.92 152.448 54.357333 227.754667a67.584 67.584 0 0 1-100.906667 73.301333L512 804.522667l-199.936 122.154666A67.498667 67.498667 0 0 1 211.114667 853.333333l54.314666-227.84-177.877333-152.405333a67.712 67.712 0 0 1-20.266667-72.192l1.706667-4.693333a67.626667 67.626667 0 0 1 57.045333-41.770667h0.085334l233.429333-18.773333L449.578667 119.466667A67.541333 67.541333 0 0 1 512 77.738667zM434.261333 378.453333a67.584 67.584 0 0 1-57.002666 41.429334l-201.728 16.213333 153.6 131.584c7.125333 6.058667 12.885333 13.525333 16.938666 21.845333l3.456 8.533334 2.304 9.045333c1.621333 9.088 1.365333 18.474667-0.768 27.52v0.085333L304 831.573333l172.8-105.514666a67.584 67.584 0 0 1 70.314667 0l172.714666 105.472-46.933333-196.821334v-0.128a67.626667 67.626667 0 0 1 1.493333-36.48l3.498667-8.576c4.053333-8.32 9.770667-15.786667 16.853333-21.802666l153.6-131.669334-201.685333-16.170666a67.584 67.584 0 0 1-57.002667-41.386667L512 191.573333l-77.738667 186.88z"})}));l.displayName="FavoriteOffIcon"},13288:(e,t,r)=>{r.d(t,{Lu:()=>o,YI:()=>s,g$:()=>i});var n=r(19490),a=r(90160);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bid",r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,l=0,s=e.map(e=>({price:String(e.price||""),quantity:String(e.quantity||""),total:0}));return"ask"===t&&s.reverse(),s=(0,a.A)(r)&&(0,a.A)(i)&&i<r?s.reduce((e,a)=>{let s=e[e.length-1];l+=Number(a.quantity)||0,a.total=l;let o=i!==r?i<=0?i-r-1:i-r:void 0,c=Math.pow(10,i);return"ask"===t?a.price=(0,n._u)(a.price)("*",c)().ceil().div(c).toFixed(r):i>0?a.price=Number(Number(a.price).toFixed(r).slice(0,o)).toFixed(r):a.price=Number(Number(Number(a.price).toFixed(r).slice(0,o))/c).toFixed(r),(null==s?void 0:s.price)===a.price?(s.quantity=String((Number(s.quantity)||0)+(Number(a.quantity)||0)),s.total=l):e.push(a),e},[]):s.map(e=>(l+=Number(e.quantity)||0,{...e,total:l})),"ask"===t&&s.reverse(),s}function l(e,t,r){var a;let i=null!=(a=e.orderPrice)?a:0;if(t&&void 0!==r){let a=r!==t?r<=0?r-t-1:r-t:void 0,l=Math.pow(10,r);switch(e.direction){case"openLong":case"closeShort":i=r>0?Number(Number(i).toFixed(t).slice(0,a)).toFixed(t):(Number(Number(i).toFixed(t).slice(0,a))/l).toFixed(t);break;case"openShort":case"closeLong":i=(0,n._u)(i)("*",l)().ceil().div(l).toFixed(t)}}return Number(i)}function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return{newAsks:e.map(e=>r.find(t=>l(t,n,a)===Number(e.price))?{...e,mySize:!0}:e),newBids:t.map(e=>r.find(t=>l(t,n,a)===Number(e.price))?{...e,mySize:!0}:e)}}function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return 0===e.length?0:Number(e.reduce((e,t)=>Number(e.total)>=Number(t.total)?e:t).total)}},13751:(e,t,r)=>{r.d(t,{Hk:()=>a,Kv:()=>s,Qx:()=>l,bh:()=>u,eT:()=>c,jO:()=>i,vC:()=>d,wL:()=>o});var n=r(70464);function a(e){return!(("limit"===e.orderType||"postOnly"===e.orderType)&&0>=Number(e.orderPrice||0)||"planLimit"===e.orderType&&(0>=Number(e.triggerPrice||0)||0>=Number(e.orderPrice||0))||"planMarket"===e.orderType&&0>=Number(e.triggerPrice||0))}function i(e){return"separated"===e}function l(e){let t=Number("openLong"===e.direction?e.longQuantity||e.quantity||0:e.shortQuantity||e.quantity||0);return(0,n.DG)({quantity:t,tradeUnit:e.tradeUnit,multiplier:e.multiplier,price:e.calcPrice,usdtCost:e.usdtCost,costOne:"openLong"===e.direction?e.oneContCostBuy:e.oneContCostSell})}function s(e){let t=Number("closeLong"===e.direction?e.longQuantity||e.quantity||0:e.shortQuantity||e.quantity||0);return(0,n.DG)({quantity:t,tradeUnit:e.tradeUnit,multiplier:e.multiplier,price:e.calcPrice,usdtCost:e.usdtCost})}function o(e){return Number("openLong"===e.direction?e.longQuantity||e.quantity||0:e.shortQuantity||e.quantity||0)}function c(e){let t=Number(e.multiplier||1)||1,r=Number(e.minTradeAmount);if(!Number.isFinite(r)||r<=0)return 0;if("2"===e.tradeUnit){r*=t;let n=Number(e.calcPrice),a=Number(e.oneContCost);return"1"===e.usdtCost&&Number.isFinite(a)&&a>0?(r/t*a).toFixed(2):!Number.isFinite(n)||n<=0?0:(r*n).toFixed(2)}return"0"===e.tradeUnit&&(r*=t),r}function d(e){var t,r;if(("limit"===e.orderType||"market"===e.orderType||"postOnly"===e.orderType)&&e.availableBalance<=0)return{valid:!1,errorCode:"INSUFFICIENT_AVAILABLE_BALANCE"};let n=Number(null!=(r=null!=(t=e.displayQuantity)?t:e.quantityCont)?r:0);if(!Number.isFinite(n)||n<=0)return{valid:!1,errorCode:"ORDER_QUANTITY_REQUIRED"};let a=Number(e.minDisplayQuantity||0);return a>0&&n<a?{valid:!1,errorCode:"BELOW_MIN_ORDER_QUANTITY",minQuantity:e.minDisplayQuantity}:!Number.isFinite(e.quantityCont)||e.quantityCont<=0?{valid:!1,errorCode:"ORDER_QUANTITY_REQUIRED"}:{valid:!0}}function u(e){return e.quantityCont<=0?{valid:!1,errorCode:"ORDER_QUANTITY_REQUIRED"}:e.quantityCont>e.maxCont?{valid:!1,errorCode:"EXCEEDS_AVAILABLE_SIZE"}:{valid:!0,submitQuantityCont:e.quantityCont}}},14220:(e,t,r)=>{r.d(t,{N:()=>a});var n=r(38113);function a(e){let t=(0,n.useRef)(e),r=(0,n.useRef)(!1);return t.current=e,(0,n.useCallback)(function(){let e;for(var n=arguments.length,a=Array(n),i=0;i<n;i++)a[i]=arguments[i];if(!r.current){r.current=!0;try{if(!(e=t.current(...a))||"function"!=typeof e.then)throw TypeError("useAsyncLock callback must return a Promise")}catch(e){return r.current=!1,Promise.reject(e)}return Promise.resolve(e).finally(()=>{r.current=!1})}},[])}},15934:(e,t,r)=>{function n(e,t){return"string"===t?(t,r)=>t[e]>=r[e]?1:-1:(t,r)=>(isNaN(Number(t[e]))?0:Number(t[e]))-(isNaN(Number(r[e]))?0:Number(r[e]))}function a(e,t){return"string"===t?(t,r)=>r[e]>=t[e]?1:-1:(t,r)=>{let n=isNaN(Number(t[e]))?0:Number(t[e]);return(isNaN(Number(r[e]))?0:Number(r[e]))-n}}r.d(t,{F:()=>n,p:()=>a})},15977:(e,t,r)=>{r.d(t,{T:()=>Z});var n=r(79237),a=r(40247),i=r(46890),l=r(47776),s=r(87042),o=r(30511),c=r(44031),d=r(82586),u=r(53678),m=r(84980),p=r(69938),x=r(91405),g=r(66960),h=r(51430),b=r(41760),y=r(96620),f=r(19490),v=r(90477),N=r(52293),j=r(51025),C=r(83125),w=r(81039),T=r(38113),k=r(76656),P=r(21219),S=r(82510),L=r(15934),M=r(3529);let O={field:null,direction:null};function _(e){return[...e].sort((e,t)=>
1Number(t.usdtVolume||0)-Number(e.usdtVolume||0))}function A(e,t){return e.filter(e=>e.baseAsset.includes(t))}function I(e,t){return _(A(e,t).filter(e=>e.baseAsset.startsWith(t)))}function q(e,t){return _(I(e,t).filter(e=>e.baseAsset===t))}function U(e,t){let r=A(e,t),n=[...I(e,t),...q(e,t)];return _(r.filter(e=>!n.some(t=>t.baseAsset===e.baseAsset)))}function E(e,t){return _(e.filter(()=>"USDT".includes(t)))}function Q(e,t){var r,n;let a=null==(n=e.groupList)||null==(r=n.find(e=>e.groupCode===t))?void 0:r.sort;return"number"==typeof a?a:Number.MAX_SAFE_INTEGER}var D=r(28598);let R="grid grid-cols-[minmax(0,180px)_minmax(0,1fr)] md:hidden",z="flex h-12 items-center px-0 py-0 text-tm14 text-t1 md:h-10 md:px-s2 md:text-c12";function B(e){return null===e?(0,n.jsx)(a.b,{className:"text-t3 size-3"}):"asc"===e?(0,n.jsx)(i.y,{className:"text-t3 size-3"}):(0,n.jsx)(i.y,{className:"text-t3 size-3",style:{transform:"rotate(180deg)"}})}function F(e){return[e||"",(0,D.oI)(e),(0,D.Hp)(e)].filter(Boolean)}let H=(0,T.memo)(function(e){let{alt:t,className:r,size:a,src:i}=e,[l,s]=(0,T.useState)(!1);return((0,T.useEffect)(()=>{s(!1)},[i]),!i||l)?(0,n.jsx)("div",{className:"bg-bg2 shrink-0 rounded-full ".concat(r||""),style:{height:a,width:a}}):(0,n.jsx)(C.Image,{src:i,alt:t,width:a,height:a,bucket:"res",className:r,onError:()=>s(!0)})});function V(e){let{activeField:t,align:r="left",children:a,className:i,direction:l,field:s,onSort:o}=e;return(0,n.jsx)("button",{type:"button",className:(0,v.cn)("flex h-9 w-full items-center px-0 py-0 text-cm12 text-t3 font-normal md:h-10 md:px-0","cursor-pointer select-none","right"===r?"justify-end text-right rtl:text-left":"justify-start text-left rtl:text-right",i),"aria-pressed":t===s&&null!==l,onClick:()=>o(s),children:(0,n.jsxs)("span",{className:(0,v.cn)("flex w-full items-center gap-[2px]","right"===r?"justify-end":"justify-start"),children:[(0,n.jsx)("span",{children:a}),B(t===s?l:null)]})})}function Z(){let{trigger:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{$t:t}=(0,g.B)(),r=(0,x.no)(),a=(0,j.k)(e=>e.user),i=(0,j.k)(e=>e.gotoLogin),C=!!(null==a?void 0:a.userId),{activeTab:_,contractGroupList:A,setActiveTab:Z,symbolsConfig:K}=(0,N.bZ)((0,k.k)(e=>({activeTab:e.activeTab,contractGroupList:e.contractGroupList,setActiveTab:e.setActiveTab,symbolsConfig:e.symbolsConfig}))),W=(0,P.T)(),{toggleSymbol:G}=(0,S.k)(),[J,$]=(0,T.useState)(!1),Y=(0,b.N1)(J?y.p.USDT.SIMPLE_TICKER_ALL():void 0)||[],X=(0,D.Hp)(W),ee=(0,D.kG)(W),et="2"!==_&&_?_:"All",er=(0,T.useMemo)(()=>{let e=Array.isArray(A)?A.filter(e=>e.groupCode):[];return e.some(e=>"All"===e.groupCode)?e:[{groupCode:"All",name:t("All")},...e]},[t,A]),en=(0,T.useMemo)(()=>{let e=[],t=new Map;return Y.forEach(e=>{F(e.symbol).forEach(r=>{t.has(r)||t.set(r,e)})}),K.forEach(r=>{let n=F(r.symbol).map(e=>t.get(e)).find(Boolean);n&&e.push({...r,...n,symbol:r.symbol,usdtVolume:(0,h.n7)(Number(n.volume)*Number(r.multiplier)*Number(n.last),2)})}),e},[K,Y]),{displayList:ea,handleSort:ei,search:el,setSearch:es,showTabs:eo,sort:ec}=function(e){let{allItems:t,activeTab:r="All"}=e,[n,a]=(0,T.useState)(""),[i,l]=(0,T.useState)(O),s=!!n,o=n.toUpperCase(),c=(0,T.useMemo)(()=>s?t:"All"===r||"2"===r?t:t.filter(e=>{var t;return null==(t=e.groupList)?void 0:t.some(e=>e.groupCode===r)}).sort((e,t)=>Q(e,r)-Q(t,r)),[r,t,s]);return{displayList:(0,T.useMemo)(()=>{var e=function(e,t){if(!t)return e;var r=q(e,t).concat(I(e,t)).concat(U(e,t)).concat(E(e,t)).concat(function(e,t){let r=q(e,t).concat(I(e,t)).concat(U(e,t)).concat(E(e,t)),n=e.filter(e=>(0,M.A2)(e.symbol).includes(t));return n.some(e=>r.find(t=>t.symbol===e.symbol))?[]:n}(e,t));let n=new Set;return r.reduce((e,t)=>(n.has(t.symbol)||(n.add(t.symbol),e.push(t)),e),[])}(c,o);if(!i.field||!i.direction)return e;let t=[...e];return"desc"===i.direction&&("symbol"===i.field&&t.sort((0,L.p)(i.field,"string")),"last"===i.field&&t.sort((0,L.p)(i.field)),"change"===i.field&&t.sort((0,L.p)(i.field)),"usdtVolume"===i.field&&t.sort((0,L.p)(i.field))),"asc"===i.direction&&("symbol"===i.field&&t.sort((0,L.F)(i.field,"string")),"last"===i.field&&t.sort((0,L.F)(i.field)),"change"===i.field&&t.sort((0,L.F)(i.field)),"usdtVolume"===i.field&&t.sort((0,L.F)(i.field))),t},[c,o,i]),handleSort:e=>{l(t=>t.field!==e?{field:e,direction:"asc"}:"asc"===t.direction?{field:e,direction:"desc"}:"desc"===t.direction?O:{field:e,direction:"asc"})},search:n,setSearch:a,showTabs:!s,sort:i}}({allItems:en,activeTab:et,isLogged:C}
1),ed=(0,T.useRef)(null),eu=(0,w.Te)({count:ea.length,getScrollElement:()=>ed.current,estimateSize:()=>48,overscan:8,initialRect:{height:r?720:617,width:r?393:440}}),em=J&&(0===K.length&&0===en.length||0===Y.length),ep=e=>{G(e.symbol)&&$(!1)},ex=null!=e?e:(0,n.jsxs)("button",{type:"button",className:(0,v.cn)("flex cursor-pointer items-center",r?"gap-s2":"-mt-3 gap-2 pt-3"),children:[ee?(0,n.jsx)(H,{src:ee,alt:W,size:r?20:24,className:"rounded-full"}):(0,n.jsx)("div",{className:(0,v.cn)("bg-bg5 rounded-full",r?"size-5":"size-6")}),r?(0,n.jsxs)("div",{className:"gap-s1 flex items-center",children:[(0,n.jsx)("span",{className:"text-t1 text-t16 whitespace-nowrap",children:X}),(0,n.jsx)("span",{className:"text-t3 text-m14 whitespace-nowrap",children:t("Demo")})]}):(0,n.jsx)("div",{className:"flex min-w-0 flex-col items-start",children:(0,n.jsxs)("div",{className:"gap-s1 flex min-w-0 items-center",children:[(0,n.jsx)("span",{className:"text-t1 text-b16 block truncate",children:X}),(0,n.jsx)("span",{className:"bg-bg2 text-t3 text-cm12 rounded-r1 px-1.5 py-0.5 font-medium whitespace-nowrap",children:t("Demo")}),(0,n.jsx)(l.C,{className:"text-t3 size-3 shrink-0"})]})})]}),eg=()=>(0,n.jsxs)("div",{className:"bg-m1 md:py-s4 relative flex min-h-0 flex-1 flex-col md:h-[var(--radix-popover-content-available-height)] md:bg-transparent",children:[em?(0,n.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,n.jsx)(o.t,{type:"global",size:"s"})}):null,(0,n.jsx)("div",{className:"px-s4",children:(0,n.jsx)(c.Input,{size:"s",value:el,onChange:e=>{es(e.target.value)},clearable:!0,onClear:()=>es(""),placeholder:r?t("Coin/Token/Symbol"):t("Symbol"),leftSlot:(0,n.jsx)(s.W,{className:"text-t4 h-4 w-4"}),wrapperClassName:"bg-bg2 h-9 rounded-r2 md:h-10"})}),eo&&er.length>0?(0,n.jsx)("div",{className:"scrollbar-none border-l1 mt-s2 flex h-9 w-full shrink-0 items-stretch gap-4 overflow-x-auto overflow-y-hidden border-b px-s4",children:er.map(e=>{let t=e.groupCode||"",r=et===t;return(0,n.jsx)("button",{type:"button",className:(0,v.cn)('text-c12 relative flex h-full shrink-0 cursor-pointer items-center leading-4 whitespace-nowrap after:absolute after:right-0 after:bottom-0 after:left-0 after:h-0.5 after:content-[""] md:text-b14',r?"text-t1 after:bg-t1 font-medium":"text-t3 after:bg-transparent"),onClick:()=>{Z(t)},children:(0,n.jsx)("span",{children:e.name||t})},t)})}):null,(0,n.jsxs)("div",{className:"mt-0 flex h-0 flex-1 flex-col",children:[(0,n.jsxs)("div",{className:"px-s4",children:[(0,n.jsxs)("div",{className:(0,v.cn)(R,"h-9 shrink-0 items-center"),role:"row",children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-center",children:[(0,n.jsx)(V,{field:"symbol",className:"!w-auto shrink-0",activeField:ec.field,direction:ec.direction,onSort:ei,children:t("Symbol")}),(0,n.jsx)("span",{className:"text-t5 mx-1 shrink-0",children:"/"}),(0,n.jsx)(V,{field:"usdtVolume",className:"!w-auto shrink-0",activeField:ec.field,direction:ec.direction,onSort:ei,children:t("24h Vol_2")})]}),(0,n.jsxs)("div",{className:"flex min-w-0 items-center justify-end",children:[(0,n.jsx)(V,{field:"last",align:"right",className:"!w-auto shrink-0",activeField:ec.field,direction:ec.direction,onSort:ei,children:t("Last Price")}),(0,n.jsx)("span",{className:"text-t5 mx-1 shrink-0",children:"/"}),(0,n.jsx)(V,{field:"change",align:"right",className:"!w-auto shrink-0",activeField:ec.field,direction:ec.direction,onSort:ei,children:t("Change")})]})]}),(0,n.jsxs)("div",{className:"hidden h-9 shrink-0 grid-cols-[minmax(0,1fr)_100px_80px] gap-4 md:grid",role:"row",children:[(0,n.jsxs)("div",{className:"text-cm12 text-t3 flex items-center font-normal",children:[(0,n.jsxs)("button",{type:"button",className:"flex h-full shrink-0 cursor-pointer items-center gap-[2px]","aria-pressed":"symbol"===ec.field&&null!==ec.direction,onClick:()=>ei("symbol"),children:[(0,n.jsx)("span",{children:t("Symbol")}),B("symbol"===ec.field?ec.direction:null)]}),(0,n.jsx)("span",{className:"text-t5 mx-[2px] shrink-0",children:"/"}),(0,n.jsxs)("button",{type:"button",className:"flex h-full shrink-0 cursor-pointer items-center gap-[2px]","aria-pressed":"usdtVolume"===ec.field&&null!==ec.direction,onClick:()=>ei("usdtVolume"),children:[(0,n.jsx)("span",{children:t("24h Vol_r_1")}),B("usdtVolume"===ec.field?ec.direction:null)]})]}),(0,n.jsx)(V,{field:"last",align:"right",className:"md:px-0",activeField:ec.field,direction:ec.direction,onSort:ei,children:t("Last Price")}),(0,n.jsx)(V,{field:"change",align:"right",className:"md:px-0",activeField:ec.field,direction:ec.direction,onSort:ei,children:t("Change")})]})]}),(0,n.jsx)(d.ScrollArea,{className:"min-h-0 flex-1",viewportRef:ed,children:ea.length?(0,n.jsx)("div",{children:(0,n.jsx)("div",{className:"text-bm14 relative w-full text-left",style:{height:eu.getTotalSize()},children:eu.getVirtualItems().map(e=>{let t=ea[e.index];if(!t)return null;let a=function(e){let t=String(e||"0"),r=Number(t.replace("%","")),n=t.includes("%")?r/100:r,a=n>0?"+":"",i=(0,f.BY)(n)||"--";return{className:n>0?"text-p2":n<0?"text-p3":"text-t3",text:"".concat(a).concat(i)}}(t.change),i=(0,D.oI)(t.symbol)||t.symbol,l=(0,D.kG)(i),s=(0,f.x0)(t.usdtVolume||0),o=(0,D.Hp)(t.symbol);return(0,n.jsx)("div",{className:"absolute top-0 left-0 w-full",style:{transform:"translateY(".concat(e.start,"px)")},children:r?(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>ep(t),onKeyDown:e=>
1{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),ep(t))},className:(0,v.cn)(R,"hover:bg-bg2 rounded-r3 px-s4 w-full cursor-pointer transition-colors"),children:[(0,n.jsx)("div",{className:(0,v.cn)(z,"rounded-l-r3 pr-3"),children:(0,n.jsxs)("div",{className:"flex min-w-0 items-start gap-1 md:gap-[6px]",children:[(0,n.jsx)(H,{src:l,alt:t.baseAsset||t.symbol,size:16,className:"shrink-0 rounded-full"}),(0,n.jsxs)("span",{className:"min-w-0",children:[(0,n.jsx)("span",{className:"text-tm12 text-t1 block truncate",children:o}),(0,n.jsx)("span",{className:"text-cm12 text-t3 block truncate md:hidden",children:s})]})]})}),(0,n.jsx)("div",{className:(0,v.cn)(z,"justify-end text-right rtl:text-left",a.className),children:(0,n.jsxs)("span",{className:"min-w-0",children:[(0,n.jsx)("span",{className:"text-mm12 text-t1 block truncate font-medium md:font-normal md:text-current",children:(0,f.iT)(t.last)||"--"}),(0,n.jsx)("span",{className:(0,v.cn)("text-cm12 block truncate md:hidden",a.className),children:a.text})]})})]}):(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>ep(t),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),ep(t))},className:(0,v.cn)("hidden md:grid md:grid-cols-[minmax(0,1fr)_100px_80px] md:gap-4","hover:bg-bg2 rounded-r3 px-s4 w-full cursor-pointer transition-colors"),children:[(0,n.jsx)("div",{className:"flex h-12 min-w-0 items-center",children:(0,n.jsxs)("div",{className:"flex min-w-0 items-start gap-1",children:[(0,n.jsx)(H,{src:l,alt:t.baseAsset||t.symbol,size:16,className:"shrink-0 rounded-full"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("span",{className:"text-tm12 text-t1 block truncate",children:o}),(0,n.jsx)("span",{className:"text-c12 text-t3 mt-[2px] flex min-w-0 items-center",children:(0,n.jsx)("span",{className:"block truncate",children:s})})]})]})}),(0,n.jsx)("div",{className:"text-c12 text-t1 flex h-12 items-center justify-end text-right rtl:text-left",children:(0,n.jsx)("span",{className:"block truncate",children:(0,f.iT)(t.last)||"--"})}),(0,n.jsx)("div",{className:(0,v.cn)("text-c12 flex h-12 items-center justify-end text-right rtl:text-left",a.className),children:(0,n.jsx)("span",{className:"block truncate",children:a.text})})]})},t.symbol)})})}):(0,n.jsxs)(u.Sv,{className:"mx-auto flex-none pt-[80px]",children:[(0,n.jsx)(u.HY,{size:"m",src:"https://cdn.tapbit.mobi/next-web/common/no-record.png",alt:"empty",className:"size-16"}),(0,n.jsx)(u.Ou,{className:"text-c12 mb-0",children:t("No result")})]})})]}),C?null:(0,n.jsxs)("div",{className:"text-b14 text-t3 mt-auto flex shrink-0 items-center justify-center py-[10px]",children:[(0,n.jsx)("span",{children:t("Log In")}),(0,n.jsx)("button",{type:"button",className:"text-p1 ml-[6px]",onClick:()=>i(),children:(0,n.jsx)("span",{dangerouslySetInnerHTML:{__html:t("<span>{0}</span> to view more",[""])}})})]})]});return r?(0,n.jsx)(m.Drawer,{trigger:ex,open:J,onOpenChange:$,direction:"bottom",title:(0,n.jsx)("span",{className:"text-t16 text-t1 font-semibold",children:t("Markets")}),className:'bg-m1 rounded-t-r5 border-l1 [&[data-vaul-drawer-direction="bottom"]]:h-[90dvh] [&[data-vaul-drawer-direction="bottom"]]:max-h-[90dvh]',headerClassName:"px-4 pt-4 pb-4",bodyClassName:"flex min-h-0 flex-1 flex-col overflow-hidden p-0",footer:!1,children:eg()}):(0,n.jsxs)(p.Popover,{trigger:"hover",open:J,onOpenChange:$,children:[(0,n.jsx)(p.PopoverTrigger,{asChild:!0,children:ex}),(0,n.jsx)(p.PopoverContent,{showArrow:!1,side:"bottom",align:"start",alignOffset:-16,avoidCollisions:!1,className:"border-bg6 bg-m3 rounded-r4 w-[440px] p-0",onOpenAutoFocus:e=>e.preventDefault(),children:eg()})]})}},16591:(e,t,r)=>{r.d(t,{f:()=>x});
1var n=r(26212),a=r(41760),i=r(96620),l=r(52293),s=r(13288),o=r(38113),c=r(2639),d=r(90604),u=r(22354),m=r(21219),p=r(97430);function x(e){let{symbol:t,panelHeight:r,centerHeight:x,rowHeight:g,dualSideFallbackRows:h,singleSideFallbackRows:b,reservedHeight:y=0,roundMode:f="floor"}=e,v=(0,m.T)(),N=t||v,j=(0,c.J)(e=>e.orderBookView),C=(0,c.J)(e=>e.mergedPrec),w=(0,u.yx)(e=>e.items),T=function(){let e=(0,d.T)(e=>e.actions.onNumberFieldChange),t=(0,d.T)(e=>e.actions.onQuantityModeChange);return(0,o.useMemo)(()=>r=>{let{price:n,quantity:a}=r;n&&(e("orderPrice")(String(n)),void 0!==a&&(t("quantity"),e("quantity")(String(a))))},[e,t])}(),{unit:k}=(0,p.A)({symbol:N}),P=(0,l.bZ)(e=>{var t;return null==(t=e.symbolsConfigBySymbol[N])?void 0:t.precision}),S="buy"!==j,L="sell"!==j,M=S&&L?h:b,O=(0,a.pj)(i.p.USDT.ORDER_BOOK(N))||{asks:[],bids:[]},_=n.UP.getConfig(N),A=null!=P?P:null==_?void 0:_.precision,I=C[N],q=(0,s.g$)(O.asks,"ask",A,I),U=(0,s.g$)(O.bids,"bid",A,I),E=w.filter(e=>e.symbol===N),{newAsks:Q,newBids:D}=(0,s.YI)(q,U,E,A,I),R=(0,s.Lu)(D.slice(0,20)),z=(0,s.Lu)(Q.slice(-20)),B=Number(R)?Number((100*R/(R+z)).toFixed(0)):0,F=Number(z)?100-Number(B):0,H=function(e){let{panelHeight:t,centerHeight:r,rowHeight:n,dualSide:a,fallbackRows:i,reservedHeight:l=0,roundMode:s="floor"}=e;if(t<=0)return i;let o=Math.max(t-r-l,0);return Math.max(("ceil"===s?Math.ceil:Math.floor)((a?o/2:o)/n),1)}({panelHeight:r,centerHeight:x,rowHeight:g,dualSide:S&&L,fallbackRows:M,reservedHeight:y,roundMode:f}),V=(0,o.useMemo)(()=>S?Q.slice(-H).map(e=>({...e,side:"sell"})):[],[Q,S,H]),Z=(0,o.useMemo)(()=>L?D.slice(0,H).map(e=>({...e,side:"buy"})):[],[D,L,H]),K=(0,o.useMemo)(()=>Math.max(0,...[...Z,...V].map(e=>Number(e.quantity)||0)),[V,Z]);return{symbol:N,orderBookView:j,showAskList:S,showBidList:L,unit:k,buyRatio:B,sellRatio:F,visibleRows:H,visibleAskList:V,visibleBidList:Z,max:K,handleDepthFill:T}}},17305:(e,t,r)=>{r.d(t,{d:()=>n});function n(e){let t=Math.max(1,Number(e.pageNum)||1),r=Math.max(0,Number(e.pageSize)||0),n=Math.max(0,Number(e.currentSize)||0),a=r>0&&n>=r;return{hasNextPage:a,shouldShowPagination:t>1||n>0&&a}}},17449:(e,t,r)=>{r.d(t,{p:()=>i});var n=r(79237),a=r(90477);function i(e){let{title:t,description:r,className:i,bodyClassName:l,children:s,rightSlot:o}=e,c=!!(t||r||o);return(0,n.jsxs)("section",{className:(0,a.cn)("bg-bg7 overflow-hidden rounded-md",i),children:[c?(0,n.jsxs)("div",{className:"flex items-start justify-between gap-3 px-4 py-3",children:[(0,n.jsxs)("div",{className:"min-w-0",children:[t?(0,n.jsx)("p",{className:"text-m14 text-t1",children:t}):null,r?(0,n.jsx)("p",{className:"text-c11 text-t3 mt-1",children:r}):null]}),o?(0,n.jsx)("div",{className:"shrink-0",children:o}):null]}):null,(0,n.jsx)("div",{className:(0,a.cn)(l),children:s})]})}},19019:(e,t,r)=>{r.d(t,{M:()=>o});var n=r(47387),a=r(41809),i=r(25749),l=r(54327);let s={orderTypeMenuOpen:!1,plansNeverRemind:!!n.Nm.get("plansNeverRemind")},o=(0,a.v)(e=>({...s,setOrderTypeMenuOpen:t=>e(e=>({orderTypeMenuOpen:"function"==typeof t?t(e.orderTypeMenuOpen):t})),setPlansNeverRemind:t=>{n.Nm.set({plansNeverRemind:t}),e({plansNeverRemind:t})},resetUi:()=>{[l.k.PlaceOrderSettings,l.k.PlaceOrderTpslAdvanced,l.k.PlaceOrderDifference,l.k.PlaceOrderConfirm,l.k.PlaceTriggerOrdersNotice].forEach(e=>(0,i.wZ)(e)),e({...s,plansNeverRemind:!!n.Nm.get("plansNeverRemind")})}}))},19024:(e,t,r)=>{r.d(t,{C:()=>c});var n=r(66960),a=r(55723),i=r(51025),l=r(4390),s=r(38113),o=r(76656);function c(){var e;let{locale:t}=(0,n.B)(),{user:r,gotoLogin:c}=(0,i.k)((0,o.k)(e=>({user:e.user,gotoLogin:e.gotoLogin}))),d=!!(null==r?void 0:r.userId),[u,m]=(0,s.useState)({}),{data:p,refetch:x}=(0,l.useQuery)({queryKey:["futures-symbol-search-favorites",t,null!=(e=null==r?void 0:r.userId)?e:0],queryFn:()=>(0,a.rs)({locale:t,params:{pageNum:1,pageSize:100}}),enabled:d,staleTime:3e4}),g=(null==p?void 0:p.data)||[],h=(0,s.useMemo)(()=>new Set(g.map(e=>e.tradePair)),[g]),b=(0,s.useCallback)(e=>h.has(e),[h]),y=(0,s.useCallback)(async(e,t)=>{if(!d)return void c();if(e&&!u[e]){m(t=>({...t,[e]:!0}));try{let r=await (0,a.dw)({tradePair:e,type:t?2:1,bizType:1});(null==r?void 0:r.code)===200&&await x()}catch(e){console.error("Unhandled async action error",e)}finally{m(t=>({...t,[e]:!1}))}}},[u,c,d,x]);return{favoriteList:g,favoriteLoading:u,favoriteSet:h,gotoLogin:c,isLogged:d,isSymbolFavorite:b,toggleSymbolFavorite:y}}},19698:(e,t,r)=>{r.d(t,{k:()=>g});var n=r(79237),a=r(66960),i=r(82410),l=r(38113),s=r(37563),o=r(72644),c=r(95496),d=r(84605),u=r(22675);function m(e){return Number(e||0)}function p(e){return e?void 0!==e.waitTriggerCount&&null!==e.waitTriggerCount?m(e.waitTriggerCount):m(e.total):0}var x=r(43129);function g(e){let{className:t,listClassName:r,triggerClassName:g}=e,{$t:h,locale:b}=(0,a.B)(),y=function(){var e;let t=(0,c.yx)(e=>e.pagination),r=(0,u.a5)(e=>e.pagination),n=(0,d.hv)(e=>e.pagination),a=(0,o.rr)(),i=(0,s._t)();return{contract:{positions:m((e={positionsTotal:a,currentOrdersTotal:t.total,triggerOrders:r,tpslOrders:n,copyTradeTotal:i.total}).positionsTotal),openOrders:m(e.currentOrdersTotal),triggerOrders:p(e.triggerOrders),tpsl:p(e.tpslOrders),copyTrade:m(e.copyTradeTotal)},grid:{running:m(e.gridRunningTotal),history:m(e.gridHistoryTotal)}}}(),f=(0,s._t)(),v=(0,x.J)(e=>e.activeContractTab),N=(0,x.J)(e=>e.setActiveContractTab),j=(0,l.useMemo)(()=>{let e=[{key:"positions",label:(0,i.V)(h("Positions_1"),y.contract.positions)},{key:"openOrders",label:(0,i.V)(h("Open Orders_r_1"),y.contract.openOrders)},{key:"triggerOrders",label:(0,i.V)(h("Trigger Orders_1_r_1"),y.contract.triggerOrders)},{key:"ordersHistory",label:h("Orders History")},{key:"tpsl",label:(0,i.V)(h("TP/SL"),y.contract.tpsl)},{key:"transactionHistory",label:h("Transaction History")}];return(f.role||"copyTrade"===v)&&e.push({key:"copyTrade",label:(0,i.V)("trader"===f.role?h("Leading Trade"):h("Copy Trade"),y.contract.copyTrade)}),e},[h,v,f.role,y]);return(0,n.jsx)(i.Z,{activeTab:v,items:j,onActiveTabChange:N,locale:b,className:t,listClassName:r,triggerClassName:g})}},20757:(e,t,r)=>{r.d(t,{I:()=>ei});var n=r(79237),a=r(24626),i=r(13603),l=r(66960),s=r(19490),o=r(90477),c=r(39824),d=r
1(38113),u=r(76656),m=r(92413),p=r(72219),x=r(41760),g=r(96620),h=r(65093),b=r(51025),y=r(17305),f=r(4390),v=r(59475),N=r(82352),j=r(95041),C=r(90877);function w(e,t){return null==e||""===String(e).trim()?t:String(e)}function T(e){var t,r,n;let{locale:a}=(0,l.B)(),i=(0,b.k)((0,u.k)(e=>{var t,r;return{isLogged:!!(null==(t=e.user)?void 0:t.userId),userId:null==(r=e.user)?void 0:r.userId,userReady:!!e.userLoadFromStorage}})),s=Math.max(1,Number(null==e?void 0:e.pageNum)||1),o=Math.max(1,Number(null==e?void 0:e.pageSize)||50),c=(null==e||null==(t=e.symbol)?void 0:t.trim())||void 0,m=(0,C.$)(),{data:p}=(0,N.pD)(),w=(0,x.N1)(g.p.USDT.USER_POSITION()),T=null==w?void 0:w.all,S=null!=(n=null==p||null==(r=p.data)?void 0:r.positions)?n:[],L=(0,j.n9)({positionSwitch:m,restPositions:S,wsPositions:T}),M=(0,f.useQuery)({queryKey:["core-grid-running-strategies",a,i.userId,s,o,c],queryFn:()=>(0,h.Jr)({locale:a,params:{userId:i.userId,pageNum:s,pageSize:o,symbol:c}}),enabled:!!(i.userReady&&i.isLogged&&i.userId),placeholderData:v.rX,staleTime:0,retry:!1,refetchInterval:!!i.userReady&&!!i.isLogged&&!!i.userId&&5e3}),O=(0,d.useMemo)(()=>{var e,t,r=(null==(e=M.data)?void 0:e.code)===200?null==(t=M.data.data)?void 0:t.list:void 0;let n=new Map;return(Array.isArray(L)?L:[]).forEach(e=>{!(null==e?void 0:e.symbol)||n.has(e.symbol)||n.set(e.symbol,e)}),(Array.isArray(r)?r:[]).map(e=>{var t;let r=e.contract?n.get(e.contract):void 0,a=(t=k(e.pnl)+k(null==r?void 0:r.unrealisedPnlLatest),Number.isFinite(t)?t.toFixed(2):"0.00"),i=k(e.margin);return{...e,hasPosition:!!(null==r?void 0:r.symbol),liquidationPrice:P(null==r?void 0:r.liquidationPrice),roeLatest:P(null==r?void 0:r.roeLatest),totalPnl:a,totalPnlRate:i>0?String(Number(a)/i):"0",unrealisedPnlLatest:P(null==r?void 0:r.unrealisedPnlLatest)}})},[L,M.data]),_=(0,y.d)({pageNum:s,pageSize:o,currentSize:O.length});return{hasNextPage:_.hasNextPage,isLoading:!!(i.userReady&&i.isLogged&&M.isPending&&0===O.length),items:O,pageNum:s,pageSize:o,shouldShowPagination:_.shouldShowPagination}}function k(e){let t=Number(e);return Number.isFinite(t)?t:0}function P(e){if(null!=e&&""!==String(e).trim())return String(e)}var S=r(43129),L=r(62309),M=r(70659),O=r(85002),_=r(24983),A=r(81742),I=r(18746),q=r(81407),U=r(66249),E=r(68924),Q=r(46540),D=r(3529);let R="text-c12 text-t3 font-normal whitespace-nowrap",z="text-c12 text-t1 leading-4 whitespace-nowrap",B="[&_thead_th]:h-8 [&_thead_th]:px-2 [&_thead_th]:py-0 [&_tbody_tr]:!h-14 [&_tbody_td]:h-14 [&_tbody_td]:px-2 [&_tbody_td]:py-0",F="h-full min-h-0 !border-0 !rounded-none bg-transparent [scrollbar-color:var(--color-bg6)_transparent] [scrollbar-width:thin] [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-bg6 [&::-webkit-scrollbar-thumb:hover]:bg-gradient-to-r [&::-webkit-scrollbar-thumb:hover]:from-bg2 [&::-webkit-scrollbar-thumb:hover]:to-bg6 [&::-webkit-scrollbar-track]:bg-transparent",H="text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",V="text-cm12 text-t1 flex-1 [&_span]:!text-cm12",Z="[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-divider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0";function K(e){return(0,D.A2)(e||"","")||"--"}function W(e){return"LONG"===e?"bg-p2":"SHORT"===e?"bg-p3":"bg-p4"}function G(e){let t=Number(e);return Number.isFinite(t)&&0!==t?t>0?"text-p2":"text-p3":"text-t1"}function J(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--";if(null==e||""===String(e).trim())return t;let r=(0,s.BY)(e);return r?"(".concat(r,")"):t}function $(e){let{value:t,className:r=z}=e,a=Number(t);if(!Number.isFinite(a))return(0,n.jsx)("span",{className:r,children:"0"});if(a<1e5)return(0,n.jsx)("span",{className:r,children:(0,s.iT)(a)});let i=a>1e5?"".concat((0,s.iT)(1e5),"+"):(0,s.iT)(a);return(0,n.jsx)(Q.Tooltip,{content:(0,n.jsx)("span",{className:"text-c12 leading-[16
1px]",children:(0,s.iT)(a)}),side:"top",children:(0,n.jsx)("span",{className:"".concat(r," cursor-help"),children:i})})}function Y(e){return(0,n.jsx)(Q.Tooltip,{content:(0,n.jsx)("span",{className:"text-c12 leading-[16px]",children:e.content}),side:"top",children:(0,n.jsx)("span",{className:"border-l1 inline-flex cursor-help items-center border-b border-dashed leading-none",children:e.label})})}var X=r(2621);function ee(e){return{slot:"item",labelClassName:H,valueClassName:(0,o.cn)(V,e)}}function et(e){let{mode:t="pc"}=e,{$t:r,locale:a}=(0,l.B)(),{theme:i}=(0,A.W)(),s="h5"===t,c=(0,m.T)(),p=(0,S.J)(e=>e.gridHideOtherMap.history),[x,g]=(0,d.useState)(1),[N,j]=(0,d.useState)(null),C=(0,d.useMemo)(()=>({endType:{MANUAL:r("Manual"),STOP_TRIGGER:r("Stop Trigger"),TAKE_PROFIT_RATE:r("TP"),STOP_LOSS_RATE:r("SL"),LIQUIDATION:r("System Stop"),ORDER_FAIL:r("System Stop"),USER_OPERATION:r("Manual")},marginMode:{crossed:r("Cross"),fixed:r("Isolated")}}),[r]),T=p?c:void 0,{hasNextPage:k,isLoading:P,items:Q,shouldShowPagination:D}=function(e){var t;let{locale:r}=(0,l.B)(),n=(0,b.k)((0,u.k)(e=>{var t,r;return{isLogged:!!(null==(t=e.user)?void 0:t.userId),userId:null==(r=e.user)?void 0:r.userId,userReady:!!e.userLoadFromStorage}})),a=Math.max(1,Number(null==e?void 0:e.pageNum)||1),i=Math.max(1,Number(null==e?void 0:e.pageSize)||50),s=(null==e||null==(t=e.symbol)?void 0:t.trim())||void 0,o=(0,f.useQuery)({queryKey:["core-grid-history-strategies",r,n.userId,a,i,s],queryFn:()=>(0,h.o7)({locale:r,params:{userId:n.userId,pageNum:a,pageSize:i,symbol:s}}),enabled:!!(n.userReady&&n.isLogged&&n.userId),placeholderData:v.rX,staleTime:0,retry:!1,refetchInterval:!!n.userReady&&!!n.isLogged&&!!n.userId&&5e3}),c=(0,d.useMemo)(()=>{var e,t,r;return(Array.isArray(r=(null==(e=o.data)?void 0:e.code)===200?null==(t=o.data.data)?void 0:t.list:void 0)?r:[]).map(e=>({...e,profit:w(e.profit,"0.00"),profitRate:w(e.profitRate,"0")}))},[o.data]),m=(0,y.d)({pageNum:a,pageSize:i,currentSize:c.length});return{hasNextPage:m.hasNextPage,isLoading:!!(n.userReady&&n.isLogged&&o.isPending&&0===c.length),items:c,pageNum:a,pageSize:i,shouldShowPagination:m.shouldShowPagination}}({pageNum:x,pageSize:50,symbol:T}),H="light"===i?"light":"dark";(0,d.useEffect)(()=>{g(1)},[T]);let V=(0,d.useMemo)(()=>[{title:(0,n.jsx)("span",{className:R,children:r("Symbol")}),key:"contract",render:(e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:(0,o.cn)("block h-5 w-1 shrink-0 rounded-full",W(t.direction))}),(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-1",children:[(0,n.jsx)("div",{className:"text-m12 text-t1 truncate",children:K(t.contract)}),(0,n.jsxs)("div",{className:"text-c12 text-t3 shrink-0",children:[(0,q.Tz)(t.marginMode,C.marginMode)," ",(0,q.Uy)(t.leverage)]})]})]}),mobile:{slot:"header",label:(e,t)=>(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{className:(0,o.cn)("block h-4 w-1 shrink-0 rounded-full",W(t.direction))}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,n.jsx)("span",{className:"text-tm14 text-t1 truncate",children:K(t.contract)}),(0,n.jsxs)("span",{className:"text-cm12 text-t3 truncate",children:[(0,q.Tz)(t.marginMode,C.marginMode)," ",(0,q.Uy)(t.leverage)]})]})]}),labelClassName:"min-w-0 flex-1"}},{title:(0,n.jsx)("span",{className:R,children:r("Start Time")}),key:"startTime",render:(e,t)=>(0,n.jsx)("span",{className:z,children:(0,q.r6)(t.startTime)}),mobile:ee()},{title:(0,n.jsx)("span",{className:R,children:r("End Time")}),key:"endTime",render:(e,t)=>(0,n.jsx)("span",{className:z,children:(0,q.r6)(t.endTime)}),mobile:ee()},{title:(0,n.jsx)("span",{className:R,children:r("Initial Margin")}),key:"margin",render:(e,t)=>(0,n.jsx)("span",{className:z,children:(0,q.ac)(t.margin)}),mobile:ee()},{title:Y({label:r("Total PNL"),content:r("Total PNL= Realized PNL+ Unrealized PNL(exclude funding fee)")}),key:"totalPnl",render:(e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:(0,o.cn)(z,G(t.profit)),children:(0,q.ac)(t.profit)}),(0,n.jsx)("span",{className:(0,o.cn)("text-c12 whitespace-nowrap",G(t.profitRate)),children:J(t.profitRate)}),(0,n.jsx)("button",{type:"button","aria-label":r("Share with Friends"),onClick:()=>j((0,X.a)({variant:"history",item:{...t,totalPnl:t.profit,totalPnlRate:t.profitRate},$t:r,locale:a,origin:window.location.origin,theme:H})),className:"text-t3 hover:text-t1 flex h-6 w-6 items-center justify-center rounded-none",children:(0,n.jsx)(L.l,{className:"size-3.5"})})]}),mobile:ee()},{title:(0,n.jsx)("span",{className:R,children:r("Price Range")}),key:"priceRange",render:(e,t)=>(0,n.jsx)("span",{className:z,children:"".concat((0,q.ac)(t.lowerPrice),"-").concat((0,q.ac)(t.upperPrice))}),mobile:ee()},{title:(0,n.jsx)("span",{className:R,children:r("Grid Qty")}),key:"gridCount",render:(e,t)=>(0,n.jsx)("span",{className:z,children:(0,q.ac)(t.gridCount)}),mobile:ee()},{title:(0,n.jsx)("span",{className:R,children:r("Arbitrage")}),key:"matchedCount",render:(e,t)=>(0,n.jsx)("span",{className:z,children:(0,q.ac)(t.matchedCount)}),mobile:ee()},{title:(0,n.jsx)("span",{className:R,children:r("Status")}),key:"endType",render:(e,t)=>(0,n.jsx)("span",{className:z,children:(0,q.Tz)(t.endType,C.endType)}),mobile:ee()},{title:(0,n.jsx)("span",{className:"".concat(R," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",render:(e,t)=>(0,n.jsx)("div",{className:"flex justify-end",children:(0,n.jsx)("button",{type:"button",onClick:()=>
1{t.id&&(0,E.Kg)(a,t.id)},className:"text-p1-dark text-m12 hover:text-p1/80",children:r("Detail")})}),mobile:{slot:"actions",label:null,value:(e,t)=>(0,n.jsx)(M.$,{type:"button",variant:"secondary",size:"s",disabled:!t.id,className:"rounded-rb1 text-mm12 h-8 w-full px-3",onClick:()=>{t.id&&(0,E.Kg)(a,t.id)},children:r("Detail")}),valueClassName:"w-full"}}],[r,C,a,H]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col pt-2",children:[(0,n.jsx)(O.AdvancedTable,{columns:V,dataSource:Q,locale:a,rowKey:"id",loading:P,className:s?Z:U.hL,outlined:!1,containerClassName:s?void 0:F,fixedCellClassName:s?void 0:U.dA,tableClassName:s?void 0:B,pagination:!1,responsive:s,mobileMode:s?"card":"table",mobileCardClassName:s?"bg-bg7":void 0}),D?(0,n.jsx)("div",{className:(0,o.cn)("py-s3 flex",s?"justify-center px-4":"justify-end px-2"),children:(0,n.jsxs)(_.Pagination,{variant:"number",children:[(0,n.jsx)(_.PaginationItem,{type:"button",icon:"first",disabled:P||1===x,onClick:()=>{P||1===x||g(1)}}),(0,n.jsx)(_.PaginationItem,{type:"button",icon:"prev",disabled:P||1===x,onClick:()=>{P||1===x||g(Math.max(1,x-1))}}),(0,n.jsx)(_.PaginationItem,{type:"number",active:!0,children:x}),(0,n.jsx)(_.PaginationItem,{type:"button",icon:"next",disabled:P||!k,onClick:()=>{!P&&k&&g(x+1)}})]})}):null]}),N?(0,n.jsx)(I.A,{config:N,onClose:()=>{j(null)}}):null]})}var er=r(50791);function en(e){return{slot:"item",labelClassName:H,valueClassName:(0,o.cn)(V,e)}}function ea(e){let{mode:t="pc"}=e,{$t:r,locale:a}=(0,l.B)(),{theme:i}=(0,A.W)(),s="h5"===t,c=(0,er.og)(),u=(0,m.T)(),p=(0,S.J)(e=>e.gridHideOtherMap.running),[x,g]=(0,d.useState)(1),[h,b]=(0,d.useState)(null),y=(0,d.useMemo)(()=>({direction:{LONG:r("Long"),SHORT:r("Short"),NEUTRAL:r("Neutral")},marginMode:{crossed:r("Cross"),fixed:r("Isolated")},status:{TO_TRIGGER:r("Awaiting"),INIT:r("Running"),RUNNING:r("Running"),TO_END:r("Running"),ENDED:r("End")}}),[r]),f=p?u:void 0,{hasNextPage:v,isLoading:N,items:j,shouldShowPagination:C}=T({pageNum:x,pageSize:50,symbol:f}),w="light"===i?"light":"dark";(0,d.useEffect)(()=>{g(1)},[f]);let k=e=>{c.showLayer({item:e})},P=(0,d.useMemo)(()=>[{title:(0,n.jsx)("span",{className:R,children:r("Symbol")}),key:"contract",render:(e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:(0,o.cn)("block h-5 w-1 shrink-0 rounded-full",W(t.direction))}),(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-1",children:[(0,n.jsx)("div",{className:"text-m12 text-t1 truncate",children:K(t.contract)}),(0,n.jsxs)("div",{className:"text-c12 text-t3 shrink-0",children:[(0,q.Tz)(t.marginMode,y.marginMode)," ",(0,q.Uy)(t.leverage)]})]})]}),mobile:{slot:"header",label:(e,t)=>(0,n.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{className:(0,o.cn)("block h-4 w-1 shrink-0 rounded-full",W(t.direction))}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,n.jsx)("span",{className:"text-tm14 text-t1 truncate",children:K(t.contract)}),(0,n.jsxs)("span",{className:"text-cm12 text-t3 truncate",children:[(0,q.Tz)(t.marginMode,y.marginMode)," ",(0,q.Uy)(t.leverage)]})]})]}),labelClassName:"min-w-0 flex-1"}},{title:(0,n.jsx)("span",{className:R,children:r("Start Time")}),key:"startTime",render:(e,t)=>(0,n.jsx)("span",{className:z,children:(0,q.r6)(t.startTime)}),mobile:en()},{title:(0,n.jsx)("span",{className:R,children:r("Initial Margin")}),key:"margin",render:(e,t)=>(0,n.jsx)("span",{className:z,children:(0,q.ac)(t.margin)}),mobile:en()},{title:(0,n.jsx)("span",{className:R,children:r("Price Range")}),key:"priceRange",render:(e,t)=>(0,n.jsx)("span",{className:z,children:"".concat((0,q.ac)(t.lowerPrice),"-").concat((0,q.ac)(t.upperPrice))}),mobile:en()},{title:Y({label:r("Total PNL"),content:r("Total PNL= Realized PNL+ Unrealized PNL(exclude funding fee)")}),key:"totalPnl",render:(e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:(0,o.cn)(z,G(t.totalPnl)),children:(0,q.ac)(t.totalPnl)}),(0,n.jsx)("span",{className:(0,o.cn)("text-c12 whitespace-nowrap",G(t.totalPnlRate)),children:J(t.totalPnlRate,"(--)")}),(0,n.jsx)("button",{type:"button","aria-label":r("Share with Friends"),onClick:()=>b((0,X.a)({variant:"running",item:t,$t:r,locale:a,origin:window.location.origin,theme:w})),className:"text-t3 hover:text-t1 flex h-6 w-6 items-center justify-center rounded-none",children:(0,n.jsx)(L.l,{className:"size-3.5"})})]}),mobile:en()},{title:Y({label:r("Realized PNL"),content:r("Total realized profit and loss of all positions+Trading Fee (exclude funding fee)")}),key:"pnl",render:(e,t)=>(0,n.jsx)("span",{className:(0,o.cn)(z,G(t.pnl)),children:(0,q.ac)(t.pnl)}),mobile:en()},{title:Y({label:r("Unrealized PNL"),content:r("The unrealized profit of open positions, calculated based on the difference between the last price and the entry price of positions.")}),key:"unrealisedPnlLatest",render:(e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)("span",{className:(0,o.cn)(z,G(t.unrealisedPnlLatest)),children:(0,q.ac)(t.unrealisedPnlLatest,"")}),(0,n.jsx)("span",{className:(0,o.cn)("text-c12 whitespace-nowrap",G(t.roeLatest)),children:J(t.roeLatest,"(--)")})]}),mobile:en()},{title:(0,n.jsx)("span",{className:R,children:r("Liq Price")}),key:"liquidationPrice",render:(e,t)=>(0,n.jsx)($,{value:t.liquidationPrice}),mobile:en()},{title:(0,n.jsx)("span",{className:R,children:r("Status")}),key:"status",render:(e,t)=>(0,n.jsx)("span",{className:z,children:(0,q.Tz)(t.status,y.status)}),mobile:en()},{title:(0,n.jsx)("span",{className:"".concat(R," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",render:(e,t)=>(0,n.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,n.jsx)("button",{type:"button",disabled:!t.id,onClick:()=>k(t),className:"text-p1-dark text-m12 hover:text-p1/80 disabled:cursor-not-allowed disabled:opacity-40",children:r("Stop")}),(0,n.jsx)("button",{type:"button",onClick:()=>
1{t.id&&(0,E.Kg)(a,t.id)},className:"text-p1-dark text-m12 hover:text-p1/80",children:r("Detail")})]}),mobile:{slot:"actions",label:null,value:(e,t)=>(0,n.jsxs)("div",{className:"grid w-full grid-cols-2 gap-2",children:[(0,n.jsx)(M.$,{type:"button",variant:"secondary",size:"s",disabled:!t.id,className:"rounded-rb1 text-mm12 h-8 w-full px-3",onClick:()=>k(t),children:r("Stop")}),(0,n.jsx)(M.$,{type:"button",variant:"secondary",size:"s",disabled:!t.id,className:"rounded-rb1 text-mm12 h-8 w-full px-3",onClick:()=>{t.id&&(0,E.Kg)(a,t.id)},children:r("Detail")})]}),valueClassName:"w-full"}}],[r,y,a,w]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col pt-2",children:[(0,n.jsx)(O.AdvancedTable,{columns:P,dataSource:j,locale:a,rowKey:"id",loading:N,className:s?Z:U.hL,outlined:!1,containerClassName:s?void 0:F,fixedCellClassName:s?void 0:U.dA,tableClassName:s?void 0:B,pagination:!1,responsive:s,mobileMode:s?"card":"table",mobileCardClassName:s?"bg-bg7":void 0}),C?(0,n.jsx)("div",{className:(0,o.cn)("py-s3 flex",s?"justify-center px-4":"justify-end px-2"),children:(0,n.jsxs)(_.Pagination,{variant:"number",children:[(0,n.jsx)(_.PaginationItem,{type:"button",icon:"first",disabled:N||1===x,onClick:()=>{N||1===x||g(1)}}),(0,n.jsx)(_.PaginationItem,{type:"button",icon:"prev",disabled:N||1===x,onClick:()=>{N||1===x||g(Math.max(1,x-1))}}),(0,n.jsx)(_.PaginationItem,{type:"number",active:!0,children:x}),(0,n.jsx)(_.PaginationItem,{type:"button",icon:"next",disabled:N||!v,onClick:()=>{!N&&v&&g(x+1)}})]})}):null]}),h?(0,n.jsx)(I.A,{config:h,onClose:()=>{b(null)}}):null]})}function ei(e){var t;let{mode:r="pc"}=e,{$t:x}=(0,l.B)(),g="h5"===r,h=(0,p.Z)(),b=(0,m.T)(),{activeTab:y,gridHideOtherMap:f,setActiveTab:v,setGridHideOther:N}=(0,S.J)((0,u.k)(e=>({activeTab:e.activeGridTab,gridHideOtherMap:e.gridHideOtherMap,setActiveTab:e.setActiveGridTab,setGridHideOther:e.setGridHideOther}))),j=null!=(t=f[y])&&t,C=!!h.isLogged&&j,{items:w}=T({pageNum:1,pageSize:50,symbol:f.running?b:void 0}),k=w.length,P=(0,d.useMemo)(()=>{var e;return[{key:"running",label:(e=x("Running"),void 0===k?e:"".concat(e," ").concat((0,s.YH)(k)))},{key:"history",label:x("History")}]},[x,k]);return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsxs)("div",{className:(0,o.cn)("flex justify-between",g?"min-h-10 items-center px-4":"border-l1 dark:border-l3 min-h-10 items-stretch border-b"),children:[(0,n.jsx)(i.Tabs,{value:y,onValueChange:e=>v(e),variant:"text",size:"s",className:(0,o.cn)("min-w-0 flex-1",!g&&"h-full [&>div]:h-full [&>div]:!border-b-0 [&>div>[data-slot=scroll-area]]:h-full"),children:(0,n.jsx)(i.TabsList,{className:(0,o.cn)("w-full justify-start bg-transparent",g?"h-auto gap-4 overflow-x-auto px-0":"h-full gap-5 px-4"),scrollGradientClass:"to-bg7",scrollArrowBgClass:"bg-bg7",children:P.map(e=>(0,n.jsx)(i.TabsTrigger,{value:e.key,className:(0,o.cn)("rounded-none whitespace-nowrap px-0 !text-m14 text-t3 data-[state=active]:!text-t1 focus-visible:ring-0 focus-visible:ring-offset-0",g&&"!text-mm14 data-[state=active]:!text-tm14"),children:e.label},e.key))})}),(0,n.jsx)("div",{className:"hidden shrink-0 items-center pr-4 pl-6 md:flex",children:(0,n.jsxs)(a.Checkbox.Label,{className:"gap-1",children:[(0,n.jsx)(a.Checkbox.Control,{checked:C,onCheckedChange:e=>{if(!h.isLogged)return void h.gotoLogin();N(y,!0===e)}}),(0,n.jsx)(a.Checkbox.Text,{className:"text-c12 text-t3 whitespace-nowrap",children:x("Hide Other Symbols")})]})})]}),(0,n.jsx)("div",{className:"min-h-0 flex-1",children:(0,n.jsxs)(c.E,{...h,children:["running"===y&&(0,n.jsx)(ea,{mode:r},"running-".concat(String(j))),"history"===y&&(0,n.jsx)(et,{mode:r},"history-".concat(String(j)))]})})]})}},23209:(e,t,r)=>{r.d(t,{Y:()=>n});function n(e){return{direction:{openLong:e("Open Long_2"),openShort:e("Open Short_2"),closeLong:e("Close Long_2"),closeShort:e("Close Short_2")},limitOrderType:{takeProfit:e("Limit TP"),stopLoss:e("Limit SL")},marketOrderType:{takeProfit:e("Market TP"),stopLoss:e("Market SL")},mode:{fixed:e("Isolated"),crossed:e("Cross"),separated:e("Split")},orderType:{limit:e("Limit"),market:e("Market"),planMarket:e("Stop Market"),liquidation:e("Liquidation"),adl:e("ADL_2"),planLimit:e("Stop Limit"),postOnly:e("Post Only"),fok:e("Fill or Kill"),ioc:e("Immediate or Cancel")},orderStatus:{new:e("Untriggered"),filled:e("Filled_r_1"),partiallyFilled:e("Partial Filled"),partiallyCanceled:e("Partial Canceled"),canceled:e("Canceled"),failed:e("Failed")},planStatus:{waitTrigger:e("Untriggered"),trigger:e("Triggered"),canceled:e("Manual Cancel"),fail:e("Trigger Failed"),canceledSys:e("System Canceled")},triggerWay:{latest:e("Last Price"),mark:e("Mark Price")},triggerDirection:{gt:">=",eq:"=",lt:"<="}}}},24800:(e,t,r)=>{r.d(t,{_:()=>tQ});var n=r(79237),a=r(91405),i=r(749),l=r(3529),s=r(92413),o=r(43129),c=r(82586),d=r(66960),u=r(65093),m=r(51025),p=r(4390),x=r(38113),g=r(122);function h(e){return null==e?"":String(e)}function b(e,t){let r=Number(e.lowerPrice),n=Number(e.upperPrice),a=Number(e.gridCount),i=Number(t.computeData.maxGridCount||0),l=i>0?Math.min(t.gridCountMax,i):t.gridCountMax;return r>0&&n>r&&a>=t.gridCountMin&&a<=l}
1function y(e){let{lowerPrice:t,upperPrice:r,$t:n}=e,a=Number(t),i=Number(r);return a&&i&&a>=i?n("Upper price must higher than lower price"):""}function f(e){let{form:t,lastPrice:r,markPrice:n,$t:a}=e,i=Number(t.triggerPrice),l=Number(t.lowerPrice),s=Number(t.upperPrice),o="MARK_PRICE"===t.stopTriggerType?Number(n||0):Number(r||0),c=o>0,d=Number(t.stopLowerPrice),u=Number(t.stopUpperPrice),m="",p="";return t.stopTriggerType&&d&&(i&&d>=i?m=a("Bottom price should be less than trigger price."):(c&&d>=o||d>=l)&&(m=a("Bottom price should be less than lower price and mark/last price."))),t.stopTriggerType&&u&&(i&&u<=i?p=a("Top price should be higher than trigger price."):(c&&u<=o||u<=s)&&(p=a("Top price should be higher than upper price and mark/last price."))),{stopLowerPriceError:m,stopUpperPriceError:p}}var v=r(69770),N=r(77962),j=r(90877),C=r(93924),w=r(95696),T=r(89719),k=r(14275),P=r(18006),S=r(50791),L=r(82352),M=r(41760),O=r(96620),_=r(12733),A=r(76656),I=r(95041);function q(e){var t,r,n,a;let{symbol:i,locale:s,isLoggedIn:o,enableCurrentLeverageQuery:c=!0}=e,d=i.split("-")[0]||"BTC",u=i.split("-")[1]||"USDT",g=(0,x.useMemo)(()=>i.endsWith("-SWAP")?i:(0,l.Qx)(i,"-"),[i]),h=(0,x.useMemo)(()=>(0,l.A2)(g,"-"),[g]),b=(0,x.useMemo)(()=>({locale:s}),[s]);(0,_.hs)(b);let y=(0,_.bZ)(e=>e.ensureContractTier),f=(0,_.bZ)(e=>e.symbolsConfigBySymbol[g]),N=(0,_.bZ)(e=>e.siteConfig),C=(0,m.k)(e=>!!e.userLoadFromStorage)&&o,T=(0,M.N1)(O.p.USDT.SIMPLE_TICKER(g)),k=(0,M.pj)(O.p.USDT.ORDER_BOOK(g)),P=(0,M.N1)(C?O.p.USDT.USER_POSITION():void 0),{data:S}=(0,L.pD)(),q=(0,j.$)(),U=(0,v.ZM)((0,A.k)(e=>({currentLeverage:e.currentLeverage,currentLeverageSymbol:e.currentLeverageSymbol}))),E=(0,p.useQuery)({queryKey:(0,L.sJ)(s,g),queryFn:()=>
1(0,w.TP)({locale:s,params:{symbol:g}}),enabled:o&&c,refetchOnMount:!1}),Q=(0,p.useQuery)({queryKey:(0,L.xc)(s,g),queryFn:()=>(0,w.kv)({locale:s,params:{symbol:g}}),enabled:o}),D=null==P?void 0:P.all,R=null!=(a=null==S||null==(t=S.data)?void 0:t.positions)?a:[],z=(0,I.n9)({positionSwitch:q,restPositions:R,wsPositions:D}),B=(0,x.useMemo)(()=>(z||[]).filter(e=>{let t=String((null==e?void 0:e.tradeType)||""),r=String((null==e?void 0:e.symbol)||"");return(!t||"common"===t)&&[i,h,g].includes(r)}),[h,z,g,i]),F=(0,x.useMemo)(()=>B.find(e=>(null==e?void 0:e.side)==="long"),[B]),H=(0,x.useMemo)(()=>B.find(e=>(null==e?void 0:e.side)==="short"),[B]),V=(0,x.useMemo)(()=>{var e;let t=null==(e=E.data)?void 0:e.data,r=U.currentLeverageSymbol===g?U.currentLeverage:null;return t||r||{}},[null==(r=E.data)?void 0:r.data,U.currentLeverage,U.currentLeverageSymbol,g]),Z=(null==(n=Q.data)?void 0:n.data)||{};return{baseAsset:d,quoteAsset:u,serviceSymbol:g,ensureContractTier:y,contractConfig:f,siteConfig:N,orderbook:k,currentLeverageInfo:V,usedRiskQuantity:Z,currentSymbolPositions:B,longPosition:F,shortPosition:H,lastPrice:Number((null==T?void 0:T.last)||0),markPrice:Number((null==T?void 0:T.markPrice)||0)}}var U=r(90477);function E(){let{$t:e}=(0,d.B)(),{changeForm:t,direction:r}=(0,N.N)((0,A.k)(e=>({changeForm:e.actions.changeForm,direction:e.form.direction})));return(0,n.jsx)("div",{className:"border-l1 dark:border-l3 px-s4 flex h-9 items-start border-b pt-[10px] pb-[9px]",children:(0,n.jsx)("div",{className:"flex items-center gap-4",children:[{value:"NEUTRAL",label:e("Neutral")},{value:"LONG",label:e("Long")},{value:"SHORT",label:e("Short")}].map(e=>{let a=e.value===r;return(0,n.jsx)("button",{type:"button",className:(0,U.cn)("relative h-4 cursor-pointer text-[12px] leading-4 transition-colors",a&&"font-medium after:absolute after:top-[23px] after:left-0 after:h-px after:w-full",a&&"NEUTRAL"===e.value&&"text-t1 after:bg-t1",a&&"LONG"===e.value&&"text-p2 after:bg-p2",a&&"SHORT"===e.value&&"text-p3 after:bg-p3",!a&&"text-t3"),onClick:()=>t({direction:e.value}),children:e.label},e.value)})})})}var Q=r(47776),D=r(27737);let R=[0,25,50,75,100].map(e=>({value:e,displayValue:e,label:"".concat(e,"%")})),z=[{value:"ARITHMETIC",labelKey:"Arithmetic"},{value:"GEOMETRIC",labelKey:"Geometric"}];var B=r(44031),F=r(46540);let H="text-c12 md:text-c12 leading-4";function V(e){let{children:t}=e;return(0,n.jsx)("div",{className:"text-c12 text-t1 leading-4",children:t})}function Z(e){let t=e.normalizeValue||(e=>e.replace(/[^\d.]/g,""));return(0,n.jsxs)("div",{className:"grid gap-1",children:[(0,n.jsx)(B.Input,{size:"m",value:e.value,inputMode:"decimal",placeholder:e.placeholder,wrapperClassName:(0,U.cn)("rounded-r3 !px-[12px]",e.error&&"!border-p3"),rightSlot:e.rightSlot||(0,n.jsx)("span",{className:"text-mm14 text-t1",children:"USDT"}),onBlur:e.onBlur,onChange:r=>e.onChange(t(r.target.value))}),e.error?(0,n.jsx)("div",{className:"text-c12 text-p3 leading-4",children:e.error}):null]})}function K(e){let t=(0,n.jsx)("span",{className:(0,U.cn)("text-t3 inline-flex items-center text-[12px] leading-4",e.tooltip&&"border-b border-dashed border-current"),children:e.label});return(0,n.jsxs)("div",{className:"flex items-center justify-between text-[12px] leading-4",children:[e.tooltip?(0,n.jsx)(F.Tooltip,{content:e.tooltip,className:H,children:(0,n.jsx)("span",{className:"cursor-pointer",children:t})}):t,(0,n.jsx)("span",{className:"text-t1 text-right",children:e.value})]})}function W(){let{$t:e}=(0,d.B)(),{changeForm:t,gridCount:r,type:a,gridCountMax:i,gridCountMin:l,maxGridCount:s,perGridProfitText:o}=(0,N.N)((0,A.k)(e=>({changeForm:e.actions.changeForm,gridCount:e.form.gridCount,type:e.form.type,gridCountMax:e.runtime.gridCountMax,gridCountMin:e.runtime.gridCountMin,maxGridCount:Number(e.runtime.computeData.maxGridCount||0),perGridProfitText:e.runtime.perGridProfitText}))),c="GEOMETRIC"===a?e("Geometric"):e("Arithmetic"),u=z.map(t=>({...t,label:"GEOMETRIC"===t.value?e("Geometric"):e("Arithmetic")})),m=Number(r),p=s>0?Math.min(i,s):i,x=r&&m>p?e("Price difference is too small. Max number of grids to run this bot is {num}.",{num:p}):"";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"pt-s4 pb-s2 grid gap-2",children:[(0,n.jsxs)(V,{children:["2.",e("Grids")]}),(0,n.jsx)(Z,{placeholder:"".concat(l,"-").concat(i),value:r,error:x,normalizeValue:e=>e.replace(/\D/g,""),onBlur:()=>{if(""===r)return;let e=Number(r);
1if(Number.isFinite(e)){if(e<l)return void t({gridCount:String(l)});e>i&&t({gridCount:String(i)})}},onChange:e=>t({gridCount:e}),rightSlot:(0,n.jsxs)(D.DropdownMenu,{children:[(0,n.jsx)(D.DropdownMenuTrigger,{showIcon:!1,className:"cursor-pointer outline-none",children:(0,n.jsxs)("span",{className:"text-t1 flex cursor-pointer items-center gap-1 text-[14px] leading-[1.4]",children:[c,(0,n.jsx)(Q.C,{className:"size-3"})]})}),(0,n.jsx)(D.DropdownMenuContent,{align:"end",className:"min-w-[120px]",children:u.map(e=>(0,n.jsx)(D.DropdownMenuItem,{onClick:()=>t({type:e.value}),children:e.label},e.value))})]})})]}),(0,n.jsx)(K,{label:e("Profit per Grid"),tooltip:e("The estimated profit rate per grid. Fees were deducted."),value:o})]})}var G=r(59514),J=r(65375);let $=x.forwardRef((e,t)=>(0,n.jsx)(J.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,n.jsx)("path",{d:"M512 128a384 384 0 1 0 0 768 384 384 0 0 0 0-768zM42.666667 512C42.666667 252.8 252.8 42.666667 512 42.666667s469.333333 210.133333 469.333333 469.333333-210.133333 469.333333-469.333333 469.333333S42.666667 771.2 42.666667 512z m469.333333-213.333333a42.666667 42.666667 0 0 1 42.666667 42.666666v238.336l97.834666-97.834666a42.666667 42.666667 0 0 1 60.330667 60.330666l-1
170.666667 170.666667a42.666667 42.666667 0 0 1-60.330666 0l-170.666667-170.666667a42.666667 42.666667 0 1 1 60.330667-60.330666L469.333333 579.669333V341.333333a42.666667 42.666667 0 0 1 42.666667-42.666666z"})}));$.displayName="DepositGridIcon";var Y=r(56044),X=r(50697),ee=r(50324),et=r(68924),er=r(97867);function en(){let{$t:e,locale:t}=(0,d.B)(),r=(0,m.k)(e=>e.gotoLogin),{balance:a,changeForm:i,changeMarginByPercent:l,displaySymbol:s,isLoggedIn:o,leverage:c,margin:u,minMargin:p,perGridQuantity:x,serviceSymbol:g,sliderPercent:h}=(0,N.N)((0,A.k)(e=>({balance:e.runtime.balance,changeForm:e.actions.changeForm,changeMarginByPercent:e.actions.changeMarginByPercent,displaySymbol:e.runtime.displaySymbol,isLoggedIn:e.runtime.isLoggedIn,leverage:e.form.leverage,margin:e.form.margin,minMargin:e.runtime.minMargin,perGridQuantity:e.runtime.computeData.perGridQuantity,serviceSymbol:e.runtime.serviceSymbol,sliderPercent:e.runtime.sliderPercent}))),b=Number(u),y=Number(u||0)*Number(c||0),f=u&&b>a?e("Insufficient USDT balance."):u&&p>0&&b<p?e("Minimum investment required to run this grid is {num}.",{num:p}):"";return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"pt-s4 grid gap-2",children:[(0,n.jsxs)(V,{children:["3.",e("Investments")]}),(0,n.jsx)(Z,{placeholder:p>0?"⥠".concat(p.toFixed(2)):e("Initial Margin"),value:u,error:f,onChange:e=>i({margin:e}),rightSlot:(0,n.jsx)("span",{className:"text-t1 flex items-center gap-1 text-[14px] leading-[1.4]",children:"USDT"})})]}),(0,n.jsx)("div",{className:"px-0.5 pt-1",children:(0,n.jsx)(Y.Slider,{value:h,marks:R,showIndicatorOnDragging:!0,onValueChange:l})}),(0,n.jsxs)("div",{className:"grid gap-3 pt-3",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between text-[12px] leading-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-t3",children:e("Avbl")}
1),(0,n.jsxs)("span",{className:"text-t1 ml-1",children:[o?a.toFixed(2):"0.0000"," USDT"]})]}),(0,n.jsxs)("div",{className:"text-t3 flex items-center gap-4",children:[(0,n.jsx)("button",{type:"button",className:"hover:text-t1 cursor-pointer",onClick:()=>{if(!o)return void r();(0,X.F9)({values:{asset:"USDT",fromProduct:ee.X9.spot,toProduct:ee.X9.futures_usdt},customData:{assetDisabled:!1},onSuccess:()=>{(0,er.xm)({locale:t,symbol:g}).catch(e=>{console.error("[GridManualInvestmentSection] å·æ°åè½¬åæ°æ®å¤±è´¥:",e)})}})},children:(0,n.jsx)(G.A,{className:"size-4"})}),(0,n.jsx)("button",{type:"button",className:"hover:text-t1 cursor-pointer",onClick:()=>{(0,et.KN)(t)},children:(0,n.jsx)($,{className:"size-4"})})]})]}),(0,n.jsx)(K,{label:e("Qty/Order"),value:x?"".concat(x," ").concat(s.replace("USDT","")):"0"}),(0,n.jsx)(K,{label:e("Total Investment"),value:"".concat(Number.isFinite(y)?y.toFixed(2):"0.00"," USDT")})]})]})}var ea=r(76562);function ei(){let{$t:e}=(0,d.B)(),t=(0,S.kw)(),r=(0,N.N)(e=>e.form.leverage),a=(0,m.k)(e=>e.user),i=(0,m.k)(e=>e.gotoLogin),l=!!(null==a?void 0:a.userId);return(0,n.jsxs)("div",{className:"pt-s4 grid grid-cols-2 gap-2",children:[(0,n.jsx)("button",{type:"button",className:"bg-bt2 text-t1/30 rounded-rb1 flex h-8 w-full cursor-not-allowed items-center justify-center text-[12px] leading-4 font-medium",disabled:!0,children:e("Cross")}),(0,n.jsxs)("button",{type:"button",className:"bg-bt2 text-t1 hover:bg-bg6 rounded-rb1 flex h-8 w-full cursor-pointer items-center justify-center gap-1 text-[12px] leading-4 font-medium",onClick:()=>{if(!l)return void i();t.showLayer()},children:[r,"X",(0,n.jsx)(ea.Y,{className:"size-3"})]})]})}function el(){let{$t:e}=(0,d.B)(),{changeForm:t,upperPrice:r,lowerPrice:a}=(0,N.N)((0,A.k)(e=>({changeForm:e.actions.changeForm,upperPrice:e.form.upperPrice,lowerPrice:e.form.lowerPrice}))),i=y({lowerPrice:a,upperPrice:r,$t:e});return(0,n.jsxs)("div",{className:"pt-s4 grid gap-2",children:[(0,n.jsxs)(V,{children:["1.",e("Price Range")]}),(0,n.jsx)(Z,{placeholder:e("Upper Price"),value:r,onChange:e=>t({upperPrice:e})}),(0,n.jsx)(Z,{placeholder:e("Lower Price"),value:a,error:i,onChange:e=>t({lowerPrice:e})})]})}var es=r(70659),eo=r(45328),ec=r(27442),ed=r(24626);function eu(e){let{$t:t}=(0,d.B)();return(0,n.jsxs)("button",{type:"button",className:"text-t3 hover:text-t1 flex cursor-pointer items-center gap-2 text-[12px] leading-4",onClick:e.onClick,children:[t("MARK_PRICE"===e.value?"Mark":"Last_1"),(0,n.jsx)(ec.y,{className:"size-3"})]})}function em(e){let t=(0,n.jsx)("span",{className:(0,U.cn)("text-c12 text-t1 leading-4",e.tooltip&&"border-t3 border-b border-dashed"),children:e.label});return(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)(ed.Checkbox,{labelClassName:"cursor-pointer",checked:e.checked,onCheckedChange:t=>e.onChange(!!t),children:e.tooltip?(0,n.jsx)(F.Tooltip,{content:e.tooltip,className:H,children:t}):t}),e.right]})}function ep(){let{$t:e}=(0,d.B)(),t=(0,N.N)(e=>e.actions.changeForm),r=(0,N.N)(e=>e.form),{stopLowerPriceError:a,stopUpperPriceError:i}=f({form:r,lastPrice:(0,N.N)(e=>e.runtime.lastPrice),markPrice:(0,N.N)(e=>e.runtime.markPrice),$t:e}),l=e=>"MARK_PRICE"===e?"LATEST_PRICE":"MARK_PRICE";return(0,n.jsxs)("div",{className:"grid gap-4",children:[(0,n.jsxs)("div",{className:r.triggerType?"grid gap-3":"grid gap-4",children:[(0,n.jsx)(em,{checked:!!r.triggerType,label:e("Grid Trigger"),tooltip:e("The grid will be active once the last price or mark price you choose reaches the set trigger price."),right:r.triggerType?(0,n.jsx)(eu,{value:r.triggerType,onClick:()=>t({triggerType:l(r.triggerType)})}):null,onChange:e=>t({triggerType:e?"MARK_PRICE":"",triggerPrice:""})}),r.triggerType?(0,n.jsx)(Z,{placeholder:e("Trigger Price"),value:r.triggerPrice,onChange:e=>t({triggerPrice:e})}):null]}),(0,n.jsxs)("div",{className:r.stopTriggerType?"grid gap-3":"grid gap-4",children:[(0,n.jsx)(em,{checked:!!r.stopTriggerType,label:e("Stop Trigger"),tooltip:e("The grid will stop when the last price or mark price of the symbol you choose reaches the set top or bottom price. All of your position will be closed at market price."),right:r.stopTriggerType?(0,n.jsx)(eu,{value:r.stopTriggerType,onClick:()=>t({stopTriggerType:l(r.stopTriggerType)})}):null,onChange:e=>t({stopTriggerType:e?"MARK_PRICE":"",stopLowerPrice:"",stopUpperPrice
1:""})}),r.stopTriggerType?(0,n.jsxs)("div",{className:"grid gap-2",children:[(0,n.jsx)(Z,{placeholder:e("Top Price"),value:r.stopUpperPrice,error:i,onChange:e=>t({stopUpperPrice:e})}),(0,n.jsx)(Z,{placeholder:e("Bottom Price"),value:r.stopLowerPrice,error:a,onChange:e=>t({stopLowerPrice:e})})]}):null]})]})}function ex(){let{$t:e}=(0,d.B)(),t=(0,N.N)(e=>e.actions.changeForm),r=(0,N.N)(e=>e.form.closeOnStop);return(0,n.jsx)(em,{checked:"YES"===r,label:e("Close all positions when grid ends"),tooltip:e("Enable close all positions to automatically close all the open positions at the market price for the symbol when the grid ends; when disabled, you can close all positions manually after the grid ends."),onChange:e=>t({closeOnStop:e?"YES":"NO"})})}function eg(){let{$t:e}=(0,d.B)(),{advancedOpen:t,isLoggedIn:r,setAdvancedOpen:a,submit:i,submitting:l,validationError:s}=(0,N.N)((0,A.k)(e=>({advancedOpen:e.advancedOpen,isLoggedIn:e.runtime.isLoggedIn,setAdvancedOpen:e.setAdvancedOpen,submit:e.actions.submit,submitting:e.runtime.submitting,validationError:e.runtime.validationError})));return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"text-t3 pt-s4 flex cursor-pointer items-center gap-1 text-[12px] leading-4",onClick:()=>a(!t),children:[e("Advanced (Optional)"),(0,n.jsx)(Q.C,{className:(0,U.cn)("size-3 transition-transform",t&&"rotate-180")})]}),t?(0,n.jsx)("div",{className:"pt-s4",children:(0,n.jsx)(ep,{})}):null,(0,n.jsx)("div",{className:"pt-s4",children:(0,n.jsx)(ex,{})}),r?(0,n.jsx)(es.$,{size:"m",loading:l,disabled:!!s||l,className:"mt-s4 w-full",onClick:i,children:e("Create")}):(0,n.jsx)("div",{className:"mt-s4",children:(0,n.jsx)(eo.X,{})})]})}function eh(){return(0,n.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-2",children:[(0,n.jsx)(E,{}),(0,n.jsx)(c.ScrollArea,{className:"min-h-0 flex-1 [&_[data-slot=scroll-bar][data-orientation=vertical]]:w-1",viewportClassName:"h-full",children:(0,n.jsxs)("div",{className:"px-s4 pb-s4",children:[(0,n.jsx)(ei,{}),(0,n.jsx)(el,{}),(0,n.jsx)(W,{}),(0,n.jsx)(en,{}),(0,n.jsx)(eg,{})]})})]})}var eb=r(30511),ey=r(83125);function ef(e){return(0,U.cn)("NEUTRAL"===e&&"bg-p1/10 text-p1-dark","LONG"===e&&"bg-p2/10 text-p2","SHORT"===e&&"bg-p3/10 text-p3")}function ev(e){let{direction:t}=e,{$t:r}=(0,d.B)(),a={NEUTRAL:r("Neutral"),LONG:r("Long"),SHORT:r("Short")};return(0,n.jsx)("span",{className:(0,U.cn)("rounded-[2px] px-1 py-0.5 text-[12px] leading-4",ef(t)),children:a[t]})}function eN(){let{$t:e}=(0,d.B)(),{copyStrategy:t,displaySymbol:r,items:a,loading:i,setActiveTab:l}=(0,N.N)((0,A.k)(e=>({copyStrategy:e.actions.copyStrategy,displaySymbol:e.runtime.displaySymbol,items:e.runtime.recommendations,loading:e.runtime.recommendationsLoading,setActiveTab:e.setActiveTab})));return i||0===a.length?(0,n.jsxs)("div",{className:"relative flex h-full min-h-[360px] flex-col items-center justify-center text-center",children:[(0,n.jsx)(ey.Image,{src:"https://cdn.tapbit.mobi/next-web/futures/strategy-empty.png",alt:"",unoptimized:!0,width:80,height:80,className:"h-[80px] w-[80px]"}),(0,n.jsx)("div",{className:"text-c12 text-t3 mt-[10px] leading-[15px]",children:e("There are no recommended grid parameters at this time.")}),(0,n.jsx)("div",{className:"text-c12 text-t3 leading-[15px]",children:e("Please manually set grid parameters.")}),(0,n.jsx)(es.$,{size:"m",variant:"secondary",className:"mt-5 h-10 w-full",onClick:()=>l("manual"),children:e("Manually set parameters")}),i?(0,n.jsx)("div",{className:"bg-bg7/60 absolute inset-0 flex items-center justify-center",children:(0,n.jsx)(eb.t,{size:"m",type:"general"})}):null]}):(0,n.jsx)("div",{className:"grid gap-3 pt-5",children:a.map((a,i)=>{let l=a.direction||"NEUTRAL";return(0,n.jsxs)("button",{type:"button",className:"group border-l1 hover:border-p1 rounded-r2 flex h-[198px] cursor-pointer flex-col gap-4 border bg-transparent px-3 py-4 text-left transition-colors",onClick:()=>t(a),children:[(0,n.jsxs)("div",{className:"flex flex-1 flex-col gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsxs)("span",{className:"text-mm14 text-t1",children:[(a.contract||r).replace("-SWAP","USDT")," ",e("Perp")]}),(0,n.jsx)(ev,{direction:l}),(0,n.jsxs)("span",{className:(0,U.cn)("rounded-[2px] px-1 py-0.5 text-[12px] leading-4",ef(l)),children:[a.leverage||10,"X"]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-p2 text-[20px] leading-[1.4] font-semibold",children:function(e){let t=Number(e);return Number.isFinite(t)?"".concat(t<0?"":"+").concat(new g.A(t).mul(100).toFixed(2),"%"):"--"}(a.profitRate)}),(0,n.jsx)("div",{className:"text-c12 text-t3 leading-4",children:e("EST. ROE")})]}),(0,n.jsxs)("div",{className:"flex items-center justify-between text-[12px] leading-[15px]",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"text-t1",children:a.gridCount||"--"}),(0,n.jsx)("div",{className:"text-t3",children:e("Grid Qty")})]}),(0,n.jsxs)("div",{className:"text-right",children:[(0,n.jsx)("div",{className:"text-t1",children:function(e,t){var r,n,a,i;if(!e)return"00".concat(null!=(r=null==t?void 0:t("D"))?r:"D"," 00").concat(null!=(n=null==t?void 0:t("H"))?n:"H");let l=Number(e),s=Math.max(0,Math.floor((Date.now()-(l>1e10?l:1e3*l))/1e3)),o=Math.floor(s/86400),c=Math.floor(s/3600%24),d=e=>String(e).padStart(2,"0");return"".concat(d(o)).concat(null!=(a=null==t?void 0:t("D"))?a:"D"," ").concat(d(c)).concat(null!=(i=null==t?void 0:t("H"))?i:"H")}(a.startTime,e)}),(0,n.jsx)("div",{className:"text-t3",children:e("Duration")})]})]})]}),(0,n.jsx)("div",{className:"bg-bt2 text-t1 group-hover:bg-bt1 rounded-rb1 flex h-8 w-full items-center justify-center text-[12px] leading-4 font-medium transition-colors group-hover:text-black",children:e("Copy_strategy")})]},"".concat(a.contract||r,"-").concat(a.startTime||i))})})}function ej(){let{$t:e}=(0,d.B)(),t=(0,N.N)(e=>e.activeTab),r=(0,N.N)(e=>e.setActiveTab),a=[{value:"recommend",label:e("Recommended")},{value:"manual",label:e("Manual")}];return(0,n.jsx)("div",{className:"bg-bg05 rounded-r2 flex h-9 items-center p-1",children:a.map(e=>{let a=t===e.value;return(0,n.jsx)("button",{type:"button",className:(0,U.cn)("rounded-r1 flex h-full flex-1 cursor-pointer items-center justify-center text-[12px] leading-4 font-medium transition-colors",a?"bg-bg3 text-t1":"text-t3 hover:bg-c2 hover:text-t1"),onClick:()=>r(e.value),children:e.label},e.value)})})}function eC(e){let{symbol:t}=e;!function(e){var t,r,n,a;let{$t:i,locale:s}=(0,d.B)(),o=(0,m.k)(e=>e.user),c=(0,N.N)(e=>e.activeTab),M=(0,N.N)(e=>e.form),O=(0,N.N)(e=>e.runtime.computeData),_=(0,N.N)(e=>e.initialize),A=(0,N.N)(e=>e.syncRuntime),I=!!(null==o?void 0:o.userId),U=(0,x.useMemo)(()=>e.endsWith("-SWAP")?e:(0,l.Qx)(e,"-"),[e]),E=U.replace("-SWAP","USDT"),Q=U.split("-")[0]||"BTC",{availableBalance:D=0}=(0,j.t)(),{contractConfig:R,currentLeverageInfo:z,lastPrice:B,markPrice:F}=q({symbol:e,locale:s,isLoggedIn:I});!function(){let{$t:e,locale:t}=(0,d.B)(),r=(0,k.useQueryClient)(),n=(0,m.k)(e=>e.gotoLogin),a=(0,T.TY)(e=>e.configs.usdtContract_grid_protocol),i=(0,S.wT)(),l=(0,S.hQ)(),s=(0,S.kw)(),o=(0,N.N)(e=>e.updateForm),c=(0,N.N)(e=>e.setActiveTab),p=(0,N.N)(e=>e.resetAfterSuccess),y=(0,N.N)(e=>e.syncActions),f=(0,N.N)(e=>e.syncRuntime),j=(0,x.useRef)(null),M=(0,P.useMutation)({mutationFn:e=>(0,u.EF)({locale:t,params:e}),onSuccess:e=>{f({computeData:(null==e?void 0:e.data)||{}})}}),O=(0,P.useMutation)({mutationFn:()=>(0,u.GN)({locale:t,params:{...N.N.getState().form,margin:N.N.getState().form.margin,marginMode:"crossed"}}),onMutate:()=>{f({submitting:!0})},onSettled:()=>{f({submitting:!1})},onSuccess:t=>{if((null==t?void 0:t.code)===200){p(),l.hideLayer(),C.toast.success(e("Success")),r.invalidateQueries({queryKey:["usdt-bot-api"]});return}C.toast.error((null==t?void 0:t.message)||e("Failed"))}}),_=(0,P.useMutation)({mutationFn:e=>
1(0,w.YF)({locale:t,params:{symbol:e.symbol||N.N.getState().runtime.serviceSymbol,leverageLong:e.leverage,leverageShort:e.leverage}}),onSuccess:(n,a)=>{if((null==n?void 0:n.code)===200){let e=a.symbol||N.N.getState().runtime.serviceSymbol;o({leverage:a.leverage}),(0,v.VY)({leverage:a.leverage,symbol:e}),r.setQueryData((0,L.sJ)(t,e),e=>({...e,data:(0,v.dH)({longLeverage:a.leverage,shortLeverage:a.leverage,current:null==e?void 0:e.data})})),s.hideLayer();return}C.toast.error((null==n?void 0:n.message)||e("Failed"))}}),A=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:N.N.getState().form,{runtime:t}=N.N.getState();t.isLoggedIn&&(j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{b(e,t)&&M.mutate(e)},500))},I=e=>{let{runtime:t}=N.N.getState();t.isLoggedIn&&b(e,t)&&(j.current&&(clearTimeout(j.current),j.current=null),M.mutate(e))},q=e=>{let t={...N.N.getState().form,...e};o(e),A(t)},U=e=>{let t=N.N.getState().form,r=N.N.getState().runtime.isLoggedIn,n=Number(t.leverage||10),a=Number(e.leverage||t.leverage||10),i={symbol:e.contract||N.N.getState().runtime.serviceSymbol,direction:e.direction||"NEUTRAL",leverage:r?n:a,lowerPrice:h(e.lowerPrice),upperPrice:h(e.upperPrice),gridCount:h(e.gridCount),type:e.type||"ARITHMETIC",margin:h(e.margin)};if(c("manual"),o(i),r){let e={...t,...i};a!==n&&_.mutate({leverage:a,symbol:e.symbol},{onSuccess:t=>{(null==t?void 0:t.code)===200&&I({...e,leverage:a})}}),I(e)}},E=()=>{let{runtime:e}=N.N.getState();return e.isLoggedIn?"1"!==a?void i.showLayer():e.validationError?void C.toast.error(e.validationError):void l.showLayer():void n()},Q=()=>{O.mutate()},D=e=>{if(!N.N.getState().runtime.isLoggedIn)return void n();_.mutate({leverage:e})},R=e=>{let t=N.N.getState().runtime.balance;q({margin:new g.A(e||0).div(100).mul(t||0).toDecimalPlaces(2,g.A.ROUND_DOWN).toFixed(2)})},z=(0,x.useMemo)(()=>({changeForm:q,copyStrategy:U,submit:E,confirmSubmit:Q,changeLeverage:D,changeMarginByPercent:R}),[q,U,E,Q,D,R]);(0,x.useEffect)(()=>{y(z)},[z,y])}(),(0,x.useEffect)(()=>{_(U)},[_,U]);let H=(0,p.useQuery)({queryKey:["usdt-bot-api","strategy-recommend",s,U],queryFn:()=>
1(0,u.v0)({locale:s,params:{symbol:U,current:1,size:10}}),enabled:"recommend"===c}),V=(0,p.useQuery)({queryKey:["usdt-bot-api","globalConfigs",s],queryFn:()=>(0,u.u8)({locale:s})}),Z=Array.isArray(n=null==(t=H.data)?void 0:t.data)?n:Array.isArray(null==n?void 0:n.items)?n.items:Array.isArray(null==n?void 0:n.list)?n.list:[],K=Array.isArray(a=null==(r=V.data)?void 0:r.data)?a:Array.isArray(null==a?void 0:a.items)?a.items:Array.isArray(null==a?void 0:a.list)?a.list:[],W=(e,t)=>{let r=K.find(t=>t.configKey===e),n=Number(null==r?void 0:r.configValue);return Number.isFinite(n)&&n>0?n:t},G=W("gridGridCountMin",2),J=W("gridGridCountMax",50),$=Number(O.maxGridCount||0),Y=Number(O.minMargin||0),X=(null==R?void 0:R.tiers)||[],ee=W("gridLeverageMax",20),et=Number((null==R?void 0:R.maxLeverage)||0),er=et>0?Math.min(ee,et):ee,en=Number((null==R?void 0:R.multiplier)||0),ea=Number((null==R?void 0:R.precision)||2),ei=Number(D||0),el=function(e,t){let r=Number(e);return 0===t&&0===r?0:0===t&&r>0?100:Math.min(Math.max(Number(new g.A(r||0).mul(100).div(t||1).toFixed(0)),0),100)}(M.margin,ei),es=M.lowerPrice&&M.upperPrice&&M.gridCount?function(e){let t=Number(e.lower),r=Number(e.upper);if(!Number.isFinite(t))return"--";let n="".concat(new g.A(t).mul(100).toFixed(2),"%");return"GEOMETRIC"!==e.type&&Number.isFinite(r)?"".concat(n,"-").concat(new g.A(r).mul(100).toFixed(2),"%"):n}({lower:O.perGridProfitRateLower,upper:O.perGridProfitRateUpper,type:M.type}):"--",eo=function(e){let{form:t,balance:r,minMargin:n,maxGridCount:a,gridCountMin:i,gridCountMax:l,lastPrice:s,markPrice:o,$t:c}=e,d=Number(t.lowerPrice),u=Number(t.upperPrice),m=Number(t.gridCount),p=Number(t.margin);if(!u)return c("Please enter the upper price");if(!d)return c("Please enter the lower price");let x=y({lowerPrice:t.lowerPrice,upperPrice:t.upperPrice,$t:c});if(x)return x;if(!m)return c("Please enter the grids");let g=a>0?Math.min(l,a):l;if(m>g)return c("Price difference is too small. Max number of grids to run this bot is {num}.",{num:g});if(!p)return c("Please enter the investments");if(p>r)return c("Insufficient USDT balance.");if(n>0&&p<n)return c("Minimum investment required to run this grid is {num}.",{num:n});if(t.triggerType&&!Number(t.triggerPrice))return c("Please enter the trigger price");let{stopLowerPriceError:h,stopUpperPriceError:b}=f({form:t,lastPrice:s,markPrice:o,$t:c});return h||b||""}({form:M,balance:ei,minMargin:Y,maxGridCount:$,gridCountMin:G,gridCountMax:J,lastPrice:B,markPrice:F,$t:i});(0,x.useEffect)(()=>{A({serviceSymbol:U,displaySymbol:E,baseAsset:Q,balance:ei,lastPrice:B,markPrice:F,isLoggedIn:I,recommendations:Z,recommendationsLoading:H.isFetching,gridCountMin:G,gridCountMax:J,minMargin:Y,maxLeverage:er,leverageTiers:X,multiplier:en,contractPrecision:ea,sliderPercent:el,perGridProfitText:es,validationError:eo})},[ei,Q,ea,E,J,G,I,B,F,er,X,en,Y,es,Z,H.isFetching,U,el,A,eo]),(0,x.useEffect)(()=>{I&&(0,v.fD)({longLeverage:(null==z?void 0:z.curLongLeverage)||(null==z?void 0:z.curLeverage),shortLeverage:(null==z?void 0:z.curShortLeverage)||(null==z?void 0:z.curLeverage),maxGridLeverage:er,symbol:U})},[null==z?void 0:z.curLeverage,null==z?void 0:z.curLongLeverage,null==z?void 0:z.curShortLeverage,I,er,U])}(t);let r=(0,N.N)(e=>e.activeTab);return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"bg-bg7 flex h-full flex-col",children:[(0,n.jsx)("div",{className:"px-s4 pt-s3",children:(0,n.jsx)(ej,{})}),"recommend"===r?(0,n.jsx)(c.ScrollArea,{className:"flex-1 [&_[data-slot=scroll-bar][data-orientation=vertical]]:w-1",viewportClassName:"h-full",children:(0,n.jsx)("div",{className:"px-s4 pb-s4",children:(0,n.jsx)(eN,{})})}):(0,n.jsx)(eh,{})]})})}var ew=r(51924),eT=r(55872),ek=r(84980),eP=r(92155),eS=r(17449),eL=r(79043),eM=r(25318),eO=r(10022),e_=r(15637),eA=r(5257),eI=r(39679),eq=r(3060),eU=r(20449);function eE(e,t){let r=Number(e||t);return!Number.isFinite(r)||r<=0?t:Math.min(r,t)}function eQ(e,t){let r=Number(e||0),n=Number(t||0);return n||r?!n&&r>0?100:Math.min(Math.floor(100*r/n),100):0}var eD=r(14220),eR=r(81742),ez=r(17854),eB=r(17883),eF=r(40882),eH=r(80156),eV=r(13751),eZ=r(49429),eK=r(10522),eW=r(33317),eG=r(5694),eJ=r(38455),e$=r(51430),eY=r(19490),eX=r(33149),e0=r(47562),e1=r(70464),e6=r(83054);function e3(e){let{quantityValue:t,side:r,tradeUnit:n,usdtCost:a,multiplier:i,calcPr
1ice:l,oneContCost:s}=e;if(!t)return 0;if("2"===n){if("1"===a){let e=Number("buy"===r?s.buy:s.sell);return e?Math.max(0,Math.floor(t/e)):0}return(0,e1.DG)({quantity:t,tradeUnit:n,multiplier:i,price:l,usdtCost:a,costOne:"buy"===r?Number(s.buy||0):Number(s.sell||0)})}return(0,e1.DG)({quantity:t,tradeUnit:n,multiplier:i,price:l,usdtCost:a})}var e2=r(40394);function e4(e){return(0,e1.vX)({quantityCont:e.quantityCont,tradeUnit:e.tradeUnit,multiplier:e.multiplier,price:e.price})}var e7=r(37563);function e5(e){let{symbol:t}=e,r=function(e){var t,r,n;let{symbol:a}=e,{locale:i}=(0,d.B)(),{user:l,gotoLogin:s}=(0,m.k)(),o=!!(null==l?void 0:l.userId),c=q({symbol:a,locale:i,isLoggedIn:o}),u=(null==(t=c.contractConfig)?void 0:t.tiers)||[],p=Number((null==(r=u[u.length-1])?void 0:r.levelMax)||(null==(n=c.contractConfig)?void 0:n.maxLeverage)||0),g=function(e){let{isLoggedIn:t}=e,r=(0,T.TY)(e=>e.configs),n=(0,eF.ru)(r.usdt_user_confirm);return{confirmStr:n,serverTradeUnit:t?r.tradeUnit:void 0,serverUsdtCost:"1"===r.usdtCost?"1":"0"}}({locale:i,isLoggedIn:o}),h=(0,e7.MO)({enabled:o}),b=(0,e7.Q_)(h.data),y=(0,j.t)(),f=(0,eK.Mr)(e=>e.form),v=(0,eK.Mr)(e=>e.initialize),N=(0,eK.Mr)(e=>e.update),C=(0,eK.Mr)(e=>e.setOrderType),w=(0,eK.Mr)(e=>e.setTradeUnit),k=(0,S.Hx)(),P=(0,S.Ui)(),L=(0,S.Lt)(),M=(0,S.vs)(),O=(0,S.H3)(),_=(0,eW.M)((0,A.k)(e=>({setOrderTypeMenuOpen:e.setOrderTypeMenuOpen,resetUi:e.resetUi,plansNeverRemind:e.plansNeverRemind}))),I=(0,eZ.X)((0,A.k)(e=>({settingsLoading:e.settingsLoading,settingsSaving:e.settingsSaving,settingsError:e.settingsError,settingsMarginDisabled:e.settingsMarginDisabled,initializeCalculatorForm:e.initializeCalculatorForm,loadSettings:e.loadSettings,saveSettings:e.saveSettings,submitOpenOrder:e.submitOpenOrder,submitCloseOrder:e.submitCloseOrder,estimateLiqPrice:e.estimateLiqPrice,setDifferenceDirection:e.setDifferenceDirection,resetSubmitFlow:e.resetSubmitFlow})));return!function(e){let{symbol:t,locale:r,isLoggedIn:n,storageSymbol:a,maxLeverage:i,currentLeverageInfo:l,formMarginMode:s,formPositionMode:o,formLongLeverage:c,formShortLeverage:d,formTradeUnit:u,formUsdtCost:m,serverTradeUnit:p,serverUsdtCost:g,initialize:h,resetUi:b,resetSubmitFlow:y,setTradeUnit:f,update:v}=e;(0,x.useEffect)(()=>{if(!a||!i)return void h(t);h(t,{longLeverage:eE(eU.$3.getLongLeverage(a),i),shortLeverage:eE(eU.$3.getShortLeverage(a),i)})},[h,i,a,t]),(0,x.useEffect)(()=>{b(),y()},[y,b,t]),(0,x.useEffect)(()=>{if(!n)return;let e=Number(l.curLeverage||0),t=Number(l.curLongLeverage||e||0),r=Number(l.curShortLeverage||e||0),a=l.marginMode||l.marginModeSetting,i=l.positionMode||l.positionModeSetting,u={};a&&s!==a&&(u.marginMode=a),i&&o!==i&&(u.positionMode=i),t>0&&c!==t&&(u.longLeverage=t),r>0&&d!==r&&(u.shortLeverage=r),Object.keys(u).length>0&&v(u)},[l.curLeverage,l.curLongLeverage,l.curShortLeverage,l.marginMode,l.marginModeSetting,l.positionMode,l.positionModeSetting,c,s,o,d,n,v]),(0,x.useEffect)(()=>{if(n||!a||!i)return;let e=eE(eU.$3.getLongLeverage(a),i),t=eE(eU.$3.getShortLeverage(a),i),r={};c!==e&&(r.longLeverage=e,eU.$3.setLongLeverage(e,a)),d!==t&&(r.shortLeverage=t,eU.$3.setShortLeverage(t,a)),Object.keys(r).length>0&&v(r)},[c,d,n,i,a,v]),(0,x.useEffect)(()=>{n&&p&&(u!==p||"2"===p&&m!==g)&&f(p,"2"===p?g:m)},[u,m,n,p,g,f])}({symbol:a,locale:i,isLoggedIn:o,storageSymbol:c.serviceSymbol,maxLeverage:p,currentLeverageInfo:c.currentLeverageInfo,formMarginMode:f.marginMode,formPositionMode:f.positionMode,formLongLeverage:f.longLeverage,formShortLeverage:f.shortLeverage,formTradeUnit:f.tradeUnit,formUsdtCost:f.usdtCost,serverTradeUnit:g.serverTradeUnit,serverUsdtCost:g.serverUsdtCost,initialize:v,resetUi:_.resetUi,resetSubmitFlow:I.resetSubmitFlow,setTradeUnit:w,update:N}),{locale:i,isLoggedIn:o,gotoLogin:s,market:c,userConfig:g,copyTrade:{isLeadingTraderEnabled:b},contractOverview:y,form:f,formActions:{update:N,setOrderType:C,setTradeUnit:w},layers:{settingsLayer:k,calculatorLayer:P,tpslAdvancedLayer:L,differenceLayer:M,triggerOrdersNoticeLayer:O},ui:_,dialogs:I}}({symbol:t}),n=function(e){let{facts:t}=e,{form:r,market:{baseAsset:n,contractConfig:a,siteConfig:i,orderbook:l,lastPrice:s,currentLeverageInfo:o,usedRiskQuantity:c,currentSymbolPositions:u},contractOverview:m}=t,p=function(e){var t;let{form:r,baseAsset:n,contractConfig:a,siteConfig:i,orderbook:l,lastPrice:s,availableBalanceSource:o,currentLeverageInfo:c,usedRiskQuantity:u,currentSymbolPositions:m}=e,p=(0,eI.tt)({orderType:r.orderType,orderPrice:r.orderPrice,triggerPrice:r.triggerPrice,lastPrice:s}),h=Number(null!=o?o:0),b=(0,eY.iT)(h.toFixed(Number((null==i?void 0:i.showPrecision)||2))),y=Number((null==a?void 0:a.multiplier)||0),f=Number(r.quantity||0),v="2"===r.tradeUnit&&"1"===r.usdtCost,N=(0,x.useMemo)(()=>(0,eI.Ir)({orderbook:l,lastPrice:s,orderType:r.orderType,orderPrice:r.orderPrice,triggerPrice:r.triggerPrice,contract:a}),[a,r.orderPrice,r.orderType,r.triggerPrice,s,l]),j=(0,x.useMemo)(()=>(0,e1.DG)({quantity:f,tradeUnit:r.tradeUnit,multiplier:y,price:p,usdtCost:r.usdtCost}),[p,r.tradeUnit,r.usdtCost,y,f]),C=Number(r.longQuantity||0),w=Number(r.shortQuantity||0),T=(0,x.useMemo)(()=>(0,eI.Op)({quantityCont:1,longLeverage:r.longLeverage,shortLeverage:r.shortLeverage,prices:N,contract:a,siteConfig:i}),[a,r.longLeverage,r.shortLeverage,N,i]),k=(0,x.useMemo)(()=>e3({quantityValue:C||f,side:"buy",tradeUnit:r.tradeUnit,usdtCost:r.usdtCost,multiplier:y,calcPr
1ice:p,oneContCost:T}),[p,C,r.tradeUnit,r.usdtCost,y,T,f]),P=(0,x.useMemo)(()=>e3({quantityValue:w||f,side:"sell",tradeUnit:r.tradeUnit,usdtCost:r.usdtCost,multiplier:y,calcPrice:p,oneContCost:T}),[p,w,r.tradeUnit,r.usdtCost,y,T,f]),S=(0,x.useMemo)(()=>(function(e){let{longQuantityContForCosts:t,shortQuantityContForCosts:r,longLeverage:n,shortLeverage:a,prices:i,contract:l,siteConfig:s}=e,o=(0,eI.Op)({quantityCont:t,longLeverage:n,shortLeverage:a,prices:i,contract:l,siteConfig:s}),c=(0,eI.Op)({quantityCont:r,longLeverage:n,shortLeverage:a,prices:i,contract:l,siteConfig:s});return{buy:o.buy,sell:c.sell}})({longQuantityContForCosts:k,shortQuantityContForCosts:P,longLeverage:r.longLeverage,shortLeverage:r.shortLeverage,prices:N,contract:a,siteConfig:i}),[a,r.longLeverage,r.shortLeverage,k,N,P,i]),L=(0,x.useMemo)(()=>(0,eI.az)({availableBalance:h,costOne:T}),[h,T]),M=(null==a?void 0:a.tiers)||[],O=Number((null==(t=M[M.length-1])?void 0:t.levelMax)||(null==a?void 0:a.maxLeverage)||1),_=(0,x.useMemo)(()=>m.reduce((e,t)=>{let r=String((null==t?void 0:t.side)||""),n=Number((null==t?void 0:t.availableQuantity)||0),a=Number((null==t?void 0:t.quantity)||0);return"long"===r&&(e.longAvailableCont+=n,e.longQuantityCont+=a),"short"===r&&(e.shortAvailableCont+=n,e.shortQuantityCont+=a),e},{longAvailableCont:0,longQuantityCont:0,shortAvailableCont:0,shortQuantityCont:0}),[m]),{buy:A,sell:I}=(0,x.useMemo)(()=>(function(e){let{maxOpenByBalance:t,maxOpenSize:r,longLeverage:n,shortLeverage:a,longRiskQuantity:i,shortRiskQuantity:l,tiers:s=[]}=e,o=(0,eI._j)(s,n),c=(0,eI._j)(s,a),d=(0,eI.IQ)(r,0),u=Math.max(0,o-(0,eI.IQ)(i,0)),m=Math.max(0,c-(0,eI.IQ)(l,0));return{buy:Math.min((0,eI.IQ)(t.buy,0),u,d),sell:Math.min((0,eI.IQ)(t.sell,0),m,d)}})({maxOpenByBalance:L,maxOpenSize:null==c?void 0:c.maxOpenSize,longLeverage:r.longLeverage,shortLeverage:r.shortLeverage,longRiskQuantity:null==u?void 0:u.longRiskQuantity,shortRiskQuantity:null==u?void 0:u.shortRiskQuantity,tiers:null==a?void 0:a.tiers}),[null==a?void 0:a.tiers,null==c?void 0:c.maxOpenSize,r.longLeverage,r.shortLeverage,L,null==u?void 0:u.longRiskQuantity,null==u?void 0:u.shortRiskQuantity]),{closeLongContLimit:q,closeShortContLimit:U,maxOpenBuy:E,maxOpenSell:Q,maxCloseLong:D,maxCloseShort:R}=function(e){let{orderType:t,tradeUnit:r,isUsdtCostMode:n,availableBalance:a,maxOpenBuyCont:i,maxOpenSellCont:l,closePositionSummary:s,multiplier:o,calcPrice:c,usdtDisplayPrecision:d}=e,u="market"===t?s.longQuantityCont:s.longAvailableCont,m="market"===t?s.shortQuantityCont:s.shortAvailableCont;return{closeLongContLimit:u,closeShortContLimit:m,maxOpenBuy:n?a:(0,e1.vX)({quantityCont:i,tradeUnit:r,multiplier:o,price:c,usdtPrecision:d}),maxOpenSell:n?a:(0,e1.vX)({quantityCont:l,tradeUnit:r,multiplier:o,price:c,usdtPrecision:d}),maxCloseLong:(0,e1.vX)({quantityCont:u,tradeUnit:r,multiplier:o,price:c}),maxCloseShort:(0,e1.vX)({quantityCont:m,tradeUnit:r,multiplier:o,price:c})}}({orderType:r.orderType,tradeUnit:r.tradeUnit,isUsdtCostMode:v,availableBalance:h,maxOpenBuyCont:A,maxOpenSellCont:I,closePositionSummary:_,multiplier:y,calcPrice:p,usdtDisplayPrecision:Number((null==a?void 0:a.precision)||2)}),z=function(e){var t;let{form:r,baseAsset:n,contractConfig:a,availableBalance:i,multiplier:l,calcPrice:s,lastPrice:o,oneContCost:c,maxOpenBuyCont:u,maxOpenSellCont:m,closeLongContLimit:p,closeShortContLimit:h,maxOpenBuy:b,maxOpenSell:y,maxCloseLong:f,maxCloseShort:v,directionalLongQuantityValue:N,directionalShortQuantityValue:j,maxLeverage:C}=e,{$t:w}=(0,d.B)(),T=(null==a?void 0:a.tiers)||[],k=(0,e2.k)((0,e1.Rw)({tradeUnit:r.tradeUnit,baseAsset:n}),w),P=(t=null==a?void 0:a.multiplier,(0,e6.DF)(t)),S=(0,x.useCallback)(e=>{var t;return t={tradeUnit:e,contractPrecision:Number((null==a?void 0:a.precision)||2),coinPrecision:P},eG.w.getState().getQuantityPrecisionByUnit(t)},[P,null==a?void 0:a.precision]),L=S(r.tradeUnit),M="open"===r.activeTab&&"2"===r.tradeUnit&&"1"===r.usdtCost?2:L,O=(0,x.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.tradeUnit;return(0,eq.oV)(e,S(t))},[r.tradeUnit,S]),_=(0,x.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.tradeUnit;return(0,eq.pz)(e,S(t))},[r.tradeUnit,S]),A=Number(O(b)||0),I=Number(O(y)||0),q=Number(O(f)||0),U=Number(O(v)||0),E=(0,x.useCallback)(e=>(0,eq.cf)(e),[]),Q=(0,x.useCallback)(e=>(0,eq.lD)(e,M),[M]),D=(0,x.useCallback)(function(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"buy";return t={displayQuantity:e,side:a,tradeUnit:r.tradeUnit,multiplier:l,usdtCost:r.usdtCost,oneContCostBuy:Number(c.buy),oneContCostSell:Number(c.sell),calcPr
1ice:s,coinPrecision:P,baseAsset:n},eG.w.getState().getBaseAssetHintValue(t)},[n,s,P,r.tradeUnit,r.usdtCost,l,c.buy,c.sell]),R=(0,x.useCallback)((e,t)=>{let n=Math.max(1,Math.min(e||1,C)),a=(0,eI._j)(T,n);if("2"===r.tradeUnit){let e=new g.A(a).mul(l||0).mul(o||0);return"".concat((0,eY.iT)((0,e$.qQ)(e,L))," ").concat(k)}let i=(0,e1.vX)({quantityCont:a,tradeUnit:r.tradeUnit,multiplier:l,price:o});return"".concat((0,eY.iT)(i.toFixed(L))," ").concat(k)},[r.tradeUnit,o,T,C,l,L,k]),z=(0,x.useMemo)(()=>(0,eq.Bw)({activeTab:r.activeTab,tradeUnit:r.tradeUnit,quantity:r.quantity,longQuantity:N,shortQuantity:j,getBaseAssetHintValue:D}),[N,j,r.activeTab,r.quantity,r.tradeUnit,D]),B="open"===r.activeTab?Math.min(A,I):Math.max(U,q),F=(0,x.useCallback)(e=>{var t;return Number((0,eq.oV)("open"===(t={activeTab:r.activeTab,tradeUnit:e,usdtCost:r.usdtCost,availableBalance:i,maxOpenBuyCont:u,maxOpenSellCont:m,closeShortContLimit:h,closeLongContLimit:p,multiplier:l,price:s,oneContCostBuy:Number(c.buy),oneContCostSell:Number(c.sell)}).activeTab?"2"===t.tradeUnit&&"1"===t.usdtCost?t.availableBalance:Math.min(e4({quantityCont:t.maxOpenBuyCont,tradeUnit:t.tradeUnit,multiplier:t.multiplier,price:t.price}),e4({quantityCont:t.maxOpenSellCont,tradeUnit:t.tradeUnit,multiplier:t.multiplier,price:t.price})):Math.max(e4({quantityCont:t.closeShortContLimit,tradeUnit:t.tradeUnit,multiplier:t.multiplier,price:t.price}),e4({quantityCont:t.closeLongContLimit,tradeUnit:t.tradeUnit,multiplier:t.multiplier,price:t.price})),S(e))||0)},[i,s,p,h,r.activeTab,r.usdtCost,S,u,m,l,c.buy,c.sell]),H=(0,x.useCallback)(function(e,t){var n;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.usdtCost;return Number((0,eq.oV)("open"===(n={activeTab:r.activeTab,side:e,tradeUnit:t,usdtCost:a,availableBalance:i,maxOpenBuyCont:u,maxOpenSellCont:m,closeLongContLimit:p,closeShortContLimit:h,multiplier:l,price:s,oneContCostBuy:Number(c.buy),oneContCostSell:Number(c.sell)}).activeTab?"2"===n.tradeUnit&&"1"===n.usdtCost?n.availableBalance:"long"===n.side?e4({quantityCont:n.maxOpenBuyCont,tradeUnit:n.tradeUnit,multiplier:n.multiplier,price:n.price}):e4({quantityCont:n.maxOpenSellCont,tradeUnit:n.tradeUnit,multiplier:n.multiplier,price:n.price}):"long"===n.side?e4({quantityCont:n.closeLongContLimit,tradeUnit:n.tradeUnit,multiplier:n.multiplier,price:n.price}):e4({quantityCont:n.closeShortContLimit,tradeUnit:n.tradeUnit,multiplier:n.multiplier,price:n.price}),S(t))||0)},[i,s,p,h,r.activeTab,r.usdtCost,S,u,m,l,c.buy,c.sell]),V=F(r.tradeUnit),Z=H("long",r.tradeUnit,r.usdtCost),K=H("short",r.tradeUnit,r.usdtCost),W=(0,x.useMemo)(()=>(0,eq.mK)({activeTab:r.activeTab,isPercentage:r.isPercentage,percentage:r.percentage,longQuantity:r.longQuantity,shortQuantity:r.shortQuantity,maxQuantityDisplay:B,maxOpenBuy:A,maxOpenSell:I,maxCloseLong:q,maxCloseShort:U}),[r.activeTab,r.isPercentage,r.longQuantity,r.percentage,r.shortQuantity,B,q,U,A,I]);return{roundedMaxOpenBuy:A,roundedMaxOpenSell:I,roundedMaxCloseLong:q,roundedMaxCloseShort:U,unitLabel:k,coinPrecision:P,quantityPrecision:L,getQuantityPrecision:S,formatDisplayQuantity:O,formatDisplayQuantityUp:_,formatCostDisplay:E,formatMaxDisplay:Q,getMaxPositionLabel:R,quantityValueHint:z,maxQuantityDisplay:B,getMaxQuantityDisplayByUnit:F,getDirectionalMaxDisplayByUnit:H,rawMaxQuantityDisplay:V,rawLongMaxDisplay:Z,rawShortMaxDisplay:K,sliderPercent:W}}({form:r,baseAsset:n,contractConfig:a,availableBalance:h,multiplier:y,calcPrice:p,lastPrice:s,oneContCost:T,maxOpenBuyCont:A,maxOpenSellCont:I,closeLongContLimit:q,closeShortContLimit:U,maxOpenBuy:E,maxOpenSell:Q,maxCloseLong:D,maxCloseShort:R,directionalLongQuantityValue:C,directionalShortQuantityValue:w,maxLeverage:O});return{calcPrice:p,availableBalance:h,availableBalanceText:b,multiplier:y,quantityCont:j,longQuantityCont:k,shortQuantityCont:P,directionalLongQuantityValue:C,directionalShortQuantityValue:w,oneContCost:T,costs:S,maxOpenBuyCont:A,maxOpenSellCont:I,closeLongContLimit:q,closeShortContLimit:U,maxOpenBuy:E,maxOpenSell:Q,maxCloseLong:D,maxCloseShort:R,maxLeverage:O,...z}}({form:r,baseAsset:n,contractConfig:a,siteConfig:i,orderbook:l,lastPrice:s,availableBalanceSource:null==m?void 0:m.availableBalance,currentLeverageInfo:o,usedRiskQuantity:c,currentSymbolPositions:u}),h=function(e){let{baseAsset:t,isPercentage:r,tradeUnit:n,usdtCost:a}=e,{$t:i}=(0,d.B)(),l=(0,x.useMemo)(()=>[{label:i("Quantity"),value:"quantity"},{label:i("Available Ratio"),value:"percentage"}],[i]);return{quantityMode:r?"percentage":"quantity",quantityModeOptions:l,tradeUnitOptions:(0,x.useMemo)(()=>[{label:"".concat(i("Coin"),"(").concat(t,")"),triggerLabel:t||i("Coin"),value:"coin"},{label:i("Cont"),value:"cont"},{label:"USDT(".concat(i("Order by Value"),")"),triggerLabel:"USDT",value:"usdtValue",description:i("You can modify the required margin by adjusting the applied leverage.")},{label:"USDT(".concat(i("Order by Cost"),")"),triggerLabel:"USDT",value:"usdtCost",description:i("Itâs inclusive of the initial margin, fees to open, and fees to close. Modifying the leverage will not change your order
1cost.")}],[i,t]),tradeUnitValue:"0"===n?"coin":"1"===n?"cont":"1"===a?"usdtCost":"usdtValue"}}({baseAsset:n,isPercentage:r.isPercentage,tradeUnit:r.tradeUnit,usdtCost:r.usdtCost}),b=Number(r.longQuantity||0)>0||Number(r.shortQuantity||0)>0;return{...p,...h,hasDirectionalQuantity:b}}({facts:r}),a=function(e){let{symbol:t,facts:r,derivations:n}=e,{locale:a,isLoggedIn:i,gotoLogin:l,form:o,formActions:{update:c,setOrderType:u,setTradeUnit:m},market:{serviceSymbol:p,ensureContractTier:g,contractConfig:h,longPosition:b,shortPosition:y,lastPrice:f,markPrice:N,quoteAsset:j,baseAsset:w},userConfig:{confirmStr:M},layers:{settingsLayer:O,calculatorLayer:I,tpslAdvancedLayer:q,differenceLayer:U,triggerOrdersNoticeLayer:E},ui:{plansNeverRemind:Q,setOrderTypeMenuOpen:D},dialogs:{initializeCalculatorForm:R,loadSettings:z,saveSettings:B,submitOpenOrder:F,submitCloseOrder:H,estimateLiqPrice:V,setDifferenceDirection:Z}}=r,{availableBalance:K,multiplier:W,calcPrice:G,oneContCost:J,maxOpenBuyCont:$,maxOpenSellCont:Y,closeLongContLimit:et,closeShortContLimit:en,costs:ea,rawMaxQuantityDisplay:ei,rawLongMaxDisplay:el,rawShortMaxDisplay:es,quantityPrecision:eo,coinPrecision:ec,unitLabel:ed,getQuantityPrecision:eu,getMaxPositionLabel:em,getMaxQuantityDisplayByUnit:ep,getDirectionalMaxDisplayByUnit:ex}=n,{getReferencePrice:eg,handleTransferSuccess:eh,handleTradeUnitChanged:eb,handleTradeUnitPersisted:ey}=function(e){let{locale:t,symbol:r,lastPrice:n,markPrice:a}=e,i=(0,x.useCallback)(e=>{let t="mark"===e?a:n;return t?String(t):""},[n,a]),l=(0,x.useCallback)(()=>{(0,er.xm)({locale:t,symbol:r}).catch(e=>{console.error("[StandardOrderPanelInteractionDeps] å·æ°åè½¬åæ°æ®å¤±è´¥:",e)})},[t,r]);return{getReferencePrice:i,handleTransferSuccess:l,handleTradeUnitChanged:(0,x.useCallback)(()=>{e_.B.getState().resetCloseEditors(),eO.ZC.getState().refreshCharts()},[]),handleTradeUnitPersisted:(0,x.useCallback)(()=>{(0,er.i3)({locale:t,symbol:r}).catch(e=>{console.error("[StandardOrderPanelInteractionDeps] å·æ°ååä½åæ°æ®å¤±è´¥:",e)})},[t,r])}}({locale:a,symbol:p,lastPrice:f,markPrice:N}),ef=function(e){let{locale:t,isLoggedIn:r,gotoLogin:n,form:a,setTradeUnit:i,update:l,lastPrice:s,getReferencePrice:o,getMaxQuantityDisplayByUnit:c,getDirectionalMaxDisplayByUnit:d,getQuantityPrecision:u,pricePrecision:m,onTransferSuccess:p,onTradeUnitChanged:x,onTradeUnitPersisted:g}=e,h=(0,k.useQueryClient)(),b=async(e,n)=>{r&&(await (0,eA.J_)({locale:t,params:{settingKey:"usdtContract_tradeUnit",settingValue:e}}),"2"===e&&n&&await (0,eA.J_)({locale:t,params:{settingKey:"usdtContract_usdtCost",settingValue:n}}),h.setQueryData(["spot-account-center-api","userConfig-querys",t],t=>({...t,data:{...(null==t?void 0:t.data)||{},usdtContract_tradeUnit:e,..."2"===e&&n?{usdtContract_usdtCost:n}:{}}})),g())};return{handleNumberFieldChange:e=>t=>{let r="quantity"===e?(0,eI.p0)({value:t,precision:u(a.tradeUnit),tradeUnit:a.tradeUnit}):(0,eI.TR)(t,m);null!==r&&l({[e]:r})},handlePercentageInputChange:e=>{let t=(0,eI.JF)(e,2);if(null===t)return;let r=Math.min(Math.max(Number(t||0),0),100),n=u(a.tradeUnit),i=c(a.tradeUnit),s=d("long",a.tradeUnit,a.usdtCost),o=d("short",a.tradeUnit,a.usdtCost),m=(a.activeTab,(0,eq.Jv)(s,r,n)),p=(a.activeTab,(0,eq.Jv)(o,r,n));l({longQuantity:m,percentage:r,quantity:(0,eq.Jv)(i||0,r,n),shortQuantity:p})},handleSliderChange:e=>{let t=u(a.tradeUnit),r=c(a.tradeUnit),n=d("long",a.tradeUnit,a.usdtCost),i=d("short",a.tradeUnit,a.usdtCost),s=(a.activeTab,(0,eq.Jv)(n,e,t)),o=(a.activeTab,(0,eq.Jv)(i,e,t));l({longQuantity:s,percentage:e,quantity:(0,eq.Jv)(r||0,e,t),shortQuantity:o})},handleTradeUnitChange:e=>{let t="coin"===e?"0":"cont"===e?"1":"2",r="usdtCost"===e?"1":"usdtValue"===e?"0":a.usdtCost;i(t,"2"===t?r:a.usdtCost),(0,T.ao)({tradeUnit:t,..."2"===t?{usdtCost:r}:{}}),x(),b(t,"2"===t?r:void 0),l({quantity:"",longQuantity:"",shortQuantity:"",percentage:0})},handleTransfer:()=>{if(!r)return void n();(0,X.F9)({values:{asset:"USDT",fromProduct:ee.X9.spot,toProduct:ee.X9.futures_usdt},customData:{assetDisabled:!1},onSuccess:p})},toggleReferencePriceField:e=>{let t="latest"===a.triggerWay?"mark":"latest";if("triggerPrice"===e)return void l({triggerWay:t});l({triggerWay:t,[e]:o(t)})},fillLastPrice:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"orderPrice";s&&l({[e]:String(s)})},handleQuantityModeChange:e=>{l({isPercentage:"percentage"===e,quantity:"",longQuantity:"",percentage:0,shortQuantity:""})},clearQuantityValues:()=>
1{l({quantity:"",longQuantity:"",percentage:0,shortQuantity:""})},toggleTriggerWay:e=>{l({[e]:"latest"===a[e]?"mark":"latest"})},clearTpslAdvanced:()=>{l({checkedTpsl:!1,takeProfitPrice:"",stopLossPrice:"",tpOrderPrice:"",slOrderPrice:"",takeProfitRate:"",stopLossRate:"",takeProfitRateAbout:"",stopLossRateAbout:"",tpTriggerWay:"mark",slTriggerWay:"mark",tpPriceType:"market",slPriceType:"market",tpslActiveTab:"openLong",tpslAdvancedEdited:!1})}}}({locale:a,isLoggedIn:i,gotoLogin:l,form:o,setTradeUnit:m,update:c,lastPrice:f,getReferencePrice:eg,getMaxQuantityDisplayByUnit:ep,getDirectionalMaxDisplayByUnit:ex,getQuantityPrecision:eu,pricePrecision:Number((null==h?void 0:h.precision)||2),onTransferSuccess:eh,onTradeUnitChanged:eb,onTradeUnitPersisted:ey});!function(e){let{activeTab:t,orderType:r,orderPrice:n,isPercentage:a,percentage:i,quantity:l,longQuantity:s,shortQuantity:o,availableBalance:c,quantityPrecision:d,rawMaxQuantityDisplay:u,rawLongMaxDisplay:m,rawShortMaxDisplay:p,update:g}=e,h=(0,x.useRef)({percentage:i,quantity:l,longQuantity:s,shortQuantity:o,quantityPrecision:d,rawMaxQuantityDisplay:u,rawLongMaxDisplay:m,rawShortMaxDisplay:p});h.current={percentage:i,quantity:l,longQuantity:s,shortQuantity:o,quantityPrecision:d,rawMaxQuantityDisplay:u,rawLongMaxDisplay:m,rawShortMaxDisplay:p},(0,x.useEffect)(()=>{if(!a)return;let e=h.current,t=Number(e.percentage||0),r=(0,eq.Jv)(e.rawMaxQuantityDisplay||0,t,e.quantityPrecision),n=(0,eq.Jv)(e.rawLongMaxDisplay,t,e.quantityPrecision),i=(0,eq.Jv)(e.rawShortMaxDisplay,t,e.quantityPrecision);(r!==e.quantity||n!==e.longQuantity||i!==e.shortQuantity)&&g({quantity:r,longQuantity:n,shortQuantity:i})},[t,a,n,r,g]),(0,x.useEffect)(()=>{if(!a)return;let e=eQ(s,m)||eQ(o,p)||eQ(l,u);e!==Number(i||0)&&g({percentage:e})},[t,c,a,s,i,l,m,u,p,o,g])}({activeTab:o.activeTab,orderType:o.orderType,orderPrice:o.orderPrice,isPercentage:o.isPercentage,percentage:o.percentage,quantity:o.quantity,longQuantity:o.longQuantity,shortQuantity:o.shortQuantity,availableBalance:K,quantityPrecision:eo,rawMaxQuantityDisplay:ei,rawLongMaxDisplay:el,rawShortMaxDisplay:es,update:c}),function(e){let{symbolKey:t,orderType:r,orderPrice:n,lastPrice:a,update:i}=e,l=(0,x.useRef)(!1),s=(0,x.useRef)(r),o=(0,x.useRef)(t);(0,x.useEffect)(()=>{o.current!==t&&(l.current=!1,s.current=r,o.current=t);let e=s.current,c="limit"===r||"postOnly"===r||"planLimit"===r,d=e!==r&&c&&"limit"!==e&&"postOnly"!==e&&"planLimit"!==e;if(!l.current){if(c&&!(n||"").trim()){if(!a)return;i({orderPrice:String(a)}),l.current=!0,s.current=r;return}l.current=!0,s.current=r;return}a&&d&&!(n||"").trim()&&i({orderPrice:String(a)}),s.current=r},[n,r,a,t,i])}({symbolKey:p,orderType:o.orderType,orderPrice:o.orderPrice,lastPrice:f,update:c});let ev=function(e){let{locale:t,symbol:r,serviceSymbol:n,isLoggedIn:a,gotoLogin:i,form:l,confirmStr:o,availableBalance:c,minTradeAmount:u,multiplier:m,calcPrice:p,oneContCost:g,maxOpenBuyCont:h,maxOpenSellCont:b,closeLongContLimit:y,closeShortContLimit:f,lastPrice:N,markPrice:j,quoteAsset:w,baseAsset:M,unitLabel:O,coinPrecision:I,quantityPrecision:q,contractMultiplier:U,longPosition:E,shortPosition:Q,costs:D,clearQuantityValues:R,clearTpslAdvanced:z,submitOpenOrder:B,submitCloseOrder:F,estimateLiqPrice:H,ensureContractTier:V,initializeCalculatorForm:Z,loadSettings:K,saveSettings:W,update:G,settingsLayer:J,calculatorLayer:$,tpslAdvancedLayer:Y,differenceLayer:X,setDifferenceDirection:ee}=e,{confirmItems:et,loading:en,handleOpenSubmit:ea,handleCloseSubmit:ei,openTpslAdvanced:el,openConfirmDialog:es,executeSubmit:eo,persistNeverRemind:ec}=function(e){let{locale:t,symbol:r,isLoggedIn:n,gotoLogin:a,confirmStr:i,availableBalance:l,minTradeAmount:o,multiplier:c,calcPrice:u,oneContCost:m,closeLongContLimit:p,closeShortContLimit:g,lastPrice:h,markPrice:b,quoteAsset:y,baseAsset:f,unitLabel:v,coinPrecision:N,quantityPrecision:j,contractMultiplier:w,longPosition:k,shortPosition:L,costs:M,clearQuantityValues:O,clearTpslAdvanced:I,submitOpenOrder:q,submitCloseOrder:U,estimateLiqPrice:E}=e,{$t:Q}=(0,d.B)(),{isExecuting:D}=(0,eL.p)(r),R=(0,S.me)(),z=(0,S.vs)(),B=(0,S.oh)(),F=(0,S.Lt)(),{patchUserConfigs:H,contractProtocol:V,preIpoRiskProtocol:Z,completeQuiz:K}=(0,T.TY)((0,A.k)(e=>({patchUserConfigs:e.patchConfigs,contractProtocol:e.configs.usdtContract_protocol,preIpoRiskProtocol:e.configs.Pre_IPO_risk_protocol,completeQuiz:e.configs.usdt_complete_quiz}))),W=(0,s.j)(r),G=(0,_.bZ)(e=>e.symbolsConfigBySymbol[W]),J=(0,eG.w)(e=>e.getConfirmQuantityDisplayText),$=(0,eK.Mr)(e=>e.form),{pendingSubmit:Y,neverRemind:X,estLiqPrice:ee,setDifferenceDirection:et,setPendingSubmit:en,setNeverRemind:ea,setEstLiqPrice:ei,resetSubmitFlow:el}=(0,eZ.X)((0,A.k)(e=>({pendingSubmit:e.pendingSubmit,neverRemind:e.neverRemind,estLiqPrice:e.estLiqPrice,setDifferenceDirection:e.setDifferenceDirection,setPendingSubmit:e.setPendingSubmit,setNeverRemind:e.setNeverRemind,setEstLiqPrice:e.setEstLiqPrice,resetSubmitFlow:e.resetSubmitFlow}))),es=(0,eW.M)(e=>e.resetUi),{active:eo,pending:ec}=(0,eM.Y)(),ed=ec||eo,eu=(0,x.useRef)(0),{theme:em}=(0,eR.W)(),{startAttempt:ep,trackBlocked:ex,trackQuantityRequired:eg,trackInvalidPrice:eh,trackSubmit:eb,trackResult:ey}=(0,ez.sj)({accountMode:"live",theme:em,symbol:r,lastPrice:h,form:$}),ef=()=>{let e=(0,eH.I)({Pre_IPO_risk_protocol:Z,usdtContract_protocol:V,usdt_complete_quiz:K},(0,eB.YV)(G));return!!e&&(B.showLayer(e),!0)},ev=(0,P.useMutation)({mutationFn:e=>(0,eA.J_)({locale:t,params:{settingKey:"usdt_user_confirm",settingValue:e}})}),{executeSubmit:eN,loading:ej}=function(e){let{locale:t,symbol:r,clearQuantityValues:n,clearTpslAdvanced:a,submitOpenOrder:i,submitCloseOrder:l,onSubmitSuccess:s,onSubmitResult:o}=e,{$t:c}=(0,d.B)(),u=(0,S.W5)(),m={locale:t,symbol:r},p=(e,t)=>{try{null==o||o(e,t)}catch(e){console.warn("[StandardOrderPanelSubmitMutations] ä¸åç»æåè°å¤±è´¥:",e)}},x=(0,P.useMutation)({mutationFn:e=>{let n=Date.now();return i(t,r,e).then(e=>({...e,durationMs:Date.now()-n}))},onSuccess:(e,t)=>{p({side:"open",...t},e),e.success?((0,C.toast)({type:"success",title:c("Order placed successfully")}),(0,er.B$)(m).catch(e=>{console.error("[StandardOrderPanelSubmitMutations] å·æ°å¼ä»æååæ°æ®å¤±è´¥:",e)}),n(),a(),s()):10307===e.errorCode&&(s(),u.showLayer())}}),g=(0,P.useMutation)({mutationFn:e=>{let n=Date.now();return l(t,r,e).then(e=>({...e,durationMs:Date.now()-n}))},onSuccess:(e,t)=>{p({side:"close",...t},e),e.success&&((0,C.toast)({type:"success",title:c("Order placed successfully")}),e_.B.getState().resetCloseEditors(),(0,er.o8)(m).catch(e=>{console.error("[StandardOrderPanelSubmitMutations] å·æ°å¹³ä»æååæ°æ®å¤±è´¥:",e)}),n(),s())}});return{executeSubmit:e=>"open"===e.side?x.mutateAsync({direction:e.direction,quantity:e.quantity,orderPrice:e.orderPrice,triggerPrice:e.triggerPrice,takeProfitPrice:e.takeProfitPrice,stopLosePrice:e.stopLosePrice}):g.mutateAsync({direction:e.direction,quantity:e.quantity,orderPrice:e.orderPrice}),loading:x.isPending||g.isPending}}({locale:t,symbol:r,clearQuantityValues:O,clearTpslAdvanced:I,submitOpenOrder:q,submitCloseOrder:U,onSubmitSuccess:()=>{es(),el(),R.hideLayer(),z.hideLayer()},onSubmitResult:ey}),eC=(0,eD.N)(e=>{let t=eN(e);if(!t)throw Error("å¼ä»è¯·æ±æªè¿å Promise");return eb(e),t}),ew=(0,eD.N)(e=>{let t=eN(e);if(!t)throw Error("å¹³ä»è¯·æ±æªè¿å Promise");return eb(e),t}),eT=e=>{if(D||"open"===e.side&&ed)return;if("close"===e.side){let t=ew(e);if(!t)return;t.catch(e=>{console.error("[StandardOrderPanelActions] å¹³ä»è¯·æ±å¤±è´¥:",e)});return}let t=eC(e);t&&t.catch(e=>{console.error("[StandardOrderPanelActions] å¼ä»è¯·æ±å¤±è´¥:",e)})},ek=async e=>{if(D||"open"===e.side&&ed)return;let n=(0,eF.p5)($.orderType);if(!(0,eF.R4)(i,n))return void eT(e);if(ea(!1),en(e),ei(""),R.showLayer(),"open"===e.side){let n=eu.current+=1;E(t,r,{direction:e.direction,quantity:e.quantity,orderPrice:e.orderPrice,triggerPrice:e.triggerPrice,positionMode:e.positionMode}).then(e=>{eu.current===n&&ei(e||"")}).catch(()=>{eu.current===n&&ei("")})}},eP=async e=>{if("limit"===$.orderType&&Number($.orderPrice||0)>0){let t=(0,eF.B2)(e.direction,$.orderPrice,h);if(t.greater){en(e),et(t.direction),z.showLayer();return}}await ek(e)},eS=e=>!!(0,eV.Hk)({orderType:$.orderType,orderPrice:$.orderPrice,triggerPrice:$.triggerPrice})||(eh(e),(0,C.toast)({type:"error",title:Q("Please enter order price.")}),!1);return{confirmItems:function(e){let{pendingSubmit:t,form:r,calcPrice:n,multiplier:a,quantityPrecision:i,unitLabel:l,oneContCost:s,coinPrecision:o,baseAsset:c,costs:u,quoteAsset:m,markPrice:p,estLiqPrice:g,symbol:h,longPosition:b,shortPosition:y,lastPrice:f,contractMultiplier:v,getConfirmQuantityDisplayText:N}=e,{$t:j}=(0,d.B)();return(0,x.useMemo)(()=>
1{if(!t)return[];let e=N({quantityCont:t.quantity,side:"openShort"===t.direction||"closeLong"===t.direction?"sell":"buy",tradeUnit:r.tradeUnit,multiplier:Number(a||0),price:n,quantityPrecision:i,unitLabel:l,usdtCost:r.usdtCost,oneContCostBuy:Number(s.buy),oneContCostSell:Number(s.sell),coinPrecision:o,baseAsset:c}),d=(0,eJ.wb)(t.orderPrice)?(0,eY.iT)(String(t.orderPrice)):"--";if("open"===t.side){let n="openLong"===t.direction?u.buy:u.sell,a="openLong"===t.direction?"â¥":"â¤",i="openShort"===t.direction?"â¥":"â¤",l=r.takeProfitPrice?(0,eY.iT)(String(r.takeProfitPrice)):"--",s=r.stopLossPrice?(0,eY.iT)(String(r.stopLossPrice)):"--";return[..."planLimit"===r.orderType||"planMarket"===r.orderType?[{label:j("Trigger Price"),value:(0,eJ.wb)(t.triggerPrice)?(0,eY.iT)(String(t.triggerPrice)):"--"}]:[],{label:j("Price_3"),value:"market"===r.orderType||"planMarket"===r.orderType?j("Market_2"):"".concat(d," ").concat(m)},{label:j("Quantity_1"),value:e},{label:j("Cost"),value:"".concat((0,eq.cf)(n)," ").concat(m)},{label:j("Take Profit"),value:r.takeProfitPrice?"".concat("latest"===r.tpTriggerWay?j("Last"):j("Mark")," ").concat(a," ").concat(l):"--"},{label:j("Stop Loss"),value:r.stopLossPrice?"".concat("latest"===r.slTriggerWay?j("Last"):j("Mark")," ").concat(i," ").concat(s):"--"},{label:j("Mark Price"),value:(0,eJ.wb)(p)?(0,eY.iT)(String(p)):"--"},{label:j("Est. Liq Price"),value:(0,eJ.wb)(g)?(0,eY.iT)(String(g)):"--"}]}let x="closeLong"===t.direction?b:y,h=Number((null==x?void 0:x.avgPrice)||0),C=Number((null==x?void 0:x.positionMargin)||0),w=Number(t.orderPrice||f||0),T=0;h&&t.quantity&&w&&v&&(T=("closeLong"===t.direction?w-h:h-w)*t.quantity*Number(v||0));let k=Number((0,e$.eh)(T,2)),P=C>0?Number((0,eJ.u3)(k,C)):0,S=k>0?"text-p2":k<0?"text-p3":"text-t1",L=k>0?"+":"",M=P>0?"+":"";return[{label:j("Price"),value:"market"===r.orderType?j("Market_2"):"".concat(d," ").concat(m)},{label:j("Quantity"),value:e},{label:"".concat(j("Expected P/L")," (").concat(j("by order price"),")"),value:"".concat(L).concat((0,eY.iT)(k)," ").concat(m),subValue:"(".concat(M).concat((0,eY.BY)(P)||"0.00%",")"),valueClassName:S,subValueClassName:S,dividerBefore:!0}]},[n,v,u.buy,u.sell,g,r.orderType,r.slTriggerWay,r.stopLossPrice,r.takeProfitPrice,r.tpTriggerWay,r.tradeUnit,r.usdtCost,f,b,p,a,t,i,m,c,y,h,o,l,N,s.buy,s.sell])}({pendingSubmit:Y,form:$,calcPrice:u,multiplier:c,quantityPrecision:j,unitLabel:v,oneContCost:m,coinPrecision:N,baseAsset:f,costs:M,quoteAsset:y,markPrice:b,estLiqPrice:ee,symbol:r,longPosition:k,shortPosition:L,lastPrice:h,contractMultiplier:w,getConfirmQuantityDisplayText:J}),loading:ej,pendingSubmit:Y,handleOpenSubmit:e=>{if(!n)return void a();if(D||ef()||ed)return;let t=ep(e);if(!eS(t))return;let r=(0,eV.wL)({direction:e,longQuantity:$.longQuantity,shortQuantity:$.shortQuantity,quantity:$.quantity}),i="openLong"===e?Number(m.buy||0):Number(m.sell||0),s=(0,eV.eT)({minTradeAmount:o,tradeUnit:$.tradeUnit,multiplier:c,calcPrice:u,usdtCost:$.usdtCost,oneContCost:i}),d=(0,eV.Qx)({direction:e,longQuantity:$.longQuantity,shortQuantity:$.shortQuantity,quantity:$.quantity,tradeUnit:$.tradeUnit,multiplier:c,calcPrice:u,usdtCost:$.usdtCost,oneContCostBuy:Number(m.buy||0),oneContCostSell:Number(m.sell||0)}),p=(0,eV.vC)({orderType:$.orderType,availableBalance:l,displayQuantity:r,minDisplayQuantity:s,quantityCont:d});if(!p.valid)return void("INSUFFICIENT_AVAILABLE_BALANCE"===p.errorCode?(ex(t,"insufficient_available_balance"),(0,C.toast)({type:"error",title:Q("Insufficient available balance")})):"ORDER_QUANTITY_REQUIRED"===p.errorCode?(eg(t,e),(0,C.toast)({type:"error",title:Q("Please enter order quantity.")})):"BELOW_MIN_ORDER_QUANTITY"===p.errorCode&&(ex(t,"below_min_amount"),(0,C.toast)({type:"error",title:Q("The minimum order quantity is {0} {1}",{0:p.minQuantity,1:v})})));eP({side:"open",direction:e,quantity:d,orderPrice:$.orderPrice,triggerPrice:$.triggerPrice,positionMode:$.positionMode,takeProfitPrice:$.takeProfitPrice?Number($.takeProfitPrice):"",stopLosePrice:$.stopLossPrice?Number($.stopLossPrice):"",trackingAttempt:t})},handleCloseSubmit:e=>{if(!n)return void a();if(D||ef())return;let t=ep(e);if((0,eV.jO)($.positionMode)){ex(t,"separated_position_close_required"),(0,C.toast)({type:"error",title:Q("Please close in the position in the split position mode")});return}if(("limit"===$.orderType||"postOnly"===$.orderType)&&0>
1=Number($.orderPrice||0)){ex(t,"invalid_order_price"),(0,C.toast)({type:"error",title:Q("Please enter order price.")});return}let r=(0,eV.Kv)({direction:e,longQuantity:$.longQuantity,shortQuantity:$.shortQuantity,quantity:$.quantity,tradeUnit:$.tradeUnit,multiplier:c,calcPrice:u,usdtCost:$.usdtCost}),i="closeLong"===e?p:g,l=(0,eV.bh)({quantityCont:r,maxCont:i});if(!l.valid)return void("ORDER_QUANTITY_REQUIRED"===l.errorCode?(eg(t,e),(0,C.toast)({type:"error",title:Q("Please enter order quantity.")})):"EXCEEDS_AVAILABLE_SIZE"===l.errorCode&&(ex(t,"exceed_closeable_amount"),(0,C.toast)({type:"error",title:Q("Exceed available size")})));eP({side:"close",direction:e,quantity:l.submitQuantityCont,orderPrice:$.orderPrice,trackingAttempt:t})},openTpslAdvanced:()=>{if(!n)return void a();if(eS()){if(!Number($.quantity||0)&&!Number($.longQuantity||0)&&!Number($.shortQuantity||0))return void(0,C.toast)({type:"error",title:Q("Please enter order quantity.")});F.showLayer()}},openConfirmDialog:ek,executeSubmit:eT,persistNeverRemind:e=>{if(!X)return;let t=(0,eF.RY)(i,e,!1);H({usdt_user_confirm:t}),ev.mutate(t)}}}({locale:t,symbol:r,isLoggedIn:a,gotoLogin:i,confirmStr:o,availableBalance:c,minTradeAmount:u,multiplier:m,calcPrice:p,oneContCost:g,maxOpenBuyCont:h,maxOpenSellCont:b,closeLongContLimit:y,closeShortContLimit:f,lastPrice:N,markPrice:j,quoteAsset:w,baseAsset:M,unitLabel:O,coinPrecision:I,quantityPrecision:q,contractMultiplier:U,longPosition:E,shortPosition:Q,costs:D,clearQuantityValues:R,clearTpslAdvanced:z,submitOpenOrder:B,submitCloseOrder:F,estimateLiqPrice:H});return{confirmItems:et,loading:en,handleOpenSubmit:ea,handleCloseSubmit:ei,openTpslAdvanced:el,...function(e){let{locale:t,symbol:r,serviceSymbol:n,isLoggedIn:a,gotoLogin:i,form:l,ensureContractTier:s,initializeCalculatorForm:o,loadSettings:c,saveSettings:u,update:m,settingsLayer:p,calculatorLayer:x,tpslAdvancedLayer:g,differenceLayer:h,setDifferenceDirection:b,openConfirmDialog:y,persistNeverRemind:f,executeSubmit:N}=e,{$t:j}=(0,d.B)(),w=(0,k.useQueryClient)(),T=(0,S.W5)();return{handleOpenSettings:async()=>{if(!a)return void i();p.showLayer(),c(t,r)},handleOpenCalculator:()=>{o(n,l.marginMode),x.showLayer(),s({locale:t})},handleChangeActiveTab:e=>{m({activeTab:e,quantity:"",longQuantity:"",shortQuantity:"",percentage:0,..."close"===e?{checkedTpsl:!1,isPercentage:!1,orderType:"planLimit"===l.orderType||"planMarket"===l.orderType?"market":l.orderType,triggerPrice:"",takeProfitPrice:"",stopLossPrice:"",tpOrderPrice:"",slOrderPrice:"",takeProfitRate:"",stopLossRate:"",takeProfitRateAbout:"",stopLossRateAbout:"",tpTriggerWay:"mark",slTriggerWay:"mark",tpPriceType:"market",slPriceType:"market",tpslActiveTab:"openLong",tpslAdvancedEdited:!1}:{}}),"close"===e&&g.hideLayer()},handleSettingsConfirm:async e=>{let a=await u(t,r,e);if(!a.success){10337===a.errorCode&&(T.showLayer(),p.hideLayer());return}w.setQueryData((0,L.sJ)(t,n),t=>({...t,data:(0,v.dH)({longLeverage:e.longLeverage,shortLeverage:e.shortLeverage,marginMode:e.marginMode,positionMode:l.positionMode,current:null==t?void 0:t.data})})),(0,C.toast)({type:"success",title:j("Success")}),p.hideLayer()},handleTpslConfirm:e=>{m(e),g.hideLayer()},handleDifferenceConfirm:async()=>{h.hideLayer(),b(void 0);let e=eZ.X.getState().pendingSubmit;e&&await y(e)},handleConfirmSubmit:()=>{let e=eZ.X.getState().pendingSubmit;e&&(f((0,eF.p5)(l.orderType)),N(e))}}}({locale:t,symbol:r,serviceSymbol:n,isLoggedIn:a,gotoLogin:i,form:l,ensureContractTier:V,initializeCalculatorForm:Z,loadSettings:K,saveSettings:W,update:G,settingsLayer:J,calculatorLayer:$,tpslAdvancedLayer:Y,differenceLayer:X,setDifferenceDirection:ee,openConfirmDialog:es,persistNeverRemind:ec,executeSubmit:eo})}}({locale:a,symbol:t,serviceSymbol:p,isLoggedIn:i,gotoLogin:l,form:o,confirmStr:M,availableBalance:K,minTradeAmount:null==h?void 0:h.minTradeAmount,multiplier:W,calcPrice:G,oneContCost:J,maxOpenBuyCont:$,maxOpenSellCont:Y,closeLongContLimit:et,closeShortContLimit:en,lastPrice:f,markPrice:N,quoteAsset:j,baseAsset:w,unitLabel:ed,coinPrecision:ec,quantityPrecision:eo,contractMultiplier:Number((null==h?void 0:h.multiplier)||0),longPosition:b,shortPosition:y,costs:ea,clearQuantityValues:ef.clearQuantityValues,clearTpslAdvanced:ef.clearTpslAdvanced,submitOpenOrder:F,submitCloseOrder:H,estimateLiqPrice:V,ensureContractTier:g,initializeCalculatorForm:R,loadSettings:z,saveSettings:B,update:c,settingsLayer:O,calculatorLayer:I,tpslAdvancedLayer:q,differenceLayer:U,setDifferenceDirection:Z}),eN=function(e){let{orderType:t,plansNeverRemind:r,lastPrice:n,setOrderType:a,setOrderTypeMenuOpen:i,showTriggerOrdersNotice:l,update:s}=e;return{handleSetOrderType:(0,x.useCallback)(function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;
1a(e),i(!1),"planLimit"===e&&n&&s({orderPrice:String(n)}),"planLimit"!==e||r||"planMarket"===o||l()},[n,t,r,a,i,l,s]),handleEnableTpsl:(0,x.useCallback)(()=>{s({checkedTpsl:!0})},[s])}}({orderType:o.orderType,plansNeverRemind:Q,lastPrice:f,setOrderType:u,setOrderTypeMenuOpen:D,showTriggerOrdersNotice:E.showLayer,update:c});return{interactions:ef,submit:ev,orderTypeActions:eN,getMaxPositionLabel:em}}({symbol:t,facts:r,derivations:n}),{form:i,market:{quoteAsset:l,serviceSymbol:o,contractConfig:c,lastPrice:u,markPrice:p,baseAsset:h},dialogs:{settingsLoading:b,settingsSaving:y,settingsError:f,settingsMarginDisabled:N}}=r,{interactions:w,submit:M,orderTypeActions:{handleSetOrderType:O,handleEnableTpsl:I},getMaxPositionLabel:U}=a,{availableBalanceText:E,quantityMode:Q,quantityModeOptions:D,tradeUnitValue:R,tradeUnitOptions:z,quantityValueHint:B,sliderPercent:F,hasDirectionalQuantity:H,unitLabel:V,maxOpenBuy:Z,maxOpenSell:K,maxCloseLong:W,maxCloseShort:G,roundedMaxCloseLong:J,roundedMaxCloseShort:$,costs:Y,formatMaxDisplay:et,formatCostDisplay:e
1n,maxLeverage:ea,quantityCont:ei,longQuantityCont:el,shortQuantityCont:es,oneContCost:eo,calcPrice:ec,coinPrecision:ed}=n,{orderEntry:eu,quantity:em,footer:ep,dialogs:ex}=function(e){let{availableBalanceText:t,quoteAsset:r,quantityMode:n,quantityModeOptions:a,tradeUnitValue:i,tradeUnitOptions:l,quantityValueHint:s,sliderPercent:o,hasDirectionalQuantity:c,loading:d,unitLabel:u,activeTab:m,maxOpenBuy:p,maxOpenSell:g,maxCloseLong:h,maxCloseShort:b,roundedMaxCloseLong:y,roundedMaxCloseShort:f,costs:v,formatMaxDisplay:N,formatCostDisplay:j,settingsMarginDisabled:C,settingsLoading:w,settingsSaving:T,settingsError:k,maxLeverage:P,serviceSymbol:S,symbol:L,quantityCont:M,longQuantityCont:O,shortQuantityCont:_,contractMultiplier:A,contractPrecision:I,coinPrecision:q,oneContCost:U,lastPrice:E,markPrice:Q,calcPrice:D,confirmItems:R,baseAsset:z}=e,B=(0,x.useMemo)(()=>({availableBalanceText:t,quoteAsset:r}),[t,r]),F=(0,x.useMemo)(()=>({quantityMode:n,quantityModeOptions:a,tradeUnitValue:i,tradeUnitOptions:l,quantityValueHint:s,sliderPercent:o,hasDirectionalQuantity:c}),[c,n,a,s,o,l,i]),H=(0,x.useMemo)(()=>({loading:d,quoteAsset:r,unitLabel:u,maxLeft:N("open"===m?p:f),maxRight:N("open"===m?g:y),costLeft:j(v.buy),costRight:j(v.sell)}),[m,v.buy,v.sell,j,N,d,h,b,y,f,p,g,r,u]),V=(0,x.useMemo)(()=>({marginDisabled:C,settingsLoading:w,settingsSaving:T,settingsError:k,maxLeverage:P,serviceSymbol:S,symbol:L,quantityCont:M,longQuantityCont:O,shortQuantityCont:_,multiplier:A,precision:I,coinPrecision:q,oneContCostBuy:Number(U.buy),oneContCostSell:Number(U.sell),lastPrice:E,markPrice:Q,calcPrice:D,confirmItems:R,confirmLoading:d,baseAsset:z}),[z,D,q,R,A,I,E,d,Q,P,U.buy,U.sell,O,M,S,k,w,C,T,_,L]);return{orderEntry:B,quantity:F,footer:H,dialogs:V}}({availableBalanceText:E,quoteAsset:l,quantityMode:Q,quantityModeOptions:D,tradeUnitValue:R,tradeUnitOptions:z,quantityValueHint:B,sliderPercent:F,hasDirectionalQuantity:H,loading:M.loading,unitLabel:V,activeTab:i.activeTab,maxOpenBuy:Z,maxOpenSell:K,maxCloseLong:W,maxCloseShort:G,roundedMaxCloseLong:J,roundedMaxCloseShort:$,costs:Y,formatMaxDisplay:et,formatCostDisplay:e
1n,settingsMarginDisabled:N,settingsLoading:b,settingsSaving:y,settingsError:f,maxLeverage:ea,serviceSymbol:o,symbol:t,quantityCont:ei,longQuantityCont:el,shortQuantityCont:es,contractMultiplier:Number((null==c?void 0:c.multiplier)||0),contractPrecision:Number((null==c?void 0:c.precision)||2),coinPrecision:ed,oneContCost:eo,lastPrice:u,markPrice:p,calcPrice:ec,confirmItems:M.confirmItems,baseAsset:h});!function(e){let t=(0,e0.$)(e=>e.resetComputed),r=(0,e0.$)(e=>e.syncComputed),n=(0,eX.T)(e=>e.resetActions),a=(0,eX.T)(e=>e.syncActions);(0,x.useEffect)(()=>{t(),n()},[e.symbolKey,n,t]),(0,x.useEffect)(()=>{r({orderEntry:e.orderEntry,quantity:e.quantity,footer:e.footer,dialogs:e.dialogs})},[e.dialogs,e.footer,e.orderEntry,e.quantity,r]),(0,x.useEffect)(()=>{a(e.actions)},[e.actions,a])}({symbolKey:t,orderEntry:eu,quantity:em,footer:ep,dialogs:ex,actions:function(e){let{activeTab:t,onTransfer:r,onSetOrderType:n,onNumberFieldChange:a,onToggleReferencePriceField:i,onFillLastPrice:l,onQuantityModeChange:s,onTradeUnitChange:o,onPercentageChange:c,onSliderChange:d,onClearQuantity:u,onOpenSubmit:m,onCloseSubmit:p,onOpenSettings:g,onOpenCalculator:h,onChangeActiveTab:b,onDisableTpsl:y,onEnableTpsl:f,onOpenTpslAdvanced:v,onToggleTpslTriggerWay:N,onTpslNumberFieldChange:j,getMaxPositionLabel:C,onSettingsConfirm:w,onTpslConfirm:T,onDifferenceConfirm:k,onConfirmSubmit:P}=e;return(0,x.useMemo)(()=>({onTransfer:r,onSetOrderType:n,onNumberFieldChange:a,onToggleReferencePriceField:i,onFillLastPrice:l,onQuantityModeChange:s,onQuantityChange:a("quantity"),onTradeUnitChange:o,onPercentageChange:c,onSliderChange:d,onClearQuantity:u,onPrimaryAction:()=>"open"===t?m("openLong"):p("closeShort"),onSecondaryAction:()=>"open"===t?m("openShort"):p("closeLong"),onOpenSettings:g,onOpenCalculator:h,onChangeActiveTab:b,onDisableTpsl:y,onEnableTpsl:f,onOpenTpslAdvanced:v,onToggleTpslTriggerWay:N,onTpslNumberFieldChange:j,getMaxPositionLabel:C,onSettingsConfirm:w,onTpslConfirm:T,onDifferenceConfirm:k,onConfirmSubmit:P}),[t,C,b,u,p,P,k,y,f,l,a,h,g,m,v,c,s,n,w,d,i,N,j,T,o,r])}({activeTab:i.activeTab,onTransfer:w.handleTransfer,onSetOrderType:O,onNumberFieldChange:w.handleNumberFieldChange,onToggleReferencePriceField:w.toggleReferencePriceField,onFillLastPrice:w.fillLastPrice,onQuantityModeChange:w.handleQuantityModeChange,onTradeUnitChange:w.handleTradeUnitChange,onPercentageChange:w.handlePercentageInputChange,onSliderChange:w.handleSliderChange,onClearQuantity:w.clearQuantityValues,onOpenSubmit:M.handleOpenSubmit,onCloseSubmit:M.handleCloseSubmit,onOpenSettings:M.handleOpenSettings,onOpenCalculator:M.handleOpenCalculator,onChangeActiveTab:M.handleChangeActiveTab,onDisableTpsl:w.clearTpslAdvanced,onEnableTpsl:I,onOpenTpslAdvanced:M.openTpslAdvanced,onToggleTpslTriggerWay:w.toggleTriggerWay,onTpslNumberFieldChange:w.handleNumberFieldChange,getMaxPositionLabel:U,onSettingsConfirm:M.handleSettingsConfirm,onTpslConfirm:M.handleTpslConfirm,onDifferenceConfirm:M.handleDifferenceConfirm,onConfirmSubmit:M.handleConfirmSubmit})})}function e8(){let e=(0,eK.Mr)((0,A.k)(e=>({marginMode:e.form.marginMode,longLeverage:e.form.longLeverage,shortLeverage:e.form.shortLeverage}))),t=(0,eX.T)((0,A.k)(e=>({onOpenSettings:e.actions.onOpenSettings,onOpenCalculator:e.actions.onOpenCalculator})));return{...e,...t}}function e9(){return{activeTab:(0,eK.Mr)(e=>e.form.activeTab),onChangeActiveTab:(0,eX.T)(e=>e.actions.onChangeActiveTab)}}function te(){let e=(0,e0.$)((0,A.k)(e=>({availableBalanceText:e.orderEntry.availableBalanceText,quoteAsset:e.orderEntry.quoteAsset}))),t=(0,eX.T)(e=>e.actions.onTransfer);return{...e,onTransfer:t}}function tt(){let e=(0,eK.Mr)((0,A.k)(e=>({activeTab:e.form.activeTab,orderType:e.form.orderType}))),t=(0,eX.T)(e=>e.actions.onSetOrderType),r=(0,eW.M)((0,A.k)(e=>({orderTypeMenuOpen:e.orderTypeMenuOpen,setOrderTypeMenuOpen:e.setOrderTypeMenuOpen})));return{...e,...r,onSetOrderType:t}}function tr(){return{sliderPercent:(0,e0.$)(e=>e.quantity.sliderPercent),onSliderChange:(0,eX.T)(e=>e.actions.onSliderChange)}}function tn(){let e=(0,eK.Mr)(e=>e.form.activeTab),t=(0,m.k)(e=>{var t;return!!(null==(t=e.user)?void 0:t.userId)});
1return{activeTab:e,isLoggedIn:t,footer:(0,e0.$)((0,A.k)(e=>({loading:e.footer.loading,quoteAsset:e.footer.quoteAsset,unitLabel:e.footer.unitLabel,maxLeft:e.footer.maxLeft,maxRight:e.footer.maxRight,costLeft:e.footer.costLeft,costRight:e.footer.costRight}))),actions:(0,eX.T)((0,A.k)(e=>({onPrimaryAction:e.actions.onPrimaryAction,onSecondaryAction:e.actions.onSecondaryAction})))}}var ta=r(51662);function ti(e,t){let r="close"===e;return r||"planLimit"!==t&&"planMarket"!==t?r&&("planLimit"===t||"planMarket"===t)?"limit":"postOnly"===t?"dropdown":"market"===t?"market":"limit":"trigger"}function tl(){let{$t:e}=(0,d.B)(),{activeTab:t,orderType:r,orderTypeMenuOpen:a,setOrderTypeMenuOpen:i,onSetOrderType:l}=tt(),s="close"===t,o=ti(t,r),c=e("postOnly"===r?"Post Only":"Trigger Orders_1_r_1"),u=e("market"===r?"Market order refers to fast buying and selling at the best price currently available in the market":"planLimit"===r||"planMarket"===r?"When the price touches the trigger price, a limit order will be placed in the market according to the set quantity, execution price, and trade direction. The order will not freeze assets before it is triggered and is subject to factors such as fill price, position limits, or tier limits, etc., and does not guarantee success.":"postOnly"===r?"Post Only orders will be added to the order book and not execute with a pre-existing order.":"A limit order is to buy or sell at a specific price, and a limit order cannot guarantee execution"),m=e=>{i(!1),l(e,r)};return(0,n.jsxs)("div",{className:"border-l1 dark:border-l3 mb-4 flex min-w-0 items-start gap-2 border-b pb-[9px] rtl:flex-row-reverse",children:[(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-4 rtl:flex-row-reverse",children:[(0,n.jsxs)("button",{type:"button",className:"relative inline-flex h-4 cursor-pointer flex-col items-start gap-2 ".concat("limit"===o?"text-t1":"text-t3 hover:text-t1"),onClick:()=>m("limit"),children:[(0,n.jsx)("span",{className:"text-[12px] leading-4 font-medium",children:e("Limit_2")}),(0,n.jsx)("span",{className:"bg-t1 absolute right-0 bottom-[-10px] left-0 h-px transition-opacity ".concat("limit"===o?"opacity-100":"opacity-0")})]}),(0,n.jsxs)("button",{type:"button",className:"relative inline-flex h-4 cursor-pointer items-start ".concat("market"===o?"text-t1":"text-t3 hover:text-t1"),onClick:()=>m("market"),children:[(0,n.jsx)("span",{className:"text-[12px] leading-4 font-normal",children:e("Market_r_1")}),(0,n.jsx)("span",{className:"bg-t1 absolute right-0 bottom-[-10px] left-0 h-px transition-opacity ".concat("market"===o?"opacity-100":"opacity-0")})]}),s?(0,n.jsxs)("button",{type:"button",className:"relative inline-flex h-4 cursor-pointer items-start ".concat("dropdown"===o?"text-t1":"text-t3 hover:text-t1"),onClick:()=>m("postOnly"),children:[(0,n.jsx)("span",{className:"text-[12px] leading-4 font-normal",children:e("Post Only")}),(0,n.jsx)("span",{className:"bg-t1 absolute right-0 bottom-[-10px] left-0 h-px transition-opacity ".concat("dropdown"===o?"opacity-100":"opacity-0")})]}):(0,n.jsx)("div",{className:"min-w-0 flex-1",children:(0,n.jsxs)(D.DropdownMenu,{trigger:"hover",modal:!1,onVisibleChange:i,children:[(0,n.jsx)(D.DropdownMenuTrigger,{showIcon:!1,className:"!w-full !min-w-0 !outline-none",triggerClassName:"flex h-4 w-full min-w-0 cursor-pointer items-center ".concat("trigger"===o||"dropdown"===o?"text-t1":"text-t3 hover:text-t1"),children:(0,n.jsxs)("span",{className:"relative inline-flex max-w-full min-w-0 items-center gap-1",children:[(0,n.jsx)("span",{className:"min-w-0 truncate text-[12px] leading-4 font-normal",children:c}),(0,n.jsx)(Q.C,{className:"size-[12px] shrink-0 transition-transform ".concat(a?"rotate-180":"")}),(0,n.jsx)("span",{className:"bg-t1 absolute right-0 bottom-[-10px] left-0 h-px transition-opacity ".concat("trigger"===o||"dropdown"===o?"opacity-100":"opacity-0")})]})}),(0,n.jsx)(D.DropdownMenuContent,{align:"start",sideOffset:10,className:"!border-l1 !bg-m1 !shadow-2 !flex !min-w-[132px] !flex-col !gap-1 !rounded-[8px] !py-2",children:[{label:e("Trigger Orders_1_r_1"),value:"planLimit"},{label:e("Post Only_r_1"),value:"postOnly"}].map(e=>{let t="planLimit"===e.value&&("planLimit"===r||"planMarket"===r)||r===e.value;return(0,n.jsx)(D.DropdownMenuItem,{className:"!rounded-r1 !mx-2 !px-2 !py-[10px] !text-[12px] !leading-4 !font-normal ".concat(t?"!bg-bg2 !text-t1 hover:!bg-bg2 !shadow-[inset_0_0_0_1px_var(--line-1)]":"!text-t1 hover:!bg-bg2"),onSelect:()=>l(e.value,r),children:e.label},e.value)})})]})})]}),(0,n.jsx)(F.Tooltip,{content:(0,n.jsx)("div",{className:"text-t1 max-w-[300px] text-[12px] leading-4",children:u}),side:"left",align:"start",className:"!max-w-[320px]",children:(0,n.jsx)(ta.m,{className:"text-t3 hover:text-t2 inl
1ine-flex size-4 shrink-0 cursor-help items-center justify-center"})})]})}function ts(){let{$t:e}=(0,d.B)(),{form:t,quoteAsset:r,actions:a}=function(){let e=(0,eK.Mr)((0,A.k)(e=>({activeTab:e.form.activeTab,orderType:e.form.orderType,triggerPrice:e.form.triggerPrice,triggerWay:e.form.triggerWay,orderPrice:e.form.orderPrice})));return{form:e,quoteAsset:(0,e0.$)(e=>e.orderEntry.quoteAsset),actions:(0,eX.T)((0,A.k)(e=>({onNumberFieldChange:e.actions.onNumberFieldChange,onToggleReferencePriceField:e.actions.onToggleReferencePriceField,onFillLastPrice:e.actions.onFillLastPrice,onSetOrderType:e.actions.onSetOrderType})))}}(),i=ti(t.activeTab,t.orderType);return(0,n.jsxs)("div",{className:"flex flex-col gap-2 md:gap-3",children:["trigger"===i?(0,n.jsx)(eP.q,{label:"".concat(e("Trigger Price")," (").concat(r,")"),value:t.triggerPrice,onChange:a.onNumberFieldChange("triggerPrice"),placeholder:"",wrapperClassName:"!bg-bg2 !border-transparent !px-[12px] focus-within:!border-p1 [&_[data-motion-state=raised]_label]:!text-t3",inputClassName:"!text-b14 placeholder:!text-t4",suffix:(0,n.jsxs)("button",{type:"button",className:"text-c12 md:text-b14 text-t1 inline-flex min-w-[52px] cursor-pointer items-center justify-end gap-[5px] leading-none rtl:flex-row-reverse rtl:justify-start",onClick:()=>a.onToggleReferencePriceField("triggerPrice"),children:[(0,n.jsx)("span",{children:e("latest"===t.triggerWay?"Last":"Mark")}),(0,n.jsx)(ec.y,{className:"size-[12px]"})]})}):null,"market"!==t.orderType?(0,n.jsx)(eP.q,{label:"".concat(e("trigger"===i?"Price_2":"Price")," (").concat(r,")"),value:t.orderPrice,onChange:a.onNumberFieldChange("orderPrice"),placeholder:"planMarket"===t.orderType?e("Market Price"):"",disabled:"planMarket"===t.orderType,wrapperClassName:"planMarket"===t.orderType?"!bg-bg07 !border-l1 !cursor-not-allowed !px-[12px] opacity-100":"!bg-bg2 !border-transparent !px-[12px] focus-within:!border-p1 [&_[data-motion-state=raised]_label]:!text-t3",inputClassName:"planMarket"===t.orderType?"!text-b14 !text-t4 placeholder:!text-t4":"!text-b14 placeholder:!text-t4",suffix:"limit"===t.orderType||"postOnly"===t.orderType?(0,n.jsx)("button",{type:"button",dir:"ltr",className:"text-c12 md:text-b14 text-p1-dark hover:text-p1 inline-flex min-w-[40px] cursor-pointer items-center justify-end text-right leading-none transition-colors",onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),a.onFillLastPrice("orderPrice")},children:e("Last")}):"trigger"===i?(0,n.jsxs)("button",{type:"button",className:"text-c12 md:text-b14 text-t1 inline-flex min-w-[52px] cursor-pointer items-center justify-end gap-[5px] leading-none rtl:flex-row-reverse rtl:justify-start",onClick:()=>a.onSetOrderType("planMarket"===t.orderType?"planLimit":"planMarket",t.orderType),children:[(0,n.jsx)("span",{children:e("planMarket"===t.orderType?"Market":"Limit")}),(0,n.jsx)(ec.y,{className:"size-[12px]"})]}):null}):null]})}function to(){let e=(0,e0.$)(e=>e.quantity.quantityValueHint);return(0,n.jsx)("div",{className:"flex items-center justify-between gap-[12px]",children:(0,n.jsx)("div",{className:"text-c12 text-t2 min-w-0 flex-1 overflow-hidden leading-[16px] text-ellipsis whitespace-nowrap rtl:text-right",children:e})})}
1var tc=r(97492),td=r(7126);function tu(e){let{menuWidth:t}=e,{$t:r,i18n:i,locale:l}=(0,d.B)(),s=(0,a.no)(),{tradeUnitValue:o,tradeUnitOptions:c,selectedOption:u,onTradeUnitChange:m}=function(){let e=(0,e0.$)((0,A.k)(e=>({tradeUnitValue:e.quantity.tradeUnitValue,tradeUnitOptions:e.quantity.tradeUnitOptions}))),t=(0,eX.T)(e=>e.actions.onTradeUnitChange),r=e.tradeUnitOptions.find(t=>t.value===e.tradeUnitValue);return{...e,selectedOption:r,onTradeUnitChange:t}}(),[p,g]=(0,x.useState)(!1),[h,b]=(0,x.useState)(o),y=i.dir(l);return s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"text-c12 text-t1 inline-flex min-w-[42px] shrink-0 cursor-pointer items-center justify-end gap-1.5",onClick:()=>{b(o),g(!0)},children:[(0,n.jsx)("span",{children:(null==u?void 0:u.triggerLabel)||(null==u?void 0:u.label)}),(0,n.jsx)(Q.C,{className:"text-t1 size-3 shrink-0"})]}),(0,n.jsx)(ek.DrawerRoot,{open:p,onOpenChange:g,children:(0,n.jsx)(ek.DrawerContent,{dir:y,className:"!bg-m1 max-h-[85dvh] !rounded-t-[20px] !border-none px-4 pt-5 pb-6",children:(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{className:"text-t1 text-[16px] leading-6 font-semibold",children:r("Contract Unit")}),(0,n.jsx)("button",{type:"button",className:"text-t3 hover:text-t1 flex size-5 cursor-pointer items-center justify-center leading-none",onClick:()=>{b(o),g(!1)},children:(0,n.jsx)(ew.U,{className:"size-5"})})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-col gap-4",children:c.map(e=>{let t=e.value===h,r=e.description?"px-4 py-3":"px-4 py-[18px]";return(0,n.jsxs)("button",{type:"button",dir:"ltr",className:"rounded-r2 flex w-full cursor-pointer items-center justify-between border transition-colors ".concat(t?"border-bt1 bg-m1":"bg-bg2 border-transparent"," text-left rtl:flex-row-reverse ").concat(r),onClick:()=>b(e.value),children:[(0,n.jsxs)("div",{dir:"ltr",className:"min-w-0 pr-4 text-left rtl:pr-0 rtl:pl-4",children:[(0,n.jsx)("div",{className:"text-t1 text-[14px] leading-5 font-medium",children:e.label}),e.description?(0,n.jsx)("div",{className:"text-c12 text-t3 mt-1 text-left leading-4 whitespace-normal",children:e.description}):null]}),(0,n.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center rounded-full border ".concat(t?"border-bt1":"border-t5"),children:(0,n.jsx)("span",{className:"block size-[10px] rounded-full ".concat(t?"bg-bt1":"bg-transparent")})})]},e.value)})}),(0,n.jsxs)("div",{className:"mt-6 grid grid-cols-2 gap-2",children:[(0,n.jsx)(es.$,{variant:"secondary",size:"m",className:"text-b14 !rou
1nded-r2 h-10 font-medium",onClick:()=>{b(o),g(!1)},children:r("Cancel")}),(0,n.jsx)(es.$,{size:"m",className:"text-b14 !rounded-r2 h-10 font-medium",onClick:()=>{h!==o&&m(h),g(!1)},children:r("Confirm")})]})]})})})]}):(0,n.jsxs)(D.DropdownMenu,{modal:!1,children:[(0,n.jsx)(D.DropdownMenuTrigger,{showIcon:!0,className:"!outline-none",triggerClassName:"text-b14 text-t1 inline-flex min-w-[42px] shrink-0 items-center justify-end gap-2",children:(0,n.jsx)("span",{children:(null==u?void 0:u.triggerLabel)||(null==u?void 0:u.label)})}),(0,n.jsx)(D.DropdownMenuContent,{align:"end",sideOffset:12,className:"!border-l1 !bg-m1 !shadow-2 !flex !min-w-0 !flex-col !gap-1 !rounded-[8px] !py-2",style:{width:t,minWidth:t,maxWidth:t,transform:"translateX(12px)"},children:c.map(e=>{let t=e.value===o;return(0,n.jsx)(D.DropdownMenuItem,{className:"!rounded-r1 !mx-2 !min-h-10 !px-3 !py-[10px] ".concat(t?"!bg-bg2 !text-t1 hover:!bg-bg2 !shadow-[inset_0_0_0_1px_var(--line-1)]":"!text-t1 hover:!bg-bg2"),onSelect:()=>m(e.value),children:(0,n.jsxs)("div",{className:"w-full text-left",children:[(0,n.jsx)("div",{className:"text-[14px] leading-[18px] font-normal",children:e.label}),e.description?(0,n.jsx)("div",{className:"text-c12 text-t4 mt-1 leading-[16px] whitespace-normal",children:e.description}):null]})},e.value)})})]})}function tm(){var e;let{$t:t,i18n:r,locale:i}=(0,d.B)(),l=(0,a.no)(),{form:s,hasDirectionalQuantity:o,tradeUnitTriggerLabel:c,actions:u}=function(){let e=(0,eK.Mr)((0,A.k)(e=>({activeTab:e.form.activeTab,isPercentage:e.form.isPercentage,percentage:e.form.percentage,quantity:e.form.quantity,longQuantity:e.form.longQuantity,shortQuantity:e.form.shortQuantity}))),t=(0,e0.$)((0,A.k)(e=>({hasDirectionalQuantity:e.quantity.hasDirectionalQuantity,tradeUnitValue:e.quantity.tradeUnitValue,tradeUnitOptions:e.quantity.tradeUnitOptions}))),r=(0,eX.T)((0,A.k)(e=>({onQuantityChange:e.actions.onQuantityChange,onPercentageChange:e.actions.onPercentageChange,onClearQuantity:e.actions.onClearQuantity}))),n=t.tradeUnitOptions.find(e=>e.value===t.tradeUnitValue);return{form:e,hasDirectionalQuantity:t.hasDirectionalQuantity,tradeUnitTriggerLabel:(null==n?void 0:n.triggerLabel)||(null==n?void 0:n.label)||"",actions:r}}(),m=r.dir(i),p=(0,x.useRef)(null),[g,h]=(0,x.useState)(260),b=o&&!s.isPercentage,y=c.length>6,f=l?"left-[8px]":"rtl"===m?"right-[12px]":"left-[12px]",v=s.isPercentage?"".concat(String(null!=(e=s.percentage)?e:0),"%"):b?"":s.quantity,N=(0,n.jsx)("div",{className:"relative z-[2] inline-flex shrink-0 items-center gap-2",children:(0,n.jsx)(tu,{menuWidth:g})});return(0,x.useEffect)(()=>{if(!p.current)return;let e=p.current,t=()=>{h(e.getBoundingClientRect().width)};t();let r=new ResizeObserver(t);return r.observe(e),()=>{r.disconnect()}},[]),(0,n.jsxs)("div",{ref:p,dir:l?void 0:m,className:"relative max-w-full min-w-0 overflow-hidden",children:[b?(0,n.jsx)("div",{className:"".concat(f," ").concat(y?"w-[116px] max-w-[calc(100vw-220px)] min-w-0 overflow-hidden md:w-[148px] md:max-w-[148px]":"w-[150px] max-w-[calc(100vw-172px)] min-w-0 overflow-hidden md:w-[170px] md:max-w-[170px]"," absolute top-1/2 z-[1] -translate-y-1/2"),children:(0,n.jsx)(tc.n,{activeTab:s.activeTab,isPercentage:s.isPercentage,longQuantity:s.longQuantity,shortQuantity:s.shortQuantity,onClear:u.onClearQuantity})}):null,(0,n.jsx)(B.Input,{size:"m",value:v,onChange:e=>s.isPercentage?u.onPercentageChange(e.target.value.replace(/%/g,"")):u.onQuantityChange(e.target.value),onKeyDown:e=>{var t,r;if(!s.isPercentage||"Backspace"!==e.key&&"Delete"!==e.key)return;let n=e.currentTarget,a=n.value,i=a.indexOf("%"),l=null!=(t=n.selectionStart)?t:0,o=null!=(r=n.selectionEnd)?r:l;if(i<1||l!==o||l!==i+1)return;e.preventDefault();let c="".concat(a.slice(0,i-1)).concat(a.slice(i));u.onPercentageChange(c.replace(/%/g,""))},onFocus:()=>{!s.isPercentage&&o&&u.onClearQuantity()},placeholder:l&&!b?t("Quantity"):"",enablePlaceholderMotion:l&&!b,wrapperClassName:l?"".concat(td.w," !h-[44px] !rounded-r2 !px-[8px] !min-w-0 !overflow-hidden [&_[data-motion-state=raised]_label]:!text-t3"):"".concat(td.w," !px-[12px] !min-w-0 !overflow-hidden"),className:"!text-b
114 placeholder:!text-t4 !leading-none ".concat("rtl"===m?"!text-right":""),leftSlot:"rtl"===m&&l?N:void 0,rightSlot:"rtl"===m&&l?void 0:N})]})}function tp(){let{$t:e}=(0,d.B)(),t=(0,a.no)(),{form:r,actions:i}={form:(0,eK.Mr)((0,A.k)(e=>({checkedTpsl:e.form.checkedTpsl,tpslAdvancedEdited:e.form.tpslAdvancedEdited,takeProfitPrice:e.form.takeProfitPrice,stopLossPrice:e.form.stopLossPrice,tpTriggerWay:e.form.tpTriggerWay,slTriggerWay:e.form.slTriggerWay}))),actions:(0,eX.T)((0,A.k)(e=>({onToggleTpslTriggerWay:e.actions.onToggleTpslTriggerWay,onTpslNumberFieldChange:e.actions.onTpslNumberFieldChange})))},l="".concat(e("Take Profit")," (USDT)"),s="".concat(e("Stop Loss")," (USDT)");return!r.checkedTpsl||r.tpslAdvancedEdited?null:(0,n.jsxs)("div",{className:"mt-2 grid gap-2 md:mt-5 md:gap-3",children:[(0,n.jsx)(eP.q,{label:l,value:r.takeProfitPrice,onChange:i.onTpslNumberFieldChange("takeProfitPrice"),placeholder:t?l:e("Trigger Price"),suffix:(0,n.jsxs)("button",{type:"button",className:"text-b14 max-md:text-c12 text-t1 inline-flex min-w-[52px] cursor-pointer items-center justify-end gap-[5px] leading-none",onClick:()=>i.onToggleTpslTriggerWay("tpTriggerWay"),children:[(0,n.jsx)("span",{children:e("latest"===r.tpTriggerWay?"Last":"Mark")}),(0,n.jsx)(ec.y,{className:"text-t1 size-[12px]"})]})}),(0,n.jsx)(eP.q,{label:s,value:r.stopLossPrice,onChange:i.onTpslNumberFieldChange("stopLossPrice"),placeholder:t?s:e("Trigger Price"),suffix:(0,n.jsxs)("button",{type:"button",className:"text-b14 max-md:text-c12 text-t1 inline-flex min-w-[52px] cursor-pointer items-center justify-end gap-[5px] leading-none",onClick:()=>i.onToggleTpslTriggerWay("slTriggerWay"),children:[(0,n.jsx)("span",{children:e("latest"===r.slTriggerWay?"Last":"Mark")}),(0,n.jsx)(ec.y,{className:"text-t1 size-[12px]"})]})})]})}var tx=r(63394),tg=r(47317);function th(){let{$t:e}=(0,d.B)(),t=(0,a.no)(),{checkedTpsl:r,tpslAdvancedEdited:i,actions:l}=function(){let e=(0,eK.Mr)((0,A.k)(e=>({checkedTpsl:e.form.checkedTpsl,tpslAdvancedEdited:e.form.tpslAdvancedEdited}))),t=(0,eX.T)((0,A.k)(e=>({onDisableTpsl:e.actions.onDisableTpsl,onEnableTpsl:e.actions.onEnableTpsl,onOpenTpslAdvanced:e.actions.onOpenTpslAdvanced})));return{...e,actions:t}}();return(0,n.jsxs)("div",{className:"flex items-center justify-between md:rtl:flex-row-reverse",children:[(0,n.jsxs)("div",{className:"flex items-center gap-[6px] md:rtl:flex-row-reverse",children:[(0,n.jsx)(ed.Checkbox,{className:"cursor-pointer",checked:r,onCheckedChange:e=>{if(!e)return void l.onDisableTpsl();l.onEnableTpsl()}}),(0,n.jsx)(F.Tooltip,{className:"max-w-[calc(100vw-32px)]",content:(0,n.jsxs)("div",{className:"w-[300px] max-w-full space-y-2",children:[(0,n.jsx)("p",{className:"text-b14 text-t1 text-c12 min-w-0 leading-5 break-words whitespace-normal",children:e("The preset take-profit and stop-loss orders will only take effect after the commission is completed. By default, all take-profit and stop-loss orders are placed according to your order quantity. If you cancel the pending order, the preset take profit and stop loss will be invalidated at the same time. You can select the latest price or the marked price to trigger the take profit and stop loss.")}),(0,n.jsx)("p",{className:"text-b14 text-t1 text-c12 min-w-0 leading-5 break-words whitespace-normal",children:e("Note: After the take profit and stop loss orders are triggered, the transaction will be executed at the market price, and the transaction price will be affected by the depth of the market.")})]}),children:(0,n.jsx)("button",{type:"button",className:"text-c12 text-t1 border-b-l2 cursor-help border-b border-dashed leading-[16px]",children:e("TP/SL")})})]}),(0,n.jsx)("div",{className:"gap-s3 flex items-center md:rtl:justify-start",children:r?(0,n.jsx)("button",{type:"button",className:t?"text-p1-dark hover:text-p1 cursor-pointer transition-colors":"text-p1-dark hover:text-p1 text-c12 cursor-pointer font-medium transition-colors",onClick:l.onOpenTpslAdvanced,children:t?i?(0,n.jsx)(tx.i,{className:"text-p1-dark size-4"}):(0,n.jsx)(tg.Z,{className:"text-p1-dark size-4"}):e(i?"Edit":"Advanced")}):null})]})}function tb(){let{$t:e}=(0,d.B)(),t=(0,eK.Mr)((0,A.k)(e=>({checkedTpsl:e.form.checkedTpsl,tpslAdvancedEdited:e.form.tpslAdvancedEdited,tpPriceType:e.form.tpPriceType,slPriceType:e.form.slPriceType,takeProfitPrice:e.form.takeProfitPrice,stopLossPrice:e.form.stopLossPrice,tpTriggerWay:e.form.tpTriggerWay,slTriggerWay:e.form.slTriggerWay})));if(!t.checkedTpsl||!t.tpslAdvancedEdited)return null;let r="TP ".concat(e("limit"===t.tpPriceType?"Limit_2":"Market_2")),a="SL ".concat(e("limit"===t.slPriceType?"Limit_2":"Market_2")),i=e("latest"===t.tpTriggerWay?"Last":"Mark"),l=e("latest"===t.slTriggerWay?"Last":"Mark");return(0,n.jsxs)("div",{className:"bg-bg2 rounded-r3 mt-2 flex flex-col gap-3 p-3 md:mt-5",children:[(0,n.jsxs)("div",{className:"text-c12 flex items-center justify-between leading-4",children:[(0,n.jsx)("div",{className:"text-t3",children:Number(t.takeProfitPrice)?r:"".concat(e("TP")," --")}),(0,n.jsxs)("div",{className:"text-t1 flex items-center justify-end gap-2 text-right",children:[(0,n.jsx)("span",{children:t.takeProfitPrice||"--"}),(0,n.jsx)("span",{children:Number(t.takeProfitPrice)?i:"--"})]})]}),(0,n.jsxs)("div",{className:"text-c12 flex items-center justify-between leading-4",children:[(0,n.jsx)("div",{className:"text-t3",children:Number(t.stopLossPrice)?a:"".concat(e("SL")," --")}),(0,n.jsxs)("div",{className:"text-t1 flex items-center justify-end gap-2 text-right",children:[(0,n.jsx)("span",{children:t.stopLossPrice||"--"}),(0,n.jsx)("span",{children:Number(t.stopLossPrice)?l:"--"})]})]})]})}function ty(){let{$t:e}=(0,d.B)(),{activeTab:t,onChangeActiveTab:r}=e9();return(0,n.jsx)("div",{className:"bg-bg05 rounded-r2 p-1",children:(0,n.jsx)("div",{className:"grid grid-cols-2 gap-[3px]",children:[{key:"open",label:e("Open_r_1")},{key:"close",label:e("Close_r_1")}].map(e=>(0,n.jsx)("button",{type:"button",className:"text-b14 h-6 cursor-pointer rounded-[6px] transition-colors ".concat(t===e.key?"bg-bg3 text-t1":"text-t3 hover:bg-c2 hover:text-t1"),onClick:()=>r(e.key),children:e.label},e.key))})})}function tf(){let{$t:e}=(0,d.B)(),{marginMode:t,longLeverage:r,shortLeverage:a,onOpenSettings:i}=e8();return(0,n.jsxs)("button",{type:"button",className:"bg-bg2 rounded-r2 flex h-7 w-full cursor-pointer items-center justify-between px-2",onClick:i,children:[(0,n.jsx)("span",{className:"text-c12 text-t1 shrink-0 leading-none",children:e("crossed"===t?"Cross":"Isolated")}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-[8px]",children:[(0,n.jsxs)("span",{className:"text-c12 text-p2 inline-flex h-4 items-center leading-none",children:[r,"X"]}
1),(0,n.jsxs)("span",{className:"text-c12 text-p3 inline-flex h-4 items-center leading-none",children:[a,"X"]}),(0,n.jsx)("span",{className:"inline-flex size-3 shrink-0 items-center justify-center",children:(0,n.jsx)(Q.C,{className:"text-t1 size-3"})})]})]})}function tv(){let{$t:e}=(0,d.B)(),t=(0,e0.$)(e=>e.orderEntry.quoteAsset);return(0,n.jsx)(eP.q,{label:"".concat(e("Price")," (").concat(t,")"),value:"",onChange:()=>{},placeholder:e("Market Price"),disabled:!0,wrapperClassName:"!h-9 !rounded-r2",inputClassName:"!text-b14 !leading-none"})}function tN(){let{$t:e}=(0,d.B)(),{orderType:t,onSetOrderType:r}=tt(),{selectedLabel:a,options:i}=function(){let{$t:e}=(0,d.B)(),{activeTab:t,orderType:r}=tt(),n=ti(t,r);return{selectedLabel:(0,x.useMemo)(()=>"postOnly"===r?e("Post Only"):"planLimit"===r||"planMarket"===r?e("Trigger Orders_1"):"market"===r?e("Market_2"):e("Limit_2"),[e,r]),options:(0,x.useMemo)(()=>"close"===t?[{label:e("Limit_2"),value:"limit",active:"limit"===n},{label:e("Market_2"),value:"market",active:"market"===n},{label:e("Post Only"),value:"postOnly",active:"dropdown"===n}]:[{label:e("Limit_2"),value:"limit",active:"limit"===n},{label:e("Market_2"),value:"market",active:"market"===n},{label:e("Trigger Orders_1"),value:"planLimit",active:"trigger"===n},{label:e("Post Only"),value:"postOnly",active:"dropdown"===n}],[e,t,n])}}(),[l,s]=(0,x.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"text-c12 bg-bg2 text-b14 text-t1 rounded-r2 flex h-7 w-full cursor-pointer items-center justify-between px-2",onClick:()=>s(!0),children:[(0,n.jsx)("span",{className:"leading-none",children:a}),(0,n.jsx)(Q.C,{className:"text-t1 size-3 shrink-0"})]}),"market"===t?(0,n.jsx)(tv,{}):null,(0,n.jsx)(ek.DrawerRoot,{open:l,onOpenChange:s,children:(0,n.jsx)(ek.DrawerContent,{className:"max-h-[60dvh]",children:(0,n.jsxs)("div",{className:"flex flex-col px-4 pt-4 pb-4",children:[(0,n.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,n.jsx)("div",{className:"text-t1 text-[16px] leading-6 font-semibold",children:e("Order Type")}),(0,n.jsx)("button",{type:"button",className:"text-t3 hover:text-t1 flex size-5 items-center justify-center leading-none",onClick:()=>s(!1),children:(0,n.jsx)(ew.U,{className:"size-5"})})]}),(0,n.jsx)("div",{className:"flex flex-col",children:i.map(e=>(0,n.jsxs)("button",{type:"button",className:"flex h-14 items-center justify-between text-left",onClick:()=>{r(e.value,t),s(!1)},children:[(0,n.jsx)("span",{className:"text-[14px] leading-5 font-normal ".concat(e.active?"text-p1-dark":"text-t1"),children:e.label}),e.active?(0,n.jsx)(eT.S,{className:"text-p1-dark size-4 shrink-0"}):null]},e.value))})]})})})]})}function tj(){let{$t:e}=(0,d.B)(),{availableBalanceText:t,quoteAsset:r,onTransfer:a}=te();return(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 py-1 rtl:flex-row-reverse",children:[(0,n.jsx)("span",{className:"text-c12 text-t3 leading-4 rtl:text-right",children:e("Avbl")}
1),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-2 rtl:flex-row-reverse",children:[(0,n.jsxs)("div",{className:"direction-ltr text-c12 text-t1 inline-flex min-w-0 items-center gap-1 text-right leading-4",children:[(0,n.jsx)("span",{className:"rtl:order-2",children:t}),(0,n.jsx)("span",{className:"rtl:order-1",children:r})]}),(0,n.jsx)("button",{type:"button",className:"text-bt1 hover:text-bt1 flex size-4 cursor-pointer items-center justify-center",onClick:a,children:(0,n.jsx)(G.A,{className:"text-p1-dark size-4"})})]})]})}function tC(){let e=(0,eK.Mr)(e=>e.form.isPercentage),{sliderPercent:t,onSliderChange:r}=tr();return(0,x.useEffect)(()=>{e&&eX.T.getState().actions.onQuantityModeChange("quantity")},[e]),(0,n.jsxs)("div",{className:"",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)(tm,{}),(0,n.jsx)(to,{})]}),(0,n.jsx)("div",{className:"px-s1",children:(0,n.jsx)(Y.Slider,{value:t,onValueChange:r,showIndicatorOnDragging:!0,marks:[{value:0,label:"0%",displayValue:0},{value:25,label:"25%",displayValue:25},{value:50,label:"50%",displayValue:50},{value:75,label:"75%",displayValue:75},{value:100,label:"100%",displayValue:100}],activeColor:"var(--color-p1)",SliderBarclassName:"!bg-bg6"})})]})}function tw(){return(0,n.jsxs)("div",{className:"space-y-0 pt-[2px]",children:[(0,n.jsx)(th,{}),(0,n.jsx)(tp,{}),(0,n.jsx)(tb,{})]})}function tT(){let{$t:e,i18n:t,locale:r}=(0,d.B)(),a=(0,s.T)(),{isExecuting:i}=(0,eL.p)(a),{activeTab:l,isLoggedIn:o,footer:c,actions:u}=tn(),{active:m,pending:p}=(0,eM.Y)(),x=i||"open"===l&&(m||p),g=t.dir(r);return(0,n.jsxs)("div",{className:"pt-[2px]",children:[o&&(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsxs)("div",{dir:g,className:"flex min-w-0 items-center justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-t3 shrink-0 text-[11px] leading-4",children:e("open"===l?"Max open":"Max")}),(0,n.jsxs)("span",{className:"direction-ltr text-t1 min-w-0 flex-1 overflow-hidden text-[11px] leading-4 text-ellipsis whitespace-nowrap ".concat("rtl"===g?"text-left":"text-right"),children:[(0,n.jsx)("span",{className:"text-p2",children:c.maxLeft})," /"," ",(0,n.jsx)("span",{className:"text-p3",children:c.maxRight})," ",c.unitLabel]})]}),"open"===l?(0,n.jsxs)("div",{dir:g,className:"flex min-w-0 items-center justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-t3 shrink-0 text-[11px] leading-4",children:e("Cost")}),(0,n.jsxs)("span",{className:"direction-ltr text-t1 min-w-0 flex-1 overflow-hidden text-[11px] leading-4 text-ellipsis whitespace-nowrap ".concat("rtl"===g?"text-left":"text-right"),children:[(0,n.jsx)("span",{className:"text-p2",children:c.costLeft})," /"," ",(0,n.jsx)("span",{className:"text-p3",children:c.costRight})," ",c.quoteAsset]})]}):null]}),o?(0,n.jsxs)("div",{className:"mt-3 flex flex-col gap-2",children:[(0,n.jsx)(es.$,{className:"bg-p2 hover:bg-p2/90 text-b14 rounded-r2 h-9 w-full border-none font-medium text-white",disabled:c.loading||x,onClick:u.onPrimaryAction,children:e("open"===l?"Open Long":"Close Short")}),(0,n.jsx)(es.$,{className:"bg-p3 hover:bg-p3/90 text-b14 rounded-r2 h-9 w-full border-none font-medium text-white",disabled:c.loading||x,onClick:u.onSecondaryAction,children:e("open"===l?"Open Short":"Close Long")})]}):(0,n.jsx)(eo.X,{className:"mt-3 grid-cols-1 py-0",buttonClassName:"text-b14 h-9 w-full"})]})}function tk(e){let{symbol:t}=e;e5({symbol:t});let{i18n:r,locale:a}=(0,d.B)(),i=(0,eK.Mr)(e=>e.form.activeTab);return(0,n.jsx)(eS.p,{className:"rounded-md",bodyClassName:"",children:(0,n.jsxs)("div",{dir:r.dir(a),className:"space-y-2",children:[(0,n.jsx)(ty,{}),(0,n.jsx)(tj,{}),(0,n.jsx)(tf,{}),(0,n.jsx)(tN,{}),(0,n.jsx)(ts,{}),(0,n.jsx)(tC,{}),"open"===i?(0,n.jsx)(tw,{}):null,(0,n.jsx)(tT,{})]})})}function tP(){let{$t:e}=(0,d.B)(),t=(0,s.T)(),{isExecuting:r}=(0,eL.p)(t),{activeTab:a,isLoggedIn:i,footer:l,actions:o}=tn(),{active:c,pending:u}=(0,eM.Y)(),m=r||"open"===a&&(c||u);return(0,n.jsxs)(n.Fragment,{children:[i?(0,n.jsxs)("div",{className:"gap-s2 grid grid-cols-2 pb-5 ".concat("open"===a?"pt-5":"pt-0"),children:[(0,n.jsx)(es.$,{className:"bg-p2 hover:bg-p2/90 !px-s2 h-auto min-h-10 border-none py-1 font-semibold whitespace-normal text-white [&>span]:max-w-full [&>span]:min-w-0 [&>span]:justify-center [&>span]:text-center [&>span]:leading-4 [&>span]:whitespace-normal",disabled:l.loading||m,onClick:o.onPrimaryAction,children:e("open"===a?"Open Long":"Close Short")}),(0,n.jsx)(es.$,{className:"bg-p3 hover:bg-p3/90 !px-s2 h-auto min-h-10 border-none py-1 font-semibold whitespace-normal text-white [&>span]:max-w-full [&>span]:min-w-0 [&>span]:justify-center [&>span]:text-center [&>span]:leading-4 [&>span]:whitespace-normal",disabled:l.loading||m,onClick:o.onSecondaryAction,children:e("open"===a?"Open Short":"Close Long")})]}):(0,n.jsx)(eo.X,{}),i&&(0,n.jsxs)("div",{className:"gap-s3 flex flex-col",children:["open"===a?(0,n.jsxs)("div",{className:"gap-s3 flex min-w-0 items-center justify-between rtl:flex-row-reverse",children:[(0,n.jsx)("span",{className:"text-c12 text-t3 shrink-0",children:e("Cost")}),(0,n.jsxs)("span",{className:"direction-ltr text-c12 text-t1 min-w-0 flex-1 overflow-hidden text-right text-ellipsis rtl:text-left",children:[(0,n.jsx)("span",{className:"text-p2",children:l.costLeft})," /"," ",(0,n.jsx)("span",{className:"text-p3",children:l.costRight})," ",l.quoteAsset]})]}):null,(0,n.jsxs)("div",{className:"gap-s3 flex min-w-0 items-center justify-between md:items-start rtl:flex-row-reverse",children:[(0,n.jsx)("span",{className:"text-c12 text-t3 shrink-0",children:e("open"===a?"Max open":"Max")}),(0,n.jsxs)("span",{className:"direction-ltr text-c12 text-t1 min-w-0 flex-1 overflow-hidden text-right text-ellipsis rtl:text-left",children:[(0,n.jsx)("span",{className:"text-p2",children:l.maxLeft})," /"," ",(0,n.jsx)("span",{className:"text-p3",children:l.maxRight})," ",l.unitLabel]})]})]})]})}let tS=x.forwardRef((e,t)=>
1(0,n.jsx)(J.B,{ref:t,viewBox:"0 0 1066 1024",...e,children:(0,n.jsx)("path",{d:"M337.152 85.333333h361.898667c34.346667 0 62.72 0 85.76 1.877334 24.021333 1.962667 46.08 6.186667 66.773333 16.725333a170.666667 170.666667 0 0 1 74.581333 74.581333c10.538667 20.693333 14.762667 42.752 16.725334 66.730667 1.877333 23.082667 1.877333 51.456 1.877333 85.76v361.941333c0 34.346667 0 62.72-1.877333 85.76-1.962667 24.021333-6.186667 46.08-16.725334 66.773334a170.666667 170.666667 0 0 1-74.581333 74.581333c-20.736 10.538667-42.752 14.762667-66.730667 16.725333-23.082667 1.877333-51.456 1.877333-85.76 1.877334H337.066667c-34.304 0-62.677333 0-85.76-1.877334-23.978667-1.962667-46.037333-6.186667-66.730667-16.725333a170.666667 170.666667 0 0 1-74.581333-74.581333c-10.538667-20.693333-14.762667-42.752-16.725334-66.730667-1.877333-23.082667-1.877333-51.456-1.877333-85.76V331.008c0-34.346667 0-62.72 1.877333-85.76 1.962667-24.021333 6.186667-46.08 16.725334-66.773333a170.666667 170.666667 0 0 1 74.581333-74.581334c20.693333-10.538667 42.752-14.762667 66.730667-16.725333C274.432 85.333333 302.805333 85.333333 337.109333 85.333333zM258.304 172.288c-18.730667 1.493333-28.288 4.266667-34.986667 7.68a85.333333 85.333333 0 0 0-37.248 37.290667c-3.413333 6.656-6.186667 16.213333-7.68 34.944-1.578667 19.2-1.621333 44.032-1.621333 80.597333v358.4c0 36.565333 0 61.397333 1.578667 80.597333 1.536 18.688 4.309333 28.288 7.68 34.944a85.333333 85.333333 0 0 0 37.333333 37.290667c6.656 3.413333 16.213333 6.186667 34.944 7.68 19.2 1.578667 44.032 1.621333 80.597333 1.621333h358.4c36.522667 0 61.397333 0 80.597334-1.621333 18.688-1.493333 28.245333-4.266667 34.944-7.68a85.333333 85.333333 0 0 0 37.290666-37.290667c3.413333-6.656 6.186667-16.213333 7.68-34.944 1.578667-19.2 1.621333-44.032 1.621334-80.597333V332.8c0-36.565333-0.042667-61.397333-1.621334-80.597333-1.493333-18.688-4.266667-28.288-7.68-34.944a85.333333 85.333333 0 0 0-37.290666-37.290667c-6.698667-3.413333-16.213333-6.186667-34.986667-7.68C758.698667 170.666667 733.866667 170.666667 697.344 170.666667h-358.4c-36.565333 0-61.397333 0-80.64 1.621333zM368.768 234.666667a42.666667 42.666667 0 0 1 42.666667 42.666666v42.666667h42.666666a42.666667 42.666667 0 1 1 0 85.333333h-42.666666v42.666667a42.666667 42.666667 0 1 1-85.333334 0v-42.666667h-42.666666a42.666667 42.666667 0 1 1 0-85.333333h42.666666v-42.666667a42.666667 42.666667 0 0 1 42.666667-42.666666z m353.834667 12.501333a42.666667 42.666667 0 1 1 60.330666 60.330667l-469.333333 469.333333a42.666667 42.666667 0 0 1-60.330667-60.330667l469.333334-469.333333zM539.434667 661.333333a42.666667 42.666667 0 0 1 42.666666-42.666666h170.666667a42.666667 42.666667 0 1 1 0 85.333333h-170.666667a42.666667 42.666667 0 0 1-42.666666-42.666667z"})}));function tL(){let{$t:e}=(0,d.B)(),{marginMode:t,longLeverage:r,shortLeverage:a,onOpenSettings:i,onOpenCalculator:l}=e8(),{preload:s}=(0,S.Hx)(),{preload:o}=(0,S.Ui)();return(0,n.jsxs)("div",{className:"px-s4 pt-s4 flex items-center justify-between pb-[10px]",children:[(0,n.jsxs)("button",{type:"button",className:"-mb-[10px] inline-flex cursor-pointer items-center gap-[6px] pb-[10px] leading-none",onMouseEnter:s,onClick:i,children:[(0,n.jsx)("span",{className:"text-b14 text-t1 text-c12",children:e("crossed"===t?"Cross":"Isolated")}),(0,n.jsxs)("span",{className:"text-b14 text-p2 text-c12",children:[r,"X"]}),(0,n.jsxs)("span",{className:"text-b14 text-p3 text-c12",children:[a,"X"]}),(0,n.jsx)("span",{className:"inline-flex size-3 shrink-0 items-center justify-center",children:(0,n.jsx)(ea.Y,{className:"text-t4 size-3 rtl:rotate-180"})})]}),(0,n.jsx)("div",{className:"gap-s2 flex items-center",children:(0,n.jsx)("button",{type:"button",className:"text-t3 hover:text-t1 inline-flex size-5 items-center justify-center",onMouseEnter:o,onFocus:o,onClick:l,children:(0,n.jsx)(tS,{className:"size-4 cursor-pointer"})})})]})}function tM(){let{$t:e}=(0,d.B)(),{activeTab:t,onChangeActiveTab:r}=e9();return(0,n.jsx)("div",{className:"bg-bg05 mx-s4 rounded-r2 mb-4 p-1",children:(0,n.jsx)("div",{className:"gap-s1 grid grid-cols-2",children:[{key:"open",label:e("Open_r_1")},{key:"close",label:e("Close_r_1")}].map(e=>(0,n.jsx)("button",{type:"button",className:"rounded-r1 text-b14 h-[28px] curs
1or-pointer transition-colors ".concat(t===e.key?"bg-bg3 text-t1":"text-t3 hover:bg-c2 hover:text-t1"),onClick:()=>r(e.key),children:e.label},e.key))})})}function tO(){let{$t:e}=(0,d.B)(),{availableBalanceText:t,quoteAsset:r,onTransfer:a}=te();return(0,n.jsxs)("div",{className:"gap-s3 flex items-center justify-between rtl:flex-row-reverse",children:[(0,n.jsxs)("div",{className:"text-c12 text-t3 min-w-0 flex-1 text-left rtl:text-right",children:[e("Available Balance"),":"," ",(0,n.jsxs)("span",{className:"direction-ltr text-t1 inline-flex items-center gap-1",children:[(0,n.jsx)("span",{className:"rtl:order-2",children:t}),(0,n.jsx)("span",{className:"rtl:order-1",children:r})]})]}),(0,n.jsx)("button",{type:"button",className:"text-t3 hover:text-t1 shrink-0",onClick:a,children:(0,n.jsx)(G.A,{className:"size-4 cursor-pointer"})})]})}function t_(){let e=(0,eK.Mr)(e=>e.form.activeTab),t=(0,eK.Mr)(e=>e.form.orderType);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(tl,{}),"open"===e||"market"!==t?(0,n.jsxs)("div",{className:"flex flex-col gap-4 ".concat("market"===t?"mb-3 md:mb-4":"mb-3"),children:[(0,n.jsx)(tO,{}),"market"!==t?(0,n.jsx)(ts,{}):null]}):null]})}function tA(){var e;let{$t:t}=(0,d.B)(),{activeTab:r,quantityMode:a,quantityModeOptions:i,onQuantityModeChange:l}=function(){let e=(0,eK.Mr)(e=>e.form.activeTab),t=(0,e0.$)((0,A.k)(e=>({quantityMode:e.quantity.quantityMode,quantityModeOptions:e.quantity.quantityModeOptions}))),r=(0,eX.T)(e=>e.actions.onQuantityModeChange);return{activeTab:e,...t,onQuantityModeChange:r}}(),s=(null==(e=i.find(e=>e.value===a))?void 0:e.label)||t("Quantity");return(0,n.jsx)("div",{className:"flex items-center justify-between rtl:flex-row-reverse",children:"open"===r?(0,n.jsxs)(D.DropdownMenu,{modal:!1,children:[(0,n.jsx)(D.DropdownMenuTrigger,{showIcon:!0,className:"!outline-none",triggerClassName:"text-c12 text-t3 inline-flex items-center gap-1 leading-[16px] rtl:flex-row-reverse rtl:text-right",children:(0,n.jsx)("span",{children:s})}),(0,n.jsx)(D.DropdownMenuContent,{align:"start",sideOffset:6,className:"!border-l1 !bg-m1 !shadow-2 !flex !min-w-[116px] !flex-col !gap-1 !rounded-[8px] !py-2",children:i.map(e=>{let t=e.value===a;return(0,n.jsx)(D.DropdownMenuItem,{className:"!rounded-r1 !mx-2 !min-h-10 !px-2 !py-[10px] !text-[12px] !leading-4 !font-normal ".concat(t?"!bg-bg2 !text-t1 hover:!bg-bg2 !shadow-[inset_0_0_0_1px_var(--line-1)]":"!text-t1 hover:!bg-bg2"),onSelect:()=>l(e.value),children:e.label},e.value)})})]}):(0,n.jsx)("div",{className:"text-c12 text-t3 leading-[16px] rtl:text-right",children:t("Quantity")})})}function tI(){let{sliderPercent:e,onSliderChange:t}=tr();return(0,n.jsx)("div",{className:"px-s1 pt-3 pb-5",children:(0,n.jsx)(Y.Slider,{value:e,onValueChange:t,showIndicatorOnDragging:!0,marks:[{value:0,label:"0%",displayValue:0},{value:25,label:"25%",displayValue:25},{value:50,label:"50%",displayValue:50},{value:75,label:"75%",displayValue:75},{value:100,label:"100%",displayValue:100}],activeColor:"var(--color-p1)",SliderBarclassName:"!bg-bg6",SliderThumbclassName:"size-3"})})}function tq(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,n.jsx)(tA,{}),(0,n.jsx)(tm,{}),(0,n.jsx)(to,{})]}),(0,n.jsx)(tI,{})]})}function tU(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(th,{}),(0,n.jsx)(tp,{}),(0,n.jsx)(tb,{})]})}function tE(e){let{symbol:t}=e;e5({symbol:t});let{i18n:r,locale:a}=(0,d.B)(),i=(0,eK.Mr)(e=>e.form.activeTab);return(0,n.jsxs)("div",{dir:r.dir(a),className:"flex h-full flex-col",children:[(0,n.jsx)(tL,{}),(0,n.jsxs)(c.ScrollArea,{className:"flex-1 [&_[data-slot=scroll-bar][data-orientation=vertical]]:w-1",viewportClassName:"h-full [&>div]:!block [&>div]:!w-full [&>div]:!min-w-0 [&>div]:!max-w-full",children:[(0,n.jsx)(tM,{}),(0,n.jsxs)("div",{className:"px-s4 pb-s4",children:[(0,n.jsx)(t_,{}),(0,n.jsx)(tq,{}),"open"===i?(0,n.jsx)(tU,{}):null,(0,n.jsx)(tP,{})]})]})]})}function tQ(){let e=(0,s.T)(),t=e?(0,l.A2)(e,"-"):"BTC-USDT",r=(0,o.J)(e=>e.strategyMode);return(0,a.no)()&&r!==i.n1.Grid?(0,n.jsx)("section",{"data-component":"PlaceOrderPanel",className:"h-full",children:(0,n.jsx)(tk,{symbol:t})}):(0,n.jsx)("section",{"data-component":"PlaceOrderPanel",className:"h-full",children:r===i.n1.Grid?(0,n.jsx)(eC,{symbol:t}):(0,n.jsx)(tE,{symbol:t})})}
1tS.displayName="CalculatorIcon"},26426:(e,t,r)=>{r.d(t,{Hf:()=>A,L5:()=>L,N7:()=>T,RH:()=>S,Vg:()=>_,WE:()=>O,X0:()=>k,Z7:()=>w,aF:()=>M,tf:()=>P});var n=r(79237),a=r(51924),i=r(55872),l=r(7370),s=r(46540),o=r(93924),c=r(66960),d=r(10935),u=r(85028),m=r(3529),p=r(90477),x=r(95696),g=r(81407),h=r(32523),b=r(18006),y=r(38113),f=r(50791),v=r(22675),N=r(84605);let j="text-t4 hover:text-t1 flex size-5 items-center justify-center rounded-none border-0 bg-transparent p-0 transition-colors",C="text-t1 hover:text-p1 flex size-[14px] shrink-0 items-center justify-center rounded-none border-0 bg-transparent p-0 transition-colors disabled:cursor-not-allowed disabled:opacity-40 [&_svg]:size-3.5";function w(e,t){let r=(0,g.Tz)(e.triggerWay,t.triggerWay),n=(0,g.Tz)(e.triggerDirection,t.triggerDirection),a=(0,g.ac)(e.triggerPrice);return"".concat(r).concat(n).concat(a)}function T(e,t){let r=e.orderType,a=(0,g.Tz)(r,t.orderType);switch(r){case"planLimit":return t.limitOrderType[e.planType||""]||a;case"planMarket":return t.marketOrderType[e.planType||""]||a;case"postOnly":default:return a;case"fok":return(0,n.jsx)(s.Tooltip,{content:a,side:"top",children:(0,n.jsx)("span",{className:"cursor-help",children:"FOK"})});case"ioc":return(0,n.jsx)(s.Tooltip,{content:a,side:"top",children:(0,n.jsx)("span",{className:"cursor-help",children:"IOC"})})}}function k(e){var t;let{item:r,isEditing:s,isSubmitting:o,onStartEdit:c,onCancelEdit:d,onConfirmEdit:u}=e,[m,x]=y.useState(String(null!=(t=r.contQuantity)?t:""));return(y.useEffect(()=>{if(s){var e;x(String(null!=(e=r.contQuantity)?e:""))}},[s,r.contQuantity]),s)?(0,n.jsxs)("div",{className:(0,p.cn)("border-p1 flex h-8 items-center gap-1 rounded-r1 border bg-transparent px-2","w-[116px] whitespace-nowrap"),children:[(0,n.jsx)("button",{type:"button","aria-label":"Cancel trigger order quantity edit",disabled:o,onClick:d,className:C,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),(0,n.jsx)("input",{autoFocus:!0,value:m,onChange:e=>x(e.target.value.replace(/[^\d]+/g,"")),className:"text-m12 text-t1 min-w-0 flex-1 border-0 bg-transparent p-0 text-center leading-4 font-medium outline-none placeholder:text-t4"}),(0,n.jsx)("button",{type:"button","aria-label":"Confirm trigger order quantity edit",disabled:o,onClick:()=>null==u?void 0:u(m),className:C,children:(0,n.jsx)(i.S,{className:"size-3.5"})})]}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default whitespace-nowrap",children:(0,g.ac)(r.contQuantity)}),r.planId&&"waitTrigger"===r.status?(0,n.jsx)("button",{type:"button","aria-label":"Edit trigger order quantity",onClick:()=>{var e;x(String(null!=(e=r.contQuantity)?e:"")),null==c||c()},className:j,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function P(e){var t;let{item:r,isEditing:s,isSubmitting:o,onStartEdit:d,onCancelEdit:u,onConfirmEdit:m}=e,{$t:x}=(0,c.B)(),[g,b]=y.useState(String(null!=(t=r.triggerPrice)?t:""));return(y.useEffect(()=>{if(s){var e;b(String(null!=(e=r.triggerPrice)?e:""))}},[s,r.triggerPrice]),s)?(0,n.jsx)(h.ho,{autoFocus:!0,value:g,symbol:r.symbol,disabled:o,onChange:b,className:(0,p.cn)("rounded-r1 border-p1 h-8 w-[160px] border bg-transparent px-2","[&_input]:text-m12 [&_input]:text-t1 [&_input]:placeholder:text-t4 [&_input]:border-0 [&_input]:bg-transparent [&_input]:p-0 [&_input]:text-center [&_input]:leading-4 [&_input]:font-medium [&_input]:outline-none","[&_svg]:size-3.5"),prefix:(0,n.jsx)("button",{type:"button","aria-label":"Cancel trigger order trigger price edit",disabled:o,onClick:u,className:C,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),suffix:(0,n.jsx)("button",{type:"button","aria-label":"Confirm trigger order trigger price edit",disabled:o,onClick:()=>null==m?void 0:m(g),className:C,children:(0,n.jsx)(i.S,{className:"size-3.5"})})}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default whitespace-nowrap",children:w(r,{triggerWay:{latest:x("Last Price"),mark:x("Mark Price")},triggerDirection:{gt:">=",eq:"=",lt:"<="}})}),r.planId&&"waitTrigger"===r.status?(0,n.jsx)("button",{type:"button","aria-label":"Edit trigger order trigger price",onClick:()=>{var e;b(String(null!=(e=r.triggerPrice)?e:"")),null==d||d()},className:j,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function S(e){var t;let{item:r,isEditing:s,isSubmitting:o,onStartEdit:d,onCancelEdit:u,onConfirmEdit:m}=e,{$t:x}=(0,c.B)(),[b,f]=y.useState(String(null!=(t=r.orderPrice)?t:""));return(y.useEffect(()=>{if(s){var e;f(String(null!=(e=r.orderPrice)?e:""))}},[s,r.orderPrice]),s)?(0,n.jsx)(h.ho,{autoFocus:!0,value:b,symbol:r.symbol,disabled:o,onChange:f,className:(0,p.cn)("rounded-r1 border-p1 h-8 w-[160px] border bg-transparent px-2","[&_input]:text-m12 [&_input]:text-t1 [&_input]:placeholder:text-t4 [&_input]:border-0 [&_input]:bg-transparent [&_input]:p-0 [&_input]:text-center [&_input]:leading-4 [&_input]:font-medium [&_input]:outline-none","[&_svg]:size-3.5"),prefix:(0,n.jsx)("button",{type:"button","aria-label":"Cancel trigger order price edit",disabled:o,onClick:u,className:C,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),suffix:(0,n.jsx)("button",{type:"button","aria-label":"Confirm trigger order price edit",disabled:o,onClick:()=>null==m?void 0:m(b),className:C,children:(0,n.jsx)(i.S,{className:"size-3.5"})})}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default whitespace-nowrap",children:(0,g.Iz)({marketLabel:x("Market"),orderPrice:r.orderPrice,orderType:r.orderType})}),r.planId&&"waitTrigger"===r.status&&"planMarket"!==r.orderType?(0,n.jsx)("button",{type:"button","aria-label":"Edit trigger order price",onClick:()=>{var e;f(String(null!=(e=r.orderPrice)?e:"")),null==d||d()},className:j,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function L(e){let{item:t,onBeforeOpen:r}=e,a=(0,f.ve)();return(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default whitespace-nowrap",children:(0,g.iN)({takeProfit:t.tpTriggerPrice,stopLoss:t.slTriggerPrice})}),"waitTrigger"===t.status?(0,n.jsx)("button",{type:"button","aria-label":"Edit trigger order TP/SL",onClick:()=>{t.planId&&(null==r||r(),a.showLayer({type:"triggerOrder",item:t}))},disabled:!t.planId,className:"text-t3 hover:text-t2 disabled:text-t4 inline-flex cursor-pointer items-center transition-colors disabled:cursor-not-allowed",children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function M(e){let{item:t,buttonClassName:r}=e,{$t:a,locale:i}=(0,c.B)(),l=(0,b.useMutation)({mutationFn:async e=>(0,u.trackBusinessOperation)({domain:"futures",operation:"order_cancel",execute:()=>(0,x.c6)({locale:i,requestType:d.Yw.JsonString,body:{planId:String(e)}})}),onSuccess:async e=>{(null==e?void 0:e.code)===200&&((0,o.toast)({type:"success",title:a("Success")}),await Promise.all([(0,v.WJ)(),(0,N.JH)()]))}});return"waitTrigger"!==t.status?(0,n.jsx)("span",{className:"text-c12 text-t3 cursor-default whitespace-nowrap",children:"--"}):(0,n.jsx)("button",{type:"button",disabled:!t.planId||l.isPending,onClick:()=>{t.planId&&!l.isPending&&l.mutate(t.planId)},className:(0,p.cn)("text-c12 text-p1-dark hover:text-p1/80 disabled:text-t4 cursor-pointer transition-colors disabled:cursor-not-allowed",r),children:a("Cancel")})}function O(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Full Position";return"position"===e.tpslType?t:"".concat((0,g.ac)(e.triggerQuantity),"/").concat((0,g.ac)(e.quantity)," ").concat(e.unit||"").trim()}function _(e,t){let r=t.find(t=>String(t.value||"")===String(e||""));return(null==r?void 0:r.name)||"--"}function A(e){return(0,m.A2)(e||"","")||"--"}},26560:(e,t,r)=>{r.d(t,{kk:()=>w});var n=r(93924),a=r(66960),i=r(51025),l=r(18006),s=r(38113),o=r(76656),c=r(25749),d=r(90178),u=r(70744),m=r(39422),p=r(2639),x=r(44844),g=r(22354),h=r(11529),b=r(36527),y=r(39731),f=r(31150),v=r(21219);let N={showHideOther:!1,bulkAction:null,showSettings:!1,settingsKind:null},j={positions:{showHideOther:!0,bulkAction:"closeAll",showSettings:!0,settingsKind:"positions"},openOrders:{showHideOther:!0,bulkAction:"cancelAll",showSettings:!1,settingsKind:null},triggerOrders:{showHideOther:!0,bulkAction:"cancelAll",showSettings:!1,settingsKind:null},ordersHistory:{showHideOther:!0,bulkAction:null,showSettings:!1,settingsKind:null},tpsl:{showHideOther:!0,bulkAction:null,showSettings:!1,settingsKind:null}};function C(e){var t;return null!=(t=j[e])?t:N}function w(e){var t;let{$t:r,locale:N}=(0,a.B)(),j=C(e),w=(0,v.T)(),{gotoLogin:T,userId:k}
1=(0,i.k)((0,o.k)(e=>{var t,r;return{gotoLogin:e.gotoLogin,userId:null!=(r=null==(t=e.user)?void 0:t.userId)?r:0}})),P=!!k,{refetch:S}=(0,d.pD)(),L=(0,c.j9)(),{positionsHideOther:M,setPositionsHideOther:O,positionColumnOptions:_,setPositionColumnOptions:A}=(0,b.r)((0,o.k)(e=>({positionsHideOther:e.hideOther,setPositionsHideOther:e.setHideOther,positionColumnOptions:e.columnOptions,setPositionColumnOptions:e.setColumnOptions}))),{openOrdersHideOther:I,setOpenOrdersHideOther:q,setOpenOrdersPageNum:U}=(0,g.yx)((0,o.k)(e=>({openOrdersHideOther:e.hideOther,setOpenOrdersHideOther:e.setHideOther,setOpenOrdersPageNum:e.setPageNum}))),{triggerOrdersHideOther:E,setTriggerOrdersHideOther:Q,setTriggerOrdersPageNum:D}=(0,f.a5)((0,o.k)(e=>({triggerOrdersHideOther:e.hideOther,setTriggerOrdersHideOther:e.setHideOther,setTriggerOrdersPageNum:e.setPageNum}))),{tpslHideOther:R,setTpslHideOther:z,setTpslPageNum:B}=(0,y.hv)((0,o.k)(e=>({tpslHideOther:e.hideOther,setTpslHideOther:e.setHideOther,setTpslPageNum:e.setPageNum}))),{orderHistoryHideOther:F,setOrderHistoryHideOther:H,setOrderHistoryPageNum:V}=(0,h.dw)((0,o.k)(e=>({orderHistoryHideOther:e.hideOther,setOrderHistoryHideOther:e.setHideOther,setOrderHistoryPageNum:e.setPageNum}))),Z=(()=>{switch(e){case"openOrders":return I;case"triggerOrders":return E;case"ordersHistory":return F;case"tpsl":return R;case"positions":return M;default:return!1}})(),K=(0,l.useMutation)({mutationFn:async t=>{if(!k)return null;switch(t){case"closeAll":return(0,m.lp)({locale:N,params:{userId:Number(k),symbol:Z?w:void 0}});case"cancelAll":if("triggerOrders"===e)return(0,m.Jp)({locale:N,params:{userId:Number(k),symbol:Z?w:""}});return(0,m.BB)({locale:N,params:{userId:Number(k),symbol:Z?w:void 0}})}},onSuccess:(t,a)=>{switch(a){case"closeAll":S(),(0,x.q)("openOrders",w),(0,x.q)("triggerOrders",w),(0,x.q)("tpsl",w);break;case"cancelAll":(0,x.q)("triggerOrders"===e?"triggerOrders":"openOrders",w)}n.toast.success(r("Success"))}}),{hasBulkTarget:W,bulkDialogTitle:G,bulkDialogDescription:J,bulkDialogNote:$,bulkActionLabel:Y}=function(){let{$t:e}=(0,a.B)(),t=(0,p.J)(e=>e.activeContractTab),r=(0,s.useMemo)(()=>C(t).bulkAction,[t]),n=(0,u.eu)({enabled:"positions"===t}),i=(0,g.yx)(e=>e.pagination.total),l=(0,f.a5)(e=>e.items.length);return(0,s.useMemo)(()=>"closeAll"===r?{hasBulkTarget:n.items.length>0,bulkDialogTitle:e("Close All"),bulkDialogDescription:e("Are you sure to close all positions at the market price and cancel all orders?"),bulkDialogNote:e("Note: when the market flutuates greatly, the market transaction may fail, and the orders will be cancelled."),bulkActionLabel:e("Close All")}:"cancelAll"===r?{hasBulkTarget:"openOrders"===t?i>0:"triggerOrders"===t&&l>0,bulkDialogTitle:e("Cancel All"),bulkDialogDescription:e("Batch Cancellation Confirmationï¼"),bulkDialogNote:"",bulkActionLabel:e("Cancel All")}:{hasBulkTarget:!1,bulkDialogTitle:"",bulkDialogDescription:"",bulkDialogNote:"",bulkActionLabel:""},[t,r,i,n.items.length,l,e])}();return{showHideOther:j.showHideOther,hideOtherChecked:!!P&&Z,onHideOtherChange:function(t){if(!P)return void T();if(j.showHideOther)switch(e){case"openOrders":q(t),U(1);return;case"triggerOrders":Q(t),D(1);return;case"ordersHistory":H(t),V(1);return;case"tpsl":z(t),B(1);return;case"positions":O(t);return}},showBulkAction:(t={isLogged:P,bulkAction:j.bulkAction,hasBulkTarget:W}).isLogged&&!!t.bulkAction&&t.hasBulkTarget,canTriggerBulkAction:W,bulkActionLabel:Y,openBulkActionDialog:function(){if(!P||!j.bulkAction||!W)return;let e=j.bulkAction;L.showLayer({title:G,description:J,note:$,onConfirm:async()=>{await K.mutateAsync(e)}})},showSettings:P&&j.showSettings,settingsKind:j.settingsKind,positionColumnOptions:_,setPositionColumnOptions:A}}},26811:(e,t,r)=>{r.d(t,{E:()=>u});var n=r(79237),a=r(34131),i=r(21219),l=r(47387),s=r(56272),o=r(38113),c=r(90178);function d(e){return"".concat("contract_usdt.fundingInterval_").concat(e)}function u(){let e=(0,i.T)(),{countdown:t,showTooltip:r,fundingInterval:u}=function(e){let{data:t,isLoading:r,isFetching:n,refetch:a}=(0,c.O0)(e),i=null==t?void 0:t.data,[u,m]=(0,o.useState)(0),[p,x]=(0,o.useState)(!1),[g,h]=(0,o.useState)(""),[b]=(0,s.A)({leftTime:e&&u>0?u:0,interval:1e3,onEnd:()=>{e&&a()}});return(0,o.useEffect)(()=>
1{if(!e||!i){m(0),x(!1),h("");return}let t=Number(i.fundingInterval||0);m(1e3*function(e,t){let r=Number(e||0),n=Number(t||0);return r&&n?Math.max(0,Math.floor(r-n)):0}(i.fundingTime,i.currentTime)),x(function(e,t){let r=d(e),n=l.Nm.get(r);return null!=n&&""!==n?String(n)!==String(t||""):!!(t&&8!==t)}(e,t)),h(t?String(t):""),l.Nm.set({[d(e)]:t})},[i]),(0,o.useEffect)(()=>{if(!e)return;let t=()=>{"visible"===document.visibilityState&&a()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[a,e]),(0,o.useEffect)(()=>{if(!e||!i||b>0)return;let t=window.setInterval(()=>{a()},1e3);return()=>window.clearInterval(t)},[b,i,a,e]),{countdown:Math.max(0,Math.floor(b/1e3)),showTooltip:p,fundingInterval:g,isLoading:r||n&&!i}}(e);return(0,n.jsx)(a.E,{symbol:e,countdown:t,showTooltip:r,fundingInterval:u})}},27442:(e,t,r)=>{r.d(t,{y:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,n.jsx)("path",{d:"M650.6496 104.69376a40.96 40.96 0 0 1 57.91744-0.73728l223.232 217.66144c36.864 35.92192 11.42784 98.38592-40.01792 98.38592H112.8448a40.96 40.96 0 0 1 0-81.92h718.52032L651.38688 162.6112a40.96 40.96 0 0 1-0.73728-57.91744zM394.24 899.15392a40.96 40.96 0 0 1-57.91744 0.73728l-223.232-217.62048c-36.864-35.92192-11.42784-98.42688 40.01792-98.42688h778.93632a40.96 40.96 0 0 1 0 81.92H213.52448l179.97824 175.47264a40.96 40.96 0 0 1 0.73728 57.91744z"})}));l.displayName="Switch2Icon"},29153:(e,t,r)=>{r.d(t,{o:()=>L});var n=r(79237),a=r(24983),i=r(85002),l=r(66960),s=r(3529),o=r(90477),c=r(39042),d=r(81407),u=r(23209),m=r(99251),p=r(66249),x=r(38113),g=r(76656),h=r(92413),b=r(93924),y=r(95696),f=r(18006),v=r(50791),N=r(97450),j=r(72219),C=r(36106),w=r(34957),T=r(37966),k=r(95496),P=r(82359);function S(e){return{slot:"item",labelClassName:"text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",valueClassName:(0,o.cn)("text-cm12 text-t1 flex-1 [&_span]:!text-cm12",e)}}function L(e){let{mode:t="pc"}=e,{$t:r,locale:L}=(0,l.B)(),M=(0,h.T)(),O="h5"===t,_=(0,x.useMemo)(()=>(0,u.Y)(r),[r]),A=(0,j.Z)(),I=(0,N.D)(),q=(0,C.e)(),{getPriceInlineEditProps:U,getQuantityInlineEditProps:E}=function(){let{$t:e,locale:t}=(0,l.B)(),r=(0,v.W5)(),[n,a]=(0,x.useState)(null),i=(0,f.useMutation)({mutationFn:async e=>(0,y.Hw)({locale:t,params:e}),onSuccess:async t=>{if((null==t?void 0:t.code)===200){(0,b.toast)({type:"success",title:e("Order placed successfully")}),a(null);return}(null==t?void 0:t.code)===10307&&r.showLayer()}}),s=e=>{e.orderId&&a({type:"quantity",orderId:String(e.orderId)})},o=e=>{e.orderId&&a({type:"price",orderId:String(e.orderId)})},c=()=>a(null),d=async(t,r)=>{if(t.orderId){if(!Number(r))return void(0,b.toast)({type:"error",title:e("Please enter the quantity")});await i.mutateAsync({orderId:String(t.orderId),quantity:Number(r)})}},u=async(t,r)=>{if(t.orderId){if(0>=Number(r))return void(0,b.toast)({type:"error",title:e("Please enter the correct price")});await i.mutateAsync({orderId:String(t.orderId),orderPrice:r})}},m=(e,t,r,a)=>({isEditing:(null==n?void 0:n.type)===e&&n.orderId===String(t.orderId),isSubmitting:i.isPending,onStartEdit:()=>r(t),onCancelEdit:c,onConfirmEdit:e=>a(t,e)});return{getQuantityInlineEditProps:e=>m("quantity",e,s,d),getPriceInlineEditProps:e=>m("price",e,o,u)}}(),{rawItems:Q,loading:D,initialized:R,pagination:z,setPageNum:B}=(0,k.yx)((0,g.k)(e=>({rawItems:e.items,loading:e.loading,initialized:e.initialized,pagination:e.pagination,setPageNum:e.setPageNum}))),F=(Array.isArray(Q)?Q:[]).map(e=>{var t,r;return{...e,contQuantity:e.quantity,openQuantity:e.quantity,quantity:I(null!=(t=e.quantity)?t:0,e.symbol||"",e.orderPrice),availableQuantity:I(null!=(r=e.availableQuantity)?r:0,e.symbol||"",e.orderPrice),calcQuantity:I(e.filledQuantity||0,e.symbol||"",e.orderPrice),remainingQuantity:I(Number(e.quantity||0)-Number(e.filledQuantity||0),e.symbol||"",e.orderPrice),unit:q(e.symbol)}}),H=!!(A.userReady&&A.isLogged&&!R)||!!D,V=Math.max(1,z.totalPage||Math.ceil(z.total/Math.max(1,z.pageSize))),Z=V>1||z.pageNum>1,K=async()=>(0,T.q)("openOrders",M),W=(0,x.useMemo)(()=>[{title:(0,n.jsx)("span",{className:m.CZ,children:r("Symbol")}),key:"symbol",dataIndex:"symbol",width:140,fixed:"left",render:(e,t)=>(0,n.jsx)(P.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:m.pd,children:(0,s.A2)(t.symbol||"")||"--"})}),mobile:{slot:"header",label:(e,t)=>
1(0,n.jsx)(P.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:"text-tm14 text-t1 block min-w-0 truncate",children:(0,s.A2)(t.symbol||"")||"--"})}),value:(e,t)=>(0,n.jsx)(w.xT,{item:t,onSuccess:K,buttonClassName:"text-mm12 shrink-0"}),labelClassName:"min-w-0 flex-1",valueClassName:"flex-none justify-end"}},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Side")}),key:"direction",width:112,render:(e,t)=>(0,n.jsx)("span",{className:(0,o.cn)(m._U,(0,d.N)(t.direction)),children:(0,d.Tz)(t.direction,_.direction)}),mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Margin Mode")}),key:"marginMode",width:120,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,d.Tz)(t.marginMode,_.mode)}),mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Leverage")}),key:"leverage",width:100,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,d.Uy)(t.leverage)}),mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Type")}),key:"orderType",width:108,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,c.N7)(t,_)}),mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Quantity_1")}),key:"quantity",width:132,render:(e,t)=>{let r=(0,d.ac)(t.quantity);return(0,n.jsx)("span",{className:m.pd,children:"--"===r?r:"".concat(r," ").concat(t.unit||"").trim()})},mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:"".concat(r("Quantity_1"),"(").concat(r("Cont"),")")}),key:"openQuantity",width:196,render:(e,t)=>(0,n.jsx)(w.yc,{item:t,...E(t)}),mobile:{...S("[&>div]:justify-end"),label:"".concat(r("Quantity_1")," (").concat(r("Cont"),")")}},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Price_3")}),key:"orderPrice",width:196,render:(e,t)=>(0,n.jsx)(w.io,{item:t,...U(t)}),mobile:S("[&>div]:!w-auto [&>div]:justify-end")},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Value")}),key:"orderValue",width:108,render:(e,t)=>{let r="canceled"===t.status?"--":(0,d.ac)(t.orderValue);return(0,n.jsx)("span",{className:m.pd,children:r})},mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Filled Qty")}),key:"filledQuantity",width:132,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,d.ac)(t.calcQuantity)}),mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Remaining")}),key:"availableQuantity",width:132,render:(e,t)=>{let r=(0,d.ac)(t.availableQuantity);return(0,n.jsx)("span",{className:m.pd,children:"--"===r?r:"".concat(r," ").concat(t.unit||"").trim()})},mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Fill Price")}),key:"averagePrice",width:112,render:(e,t)=>{let r="liquidation"===t.orderType?"--":(0,d.ac)(t.averagePrice);return(0,n.jsx)("span",{className:m.pd,children:r})},mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Setup Time")}),key:"orderTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,d.r6)(t.orderTime)}),mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Filled%")}),key:"filledPercentage",width:98,render:(e,t)=>
1(0,n.jsx)("span",{className:m.pd,children:(0,c.cS)({filledQuantity:t.calcQuantity,quantity:t.quantity})}),mobile:S()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("TP/SL")}),key:"tpsl",width:140,render:(e,t)=>(0,n.jsx)(w.wD,{item:t}),mobile:S("[&>div]:justify-end")},{title:(0,n.jsx)("span",{className:"".concat(m.CZ," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",width:108,fixed:"right",render:(e,t)=>(0,n.jsx)(w.xT,{item:t,onSuccess:K}),mobile:{hidden:!0}}],[r,U,E,_,K]),G=Z?(0,n.jsx)("div",{className:(0,o.cn)("py-s3 flex",O?"justify-center px-4":"justify-end px-[10px]"),children:(0,n.jsxs)(a.Pagination,{variant:"number",children:[(0,n.jsx)(a.PaginationItem,{type:"button",icon:"first",disabled:H||1===z.pageNum,onClick:()=>{H||B(1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"prev",disabled:H||1===z.pageNum,onClick:()=>{H||B(Math.max(1,z.pageNum-1))}}),(0,n.jsx)(a.PaginationItem,{type:"number",active:!0,children:z.pageNum}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"next",disabled:H||z.pageNum>=V,onClick:()=>{H||z.pageNum>=V||B(z.pageNum+1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"last",disabled:H||z.pageNum>=V,onClick:()=>{H||z.pageNum>=V||B(V)}})]})}):null;return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsx)(i.AdvancedTable,{columns:W,dataSource:F,locale:L,rowKey:"orderId",loading:H,className:O?"[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-divider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0":p.hL,outlined:!1,containerClassName:O?void 0:p.CL,tableClassName:O?void 0:"[&_tbody_tr]:!h-14",fixedCellClassName:O?void 0:p.dA,pagination:!1,scroll:O?void 0:{x:2060},responsive:O,mobileMode:O?"card":"table",mobileCardClassName:O?"bg-bg7":void 0}),G]})}},32371:(e,t,r)=>{r.d(t,{_:()=>e2});var n=r(79237),a=r(91405),i=r(3529),l=r(21219),s=r(47776),o=r(51924),c=r(55872),d=r(45341),u=r(84980),m=r(56044),p=r(70659),x=r(66960),g=r(92155),h=r(45328),b=r(17449),y=r(38113),f=r(76856),v=r(12724),N=r(10022),j=r(28373),C=r(31687),w=r(5257),T=r(89719),k=r(14275),P=r(39679),S=r(3060),L=r(20449);function M(e,t){let r=Number(e||t);return!Number.isFinite(r)||r<=0?t:Math.min(r,t)}function O(e,t){let r=Number(e||0),n=Number(t||0);return n||r?!n&&r>0?100:Math.min(Math.floor(100*r/n),100):0}var _=r(93924),A=r(81742),I=r(17854),q=r(40882),U=r(18006),E=r(76656),Q=r(25749),D=r(10209),R=r(66143),z=r(56856),B=r(19019),F=r(11636),H=r(19490),V=r(60391),Z=r(51430),K=r(49695),W=r(90178),G=r(28598),J=r(90604),$=r(55896),Y=r(67666),X=r(83054);function ee(e){let{quantityValue:t,side:r,tradeUnit:n,usdtCost:a,multiplier:i,calcPrice:l,oneContCost:s}=e;if(!t)return 0;if("2"===n){if("1"===a){let e=Number("buy"===r?s.buy:s.sell);return e?Math.max(0,Math.floor(t/e)):0}return(0,Y.DG)({quantity:t,tradeUnit:n,multiplier:i,price:l,usdtCost:a,costOne:"buy"===r?Number(s.buy||0):Number(s.sell||0)})}return(0,Y.DG)({quantity:t,tradeUnit:n,multiplier:i,price:l,usdtCost:a})}var et=r(40394),er=r(122);function en(e){return(0,Y.vX)({quantityCont:e.quantityCont,tradeUnit:e.tradeUnit,multiplier:e.multiplier,price:e.price})}var ea=r(51025),ei=r(2815),el=r(41760),es=r(96620),eo=r(52293),ec=r(4390),ed=r(39422);function eu(e){let{symbol:t}=e,r=function(e){var t,r,n;let{symbol:a}=e,{locale:l}=(0,x.B)(),{user:s,gotoLogin:o}=(0,ea.k)(),c=!!(null==s?void 0:s.userId),d=function(e){var t,r,n,a;let{symbol:l,locale:s,isLoggedIn:o,enableCurrentLeverageQuery:c=!0}=e,d=l.split("-")[0]||"BTC",u=G.QT,m=(0,y.useMemo)(()=>l.endsWith("-SWAP")?l:(0,i.Qx)(l,"-"),[l]),p=(0,y.useMemo)(()=>(0,i.A2)(m,"-"),[m]),x=(0,y.useMemo)(()=>(0,G.bh)(m),[m]),g=(0,y.useMemo)(()=>({locale:s}),[s]);(0,eo.hs)(g);let h=(0,eo.bZ)(e=>e.ensureContractTier),b=(0,eo.bZ)(e=>e.symbolsConfigBySymbol[m]),f=(0,eo.bZ)(e=>e.siteConfig),v=(0,el.N1)(es.p.USDT.SIMPLE_TICKER(m)),N=(0,el.pj)(es.p.USDT.ORDER_BOOK(m)),{data:j}=(0,W.pD)(),C=(0,K.ZM)((0,E.k)(e=>({currentLeverage:e.currentLeverage,currentLeverageSymbol:e.currentLeverageSymbol}))),w=(0,ec.useQuery)({queryKey:(0,W.sJ)(s,x),queryFn:()=>
1(0,ed.UN)({locale:s,params:{symbol:x}}),enabled:o&&c,refetchOnMount:!1}),T=(0,ec.useQuery)({queryKey:(0,W.xc)(s,x),queryFn:()=>(0,ed.dF)({locale:s,params:{symbol:x}}),enabled:o}),k=null!=(a=null==j||null==(t=j.data)?void 0:t.positions)?a:[],P=(0,y.useMemo)(()=>(k||[]).filter(e=>{let t=String((null==e?void 0:e.tradeType)||""),r=String((null==e?void 0:e.symbol)||"");return(!t||"common"===t)&&[l,p,m,x].includes(r)}),[x,p,k,m,l]),S=(0,y.useMemo)(()=>P.find(e=>(null==e?void 0:e.side)==="long"),[P]),L=(0,y.useMemo)(()=>P.find(e=>(null==e?void 0:e.side)==="short"),[P]),M=(0,y.useMemo)(()=>{var e;let t=null==(e=w.data)?void 0:e.data,r=C.currentLeverageSymbol===m?C.currentLeverage:null;return t||r||{}},[null==(r=w.data)?void 0:r.data,C.currentLeverage,C.currentLeverageSymbol,m]),O=(null==(n=T.data)?void 0:n.data)||{};return{baseAsset:d,quoteAsset:u,serviceSymbol:m,ensureContractTier:h,contractConfig:b,siteConfig:f,orderbook:N,currentLeverageInfo:M,usedRiskQuantity:O,currentSymbolPositions:P,longPosition:S,shortPosition:L,lastPrice:Number((null==v?void 0:v.last)||0),markPrice:Number((null==v?void 0:v.markPrice)||0)}}({symbol:a,locale:l,isLoggedIn:c}),u=(null==(t=d.contractConfig)?void 0:t.tiers)||[],m=Number((null==(r=u[u.length-1])?void 0:r.levelMax)||(null==(n=d.contractConfig)?void 0:n.maxLeverage)||0),p=function(e){let{isLoggedIn:t}=e,r=(0,T.TY)(e=>e.configs),n=(0,q.ru)(r.usdt_user_confirm);return{confirmStr:n,serverTradeUnit:t?r.tradeUnit:void 0,serverUsdtCost:"1"===r.usdtCost?"1":"0"}}({locale:l,isLoggedIn:c}),g=(0,ei.tQ)(),h=(0,z.Mr)(e=>e.form),b=(0,z.Mr)(e=>e.initialize),f=(0,z.Mr)(e=>e.update),v=(0,z.Mr)(e=>e.setOrderType),N=(0,z.Mr)(e=>e.setTradeUnit),j=(0,Q.Hx)(),C=(0,Q.Lt)(),w=(0,Q.vs)(),k=(0,Q.H3)(),P=(0,B.M)((0,E.k)(e=>({setOrderTypeMenuOpen:e.setOrderTypeMenuOpen,resetUi:e.resetUi,plansNeverRemind:e.plansNeverRemind}))),S=(0,R.X)((0,E.k)(e=>({settingsLoading:e.settingsLoading,settingsSaving:e.settingsSaving,settingsError:e.settingsError,settingsMarginDisabled:e.settingsMarginDisabled,loadSettings:e.loadSettings,saveSettings:e.saveSettings,submitOpenOrder:e.submitOpenOrder,submitCloseOrder:e.submitCloseOrder,estimateLiqPrice:e.estimateLiqPrice,setDifferenceDirection:e.setDifferenceDirection,resetSubmitFlow:e.resetSubmitFlow})));return!function(e){let{symbol:t,locale:r,isLoggedIn:n,storageSymbol:a,maxLeverage:i,currentLeverageInfo:l,formMarginMode:s,formPositionMode:o,formLongLeverage:c,formShortLeverage:d,formTradeUnit:u,formUsdtCost:m,serverTradeUnit:p,serverUsdtCost:x,initialize:g,resetUi:h,resetSubmitFlow:b,setTradeUnit:f,update:v}=e;(0,y.useEffect)(()=>{if(!a||!i)return void g(t);g(t,{longLeverage:M(L.P8.getLongLeverage(a),i),shortLeverage:M(L.P8.getShortLeverage(a),i)})},[g,i,a,t]),(0,y.useEffect)(()=>{h(),b()},[b,h,t]),(0,y.useEffect)(()=>{if(!n)return;let e=Number(l.curLeverage||0),t=Number(l.curLongLeverage||e||0),r=Number(l.curShortLeverage||e||0),a=l.marginMode||l.marginModeSetting,i=l.positionMode||l.positionModeSetting,u={};a&&s!==a&&(u.marginMode=a),i&&o!==i&&(u.positionMode=i),t>0&&c!==t&&(u.longLeverage=t),r>0&&d!==r&&(u.shortLeverage=r),Object.keys(u).length>0&&v(u)},[l.curLeverage,l.curLongLeverage,l.curShortLeverage,l.marginMode,l.marginModeSetting,l.positionMode,l.positionModeSetting,c,s,o,d,n,v]),(0,y.useEffect)(()=>{if(n||!a||!i)return;let e=M(L.P8.getLongLeverage(a),i),t=M(L.P8.getShortLeverage(a),i),r={};c!==e&&(r.longLeverage=e,L.P8.setLongLeverage(e,a)),d!==t&&(r.shortLeverage=t,L.P8.setShortLeverage(t,a)),Object.keys(r).length>0&&v(r)},[c,d,n,i,a,v]),(0,y.useEffect)(()=>{n&&p&&(u!==p||"2"===p&&m!==x)&&f(p,"2"===p?x:m)},[u,m,n,p,x,f])}({symbol:a,locale:l,isLoggedIn:c,storageSymbol:d.serviceSymbol,maxLeverage:m,currentLeverageInfo:d.currentLeverageInfo,formMarginMode:h.marginMode,formPositionMode:h.positionMode,formLongLeverage:h.longLeverage,formShortLeverage:h.shortLeverage,formTradeUnit:h.tradeUnit,formUsdtCost:h.usdtCost,serverTradeUnit:p.serverTradeUnit,serverUsdtCost:p.serverUsdtCost,initialize:b,resetUi:P.resetUi,resetSubmitFlow:S.resetSubmitFlow,setTradeUnit:N,update:f}),{locale:l,isLoggedIn:c,gotoLogin:o,market:d,userConfig:p,contractOverview:g,form:h,formActions:{update:f,setOrderType:v,setTradeUnit:N},layers:{settingsLayer:j,tpslAdvancedLayer:C,differenceLayer:w,triggerOrdersNoticeLayer:k},ui:P,dialogs:S}}
1({symbol:t}),n=function(e){let{facts:t}=e,{form:r,market:{baseAsset:n,contractConfig:a,siteConfig:i,orderbook:l,lastPrice:s,currentLeverageInfo:o,usedRiskQuantity:c,currentSymbolPositions:d},contractOverview:u}=t,m=function(e){var t;let{form:r,baseAsset:n,contractConfig:a,siteConfig:i,orderbook:l,lastPrice:s,availableBalanceSource:o,currentLeverageInfo:c,usedRiskQuantity:d,currentSymbolPositions:u}=e,m=(0,P.tt)({orderType:r.orderType,orderPrice:r.orderPrice,triggerPrice:r.triggerPrice,lastPrice:s}),p=Number(null!=o?o:0),g=(0,H.iT)(p.toFixed(Number((null==i?void 0:i.showPrecision)||2))),h=Number((null==a?void 0:a.multiplier)||0),b=Number(r.quantity||0),f="2"===r.tradeUnit&&"1"===r.usdtCost,v=(0,y.useMemo)(()=>(0,P.Ir)({orderbook:l,lastPrice:s,orderType:r.orderType,orderPrice:r.orderPrice,triggerPrice:r.triggerPrice,contract:a}),[a,r.orderPrice,r.orderType,r.triggerPrice,s,l]),N=(0,y.useMemo)(()=>(0,Y.DG)({quantity:b,tradeUnit:r.tradeUnit,multiplier:h,price:m,usdtCost:r.usdtCost}),[m,r.tradeUnit,r.usdtCost,h,b]),j=Number(r.longQuantity||0),C=Number(r.shortQuantity||0),w=(0,y.useMemo)(()=>(0,P.Op)({quantityCont:1,longLeverage:r.longLeverage,shortLeverage:r.shortLeverage,prices:v,contract:a,siteConfig:i}),[a,r.longLeverage,r.shortLeverage,v,i]),T=(0,y.useMemo)(()=>ee({quantityValue:j||b,side:"buy",tradeUnit:r.tradeUnit,usdtCost:r.usdtCost,multiplier:h,calcPrice:m,oneContCost:w}),[m,j,r.tradeUnit,r.usdtCost,h,w,b]),k=(0,y.useMemo)(()=>ee({quantityValue:C||b,side:"sell",tradeUnit:r.tradeUnit,usdtCost:r.usdtCost,multiplier:h,calcPrice:m,oneContCost:w}),[m,C,r.tradeUnit,r.usdtCost,h,w,b]),L=(0,y.useMemo)(()=>(function(e){let{longQuantityContForCosts:t,shortQuantityContForCosts:r,longLeverage:n,shortLeverage:a,prices:i,contract:l,siteConfig:s}=e,o=(0,P.Op)({quantityCont:t,longLeverage:n,shortLeverage:a,prices:i,contract:l,siteConfig:s}),c=(0,P.Op)({quantityCont:r,longLeverage:n,shortLeverage:a,prices:i,contract:l,siteConfig:s});return{buy:o.buy,sell:c.sell}})({longQuantityContForCosts:T,shortQuantityContForCosts:k,longLeverage:r.longLeverage,shortLeverage:r.shortLeverage,prices:v,contract:a,siteConfig:i}),[a,r.longLeverage,r.shortLeverage,T,v,k,i]),M=(0,y.useMemo)(()=>(0,P.az)({availableBalance:p,costOne:w}),[p,w]),O=(null==a?void 0:a.tiers)||[],_=Number((null==(t=O[O.length-1])?void 0:t.levelMax)||(null==a?void 0:a.maxLeverage)||
11),A=(0,y.useMemo)(()=>u.reduce((e,t)=>{let r=String((null==t?void 0:t.side)||""),n=Number((null==t?void 0:t.availableQuantity)||0),a=Number((null==t?void 0:t.quantity)||0);return"long"===r&&(e.longAvailableCont+=n,e.longQuantityCont+=a),"short"===r&&(e.shortAvailableCont+=n,e.shortQuantityCont+=a),e},{longAvailableCont:0,longQuantityCont:0,shortAvailableCont:0,shortQuantityCont:0}),[u]),{buy:I,sell:q}=(0,y.useMemo)(()=>(function(e){let{maxOpenByBalance:t,maxOpenSize:r,longLeverage:n,shortLeverage:a,longRiskQuantity:i,shortRiskQuantity:l,tiers:s=[]}=e,o=(0,P._j)(s,n),c=(0,P._j)(s,a),d=(0,P.IQ)(r,0),u=Math.max(0,o-(0,P.IQ)(i,0)),m=Math.max(0,c-(0,P.IQ)(l,0));return{buy:Math.min((0,P.IQ)(t.buy,0),u,d),sell:Math.min((0,P.IQ)(t.sell,0),m,d)}})({maxOpenByBalance:M,maxOpenSize:null==c?void 0:c.maxOpenSize,longLeverage:r.longLeverage,shortLeverage:r.shortLeverage,longRiskQuantity:null==d?void 0:d.longRiskQuantity,shortRiskQuantity:null==d?void 0:d.shortRiskQuantity,tiers:null==a?void 0:a.tiers}),[null==a?void 0:a.tiers,null==c?void 0:c.maxOpenSize,r.longLeverage,r.shortLeverage,M,null==d?void 0:d.longRiskQuantity,null==d?void 0:d.shortRiskQuantity]),{closeLongContLimit:U,closeShortContLimit:E,maxOpenBuy:Q,maxOpenSell:D,maxCloseLong:R,maxCloseShort:z}=function(e){let{orderType:t,tradeUnit:r,isUsdtCostMode:n,availableBalance:a,maxOpenBuyCont:i,maxOpenSellCont:l,closePositionSummary:s,multiplier:o,calcPrice:c}=e,d="market"===t?s.longQuantityCont:s.longAvailableCont,u="market"===t?s.shortQuantityCont:s.shortAvailableCont;return{closeLongContLimit:d,closeShortContLimit:u,maxOpenBuy:n?a:(0,Y.vX)({quantityCont:i,tradeUnit:r,multiplier:o,price:c}),maxOpenSell:n?a:(0,Y.vX)({quantityCont:l,tradeUnit:r,multiplier:o,price:c}),maxCloseLong:(0,Y.vX)({quantityCont:d,tradeUnit:r,multiplier:o,price:c}),maxCloseShort:(0,Y.vX)({quantityCont:u,tradeUnit:r,multiplier:o,price:c})}}({orderType:r.orderType,tradeUnit:r.tradeUnit,isUsdtCostMode:f,availableBalance:p,maxOpenBuyCont:I,maxOpenSellCont:q,closePositionSummary:A,multiplier:h,calcPrice:m}),B=function(e){var t;let{form:r,baseAsset:n,contractConfig:a,availableBalance:i,multiplier:l,calcPrice:s,lastPrice:o,oneContCost:c,maxOpenBuyCont:d,maxOpenSellCont:u,closeLongContLimit:m,closeShortContLimit:p,maxOpenBuy:g,maxOpenSell:h,maxCloseLong:b,maxCloseShort:f,directionalLongQuantityValue:v,directionalShortQuantityValue:N,maxLeverage:j}=e,{$t:C}=(0,x.B)(),w=(null==a?void 0:a.tiers)||[],T=(0,et.k)((0,Y.Rw)({tradeUnit:r.tradeUnit,baseAsset:n}),C),k=(t=null==a?void 0:a.multiplier,(0,X.DF)(t)),L=(0,y.useCallback)(e=>{var t;return t={tradeUnit:e,contractPrecision:Number((null==a?void 0:a.precision)||2),coinPrecision:k},F.w.getState().getQuantityPrecisionByUnit(t)},[k,null==a?void 0:a.precision]),M=L(r.tradeUnit),O="open"===r.activeTab&&"2"===r.tradeUnit&&"1"===r.usdtCost?2:M,_=(0,y.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.tradeUnit;return(0,S.oV)(e,L(t))},[r.tradeUnit,L]),A=(0,y.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.tradeUnit;return(0,S.pz)(e,L(t))},[r.tradeUnit,L]),I=Number(_(g)||0),q=Number(_(h)||0),U=Number(_(b)||0),E=Number(_(f)||0),Q=(0,y.useCallback)(e=>(0,S.cf)(e),[]),D=(0,y.useCallback)(e=>(0,S.lD)(e,O),[O]),R=(0,y.useCallback)(function(e){var t;let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"buy";return t={displayQuantity:e,side:a,tradeUnit:r.tradeUnit,multiplier:l,usdtCost:r.usdtCost,oneContCostBuy:Number(c.buy),oneContCostSell:Number(c.sell),calcPrice:s,coinPrecision:k,baseAsset:n},F.w.getState().getBaseAssetHintValue(t)},[n,s,k,r.tradeUnit,r.usdtCost,l,c.buy,c.sell]),z=(0,y.useCallback)((e,t)=>{let n=Math.max(1,Math.min(e||1,j)),a=(0,P._j)(w,n);if("2"===r.tradeUnit){let e=new er.A(a).mul(l||0).mul(o||0);return"".concat((0,H.iT)((0,Z.qQ)(e,M))," ").concat(T)}let i=(0,Y.vX)({quantityCont:a,tradeUnit:r.tradeUnit,multiplier:l,price:o});return"".concat((0,H.iT)(i.toFixed(M))," ").concat(T)},[r.tradeUnit,o,w,j,l,M,T]),B=(0,y.useMemo)(()=>(0,S.Bw)({activeTab:r.activeTab,tradeUnit:r.tradeUnit,quantity:r.quantity,longQuantity:v,shortQuantity:N,getBaseAssetHintValue:R}),[v,N,r.activeTab,r.quantity,r.tradeUnit,R]),V="open"===r.activeTab?Math.min(I,q):Math.max(E,U),K=(0,y.useCallback)(e=>{var t;return Number((0,S.oV)("open"===(t={activeTab:r.activeTab,tradeUnit:e,usdtCost:r.usdtCost,availableBalance:i,maxOpenBuyCont:d,maxOpenSellCont:u,closeShortContLimit:p,closeLongContLimit:m,multiplier:l,price:s,oneContCostBuy:Number(c.buy),oneContCostSell:Number(c.sell)}).activeTab?"2"===t.tradeUnit&&"1"===t.usdtCost?t.availableBalance:Math.min(en({quantityCont:t.maxOpenBuyCont,tradeUnit:t.tradeUnit,multiplier:t.multiplier,price:t.price}),en({quantityCont:t.maxOpenSellCont,tradeUnit:t.tradeUnit,multiplier:t.multiplier,price:t.price})):Math.max(en({quantityCont:t.closeShortContLimit,tradeUnit:t.tradeUnit,multiplier:t.multiplier,price:t.price}),en({quantityCont:t.closeLongContLimit,tradeUnit:t.tradeUnit,multiplier:t.multiplier,price:t.price})),L(e))||0)},[i,s,m,p,r.activeTab,r.usdtCost,L,d,u,l,c.buy,c.sell]),W=(0,y.useCallback)(function(e,t){var n;let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.usdtCost;return Number((0,S.oV)("open"===(n={activeTab:r.activeTab,side:e,tradeUnit:t,usdtCost:a,availableBalance:i,maxOpenBuyCont:d,maxOpenSellCont:u,closeLongContLimit:m,closeShortContLimit:p,multiplier:l,price:s,oneContCostBuy:Number(c.buy),oneContCostSell:Number(c.sell)}).activeTab?"2"===n.tradeUnit&&"1"===n.usdtCost?n.availableBalance:"long"===n.side?en({quantityCont:n.maxOpenBuyCont,tradeUnit:n.tradeUnit,multiplier:n.multiplier,price:n.price}):en({quantityCont:n.maxOpenSellCont,tradeUnit:n.tradeUnit,multiplier:n.multiplier,price:n.price}):"long"===n.side?en({quantityCont:n.closeLongContLimit,tradeUnit:n.tradeUnit,multiplier:n.multiplier,price:n.price}):en({quantityCont:n.closeShortContLimit,tradeUnit:n.tradeUnit,multiplier:n.multiplier,price:n.price}),L(t))||0)},[i,s,m,p,r.activeTab,r.usdtCost,L,d,u,l,c.buy,c.sell]),G=K(r.tradeUnit),J=W("long",r.tradeUnit,r.usdtCost),$=W("short",r.tradeUnit,r.usdtCost),ee=(0,y.useMemo)(()=>(0,S.mK)({activeTab:r.activeTab,isPercentage:r.isPercentage,percentage:r.percentage,longQuantity:r.longQuantity,shortQuantity:r.shortQuantity,maxQuantityDisplay:V,maxOpenBuy:I,maxOpenSell:q,maxCloseLong:U,maxCloseShort:E}),[r.activeTab,r.isPercentage,r.longQuantity,r.percentage,r.shortQuantity,V,U,E,I,q]);return{roundedMaxOpenBuy:I,roundedMaxOpenSell:q,roundedMaxCloseLong:U,roundedMaxCloseShort:E,unitLabel:T,coinPrecision:k,quantityPrecision:M,getQuantityPrecision:L,formatDisplayQuantity:_,formatDisplayQuantityUp:A,formatCostDisplay:Q,formatMaxDisplay:D,getMaxPositionLabel:z,quantityValueHint:B,maxQuantityDisplay:V,getMaxQuantityDisplayByUnit:K,getDirectionalMaxDisplayByUnit:W,rawMaxQuantityDisplay:G,rawLongMaxDisplay:J,rawShortMaxDisplay:$,sliderPercent:ee}}({form:r,baseAsset:n,contractConfig:a,availableBalance:p,multiplier:h,calcPrice:m,lastPrice:s,oneContCost:w,maxOpenBuyCont:I,maxOpenSellCont:q,closeLongContLimit:U,closeShortContLimit:E,maxOpenBuy:Q,maxOpenSell:D,maxCloseLong:R,maxCloseShort:z,directionalLongQuantityValue:j,directionalShortQuantityValue:C,maxLeverage:_});return{calcPrice:m,availableBalance:p,availableBalanceText:g,multiplier:h,quantityCont:N,longQuantityCont:T,shortQuantityCont:k,directionalLongQuantityValue:j,directionalShortQuantityValue:C,oneContCost:w,costs:L,maxOpenBuyCont:I,maxOpenSellCont:q,closeLongContLimit:U,closeShortContLimit:E,maxOpenBuy:Q,maxOpenSell:D,maxCloseLong:R,maxCloseShort:z,maxLeverage:_,...B}}({form:r,baseAsset:n,contractConfig:a,siteConfig:i,orderbook:l,lastPrice:s,availableBalanceSource:null==u?void 0:u.availableBalance,currentLeverageInfo:o,usedRiskQuantity:c,currentSymbolPositions:d}),p=function(e){let{baseAsset:t,isPercentage:r,tradeUnit:n,usdtCost:a}=e,{$t:i}=(0,x.B)(),l=(0,y.useMemo)(()=>[{label:i("Quantity"),value:"quantity"},{label:i("Available Ratio"),value:"percentage"}],[i]);return{quantityMode:r?"percentage":"quantity",quantityModeOptions:l,tradeUnitOptions:(0,y.useMemo)(()=>[{label:"".concat(i("Coin"),"(").concat(t,")"),triggerLabel:t||i("Coin"),value:"coin"},{label:i("Cont"),value:"cont"},{label:"".concat(G.QT,"(").concat(i("Order by Value"),")"),triggerLabel:G.QT,value:"usdtValue",description:i("You can modify the required margin by adjusting the applied leverage.")},{label:"".concat(G.QT,"(").concat(i("Order by Cost"),")"),triggerLabel:G.QT,value:"usdtCost",description:i("Itâs inclusive of the initial margin, fees to open, and fees to close. Modifying the leverage will not change your order
1cost.")}],[i,t]),tradeUnitValue:"0"===n?"coin":"1"===n?"cont":"1"===a?"usdtCost":"usdtValue"}}({baseAsset:n,isPercentage:r.isPercentage,tradeUnit:r.tradeUnit,usdtCost:r.usdtCost}),g=Number(r.longQuantity||0)>0||Number(r.shortQuantity||0)>0;return{...m,...p,hasDirectionalQuantity:g}}({facts:r}),a=function(e){var t,r,n;let{symbol:a,facts:l,derivations:s}=e,{locale:o,isLoggedIn:c,gotoLogin:d,form:u,formActions:{update:m,setOrderType:p,setTradeUnit:g},market:{serviceSymbol:h,contractConfig:b,longPosition:L,shortPosition:M,lastPrice:J,markPrice:$,quoteAsset:Y,baseAsset:X},userConfig:{confirmStr:ee},layers:{settingsLayer:et,tpslAdvancedLayer:er,differenceLayer:en,triggerOrdersNoticeLayer:ea},ui:{plansNeverRemind:ei,setOrderTypeMenuOpen:el},dialogs:{loadSettings:es,saveSettings:eo,submitOpenOrder:ec,submitCloseOrder:ed,estimateLiqPrice:eu,setDifferenceDirection:em}}=l,{availableBalance:ep,multiplier:ex,calcPrice:eg,oneContCost:eh,maxOpenBuyCont:eb,maxOpenSellCont:ey,closeLongContLimit:ef,closeShortContLimit:ev,quantityCont:eN,costs:ej,rawMaxQuantityDisplay:eC,rawLongMaxDisplay:ew,rawShortMaxDisplay:eT,quantityPrecision:ek,coinPrecision:eP,unitLabel:eS,getQuantityPrecision:eL,getMaxPositionLabel:eM,getMaxQuantityDisplayByUnit:eO,getDirectionalMaxDisplayByUnit:e_}=s,{getReferencePrice:eA,handleTradeUnitChanged:eI,handleTradeUnitPersisted:eq}=function(e){let{locale:t,symbol:r,lastPrice:n,markPrice:a}=e,i=(0,y.useCallback)(e=>{let t="mark"===e?a:n;return t?String(t):""},[n,a]);return{getReferencePrice:i,handleTradeUnitChanged:(0,y.useCallback)(()=>{C.B.getState().resetCloseEditors(),N.ZC.getState().reloadCharts()},[]),handleTradeUnitPersisted:(0,y.useCallback)(()=>{(0,j.i3)({locale:t,symbol:r}).catch(e=>{console.error("[StandardOrderPanelInteractionDeps] å·æ°ååä½åæ°æ®å¤±è´¥:",e)})},[t,r])}}({locale:o,symbol:h,lastPrice:J,markPrice:$}),eU=function(e){let{locale:t,isLoggedIn:r,gotoLogin:n,form:a,setTradeUnit:i,update:l,lastPrice:s,getReferencePrice:o,getMaxQuantityDisplayByUnit:c,getDirectionalMaxDisplayByUnit:d,getQuantityPrecision:u,pricePrecision:m,onTradeUnitChanged:p,onTradeUnitPersisted:x}=e,g=(0,k.useQueryClient)(),h=async(e,n)=>{r&&(await (0,w.J_)({locale:t,params:{settingKey:"usdtContract_tradeUnit",settingValue:e}}),"2"===e&&n&&await (0,w.J_)({locale:t,params:{settingKey:"usdtContract_usdtCost",settingValue:n}}),g.setQueryData(["spot-account-center-api","userConfig-querys",t],t=>({...t,data:{...(null==t?void 0:t.data)||{},usdtContract_tradeUnit:e,..."2"===e&&n?{usdtContract_usdtCost:n}:{}}})),x())};return{handleNumberFieldChange:e=>t=>{let r="quantity"===e?(0,P.p0)({value:t,precision:u(a.tradeUnit),tradeUnit:a.tradeUnit}):(0,P.TR)(t,m);null!==r&&l({[e]:r})},handlePercentageInputChange:e=>{let t=(0,P.JF)(e,2);if(null===t)return;let r=Math.min(Math.max(Number(t||0),0),100),n=u(a.tradeUnit),i=c(a.tradeUnit),s=d("long",a.tradeUnit,a.usdtCost),o=d("short",a.tradeUnit,a.usdtCost),m=(a.activeTab,(0,S.Jv)(s,r,n)),p=(a.activeTab,(0,S.Jv)(o,r,n));l({longQuantity:m,percentage:r,quantity:(0,S.Jv)(i||0,r,n),shortQuantity:p})},handleSliderChange:e=>{let t=u(a.tradeUnit),r=c(a.tradeUnit),n=d("long",a.tradeUnit,a.usdtCost),i=d("short",a.tradeUnit,a.usdtCost),s=(a.activeTab,(0,S.Jv)(n,e,t)),o=(a.activeTab,(0,S.Jv)(i,e,t));l({longQuantity:s,percentage:e,quantity:(0,S.Jv)(r||0,e,t),shortQuantity:o})},handleTradeUnitChange:e=>{let t="coin"===e?"0":"cont"===e?"1":"2",r="usdtCost"===e?"1":"usdtValue"===e?"0":a.usdtCost;i(t,"2"===t?r:a.usdtCost),(0,T.ao)({tradeUnit:t,..."2"===t?{usdtCost:r}:{}}),p(),h(t,"2"===t?r:void 0),l({quantity:"",longQuantity:"",shortQuantity:"",percentage:0})},toggleReferencePriceField:e=>{let t="latest"===a.triggerWay?"mark":"latest";if("triggerPrice"===e)return void l({triggerWay:t});l({triggerWay:t,[e]:o(t)})},fillLastPrice:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"orderPrice";s&&l({[e]:String(s)})},handleQuantityModeChange:e=>{l({isPercentage:"percentage"===e,quantity:"",longQuantity:"",percentage:0,shortQuantity:""})},clearQuantityValues:()=>{l({quantity:"",longQuantity:"",percentage:0,shortQuantity:""})},toggleTriggerWay:e=>{l({[e]:"latest"===a[e]?"mark":"latest"})},clearTpslAdvanced:()=>{l({checkedTpsl:!1,takeProfitPrice:"",stopLossPrice:"",tpOrderPrice:"",slOrderPrice:"",takeProfitRate:"",stopLossRate:"",takeProfitRateAbout:"",stopLossRateAbout:"",tpTriggerWay:"mark",slTriggerWay:"mark",tpPriceType:"market",slPriceType:"market",tpslActiveTab:"openLong",tpslAdvancedEdited:!1})}}}({locale:o,isLoggedIn:c,gotoLogin:d,form:u,setTradeUnit:g,update:m,lastPrice:J,getReferencePrice:eA,getMaxQuantityDisplayByUnit:eO,getDirectionalMaxDisplayByUnit:e_,getQuantityPrecision:eL,pricePrecision:Number((null==b?void 0:b.precision)||2),onTradeUnitChanged:eI,onTradeUnitPersisted:eq});!function(e){let{activeTab:t,orderType:r,orderPrice:n,isPercentage:a,percentage:i,quantity:l,longQuantity:s,shortQuantity:o,availableBalance:c,quantityPrecision:d,rawMaxQuantityDisplay:u,rawLongMaxDisplay:m,rawShortMaxDisplay:p,update:x}=e,g=(0,y.useRef)({percentage:i,quantity:l,longQuantity:s,shortQuantity:o,quantityPrecision:d,rawMaxQuantityDisplay:u,rawLongMaxDisplay:m,rawShortMaxDisplay:p});g.current={percentage:i,quantity:l,longQuantity:s,shortQuantity:o,quantityPrecision:d,rawMaxQuantityDisplay:u,rawLongMaxDisplay:m,rawShortMaxDisplay:p},(0,y.useEffect)(()=>
1{if(!a)return;let e=g.current,t=Number(e.percentage||0),r=(0,S.Jv)(e.rawMaxQuantityDisplay||0,t,e.quantityPrecision),n=(0,S.Jv)(e.rawLongMaxDisplay,t,e.quantityPrecision),i=(0,S.Jv)(e.rawShortMaxDisplay,t,e.quantityPrecision);(r!==e.quantity||n!==e.longQuantity||i!==e.shortQuantity)&&x({quantity:r,longQuantity:n,shortQuantity:i})},[t,a,n,r,x]),(0,y.useEffect)(()=>{if(!a)return;let e=O(s,m)||O(o,p)||O(l,u);e!==Number(i||0)&&x({percentage:e})},[t,c,a,s,i,l,m,u,p,o,x])}({activeTab:u.activeTab,orderType:u.orderType,orderPrice:u.orderPrice,isPercentage:u.isPercentage,percentage:u.percentage,quantity:u.quantity,longQuantity:u.longQuantity,shortQuantity:u.shortQuantity,availableBalance:ep,quantityPrecision:ek,rawMaxQuantityDisplay:eC,rawLongMaxDisplay:ew,rawShortMaxDisplay:eT,update:m}),function(e){let{symbolKey:t,orderType:r,orderPrice:n,lastPrice:a,update:i}=e,l=(0,y.useRef)(!1),s=(0,y.useRef)(r),o=(0,y.useRef)(t);(0,y.useEffect)(()=>{o.current!==t&&(l.current=!1,s.current=r,o.current=t);let e=s.current,c="limit"===r||"postOnly"===r||"planLimit"===r,d=e!==r&&c&&"limit"!==e&&"postOnly"!==e&&"planLimit"!==e;if(!l.current){if(c&&!(n||"").trim()){if(!a)return;i({orderPrice:String(a)}),l.current=!0,s.current=r;return}l.current=!0,s.current=r;return}a&&d&&!(n||"").trim()&&i({orderPrice:String(a)}),s.current=r},[n,r,a,t,i])}({symbolKey:h,orderType:u.orderType,orderPrice:u.orderPrice,lastPrice:J,update:m});let eE=function(e){let{locale:t,symbol:r,serviceSymbol:n,isLoggedIn:a,gotoLogin:l,form:s,confirmStr:o,availableBalance:c,multiplier:d,calcPrice:u,oneContCost:m,maxOpenBuyCont:p,maxOpenSellCont:g,closeLongContLimit:h,closeShortContLimit:b,quantityCont:f,lastPrice:v,markPrice:N,quoteAsset:P,baseAsset:L,unitLabel:M,coinPrecision:O,quantityPrecision:J,contractMultiplier:$,longPosition:Y,shortPosition:X,costs:ee,clearQuantityValues:et,clearTpslAdvanced:er,submitOpenOrder:en,submitCloseOrder:ea,estimateLiqPrice:ei,loadSettings:el,saveSettings:es,update:eo,settingsLayer:ec,tpslAdvancedLayer:ed,differenceLayer:eu,setDifferenceDirection:em}=e,{confirmItems:ep,loading:ex,pendingSubmit:eg,handleOpenSubmit:eh,handleCloseSubmit:eb,openTpslAdvanced:ey,openConfirmDialog:ef,executeSubmit:ev,persistNeverRemind:eN}=function(e){let{locale:t,symbol:r,isLoggedIn:n,gotoLogin:a,confirmStr:l,availableBalance:s,multiplier:o,calcPrice:c,oneContCost:d,closeLongContLimit:u,closeShortContLimit:m,quantityCont:p,lastPrice:g,markPrice:h,quoteAsset:b,baseAsset:f,unitLabel:v,coinPrecision:N,quantityPrecision:k,contractMultiplier:P,longPosition:L,shortPosition:M,costs:O,clearQuantityValues:K,clearTpslAdvanced:W,submitOpenOrder:G,submitCloseOrder:J,estimateLiqPrice:$}=e,{$t:Y}=(0,x.B)(),X=(0,Q.me)(),ee=(0,Q.vs)(),et=(0,Q.Lt)(),er=(0,T.TY)(e=>e.patchConfigs),en=(0,F.w)(e=>e.getConfirmQuantityDisplayText),ea=(0,z.Mr)(e=>e.form),{pendingSubmit:ei,neverRemind:el,estLiqPrice:es,setDifferenceDirection:eo,setPendingSubmit:ec,setNeverRemind:ed,setEstLiqPrice:eu,resetSubmitFlow:em}=(0,R.X)((0,E.k)(e=>({pendingSubmit:e.pendingSubmit,neverRemind:e.neverRemind,estLiqPrice:e.estLiqPrice,setDifferenceDirection:e.setDifferenceDirection,setPendingSubmit:e.setPendingSubmit,setNeverRemind:e.setNeverRemind,setEstLiqPrice:e.setEstLiqPrice,resetSubmitFlow:e.resetSubmitFlow}))),ep=(0,B.M)(e=>e.resetUi),ex=(0,y.useRef)(0),{theme:eg}=(0,A.W)(),{startAttempt:eh,trackBlocked:eb,trackQuantityRequired:ey,trackInvalidPrice:ef,trackSubmit:ev,trackResult:eN}
1=(0,I.sj)({accountMode:"demo",theme:eg,symbol:r,lastPrice:g,form:ea}),ej=(0,U.useMutation)({mutationFn:e=>(0,w.J_)({locale:t,params:{settingKey:"usdt_user_confirm",settingValue:e}})}),{executeSubmit:eC,loading:ew}=function(e){let{locale:t,symbol:r,clearQuantityValues:n,clearTpslAdvanced:a,submitOpenOrder:i,submitCloseOrder:l,onSubmitSuccess:s,onSubmitResult:o}=e,{$t:c}=(0,x.B)(),d={locale:t,symbol:r},u=(0,U.useMutation)({mutationFn:e=>{let n=Date.now();return i(t,r,e).then(e=>({...e,durationMs:Date.now()-n}))},onSuccess:(e,t)=>{null==o||o({side:"open",...t},e),e.success?((0,_.toast)({type:"success",title:c("Order place success")}),(0,j.B$)(d).catch(e=>{console.error("[StandardOrderPanelSubmitMutations] å·æ°å¼ä»æååæ°æ®å¤±è´¥:",e)}),n(),a(),s()):10307===e.errorCode&&s()}}),m=(0,U.useMutation)({mutationFn:e=>{let n=Date.now();return l(t,r,e).then(e=>({...e,durationMs:Date.now()-n}))},onSuccess:(e,t)=>{null==o||o({side:"close",...t},e),e.success&&((0,_.toast)({type:"success",title:c("Order place success")}),C.B.getState().resetCloseEditors(),(0,j.o8)(d).catch(e=>{console.error("[StandardOrderPanelSubmitMutations] å·æ°å¹³ä»æååæ°æ®å¤±è´¥:",e)}),n(),s())}});return{executeSubmit:e=>{if("open"===e.side)return void u.mutate({direction:e.direction,quantity:e.quantity,orderPrice:e.orderPrice,triggerPrice:e.triggerPrice,takeProfitPrice:e.takeProfitPrice,stopLosePrice:e.stopLosePrice});m.mutate({direction:e.direction,quantity:e.quantity,orderPrice:e.orderPrice})},loading:u.isPending||m.isPending}}({locale:t,symbol:r,clearQuantityValues:K,clearTpslAdvanced:W,submitOpenOrder:G,submitCloseOrder:J,onSubmitSuccess:()=>{ep(),em(),X.hideLayer(),ee.hideLayer()},onSubmitResult:eN}),eT=e=>{ev(e),eC(e)},ek=async e=>{let n=(0,q.p5)(ea.orderType);if(!(0,q.R4)(l,n))return void eT(e);if(ed(!1),ec(e),eu(""),X.showLayer(),"open"===e.side){let n=ex.current+=1;$(t,r,{direction:e.direction,quantity:e.quantity,orderPrice:e.orderPrice,triggerPrice:e.triggerPrice,positionMode:e.positionMode}).then(e=>{ex.current===n&&eu(e||"")}).catch(()=>{ex.current===n&&eu("")})}},eP=async e=>{if("limit"===ea.orderType&&Number(ea.orderPrice||0)>0){let t=(0,q.B2)(e.direction,ea.orderPrice,g);if(t.greater){ec(e),eo(t.direction),ee.showLayer();return}}await ek(e)},eS=e=>!!(0,D.Hk)({orderType:ea.orderType,orderPrice:ea.orderPrice,triggerPrice:ea.triggerPrice})||(ef(e),(0,_.toast)({type:"error",title:Y("Please enter order price.")}),!1);return{confirmItems:function(e){let{pendingSubmit:t,form:r,calcPrice:n,multiplier:a,quantityPrecision:l,unitLabel:s,oneContCost:o,coinPrecision:c,baseAsset:d,costs:u,quoteAsset:m,markPrice:p,estLiqPrice:g,symbol:h,longPosition:b,shortPosition:f,lastPrice:v,contractMultiplier:N,getConfirmQuantityDisplayText:j}=e,{$t:C}=(0,x.B)();return(0,y.useMemo)(()=>{if(!t)return[];let e=j({quantityCont:t.quantity,side:"openShort"===t.direction||"closeLong"===t.direction?"sell":"buy",tradeUnit:r.tradeUnit,multiplier:Number(a||0),price:n,quantityPrecision:l,unitLabel:s,usdtCost:r.usdtCost,oneContCostBuy:Number(o.buy),oneContCostSell:Number(o.sell),coinPrecision:c,baseAsset:d}),x=(0,V.wb)(t.orderPrice)?(0,H.iT)(String(t.orderPrice)):"--";if("open"===t.side){let n="openLong"===t.direction?u.buy:u.sell,a="openLong"===t.direction?"â¥":"â¤",i="openShort"===t.direction?"â¥":"â¤",l=r.takeProfitPrice?(0,H.iT)(String(r.takeProfitPrice)):"--",s=r.stopLossPrice?(0,H.iT)(String(r.stopLossPrice)):"--";return[..."planLimit"===r.orderType||"planMarket"===r.orderType?[{label:C("Trigger Price"),value:(0,V.wb)(t.triggerPrice)?(0,H.iT)(String(t.triggerPrice)):"--"}]:[],{label:C("Price_3"),value:"market"===r.orderType||"planMarket"===r.orderType?C("Market_2"):"".concat(x," ").concat(m)},{label:C("Quantity_1"),value:e},{label:C("Cost"),value:"".concat((0,S.cf)(n)," ").concat(m)},{label:C("Take Profit"),value:r.takeProfitPrice?"".concat("latest"===r.tpTriggerWay?C("Last"):C("Mark")," ").concat(a," ").concat(l):"--"},{label:C("Stop Loss"),value:r.stopLossPrice?"".concat("latest"===r.slTriggerWay?C("Last"):C("Mark")," ").concat(i," ").concat(s):"--"},{label:C("Mark Price"),value:(0,V.wb)(p)?(0,H.iT)(String(p)):"--"},{label:C("Est. Liq Price"),value:(0,V.wb)(g)?(0,H.iT)(String(g)):"--"}]}let y="closeLong"===t.direction?b:f,w=Number((null==y?void 0:y.avgPrice)||0),T=Number((null==y?void 0:y.positionMargin)||0),k=Number(t.orderPrice||v||0),P=(0,i.A2)(h,""),L=0;w&&t.quantity&&k&&N&&(L="BTCUSDT"===P?"closeLong"===t.direction?(1/w-1/k)*t.quantity*Number(N||0):(1/k-1/w)*t.quantity*Number(N||0):("closeLong"===t.direction?k-w:w-k)*t.quantity*Number(N||0));let M=Number((0,Z.eh)(L,2)),O=T>0?Number((0,V.u3)(M,T)):0,_=M>0?"text-p2":M<0?"text-p3":"text-t1",A=M>0?"+":"",I=O>0?"+":"";return[{label:C("Price"),value:"market"===r.orderType?C("Market_2"):"".concat(x," ").concat(m)},{label:C("Quantity"),value:e},{label:"".concat(C("Expected P/L")," (").concat(C("by order price"),")"),value:"".concat(A).
1concat((0,H.iT)(M)," ").concat(m),subValue:"(".concat(I).concat((0,H.BY)(O)||"0.00%",")"),valueClassName:_,subValueClassName:_,dividerBefore:!0}]},[n,N,u.buy,u.sell,g,r.orderType,r.slTriggerWay,r.stopLossPrice,r.takeProfitPrice,r.tpTriggerWay,r.tradeUnit,r.usdtCost,v,b,p,a,t,l,m,d,f,h,c,s,j,o.buy,o.sell])}({pendingSubmit:ei,form:ea,calcPrice:c,multiplier:o,quantityPrecision:k,unitLabel:v,oneContCost:d,coinPrecision:N,baseAsset:f,costs:O,quoteAsset:b,markPrice:h,estLiqPrice:es,symbol:r,longPosition:L,shortPosition:M,lastPrice:g,contractMultiplier:P,getConfirmQuantityDisplayText:en}),loading:ew,pendingSubmit:ei,handleOpenSubmit:e=>{if(!n)return void a();let t=eh(e);if(!eS(t))return;let r=(0,D.Qx)({direction:e,longQuantity:ea.longQuantity,shortQuantity:ea.shortQuantity,quantity:ea.quantity,tradeUnit:ea.tradeUnit,multiplier:o,calcPrice:c,usdtCost:ea.usdtCost,oneContCostBuy:Number(d.buy||0),oneContCostSell:Number(d.sell||0)}),i=(0,D.vC)({orderType:ea.orderType,availableBalance:s,quantityCont:r});if(!i.valid)return void("INSUFFICIENT_AVAILABLE_BALANCE"===i.errorCode?(eb(t,"insufficient_available_balance"),(0,_.toast)({type:"error",title:Y("Insufficient available balance")})):"ORDER_QUANTITY_REQUIRED"===i.errorCode&&(ey(t,e),(0,_.toast)({type:"error",title:Y("Please enter order quantity.")})));eP({side:"open",direction:e,quantity:r,orderPrice:ea.orderPrice,triggerPrice:ea.triggerPrice,positionMode:ea.positionMode,takeProfitPrice:ea.takeProfitPrice?Number(ea.takeProfitPrice):"",stopLosePrice:ea.stopLossPrice?Number(ea.stopLossPrice):"",trackingAttempt:t})},handleCloseSubmit:e=>{if(!n)return void a();let t=eh(e);if((0,D.jO)(ea.positionMode)){eb(t,"separated_position_close_required"),(0,_.toast)({type:"error",title:Y("Please close in the position in the split position mode")});return}if(("limit"===ea.orderType||"postOnly"===ea.orderType)&&0>=Number(ea.orderPrice||0)){eb(t,"invalid_order_price"),(0,_.toast)({type:"error",title:Y("Please enter order price.")});return}let r=(0,D.Kv)({direction:e,longQuantity:ea.longQuantity,shortQuantity:ea.shortQuantity,quantity:ea.quantity,tradeUnit:ea.tradeUnit,multiplier:o,calcPrice:c,usdtCost:ea.usdtCost}),i="closeLong"===e?u:m,l=(0,D.bh)({quantityCont:r,maxCont:i});if(!l.valid)return void("ORDER_QUANTITY_REQUIRED"===l.errorCode?(ey(t,e),(0,_.toast)({type:"error",title:Y("Please enter order quantity.")})):"EXCEEDS_AVAILABLE_SIZE"===l.errorCode&&(eb(t,"exceed_closeable_amount"),(0,_.toast)({type:"error",title:Y("Exceed available size")})));eP({side:"close",direction:e,quantity:l.submitQuantityCont,orderPrice:ea.orderPrice,trackingAttempt:t})},openTpslAdvanced:()=>{if(!n)return void a();if(eS()){if(!Number(ea.quantity||0)&&!Number(ea.longQuantity||0)&&!Number(ea.shortQuantity||0))return void(0,_.toast)({type:"error",title:Y("Please enter order quantity.")});et.showLayer()}},openConfirmDialog:ek,executeSubmit:eT,persistNeverRemind:e=>{if(!el)return;let t=(0,q.RY)(l,e,!1);er({usdt_user_confirm:t}),ej.mutate(t)}}}({locale:t,symbol:r,isLoggedIn:a,gotoLogin:l,confirmStr:o,availableBalance:c,multiplier:d,calcPrice:u,oneContCost:m,maxOpenBuyCont:p,maxOpenSellCont:g,closeLongContLimit:h,closeShortContLimit:b,quantityCont:f,lastPrice:v,markPrice:N,quoteAsset:P,baseAsset:L,unitLabel:M,coinPrecision:O,quantityPrecision:J,contractMultiplier:$,longPosition:Y,shortPosition:X,costs:ee,clearQuantityValues:et,clearTpslAdvanced:er,submitOpenOrder:en,submitCloseOrder:ea,estimateLiqPrice:ei});return{confirmItems:ep,loading:ex,handleOpenSubmit:eh,handleCloseSubmit:eb,openTpslAdvanced:ey,...function(e){let{locale:t,symbol:r,serviceSymbol:n,isLoggedIn:a,gotoLogin:i,form:l,loadSettings:s,saveSettings:o,update:c,settingsLayer:d,tpslAdvancedLayer:u,differenceLayer:m,setDifferenceDirection:p,openConfirmDialog:g,persistNeverRemind:h,executeSubmit:b}=e,{$t:y}=(0,x.B)(),f=(0,k.useQueryClient)();return{handleOpenSettings:async()=>{if(!a)return void i();d.showLayer(),s(t,r)},handleChangeActiveTab:e=>{c({activeTab:e,quantity:"",longQuantity:"",shortQuantity:"",percentage:0,..."close"===e?{checkedTpsl:!1,isPercentage:!1,orderType:"planLimit"===l.orderType||"planMarket"===l.orderType?"market":l.orderType,triggerPrice:"",takeProfitPrice:"",stopLossPrice:"",tpOrderPrice:"",slOrderPrice:"",takeProfitRate:"",stopLossRate:"",takeProfitRateAbout:"",stopLossRateAbout:"",tpTriggerWay:"mark",slTriggerWay:"mark",tpPriceType:"market",slPriceType:"market",tpslActiveTab:"openLong",tpslAdvancedEdited:!1}:{}}),"close"===e&&u.hideLayer()},handleSettingsConfirm:async e=>{let a=await o(t,r,e);if(!a.success){10337===a.errorCode&&d.hideLayer();return}let i=(0,G.bh)(n);f.setQueryData((0,W.sJ)(t,i),t=>({...t,data:(0,K.dH)({longLeverage:e.longLeverage,shortLeverage:e.shortLeverage,marginMode:e.marginMode,positionMode:l.positionMode,current:null==t?void 0:t.data})})),(0,_.toast)({type:"success",title:y("Success")}),d.hideLayer()},handleTpslConfirm:e=>{c(e),u.hideLayer()},handleDifferenceConfirm:async()=>{m.hideLayer(),p(void 0);let e=R.X.getState().pendingSubmit;e&&await g(e)},handleConfirmSubmit:()=>{let e=R.X.getState().pendingSubmit;e&&(h((0,q.p5)(l.orderType)),b(e))}}}
1({locale:t,symbol:r,serviceSymbol:n,isLoggedIn:a,gotoLogin:l,form:s,loadSettings:el,saveSettings:es,update:eo,settingsLayer:ec,tpslAdvancedLayer:ed,differenceLayer:eu,setDifferenceDirection:em,openConfirmDialog:ef,persistNeverRemind:eN,executeSubmit:ev})}}({locale:o,symbol:a,serviceSymbol:h,isLoggedIn:c,gotoLogin:d,form:u,confirmStr:ee,availableBalance:ep,multiplier:ex,calcPrice:eg,oneContCost:eh,maxOpenBuyCont:eb,maxOpenSellCont:ey,closeLongContLimit:ef,closeShortContLimit:ev,quantityCont:eN,lastPrice:J,markPrice:$,quoteAsset:Y,baseAsset:X,unitLabel:eS,coinPrecision:eP,quantityPrecision:ek,contractMultiplier:Number((null==b?void 0:b.multiplier)||0),longPosition:L,shortPosition:M,costs:ej,clearQuantityValues:eU.clearQuantityValues,clearTpslAdvanced:eU.clearTpslAdvanced,submitOpenOrder:ec,submitCloseOrder:ed,estimateLiqPrice:eu,loadSettings:es,saveSettings:eo,update:m,settingsLayer:et,tpslAdvancedLayer:er,differenceLayer:en,setDifferenceDirection:em}),eQ=function(e){let{orderType:t,plansNeverRemind:r,lastPrice:n,setOrderType:a,setOrderTypeMenuOpen:i,showTriggerOrdersNotice:l,update:s}=e;return{handleSetOrderType:(0,y.useCallback)(function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;a(e),i(!1),"planLimit"===e&&n&&s({orderPrice:String(n)}),"planLimit"!==e||r||"planMarket"===o||l()},[n,t,r,a,i,l,s]),handleEnableTpsl:(0,y.useCallback)(()=>{s({checkedTpsl:!0})},[s])}}({orderType:u.orderType,plansNeverRemind:ei,lastPrice:J,setOrderType:p,setOrderTypeMenuOpen:el,showTriggerOrdersNotice:ea.showLayer,update:m}),eD=(0,v.oM)();return{interactions:eU,submit:eE,resetDemoFund:(0,f.R)({locale:o,symbol:a,isLoggedIn:c,gotoLogin:d,activityInfo:null==(t=eD.data)?void 0:t.data,isActivityEnd:null==(n=eD.data)||null==(r=n.data)?void 0:r.isActivityEnd}),orderTypeActions:eQ,getMaxPositionLabel:eM}}({symbol:t,facts:r,derivations:n}),{form:l,market:{quoteAsset:s,serviceSymbol:o,contractConfig:c,lastPrice:d,markPrice:u,baseAsset:m},dialogs:{settingsLoading:p,settingsSaving:g,settingsError:h,settingsMarginDisabled:b}}=r,{interactions:eu,resetDemoFund:em,submit:ep,orderTypeActions:{handleSetOrderType:ex,handleEnableTpsl:eg},getMaxPositionLabel:eh}=a,{availableBalanceText:eb,quantityMode:ey,quantityModeOptions:ef,tradeUnitValue:ev,tradeUnitOptions:eN,quantityValueHint:ej,sliderPercent:eC,hasDirectionalQuantity:ew,unitLabel:eT,maxOpenBuy:ek,maxOpenSell:eP,maxCloseLong:eS,maxCloseShort:eL,roundedMaxCloseLong:eM,roundedMaxCloseShort:eO,costs:e_,formatMaxDisplay:eA,formatCostDisplay:eI,maxLeverage:eq,quantityCont:eU,longQuantityCont:eE,shortQuantityCont:eQ,oneContCost:eD,calcPrice:eR,coinPrecision:ez}=n,{orderEntry:eB,quantity:eF,footer:eH,dialogs:eV}=function(e){let{availableBalanceText:t,quoteAsset:r,quantityMode:n,quantityModeOptions:a,tradeUnitValue:i,tradeUnitOptions:l,quantityValueHint:s,sliderPercent:o,hasDirectionalQuantity:c,loading:d,unitLabel:u,activeTab:m,maxOpenBuy:p,maxOpenSell:x,maxCloseLong:g,maxCloseShort:h,roundedMaxCloseLong:b,roundedMaxCloseShort:f,costs:v,formatMaxDisplay:N,formatCostDisplay:j,settingsMarginDisabled:C,settingsLoading:w,settingsSaving:T,settingsError:k,maxLeverage:P,serviceSymbol:S,symbol:L,quantityCont:M,longQuantityCont:O,shortQuantityCont:_,contractMultiplier:A,contractPrecision:I,coinPrecision:q,oneContCost:U,lastPrice:E,markPrice:Q,calcPrice:D,confirmItems:R,baseAsset:z}=e,B=(0,y.useMemo)(()=>({availableBalanceText:t,quoteAsset:r}),[t,r]),F=(0,y.useMemo)(()=>({quantityMode:n,quantityModeOptions:a,tradeUnitValue:i,tradeUnitOptions:l,quantityValueHint:s,sliderPercent:o,hasDirectionalQuantity:c}),[c,n,a,s,o,l,i]),H=(0,y.useMemo)(()=>({loading:d,quoteAsset:r,unitLabel:u,maxLeft:N("open"===m?p:f),maxRight:N("open"===m?x:b),costLeft:j(v.buy),costRight:j(v.sell)}),[m,v.buy,v.sell,j,N,d,g,h,b,f,p,x,r,u]),V=(0,y.useMemo)(()=>({marginDisabled:C,settingsLoading:w,settingsSaving:T,settingsError:k,maxLeverage:P,serviceSymbol:S,symbol:L,quantityCont:M,longQuantityCont:O,shortQuantityCont:_,multiplier:A,precision:I,coinPrecision:q,oneContCostBuy:Number(U.buy),oneContCostSell:Number(U.sell),lastPrice:E,markPrice:Q,calcPrice:D,confirmItems:R,confirmLoading:d,baseAsset:z}
1),[z,D,q,R,A,I,E,d,Q,P,U.buy,U.sell,O,M,S,k,w,C,T,_,L]);return{orderEntry:B,quantity:F,footer:H,dialogs:V}}({availableBalanceText:eb,quoteAsset:s,quantityMode:ey,quantityModeOptions:ef,tradeUnitValue:ev,tradeUnitOptions:eN,quantityValueHint:ej,sliderPercent:eC,hasDirectionalQuantity:ew,loading:ep.loading,unitLabel:eT,activeTab:l.activeTab,maxOpenBuy:ek,maxOpenSell:eP,maxCloseLong:eS,maxCloseShort:eL,roundedMaxCloseLong:eM,roundedMaxCloseShort:eO,costs:e_,formatMaxDisplay:eA,formatCostDisplay:eI,settingsMarginDisabled:b,settingsLoading:p,settingsSaving:g,settingsError:h,maxLeverage:eq,serviceSymbol:o,symbol:t,quantityCont:eU,longQuantityCont:eE,shortQuantityCont:eQ,contractMultiplier:Number((null==c?void 0:c.multiplier)||0),contractPrecision:Number((null==c?void 0:c.precision)||2),coinPrecision:ez,oneContCost:eD,lastPrice:d,markPrice:u,calcPrice:eR,confirmItems:ep.confirmItems,baseAsset:m});!function(e){let t=(0,$.$)(e=>e.resetComputed),r=(0,$.$)(e=>e.syncComputed),n=(0,J.T)(e=>e.resetActions),a=(0,J.T)(e=>e.syncActions);(0,y.useEffect)(()=>{t(),n()},[e.symbolKey,n,t]),(0,y.useEffect)(()=>{r({orderEntry:e.orderEntry,quantity:e.quantity,footer:e.footer,dialogs:e.dialogs})},[e.dialogs,e.footer,e.orderEntry,e.quantity,r]),(0,y.useEffect)(()=>{a(e.actions)},[e.actions,a])}({symbolKey:t,orderEntry:eB,quantity:eF,footer:eH,dialogs:eV,actions:function(e){let{activeTab:t,onSetOrderType:r,onNumberFieldChange:n,onToggleReferencePriceField:a,onFillLastPrice:i,onQuantityModeChange:l,onTradeUnitChange:s,onPercentageChange:o,onSliderChange:c,onClearQuantity:d,onOpenSubmit:u,onCloseSubmit:m,onResetDemoFund:p,onOpenSettings:x,onChangeActiveTab:g,onDisableTpsl:h,onEnableTpsl:b,onOpenTpslAdvanced:f,onToggleTpslTriggerWay:v,onTpslNumberFieldChange:N,getMaxPositionLabel:j,onSettingsConfirm:C,onTpslConfirm:w,onDifferenceConfirm:T,onConfirmSubmit:k}=e;return(0,y.useMemo)(()=>({onSetOrderType:r,onNumberFieldChange:n,onToggleReferencePriceField:a,onFillLastPrice:i,onQuantityModeChange:l,onQuantityChange:n("quantity"),onTradeUnitChange:s,onPercentageChange:o,onSliderChange:c,onClearQuantity:d,onPrimaryAction:()=>"open"===t?u("openLong"):m("closeShort"),onSecondaryAction:()=>"open"===t?u("openShort"):m("closeLong"),onResetDemoFund:p,onOpenSettings:x,onChangeActiveTab:g,onDisableTpsl:h,onEnableTpsl:b,onOpenTpslAdvanced:f,onToggleTpslTriggerWay:v,onTpslNumberFieldChange:N,getMaxPositionLabel:j,onSettingsConfirm:C,onTpslConfirm:w,onDifferenceConfirm:T,onConfirmSubmit:k}),[t,j,g,d,m,k,T,h,b,i,n,x,u,p,f,o,l,r,C,c,a,v,N,w,s])}({activeTab:l.activeTab,onSetOrderType:ex,onNumberFieldChange:eu.handleNumberFieldChange,onToggleReferencePriceField:eu.toggleReferencePriceField,onFillLastPrice:eu.fillLastPrice,onQuantityModeChange:eu.handleQuantityModeChange,onTradeUnitChange:eu.handleTradeUnitChange,onPercentageChange:eu.handlePercentageInputChange,onSliderChange:eu.handleSliderChange,onClearQuantity:eu.clearQuantityValues,onResetDemoFund:em.handleResetDemoFund,onOpenSubmit:ep.handleOpenSubmit,onCloseSubmit:ep.handleCloseSubmit,onOpenSettings:ep.handleOpenSettings,onChangeActiveTab:ep.handleChangeActiveTab,onDisableTpsl:eu.clearTpslAdvanced,onEnableTpsl:eg,onOpenTpslAdvanced:ep.openTpslAdvanced,onToggleTpslTriggerWay:eu.toggleTriggerWay,onTpslNumberFieldChange:eu.handleNumberFieldChange,getMaxPositionLabel:eh,onSettingsConfirm:ep.handleSettingsConfirm,onTpslConfirm:ep.handleTpslConfirm,onDifferenceConfirm:ep.handleDifferenceConfirm,onConfirmSubmit:ep.handleConfirmSubmit})})}function em(){let e=(0,z.Mr)((0,E.k)(e=>({marginMode:e.form.marginMode,longLeverage:e.form.longLeverage,shortLeverage:e.form.shortLeverage}))),t=(0,J.T)((0,E.k)(e=>({onOpenSettings:e.actions.onOpenSettings})));return{...e,...t}}function ep(){return{activeTab:(0,z.Mr)(e=>e.form.activeTab),onChangeActiveTab:(0,J.T)(e=>e.actions.onChangeActiveTab)}}function ex(){let e=(0,$.$)((0,E.k)(e=>({availableBalanceText:e.orderEntry.availableBalanceText,quoteAsset:e.orderEntry.quoteAsset}))),t=(0,J.T)(e=>e.actions.onResetDemoFund);return{...e,onResetDemoFund:t}}function eg(){let e=(0,z.Mr)((0,E.k)(e=>({activeTab:e.form.activeTab,orderType:e.form.orderType}))),t=(0,J.T)(e=>e.actions.onSetOrderType),r=(0,B.M)((0,E.k)(e=>({orderTypeMenuOpen:e.orderTypeMenuOpen,setOrderTypeMenuOpen:e.setOrderTypeMenuOpen})));return{...e,...r,onSetOrderType:t}}function eh(){return{sliderPercent:(0,$.$)(e=>e.quantity.sliderPercent),onSliderChange:(0,J.T)(e=>e.actions.onSliderChange)}}function eb(){let e=(0,z.Mr)(e=>e.form.activeTab),t=(0,ea.k)(e=>{var t;return!!(null==(t=e.user)?void 0:t.userId)});
1return{activeTab:e,isLoggedIn:t,footer:(0,$.$)((0,E.k)(e=>({loading:e.footer.loading,quoteAsset:e.footer.quoteAsset,unitLabel:e.footer.unitLabel,maxLeft:e.footer.maxLeft,maxRight:e.footer.maxRight,costLeft:e.footer.costLeft,costRight:e.footer.costRight}))),actions:(0,J.T)((0,E.k)(e=>({onPrimaryAction:e.actions.onPrimaryAction,onSecondaryAction:e.actions.onSecondaryAction})))}}var ey=r(51662),ef=r(27737),ev=r(46540);function eN(e,t){let r="close"===e;return r||"planLimit"!==t&&"planMarket"!==t?r&&("planLimit"===t||"planMarket"===t)?"limit":"postOnly"===t?"dropdown":"market"===t?"market":"limit":"trigger"}function ej(){let{$t:e}=(0,x.B)(),{activeTab:t,orderType:r,orderTypeMenuOpen:a,setOrderTypeMenuOpen:i,onSetOrderType:l}=eg(),o="close"===t,c=eN(t,r),d=e("postOnly"===r?"Post Only":"Trigger Orders_1_r_1"),u=e("market"===r?"Market order refers to fast buying and selling at the best price currently available in the market":"planLimit"===r||"planMarket"===r?"When the price touches the trigger price, a limit order will be initiated to the market according to the set quantity, execution price and the trade direction. The order will not freeze the assets before it is triggered and is subject to factors such as the filled price, position or gear limit, etc., does not guarantee success":"postOnly"===r?"Post Only orders will be added to the order book and not execute with a pre-existing order.":"A limit order is to buy or sell at a specific price, and a limit order cannot guarantee execution"),m=e=>{i(!1),l(e,r)};return(0,n.jsxs)("div",{className:"border-l1 dark:border-l3 mb-4 flex min-w-0 items-start gap-2 border-b pb-[9px] rtl:flex-row-reverse",children:[(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-4 rtl:flex-row-reverse",children:[(0,n.jsxs)("button",{type:"button",className:"relative inline-flex h-4 cursor-pointer flex-col items-start gap-2 ".concat("limit"===c?"text-t1":"text-t3 hover:text-t1"),onClick:()=>m("limit"),children:[(0,n.jsx)("span",{className:"text-[12px] leading-4 font-medium",children:e("Limit_2")}),(0,n.jsx)("span",{className:"bg-t1 absolute right-0 bottom-[-10px] left-0 h-px transition-opacity ".concat("limit"===c?"opacity-100":"opacity-0")})]}),(0,n.jsxs)("button",{type:"button",className:"relative inline-flex h-4 cursor-pointer items-start ".concat("market"===c?"text-t1":"text-t3 hover:text-t1"),onClick:()=>m("market"),children:[(0,n.jsx)("span",{className:"text-[12px] leading-4 font-normal",children:e("Market_r_1")}),(0,n.jsx)("span",{className:"bg-t1 absolute right-0 bottom-[-10px] left-0 h-px transition-opacity ".concat("market"===c?"opacity-100":"opacity-0")})]}),o?(0,n.jsxs)("button",{type:"button",className:"relative inline-flex h-4 cursor-pointer items-start ".concat("dropdown"===c?"text-t1":"text-t3 hover:text-t1"),onClick:()=>m("postOnly"),children:[(0,n.jsx)("span",{className:"text-[12px] leading-4 font-normal",children:e("Post Only")}),(0,n.jsx)("span",{className:"bg-t1 absolute right-0 bottom-[-10px] left-0 h-px transition-opacity ".concat("dropdown"===c?"opacity-100":"opacity-0")})]}):(0,n.jsx)("div",{className:"min-w-0 flex-1",children:(0,n.jsxs)(ef.DropdownMenu,{trigger:"hover",modal:!1,onVisibleChange:i,children:[(0,n.jsx)(ef.DropdownMenuTrigger,{showIcon:!1,className:"!w-full !min-w-0 !outline-none",triggerClassName:"flex h-4 w-full min-w-0 cursor-pointer items-center ".concat("trigger"===c||"dropdown"===c?"text-t1":"text-t3 hover:text-t1"),children:(0,n.jsxs)("span",{className:"relative inline-flex max-w-full min-w-0 items-center gap-1",children:[(0,n.jsx)("span",{className:"min-w-0 truncate text-[12px] leading-4 font-normal",children:d}),(0,n.jsx)(s.C,{className:"size-[12px] shrink-0 transition-transform ".concat(a?"rotate-180":"")}),(0,n.jsx)("span",{className:"bg-t1 absolute right-0 bottom-[-10px] left-0 h-px transition-opacity ".concat("trigger"===c||"dropdown"===c?"opacity-100":"opacity-0")})]})}),(0,n.jsx)(ef.DropdownMenuContent,{align:"start",sideOffset:10,className:"!border-l1 !bg-m1 !shadow-2 !flex !min-w-[132px] !flex-col !gap-1 !rounded-[8px] !py-2",children:[{label:e("Trigger Orders_1_r_1"),value:"planLimit"},{label:e("Post Only_r_1"),value:"postOnly"}].map(e=>{let t="planLimit"===e.value&&("planLimit"===r||"planMarket"===r)||r===e.value;return(0,n.jsx)(ef.DropdownMenuItem,{className:"!rounded-r1 !mx-2 !px-2 !py-[10px] !text-[12px] !leading-4 !font-normal ".concat(t?"!bg-bg2 !text-t1 hover:!bg-bg2 !shadow-[inset_0_0_0_1px_var(--line-1)]":"!text-t1 hover:!bg-bg2"),onSelect:()=>l(e.value,r),children:e.label},e.value)})})]})})]}),(0,n.jsx)(ev.Tooltip,{content:(0,n.jsx)("div",{className:"text-t1 max-w-[300px] text-[12px] leading-4",children:u}),side:"left",align:"start",className:"!max-w-[320px]",children:(0,n.jsx)(ey.m,{className:"text-t3 hover:text-t2 inl
1ine-flex size-4 shrink-0 cursor-help items-center justify-center"})})]})}var eC=r(27442);function ew(){let{$t:e}=(0,x.B)(),{form:t,quoteAsset:r,actions:a}=function(){let e=(0,z.Mr)((0,E.k)(e=>({activeTab:e.form.activeTab,orderType:e.form.orderType,triggerPrice:e.form.triggerPrice,triggerWay:e.form.triggerWay,orderPrice:e.form.orderPrice})));return{form:e,quoteAsset:(0,$.$)(e=>e.orderEntry.quoteAsset),actions:(0,J.T)((0,E.k)(e=>({onNumberFieldChange:e.actions.onNumberFieldChange,onToggleReferencePriceField:e.actions.onToggleReferencePriceField,onFillLastPrice:e.actions.onFillLastPrice,onSetOrderType:e.actions.onSetOrderType})))}}(),i=eN(t.activeTab,t.orderType);return(0,n.jsxs)("div",{className:"flex flex-col gap-2 md:gap-3",children:["trigger"===i?(0,n.jsx)(g.q,{label:"".concat(e("Trigger Price")," (").concat(r,")"),value:t.triggerPrice,onChange:a.onNumberFieldChange("triggerPrice"),placeholder:"",wrapperClassName:"!bg-bg2 !border-transparent !px-[12px] focus-within:!border-p1 [&_[data-motion-state=raised]_label]:!text-t3",inputClassName:"!text-b14 placeholder:!text-t4",suffix:(0,n.jsxs)("button",{type:"button",className:"text-c12 md:text-b14 text-t1 inline-flex min-w-[52px] cursor-pointer items-center justify-end gap-[5px] leading-none rtl:flex-row-reverse rtl:justify-start",onClick:()=>a.onToggleReferencePriceField("triggerPrice"),children:[(0,n.jsx)("span",{children:e("latest"===t.triggerWay?"Last":"Mark")}),(0,n.jsx)(eC.y,{className:"size-[12px]"})]})}):null,"market"!==t.orderType?(0,n.jsx)(g.q,{label:"".concat(e("trigger"===i?"Price_2":"Price")," (").concat(r,")"),value:t.orderPrice,onChange:a.onNumberFieldChange("orderPrice"),placeholder:"planMarket"===t.orderType?e("Market Price"):"",disabled:"planMarket"===t.orderType,wrapperClassName:"planMarket"===t.orderType?"!bg-bg07 !border-l1 !cursor-not-allowed !px-[12px] opacity-100":"!bg-bg2 !border-transparent !px-[12px] focus-within:!border-p1 [&_[data-motion-state=raised]_label]:!text-t3",inputClassName:"planMarket"===t.orderType?"!text-b14 !text-t4 placeholder:!text-t4":"!text-b14 placeholder:!text-t4",suffix:"limit"===t.orderType||"postOnly"===t.orderType?(0,n.jsx)("button",{type:"button",dir:"ltr",className:"text-c12 md:text-b14 text-p1-dark hover:text-p1 inline-flex min-w-[40px] cursor-pointer items-center justify-end text-right leading-none transition-colors",onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),a.onFillLastPrice("orderPrice")},children:e("Last")}):"trigger"===i?(0,n.jsxs)("button",{type:"button",className:"text-c12 md:text-b14 text-t1 inline-flex min-w-[52px] cursor-pointer items-center justify-end gap-[5px] leading-none rtl:flex-row-reverse rtl:justify-start",onClick:()=>a.onSetOrderType("planMarket"===t.orderType?"planLimit":"planMarket",t.orderType),children:[(0,n.jsx)("span",{children:e("planMarket"===t.orderType?"Market":"Limit")}),(0,n.jsx)(eC.y,{className:"size-[12px]"})]}):null}):null]})}function eT(){let e=(0,$.$)(e=>e.quantity.quantityValueHint);return(0,n.jsx)("div",{className:"flex items-center justify-between gap-[12px]",children:(0,n.jsx)("div",{className:"text-c12 text-t2 min-w-0 flex-1 overflow-hidden leading-[16px] text-ellipsis whitespace-nowrap rtl:text-right",children:e})})}var ek=r(44031),eP=r(97492),eS=r(7126);function eL(e){let{menuWidth:t}=e,{$t:r,i18n:i,locale:l}=(0,x.B)(),c=(0,a.no)(),{tradeUnitValue:d,tradeUnitOptions:m,selectedOption:g,onTradeUnitChange:h}=function(){let e=(0,$.$)((0,E.k)(e=>({tradeUnitValue:e.quantity.tradeUnitValue,tradeUnitOptions:e.quantity.tradeUnitOptions}))),t=(0,J.T)(e=>e.actions.onTradeUnitChange),r=e.tradeUnitOptions.find(t=>t.value===e.tradeUnitValue);return{...e,selectedOption:r,onTradeUnitChange:t}}(),[b,f]=(0,y.useState)(!1),[v,N]=(0,y.useState)(d),j=i.dir(l);return c?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"text-c12 text-t1 inline-flex min-w-[42px] shrink-0 cursor-pointer items-center justify-end gap-1.5",onClick:()=>{N(d),f(!0)},children:[(0,n.jsx)("span",{children:(null==g?void 0:g.triggerLabel)||(null==g?void 0:g.label)}),(0,n.jsx)(s.C,{className:"text-t1 size-3 shrink-0"})]}),(0,n.jsx)(u.DrawerRoot,{open:b,onOpenChange:f,children:(0,n.jsx)(u.DrawerContent,{dir:j,className:"!bg-m1 max-h-[85dvh] !rounded-t-[20px] !border-none px-4 pt-5 pb-6",children:(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsx)("div",{className:"text-t1 text-[16px] leading-6 font-semibold",children:r("Contract Unit")}),(0,n.jsx)("button",{type:"button",className:"text-t3 hover:text-t1 flex size-5 cursor-pointer items-center justify-center leading-none",onClick:()=>{N(d),f(!1)},children:(0,n.jsx)(o.U,{className:"size-5"})})]}),(0,n.jsx)("div",{className:"mt-4 flex flex-col gap-4",children:m.map(e=>{let t=e.value===v,r=e.description?"px-4 py-3":"px-4 py-[18px]";return(0,n.jsxs)("button",{type:"button",dir:"ltr",className:"rounded-r2 flex w-full cursor-pointer items-center justify-between border transition-colors ".concat(t?"border-bt1 bg-m1":"bg-bg2 border-transparent"," text-left rtl:flex-row-reverse ").concat(r),onClick:()=>N(e.value),children:[(0,n.jsxs)("div",{dir:"ltr",className:"min-w-0 pr-4 text-left rtl:pr-0 rtl:pl-4",children:[(0,n.jsx)("div",{className:"text-t1 text-[14px] leading-5 font-medium",children:e.label}),e.description?(0,n.jsx)("div",{className:"text-c12 text-t3 mt-1 text-left leading-4 whitespace-normal",children:e.description}):null]}),(0,n.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center rounded-full border ".concat(t?"border-bt1":"border-t5"),children:(0,n.jsx)("span",{className:"block size-[10px] rounded-full ".concat(t?"bg-bt1":"bg-transparent")})})]},e.value)})}),(0,n.jsxs)("div",{className:"mt-6 grid grid-cols-2 gap-2",children:[(0,n.jsx)(p.$,{variant:"secondary",size:"m",className:"text-b14 !rou
1nded-r2 h-10 font-medium",onClick:()=>{N(d),f(!1)},children:r("Cancel")}),(0,n.jsx)(p.$,{size:"m",className:"text-b14 !rounded-r2 h-10 font-medium",onClick:()=>{v!==d&&h(v),f(!1)},children:r("Confirm")})]})]})})})]}):(0,n.jsxs)(ef.DropdownMenu,{modal:!1,children:[(0,n.jsx)(ef.DropdownMenuTrigger,{showIcon:!0,className:"!outline-none",triggerClassName:"text-b14 text-t1 inline-flex min-w-[42px] shrink-0 items-center justify-end gap-2",children:(0,n.jsx)("span",{children:(null==g?void 0:g.triggerLabel)||(null==g?void 0:g.label)})}),(0,n.jsx)(ef.DropdownMenuContent,{align:"end",sideOffset:12,className:"!border-l1 !bg-m1 !shadow-2 !flex !min-w-0 !flex-col !gap-1 !rounded-[8px] !py-2",style:{width:t,minWidth:t,maxWidth:t,transform:"translateX(12px)"},children:m.map(e=>{let t=e.value===d;return(0,n.jsx)(ef.DropdownMenuItem,{className:"!rounded-r1 !mx-2 !min-h-10 !px-3 !py-[10px] ".concat(t?"!bg-bg2 !text-t1 hover:!bg-bg2 !shadow-[inset_0_0_0_1px_var(--line-1)]":"!text-t1 hover:!bg-bg2"),onSelect:()=>h(e.value),children:(0,n.jsxs)("div",{className:"w-full text-left",children:[(0,n.jsx)("div",{className:"text-[14px] leading-[18px] font-normal",children:e.label}),e.description?(0,n.jsx)("div",{className:"text-c12 text-t4 mt-1 leading-[16px] whitespace-normal",children:e.description}):null]})},e.value)})})]})}function eM(){var e;let{$t:t,i18n:r,locale:i}=(0,x.B)(),l=(0,a.no)(),{form:s,hasDirectionalQuantity:o,tradeUnitTriggerLabel:c,actions:d}=function(){let e=(0,z.Mr)((0,E.k)(e=>({activeTab:e.form.activeTab,isPercentage:e.form.isPercentage,percentage:e.form.percentage,quantity:e.form.quantity,longQuantity:e.form.longQuantity,shortQuantity:e.form.shortQuantity}))),t=(0,$.$)((0,E.k)(e=>({hasDirectionalQuantity:e.quantity.hasDirectionalQuantity,tradeUnitValue:e.quantity.tradeUnitValue,tradeUnitOptions:e.quantity.tradeUnitOptions}))),r=(0,J.T)((0,E.k)(e=>({onQuantityChange:e.actions.onQuantityChange,onPercentageChange:e.actions.onPercentageChange,onClearQuantity:e.actions.onClearQuantity}))),n=t.tradeUnitOptions.find(e=>e.value===t.tradeUnitValue);return{form:e,hasDirectionalQuantity:t.hasDirectionalQuantity,tradeUnitTriggerLabel:(null==n?void 0:n.triggerLabel)||(null==n?void 0:n.label)||"",actions:r}}(),u=r.dir(i),m=(0,y.useRef)(null),[p,g]=(0,y.useState)(260),h=o&&!s.isPercentage,b=c.length>6,f=l?"left-[8px]":"rtl"===u?"right-[12px]":"left-[12px]",v=s.isPercentage?"".concat(String(null!=(e=s.percentage)?e:0),"%"):h?"":s.quantity,N=(0,n.jsx)("div",{className:"relative z-[2] inline-flex shrink-0 items-center gap-2",children:(0,n.jsx)(eL,{menuWidth:p})});return(0,y.useEffect)(()=>{if(!m.current)return;let e=m.current,t=()=>{g(e.getBoundingClientRect().width)};t();let r=new ResizeObserver(t);return r.observe(e),()=>{r.disconnect()}},[]),(0,n.jsxs)("div",{ref:m,dir:l?void 0:u,className:"relative max-w-full min-w-0 overflow-hidden",children:[h?(0,n.jsx)("div",{className:"".concat(f," ").concat(b?"w-[116px] max-w-[calc(100vw-220px)] min-w-0 overflow-hidden md:w-[148px] md:max-w-[148px]":"w-[150px] max-w-[calc(100vw-172px)] min-w-0 overflow-hidden md:w-[170px] md:max-w-[170px]"," absolute top-1/2 z-[1] -translate-y-1/2"),children:(0,n.jsx)(eP.n,{activeTab:s.activeTab,isPercentage:s.isPercentage,longQuantity:s.longQuantity,shortQuantity:s.shortQuantity,onClear:d.onClearQuantity})}):null,(0,n.jsx)(ek.Input,{size:"m",value:v,onChange:e=>s.isPercentage?d.onPercentageChange(e.target.value.replace(/%/g,"")):d.onQuantityChange(e.target.value),onKeyDown:e=>{var t,r;if(!s.isPercentage||"Backspace"!==e.key&&"Delete"!==e.key)return;let n=e.currentTarget,a=n.value,i=a.indexOf("%"),l=null!=(t=n.selectionStart)?t:0,o=null!=(r=n.selectionEnd)?r:l;if(i<1||l!==o||l!==i+1)return;e.preventDefault();let c="".concat(a.slice(0,i-1)).concat(a.slice(i));d.onPercentageChange(c.replace(/%/g,""))},onFocus:()=>{!s.isPercentage&&o&&d.onClearQuantity()},placeholder:l&&!h?t("Quantity"):"",enablePlaceholderMotion:l&&!h,wrapperClassName:l?"".concat(eS.w," !h-[44px] !rounded-r2 !px-[8px] !min-w-0 !overflow-hidden"):"".concat(eS.w," !px-[12px] !min-w-0 !overflow-hidden"),className:"!text-b
114 placeholder:!text-t4 !leading-none ".concat("rtl"===u?"!text-right":""),leftSlot:"rtl"===u&&l?N:void 0,rightSlot:"rtl"===u&&l?void 0:N})]})}function eO(){let{$t:e}=(0,x.B)(),t=(0,a.no)(),{form:r,actions:i}={form:(0,z.Mr)((0,E.k)(e=>({checkedTpsl:e.form.checkedTpsl,tpslAdvancedEdited:e.form.tpslAdvancedEdited,takeProfitPrice:e.form.takeProfitPrice,stopLossPrice:e.form.stopLossPrice,tpTriggerWay:e.form.tpTriggerWay,slTriggerWay:e.form.slTriggerWay}))),actions:(0,J.T)((0,E.k)(e=>({onToggleTpslTriggerWay:e.actions.onToggleTpslTriggerWay,onTpslNumberFieldChange:e.actions.onTpslNumberFieldChange})))},l="".concat(e("Take Profit")," (USDT)"),s="".concat(e("Stop Loss")," (USDT)");return!r.checkedTpsl||r.tpslAdvancedEdited?null:(0,n.jsxs)("div",{className:"mt-2 grid gap-2 md:mt-5 md:gap-3",children:[(0,n.jsx)(g.q,{label:l,value:r.takeProfitPrice,onChange:i.onTpslNumberFieldChange("takeProfitPrice"),placeholder:t?l:e("Trigger Price"),suffix:(0,n.jsxs)("button",{type:"button",className:"text-b14 max-md:text-c12 text-t1 inline-flex min-w-[52px] cursor-pointer items-center justify-end gap-[5px] leading-none",onClick:()=>i.onToggleTpslTriggerWay("tpTriggerWay"),children:[(0,n.jsx)("span",{children:e("latest"===r.tpTriggerWay?"Last":"Mark")}),(0,n.jsx)(eC.y,{className:"text-t1 size-[12px]"})]})}),(0,n.jsx)(g.q,{label:s,value:r.stopLossPrice,onChange:i.onTpslNumberFieldChange("stopLossPrice"),placeholder:t?s:e("Trigger Price"),suffix:(0,n.jsxs)("button",{type:"button",className:"text-b14 max-md:text-c12 text-t1 inline-flex min-w-[52px] cursor-pointer items-center justify-end gap-[5px] leading-none",onClick:()=>i.onToggleTpslTriggerWay("slTriggerWay"),children:[(0,n.jsx)("span",{children:e("latest"===r.slTriggerWay?"Last":"Mark")}),(0,n.jsx)(eC.y,{className:"text-t1 size-[12px]"})]})})]})}var e_=r(63394),eA=r(47317),eI=r(24626);function eq(){let{$t:e}=(0,x.B)(),t=(0,a.no)(),{checkedTpsl:r,tpslAdvancedEdited:i,actions:l}=function(){let e=(0,z.Mr)((0,E.k)(e=>({checkedTpsl:e.form.checkedTpsl,tpslAdvancedEdited:e.form.tpslAdvancedEdited}))),t=(0,J.T)((0,E.k)(e=>({onDisableTpsl:e.actions.onDisableTpsl,onEnableTpsl:e.actions.onEnableTpsl,onOpenTpslAdvanced:e.actions.onOpenTpslAdvanced})));return{...e,actions:t}}();return(0,n.jsxs)("div",{className:"flex items-center justify-between md:rtl:flex-row-reverse",children:[(0,n.jsxs)("div",{className:"flex items-center gap-[6px] md:rtl:flex-row-reverse",children:[(0,n.jsx)(eI.Checkbox,{className:"cursor-pointer",checked:r,onCheckedChange:e=>{if(!e)return void l.onDisableTpsl();l.onEnableTpsl()}}),(0,n.jsx)(ev.Tooltip,{className:"max-w-[calc(100vw-32px)]",content:(0,n.jsxs)("div",{className:"w-[300px] max-w-full space-y-2",children:[(0,n.jsx)("p",{className:"text-b14 text-t1 text-c12 min-w-0 leading-5 break-words whitespace-normal",children:e("The preset take-profit and stop-loss orders will only take effect after the commission is completed. By default, all take-profit and stop-loss orders are placed according to your order quantity. If you cancel the pending order, the preset take profit and stop loss will be invalidated at the same time. You can select the latest price or the marked price to trigger the take profit and stop loss.")}),(0,n.jsx)("p",{className:"text-b14 text-t1 text-c12 min-w-0 leading-5 break-words whitespace-normal",children:e("Note: After the take profit and stop loss orders are triggered, the transaction will be executed at the market price, and the transaction price will be affected by the depth of the market.")})]}),children:(0,n.jsx)("button",{type:"button",className:"text-c12 text-t1 border-b-l2 cursor-help border-b border-dashed leading-[16px]",children:e("TP/SL")})})]}),(0,n.jsx)("div",{className:"gap-s3 flex items-center md:rtl:justify-start",children:r?(0,n.jsx)("button",{type:"button",className:t?"text-p1-dark hover:text-p1 cursor-pointer transition-colors":"text-p1-dark hover:text-p1 text-c12 cursor-pointer font-medium transition-colors",onClick:l.onOpenTpslAdvanced,children:t?i?(0,n.jsx)(e_.i,{className:"text-p1-dark size-4"}):(0,n.jsx)(eA.Z,{className:"text-p1-dark size-4"}):e(i?"Edit":"Advanced")}):null})]})}function eU(){let{$t:e}=(0,x.B)(),t=(0,z.Mr)((0,E.k)(e=>({checkedTpsl:e.form.checkedTpsl,tpslAdvancedEdited:e.form.tpslAdvancedEdited,tpPriceType:e.form.tpPriceType,slPriceType:e.form.slPriceType,takeProfitPrice:e.form.takeProfitPrice,stopLossPrice:e.form.stopLossPrice,tpTriggerWay:e.form.tpTriggerWay,slTriggerWay:e.form.slTriggerWay})));if(!t.checkedTpsl||!t.tpslAdvancedEdited)return null;let r="TP ".concat(e("limit"===t.tpPriceType?"Limit_2":"Market_2")),a="SL ".concat(e("limit"===t.slPriceType?"Limit_2":"Market_2")),i=e("latest"===t.tpTriggerWay?"Last":"Mark"),l=e("latest"===t.slTriggerWay?"Last":"Mark");return(0,n.jsxs)("div",{className:"bg-bg2 rounded-r3 mt-2 flex flex-col gap-3 p-3 md:mt-5",children:[(0,n.jsxs)("div",{className:"text-c12 flex items-center justify-between leading-4",children:[(0,n.jsx)("div",{className:"text-t3",children:Number(t.takeProfitPrice)?r:"".concat(e("TP")," --")}),(0,n.jsxs)("div",{className:"text-t1 flex items-center justify-end gap-2 text-right",children:[(0,n.jsx)("span",{children:t.takeProfitPrice||"--"}),(0,n.jsx)("span",{children:Number(t.takeProfitPrice)?i:"--"})]})]}),(0,n.jsxs)("div",{className:"text-c12 flex items-center justify-between leading-4",children:[(0,n.jsx)("div",{className:"text-t3",children:Number(t.stopLossPrice)?a:"".concat(e("SL")," --")}),(0,n.jsxs)("div",{className:"text-t1 flex items-center justify-end gap-2 text-right",children:[(0,n.jsx)("span",{children:t.stopLossPrice||"--"}),(0,n.jsx)("span",{children:Number(t.stopLossPrice)?l:"--"})]})]})]})}function eE(){let{$t:e}=(0,x.B)(),{activeTab:t,onChangeActiveTab:r}=ep();return(0,n.jsx)("div",{className:"bg-bg05 rounded-r2 p-1",children:(0,n.jsx)("div",{className:"grid grid-cols-2 gap-[3px]",children:[{key:"open",label:e("Open_r_1")},{key:"close",label:e("Close_r_1")}].map(e=>(0,n.jsx)("button",{type:"button",className:"text-b14 h-6 cursor-pointer rounded-[6px] transition-colors ".concat(t===e.key?"bg-bg3 text-t1":"text-t3 hover:bg-c2 hover:text-t1"),onClick:()=>r(e.key),children:e.label},e.key))})})}function eQ(){let{$t:e}=(0,x.B)(),{marginMode:t,longLeverage:r,shortLeverage:a,onOpenSettings:i}=em();return(0,n.jsxs)("button",{type:"button",className:"bg-bg2 rounded-r2 flex h-7 w-full cursor-pointer items-center justify-between px-2",onClick:i,children:[(0,n.jsx)("span",{className:"text-c12 text-t1 shrink-0 leading-none",children:e("crossed"===t?"Cross":"Isolated")}),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-[8px]",children:[(0,n.jsxs)("span",{className:"text-c12 text-p2 inline-flex h-4 items-center leading-none",children:[r,"X"]}
1),(0,n.jsxs)("span",{className:"text-c12 text-p3 inline-flex h-4 items-center leading-none",children:[a,"X"]}),(0,n.jsx)("span",{className:"inline-flex size-3 shrink-0 items-center justify-center",children:(0,n.jsx)(s.C,{className:"text-t1 size-3"})})]})]})}function eD(){let{$t:e}=(0,x.B)(),t=(0,$.$)(e=>e.orderEntry.quoteAsset);return(0,n.jsx)(g.q,{label:"".concat(e("Price")," (").concat(t,")"),value:"",onChange:()=>{},placeholder:e("Market Price"),disabled:!0,wrapperClassName:"!h-9 !rounded-r2",inputClassName:"!text-b14 !leading-none"})}function eR(){let{$t:e}=(0,x.B)(),{orderType:t,onSetOrderType:r}=eg(),{selectedLabel:a,options:i}=function(){let{$t:e}=(0,x.B)(),{activeTab:t,orderType:r}=eg(),n=eN(t,r);return{selectedLabel:(0,y.useMemo)(()=>"postOnly"===r?e("Post Only"):"planLimit"===r||"planMarket"===r?e("Trigger Orders_1"):"market"===r?e("Market_2"):e("Limit_2"),[e,r]),options:(0,y.useMemo)(()=>"close"===t?[{label:e("Limit_2"),value:"limit",active:"limit"===n},{label:e("Market_2"),value:"market",active:"market"===n},{label:e("Post Only"),value:"postOnly",active:"dropdown"===n}]:[{label:e("Limit_2"),value:"limit",active:"limit"===n},{label:e("Market_2"),value:"market",active:"market"===n},{label:e("Trigger Orders_1"),value:"planLimit",active:"trigger"===n},{label:e("Post Only"),value:"postOnly",active:"dropdown"===n}],[e,t,n])}}(),[l,d]=(0,y.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"text-c12 bg-bg2 text-b14 text-t1 rounded-r2 flex h-7 w-full cursor-pointer items-center justify-between px-2",onClick:()=>d(!0),children:[(0,n.jsx)("span",{className:"leading-none",children:a}),(0,n.jsx)(s.C,{className:"text-t1 size-3 shrink-0"})]}),"market"===t?(0,n.jsx)(eD,{}):null,(0,n.jsx)(u.DrawerRoot,{open:l,onOpenChange:d,children:(0,n.jsx)(u.DrawerContent,{className:"max-h-[60dvh]",children:(0,n.jsxs)("div",{className:"flex flex-col px-4 pt-4 pb-4",children:[(0,n.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,n.jsx)("div",{className:"text-t1 text-[16px] leading-6 font-semibold",children:e("Order Type")}),(0,n.jsx)("button",{type:"button",className:"text-t3 hover:text-t1 flex size-5 items-center justify-center leading-none",onClick:()=>d(!1),children:(0,n.jsx)(o.U,{className:"size-5"})})]}),(0,n.jsx)("div",{className:"flex flex-col",children:i.map(e=>(0,n.jsxs)("button",{type:"button",className:"flex h-14 items-center justify-between text-left",onClick:()=>{r(e.value,t),d(!1)},children:[(0,n.jsx)("span",{className:"text-[14px] leading-5 font-normal ".concat(e.active?"text-p1-dark":"text-t1"),children:e.label}),e.active?(0,n.jsx)(c.S,{className:"text-p1-dark size-4 shrink-0"}):null]},e.value))})]})})})]})}function ez(){let{$t:e}=(0,x.B)(),{availableBalanceText:t,quoteAsset:r,onResetDemoFund:a}=ex();return(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3 py-1 rtl:flex-row-reverse",children:[(0,n.jsx)("span",{className:"text-c12 text-t3 leading-4 rtl:text-right",children:e("Avbl")}
1),(0,n.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-2 rtl:flex-row-reverse",children:[(0,n.jsxs)("div",{className:"direction-ltr text-c12 text-t1 inline-flex min-w-0 items-center gap-1 text-right leading-4",children:[(0,n.jsx)("span",{className:"rtl:order-2",children:t}),(0,n.jsx)("span",{className:"rtl:order-1",children:r})]}),(0,n.jsx)("button",{type:"button","aria-label":e("Reset Demo Fund"),className:"text-t3 hover:text-t1 flex size-4 shrink-0 cursor-pointer items-center justify-center transition-colors",onClick:a,children:(0,n.jsx)(d.N,{className:"size-4"})})]})]})}function eB(){let e=(0,z.Mr)(e=>e.form.isPercentage),{sliderPercent:t,onSliderChange:r}=eh();return(0,y.useEffect)(()=>{e&&J.T.getState().actions.onQuantityModeChange("quantity")},[e]),(0,n.jsxs)("div",{className:"",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)(eM,{}),(0,n.jsx)(eT,{})]}),(0,n.jsx)("div",{className:"px-s1",children:(0,n.jsx)(m.Slider,{value:t,onValueChange:r,showIndicatorOnDragging:!0,marks:[{value:0,label:"0%",displayValue:0},{value:25,label:"25%",displayValue:25},{value:50,label:"50%",displayValue:50},{value:75,label:"75%",displayValue:75},{value:100,label:"100%",displayValue:100}],activeColor:"var(--color-p1)",SliderBarclassName:"!bg-bg6",SliderThumbclassName:"size-4"})})]})}function eF(){return(0,n.jsxs)("div",{className:"space-y-0 pt-[2px]",children:[(0,n.jsx)(eq,{}),(0,n.jsx)(eO,{}),(0,n.jsx)(eU,{})]})}function eH(){let{$t:e,i18n:t,locale:r}=(0,x.B)(),{activeTab:a,isLoggedIn:i,footer:l,actions:s}=eb(),o=t.dir(r);return(0,n.jsxs)("div",{className:"pt-[2px]",children:[i&&(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsxs)("div",{dir:o,className:"flex min-w-0 items-center justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-t3 shrink-0 text-[11px] leading-4",children:e("open"===a?"Max open":"Max")}),(0,n.jsxs)("span",{className:"direction-ltr text-t1 min-w-0 flex-1 overflow-hidden text-[11px] leading-4 text-ellipsis whitespace-nowrap ".concat("rtl"===o?"text-left":"text-right"),children:[(0,n.jsx)("span",{className:"text-p2",children:l.maxLeft})," /"," ",(0,n.jsx)("span",{className:"text-p3",children:l.maxRight})," ",l.unitLabel]})]}),"open"===a?(0,n.jsxs)("div",{dir:o,className:"flex min-w-0 items-center justify-between gap-3",children:[(0,n.jsx)("span",{className:"text-t3 shrink-0 text-[11px] leading-4",children:e("Cost")}),(0,n.jsxs)("span",{className:"direction-ltr text-t1 min-w-0 flex-1 overflow-hidden text-[11px] leading-4 text-ellipsis whitespace-nowrap ".concat("rtl"===o?"text-left":"text-right"),children:[(0,n.jsx)("span",{className:"text-p2",children:l.costLeft})," /"," ",(0,n.jsx)("span",{className:"text-p3",children:l.costRight})," ",l.quoteAsset]})]}):null]}),i?(0,n.jsxs)("div",{className:"mt-3 flex flex-col gap-2",children:[(0,n.jsx)(p.$,{className:"bg-p2 hover:bg-p2/90 text-b14 rounded-r2 h-9 w-full border-none font-medium text-white",disabled:l.loading,onClick:s.onPrimaryAction,children:e("open"===a?"Open Long":"Close Short")}),(0,n.jsx)(p.$,{className:"bg-p3 hover:bg-p3/90 text-b14 rounded-r2 h-9 w-full border-none font-medium text-white",disabled:l.loading,onClick:s.onSecondaryAction,children:e("open"===a?"Open Short":"Close Long")})]}):(0,n.jsx)(h.X,{className:"mt-3 grid-cols-1 py-0",buttonClassName:"text-b14 h-9 w-full"})]})}function eV(e){let{symbol:t}=e;eu({symbol:t});let{i18n:r,locale:a}=(0,x.B)(),i=(0,z.Mr)(e=>e.form.activeTab);return(0,n.jsx)(b.p,{className:"rounded-md",bodyClassName:"",children:(0,n.jsxs)("div",{dir:r.dir(a),className:"space-y-2",children:[(0,n.jsx)(eE,{}),(0,n.jsx)(ez,{}),(0,n.jsx)(eQ,{}),(0,n.jsx)(eR,{}),(0,n.jsx)(ew,{}),(0,n.jsx)(eB,{}),"open"===i?(0,n.jsx)(eF,{}):null,(0,n.jsx)(eH,{})]})})}var eZ=r(82586);function eK(){let{$t:e}=(0,x.B)(),{activeTab:t,isLoggedIn:r,footer:a,actions:i}=eb();return(0,n.jsxs)(n.Fragment,{children:[r?(0,n.jsxs)("div",{className:"gap-s2 grid grid-cols-2 pb-5 ".concat("open"===t?"pt-5":"pt-0"),children:[(0,n.jsx)(p.$,{className:"bg-p2 hover:bg-p2/90 !px-s2 h-auto min-h-10 border-none py-1 font-semibold whitespace-normal text-white [&>span]:max-w-full [&>span]:min-w-0 [&>span]:justify-center [&>span]:text-center [&>span]:leading-4 [&>span]:whitespace-normal",disabled:a.loading,onClick:i.onPrimaryAction,children:e("open"===t?"Open Long":"Close Short")}),(0,n.jsx)(p.$,{className:"bg-p3 hover:bg-p3/90 !px-s2 h-auto min-h-10 border-none py-1 font-semibold whitespace-normal text-white [&>span]:max-w-full [&>span]:min-w-0 [&>span]:justify-center [&>span]:text-center [&>span]:leading-4 [&>span]:whitespace-normal",disabled:a.loading,onClick:i.onSecondaryAction,children:e("open"===t?"Open Short":"Close Long")})]}):(0,n.jsx)(h.X,{}),r&&(0,n.jsxs)("div",{className:"gap-s3 flex flex-col",children:["open"===t?(0,n.jsxs)("div",{className:"gap-s3 flex min-w-0 items-center justify-between rtl:flex-row-reverse",children:[(0,n.jsx)("span",{className:"text-c12 text-t3 shrink-0",children:e("Cost")}),(0,n.jsxs)("span",{className:"direction-ltr text-c12 text-t1 min-w-0 flex-1 overflow-hidden text-right text-ellipsis rtl:text-left",children:[(0,n.jsx)("span",{className:"text-p2",children:a.costLeft})," /"," ",(0,n.jsx)("span",{className:"text-p3",children:a.costRight})," ",a.quoteAsset]})]}):null,(0,n.jsxs)("div",{className:"gap-s3 flex min-w-0 items-center justify-between md:items-start rtl:flex-row-reverse",children:[(0,n.jsx)("span",{className:"text-c12 text-t3 shrink-0",children:e("open"===t?"Max open":"Max")}),(0,n.jsxs)("span",{className:"direction-ltr text-c12 text-t1 min-w-0 flex-1 overflow-hidden text-right text-ellipsis rtl:text-left",children:[(0,n.jsx)("span",{className:"text-p2",children:a.maxLeft})," /"," ",(0,n.jsx)("span",{className:"text-p3",children:a.maxRight})," ",a.unitLabel]})]})]})]})}var eW=r(76562);function eG(){let{$t:e}=(0,x.B)(),{marginMode:t,longLeverage:r,shortLeverage:a,onOpenSettings:i}=em(),{preload:l}=(0,Q.Hx)();return(0,n.jsx)("div",{className:"px-s4 pt-s4 flex items-center justify-between pb-[10px]",children:(0,n.jsxs)("button",{type:"button",className:"-mb-[
110px] inline-flex cursor-pointer items-center gap-[6px] pb-[10px] leading-none",onMouseEnter:l,onClick:i,children:[(0,n.jsx)("span",{className:"text-b14 text-t1 text-c12",children:e("crossed"===t?"Cross":"Isolated")}),(0,n.jsxs)("span",{className:"text-b14 text-p2 text-c12",children:[r,"X"]}),(0,n.jsxs)("span",{className:"text-b14 text-p3 text-c12",children:[a,"X"]}),(0,n.jsx)("span",{className:"inline-flex size-3 shrink-0 items-center justify-center",children:(0,n.jsx)(eW.Y,{className:"text-t4 size-3 rtl:rotate-180"})})]})})}function eJ(){let{$t:e}=(0,x.B)(),{activeTab:t,onChangeActiveTab:r}=ep();return(0,n.jsx)("div",{className:"bg-bg05 mx-s4 rounded-r2 mb-4 p-1",children:(0,n.jsx)("div",{className:"gap-s1 grid grid-cols-2",children:[{key:"open",label:e("Open_r_1")},{key:"close",label:e("Close_r_1")}].map(e=>(0,n.jsx)("button",{type:"button",className:"rounded-r1 text-b14 h-[28px] cursor-pointer transition-colors ".concat(t===e.key?"bg-bg3 text-t1":"text-t3 hover:bg-c2 hover:text-t1"),onClick:()=>r(e.key),children:e.label},e.key))})})}function e$(){let{$t:e}=(0,x.B)(),{availableBalanceText:t,quoteAsset:r,onResetDemoFund:a}=ex();return(0,n.jsxs)("div",{className:"gap-s3 flex items-center justify-between rtl:flex-row-reverse",children:[(0,n.jsxs)("div",{className:"text-c12 text-t3 min-w-0 flex-1 text-left rtl:text-right",children:[e("Available Balance"),":"," ",(0,n.jsxs)("span",{className:"direction-ltr text-t1 inline-flex items-center gap-1",children:[(0,n.jsx)("span",{className:"rtl:order-2",children:t}),(0,n.jsx)("span",{className:"rtl:order-1",children:r})]})]}),(0,n.jsx)(ev.Tooltip,{content:e("Reset Demo Fund"),children:(0,n.jsx)("button",{type:"button","aria-label":e("Reset Demo Fund"),className:"text-t3 hover:text-t1 flex size-4 shrink-0 cursor-pointer items-center justify-center transition-colors",onClick:a,children:(0,n.jsx)(d.N,{className:"size-4"})})})]})}function eY(){let e=(0,z.Mr)(e=>e.form.activeTab),t=(0,z.Mr)(e=>e.form.orderType);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(ej,{}),"open"===e||"market"!==t?(0,n.jsxs)("div",{className:"flex flex-col gap-4 ".concat("market"===t?"mb-3 md:mb-4":"mb-3"),children:[(0,n.jsx)(e$,{}),"market"!==t?(0,n.jsx)(ew,{}):null]}):null]})}function eX(){var e;let{$t:t}=(0,x.B)(),{activeTab:r,quantityMode:a,quantityModeOptions:i,onQuantityModeChange:l}=function(){let e=(0,z.Mr)(e=>e.form.activeTab),t=(0,$.$)((0,E.k)(e=>({quantityMode:e.quantity.quantityMode,quantityModeOptions:e.quantity.quantityModeOptions}))),r=(0,J.T)(e=>e.actions.onQuantityModeChange);return{activeTab:e,...t,onQuantityModeChange:r}}(),s=(null==(e=i.find(e=>e.value===a))?void 0:e.label)||t("Quantity");return(0,n.jsx)("div",{className:"flex items-center justify-between rtl:flex-row-reverse",children:"open"===r?(0,n.jsxs)(ef.DropdownMenu,{modal:!1,children:[(0,n.jsx)(ef.DropdownMenuTrigger,{showIcon:!0,className:"!outline-none",triggerClassName:"text-c12 text-t3 inline-flex items-center gap-1 leading-[16px] rtl:flex-row-reverse rtl:text-right",children:(0,n.jsx)("span",{children:s})}),(0,n.jsx)(ef.DropdownMenuContent,{align:"start",sideOffset:6,className:"!border-l1 !bg-m1 !shadow-2 !flex !min-w-[116px] !flex-col !gap-1 !rounded-[8px] !py-2",children:i.map(e=>{let t=e.value===a;return(0,n.jsx)(ef.DropdownMenuItem,{className:"!rounded-r1 !mx-2 !min-h-10 !px-2 !py-[10px] !text-[12px] !leading-4 !font-normal ".concat(t?"!bg-bg2 !text-t1 hover:!bg-bg2 !shadow-[inset_0_0_0_1px_var(--line-1)]":"!text-t1 hover:!bg-bg2"),onSelect:()=>l(e.value),children:e.label},e.value)})})]}):(0,n.jsx)("div",{className:"text-c12 text-t3 leading-[16px] rtl:text-right",children:t("Quantity")})})}function e0(){let{sliderPercent:e,onSliderChange:t}=eh();return(0,n.jsx)("div",{className:"px-s1 pt-3 pb-5",children:(0,n.jsx)(m.Slider,{value:e,onValueChange:t,showIndicatorOnDragging:!0,marks:[{value:0,label:"0%",displayValue:0},{value:25,label:"25%",displayValue:25},{value:50,label:"50%",displayValue:50},{value:75,label:"75%",displayValue:75},{value:100,label:"100%",displayValue:100}],activeColor:"var(--color-p1)",SliderBarclassName:"!bg-bg6",SliderThumbclassName:"size-3"})})}function e1(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,n.jsx)(eX,{}),(0,n.jsx)(eM,{}),(0,n.jsx)(eT,{})]}),(0,n.jsx)(e0,{})]})}function e6(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(eq,{}),(0,n.jsx)(eO,{}),(0,n.jsx)(eU,{})]})}function e3(e){let{symbol:t}=e;eu({symbol:t});let{i18n:r,locale:a}=(0,x.B)(),i=(0,z.Mr)(e=>e.form.activeTab);return(0,n.jsxs)("div",{dir:r.dir(a),className:"flex h-full flex-col",children:[(0,n.jsx)(eG,{}),(0,n.jsxs)(eZ.ScrollArea,{className:"flex-1 [&_[data-slot=scroll-bar][data-orientation=vertical]]:w-1",viewportClassName:"h-full [&>div]:!block [&>div]:!w-full [&>div]:!min-w-0 [&>div]:!max-w-full",children:[(0,n.jsx)(eJ,{}),(0,n.jsxs)("div",{className:"px-s4 pb-s4",children:[(0,n.jsx)(eY,{}),(0,n.jsx)(e1,{}),"open"===i?(0,n.jsx)(e6,{}):null,(0,n.jsx)(eK,{})]})]})]})}function e2(){let e=(0,l.T)(),t=e?(0,i.A2)(e,"-"):"BTC-USDT";return(0,a.no)()?(0,n.jsx)("section",{"data-component":"PlaceOrderPanel",className:"h-full",children:(0,n.jsx)(eV,{symbol:t})}):(0,n.jsx)("section",{"data-component":"PlaceOrderPanel",className:"h-full",children:(0,n.jsx)(e3,{symbol:t})})}},32523:(e,t,r)=>{r.d(t,{ho:()=>c});var n=r(79237),a=r(44031),i=r(749),l=r(90477),s=r(12733);r(38113);var o=r(76656);function c(e){let{value:t,onChange:r=()=>{},symbol:c="BTCUSDT",className:d,inputClassName:u,style:m,placeholder:p,prefix:x,suffix:g,disabled:h,autoFocus:b,onFocus:y,onBlur:f}
1=e,v=(0,s.bZ)((0,o.k)(e=>e.symbolsConfigBySymbol[c]||{})),N=Number(v.precision)||1,j=String(v.minPriceChange||"0.5");return(0,n.jsx)("div",{style:m,className:"w-full",children:(0,n.jsx)(a.Input,{autoFocus:b,size:"s",value:String(null!=t?t:""),placeholder:p,disabled:h,onFocus:y,onBlur:f||(e=>(e=>{let t=e&&j.endsWith("5")?(0,i.Xt)(e,N,j):e;Number(t)!==Number(e)&&r(t)})(e.target.value)),onChange:e=>(e=>{let t=function(e,t){let r=e.replace(/[^\d.]+/g,""),n=r.split("."),a=n[0],i=n[1]||"";return((i.length||0)>t&&(r="".concat(a,".").concat(i.slice(0,t))),isNaN(Number(r))||0>Number(r)||Number(r)>=1e8)?null:r}(e,N);null!==t&&r(t)})(e.target.value),leftSlot:x,rightSlot:g,wrapperClassName:(0,l.cn)("w-full",d),className:(0,l.cn)("text-b12 text-t1 text-center",u)})})}},33317:(e,t,r)=>{r.d(t,{M:()=>o});var n=r(47387),a=r(41809),i=r(50791),l=r(50965);let s={orderTypeMenuOpen:!1,plansNeverRemind:!!n.hv.get("plansNeverRemind")},o=(0,a.v)(e=>({...s,setOrderTypeMenuOpen:t=>e(e=>({orderTypeMenuOpen:"function"==typeof t?t(e.orderTypeMenuOpen):t})),setPlansNeverRemind:t=>{n.hv.set({plansNeverRemind:t}),e({plansNeverRemind:t})},resetUi:()=>{[l.k.PlaceOrderSettings,l.k.PlaceOrderCalculator,l.k.PlaceOrderTpslAdvanced,l.k.PlaceOrderDifference,l.k.PlaceOrderConfirm,l.k.PlaceTriggerOrdersNotice].forEach(e=>(0,i.wZ)(e)),e({...s,plansNeverRemind:!!n.hv.get("plansNeverRemind")})}}))},34131:(e,t,r)=>{r.d(t,{E:()=>u});var n=r(79237),a=r(46540),i=r(91405),l=r(66960),s=r(41760),o=r(96620),c=r(19490),d=r(38113);function u(e){let{symbol:t,countdown:r,showTooltip:u,fundingInterval:m,fundingRateHref:p}=e,{$t:x}=(0,l.B)(),g=(0,i.no)(),h=(0,s.N1)(o.p.USDT.SIMPLE_TICKER(t)),[b,y]=(0,d.useState)(!1);(0,d.useEffect)(()=>{y(u)},[u]);let f=null==h?void 0:h.fundingRate,v=null!=f&&""!==f&&(0,c.BY)(f,4)||"--%",N=v.replace("%",""),j="".concat(x("Funding"),"/").concat(x("Countdown")),C=(()=>{if(!r)return"00:00:00";let e=parseInt(String(r/3600),10),t=parseInt(String(r/60%60),10),n=e=>String(e).replace(/(^\d{1}$)/,"0$1");return"".concat(n(e),":").concat(n(t),":").concat(n(r%60))})(),w=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"text-p1-dark",children:v}),(0,n.jsxs)("span",{children:["/",C]})]}),T=(0,n.jsxs)("div",{className:"text-c12 max-w-[300px]",children:[Number.isNaN(Number(N))?(0,n.jsx)("div",{children:x("Long positions need to compensate for the short of the {1} holding value",{1:"0.0000%"})}):Number(N)>=0?(0,n.jsx)("div",{children:x("Long positions need to compensate for the short of the {1} holding value",{1:"".concat(N,"%")})}):(0,n.jsx)("div",{children:x("Short positions need to compensate for the long of the {1} holding value",{1:"".concat(N.replace("-",""),"%")})}),p?(0,n.jsx)("a",{href:p,target:"_blank",rel:"noreferrer",className:"text-p1 text-c12 mt-2 inline-flex hover:underline",children:x("Click to check more")}):null]}),k=(0,n.jsxs)("div",{className:"max-w-[300px]",children:[(0,n.jsx)("div",{className:"text-c12 text-t1",children:x("The current trading pair's funding interval changes to every {0} hours. Note the next funding settlement time.",{0:m})}),(0,n.jsx)("button",{type:"button",onClick:()=>y(!1),className:"text-p1 text-b14 text-c12 mt-3 text-right",children:x("Close_1")})]});return g?(0,n.jsxs)("div",{className:"shrink-0",children:[(0,n.jsx)("div",{className:"text-t3 text-cm11 whitespace-nowrap",children:j}),(0,n.jsx)("div",{className:"text-t1 text-cm12 mt-[2px] whitespace-nowrap",children:w})]}):(0,n.jsxs)("div",{className:"shrink-0",children:[(0,n.jsx)("div",{className:"text-t3 text-c12 cursor-pointer",children:(0,n.jsx)(a.Tooltip,{content:T,disableHoverTriggerClick:!0,hoverCloseDelay:300,side:"bottom",align:"start",className:"max-w-[300px]",children:(0,n.jsx)("button",{type:"button",className:"inline-flex cursor-help items-center border-b border-dashed border-current pb-px text-left whitespace-nowrap",children:j})})}),(0,n.jsx)(a.Tooltip,{content:k,trigger:"click",open:b,onOpenChange:y,side:"bottom",align:"start",className:"max-w-[300px]",children:(0,n.jsx)("button",{type:"button",className:"text-t1 text-m12 mt-1 inline-flex whitespace-nowrap",children:w})})]})}},34957:(e,t,r)=>{r.d(t,{JE:()=>k,QA:()=>O,io:()=>S,wD:()=>L,xT:()=>M,yc:()=>P});var n=r(79237),a=r(51924),i=r(55872),l=r(7370),s=r(62309),o=r(25829),c=r(93924),d=r
1(70659),u=r(66960),m=r(85028),p=r(3529),x=r(90477),g=r(95696),h=r(81407),b=r(32523),y=r(18006),f=r(38113),v=r(50791),N=r(82359),j=r(95496);let C="text-c12 text-p1-dark hover:text-p1/80 disabled:text-t4 cursor-pointer transition-colors disabled:cursor-not-allowed",w="text-t4 hover:text-t1 flex size-5 items-center justify-center rounded-none border-0 bg-transparent p-0 transition-colors",T="text-t1 hover:text-p1 flex size-[14px] shrink-0 items-center justify-center rounded-none border-0 bg-transparent p-0 transition-colors disabled:cursor-not-allowed disabled:opacity-40 [&_svg]:size-3.5";function k(e){let{item:t}=e,{$t:r}=(0,u.B)(),a="openShort"===t.direction||"closeLong"===t.direction?"#FC3C56":"#00BF75",i=(0,p.A2)(t.symbol||"","")||"--";return(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-1 inline-block h-3 w-1 shrink-0",style:{background:a}}),(0,n.jsx)(N.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:"text-c12 text-t1 leading-4",children:i})}),"trader"===t.tradeType?(0,n.jsx)(o.vw,{variant:"yellow",className:"ml-1",children:r("Leading Trade")}):null,"follower"===t.tradeType?(0,n.jsx)(o.vw,{variant:"yellow",className:"ml-1",children:r("Copy Trade")}):null]})}function P(e){var t;let{item:r,isEditing:s,isSubmitting:o,onStartEdit:c,onCancelEdit:d,onConfirmEdit:u}=e,[m,p]=f.useState(String(null!=(t=r.openQuantity)?t:""));return(f.useEffect(()=>{if(s){var e;p(String(null!=(e=r.openQuantity)?e:""))}},[s,r.openQuantity]),s)?(0,n.jsxs)("div",{className:(0,x.cn)("border-p1 flex h-8 items-center gap-1 rounded-r1 border bg-transparent px-2","w-[160px] whitespace-nowrap"),children:[(0,n.jsx)("button",{type:"button","aria-label":"Cancel open order quantity edit",disabled:o,onClick:d,className:T,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),(0,n.jsx)("input",{autoFocus:!0,value:m,onChange:e=>p(e.target.value.replace(/[^\d]+/g,"")),className:"text-m12 text-t1 min-w-0 flex-1 border-0 bg-transparent p-0 text-center leading-4 font-medium outline-none placeholder:text-t4"}),(0,n.jsx)("button",{type:"button","aria-label":"Confirm open order quantity edit",disabled:o,onClick:()=>null==u?void 0:u(m),className:T,children:(0,n.jsx)(i.S,{className:"size-3.5"})})]}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default",children:(0,h.ac)(r.openQuantity)}),r.orderId?(0,n.jsx)("button",{type:"button","aria-label":"Edit open order quantity",onClick:()=>{var e;p(String(null!=(e=r.openQuantity)?e:"")),null==c||c()},className:w,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function S(e){var t,r;let{item:s,isEditing:o,isSubmitting:c,onStartEdit:d,onCancelEdit:m,onConfirmEdit:p}=e,{$t:g}=(0,u.B)(),y=null==(t=s.orderType)?void 0:t.toLowerCase().includes("market"),[v,N]=f.useState(String(null!=(r=s.orderPrice)?r:""));return(f.useEffect(()=>{if(o){var e;N(String(null!=(e=s.orderPrice)?e:""))}},[o,s.orderPrice]),o)?(0,n.jsx)(b.ho,{autoFocus:!0,value:v,symbol:s.symbol,disabled:c,onChange:N,className:(0,x.cn)("rounded-r1 border-p1 h-8 w-[160px] border bg-transparent px-2","[&_input]:text-m12 [&_input]:text-t1 [&_input]:placeholder:text-t4 [&_input]:border-0 [&_input]:bg-transparent [&_input]:p-0 [&_input]:text-center [&_input]:leading-4 [&_input]:font-medium [&_input]:outline-none","[&_svg]:size-3.5"),prefix:(0,n.jsx)("button",{type:"button","aria-label":"Cancel open order price edit",disabled:c,onClick:m,className:T,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),suffix:(0,n.jsx)("button",{type:"button","aria-label":"Confirm open order price edit",disabled:c,onClick:()=>null==p?void 0:p(v),className:T,children:(0,n.jsx)(i.S,{className:"size-3.5"})})}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default",children:(0,h.Iz)({marketLabel:g("Market"),orderPrice:s.orderPrice,orderType:s.orderType})}),!y&&s.orderId?(0,n.jsx)("button",{type:"button","aria-label":"Edit open order price",onClick:()=>{var e;N(String(null!=(e=s.orderPrice)?e:"")),null==d||d()},className:w,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function L(e){let{item:t}=e,r=(0,v.ve)(),a="openLong"===t.direction||"openShort"===t.direction;return(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default",children:(0,h.iN)({takeProfit:t.takeProfitPrice,stopLoss:t.stopLossPrice})}),a?(0,n.jsx)("button",{type:"button","aria-label":"Edit open order TP/SL",onClick:()=>{t.orderId&&r.showLayer({type:"openOrder",item:t})},disabled:!t.orderId,className:w,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function M(e){let{item:t,onSuccess:r,buttonClassName:a}=e,{$t:i,locale:l}=(0,u.B)(),s=(0,y.useMutation)({mutationFn:async e=>(0,m.trackBusinessOperation)({domain:"futures",operation:"order_cancel",execute:()=>(0,g.Ph)({locale:l,params:{orderId:String(e)}})}),onSuccess:async e=>{if((null==e?void 0:e.code)===200){(0,c.toast)({type:"success",title:i("Order cancel submitted")}),r?await r():await (0,j.j6)();return}(null==e?void 0:e.code)===10325&&((0,c.toast)({type:"error",title:i("Cancelling")}),r?await r():await (0,j.j6)())}});return(0,n.jsx)("button",{type:"button",disabled:!t.orderId||s.isPending,onClick:()=>{t.orderId&&!s.isPending&&s.mutate(t.orderId)},className:(0,x.cn)(C,a),children:i("Cancel_2")})}function O(e){let{item:t,onShare:r,onCheck:a,unavailableFallback:i}=e,{$t:l}=(0,u.B)();return"filled"!==t.status&&"partiallyFilled"!==t.status&&"partiallyCanceled"!==t.status?void 0!==i?(0,n.jsx)(n.Fragment,{children:i}):(0,n.jsx)("span",{className:"text-t3",children:"--"}):(0,n.jsxs)("div",{className:"flex flex-row-reverse items-center justify-end gap-2 md:flex-row",children:[("closeLong"===t.direction||"closeShort"===t.direction)&&"liquidation"!==t.orderType?(0,n.jsx)(d.$,{variant:"line",size:"xs",className:"text-t3 hover:text-t1 h-8 min-h-8 w-8 min-w-8 rounded-none border-0 bg-transparent p-0 hover:bg-transparent [&_svg]:h-4 [&_svg]:w-4",onClick:()=>r(t),children:(0,n.jsx)(s.l,{className:"text-c16"})}):null,(0,n.jsx)("button",{type:"button",onClick:()=>a(t),className:C,children:l("Check")})]})}},35263:(e,t,r)=>{r.d(t,{C:()=>p,W:()=>x});var n=r(79237),a=r(8188),i=r(41387),l=r(46540),s=r(66960),o=r(41760),c=r(96620),d=r(19490),u=r(38113),m=function(e){return e.N
1one="none",e.Up="up",e.Down="down",e}(m||{});let p=(0,u.memo)(function(e){let{symbol:t,getMarkPricePath:r,hidden:u}=e,{$t:m,locale:p}=(0,s.B)(),g=(0,o.N1)(c.p.USDT.SIMPLE_TICKER(t))||{},h=(0,o.N1)(c.p.USDT.INDEX_PRICE(t))||{},b=g.last||"",y=b.length>12?"text-t14":"text-t20",f=h.markPrice||"",v=x(t);if(u)return null;let N=(0,n.jsxs)("div",{className:"max-w-[300px]",children:[(0,n.jsx)("div",{className:"text-c12 text-t1 mb-[10px]",children:m("Mark price is used for the calculation of the liquidation price and the unrealized PnL.")}),(0,n.jsx)("div",{children:(0,n.jsx)("a",{href:r(p,t),target:"_blank",rel:"noopener noreferrer",className:"text-c12 text-p1",children:m("Click to check more")})})]}),j=f?"text-t3":"text-t1";return(0,n.jsxs)("div",{className:"flex h-[44px] items-center gap-[8px]",children:[(0,n.jsxs)("div",{className:"flex items-center gap-[4px]",children:[(0,n.jsx)("div",{className:"".concat(y," ").concat("up"===v?"text-p2":"down"===v?"text-p3":"text-t1"," font-semibold"),children:b?(0,d.iT)(b):"--"}),(0,n.jsx)("div",{className:"flex h-5 w-5 items-center justify-center",children:"up"===v?(0,n.jsx)(a.K,{className:"text-p2 h-5 w-5"}):"down"===v?(0,n.jsx)(i.Z,{className:"text-p3 h-5 w-5"}):null})]}),(0,n.jsx)(l.Tooltip,{content:N,side:"top",className:"max-w-[300px]",children:(0,n.jsx)("div",{className:"text-c12 ".concat(j),children:f?(0,d.iT)(f):"--"})})]})});function x(e){var t,r;let n=(0,o.N1)(c.p.USDT.TRADE_LIST(e))||[],a=Number((null==(t=n[0])?void 0:t.price)||0),i=Number((null==(r=n[1])?void 0:r.price)||0),l="none";return a>i&&(l="up"),a<i&&(l="down"),l}p.displayName="OrderBookTicker"},36506:(e,t,r)=>{r.d(t,{kk:()=>P});var n=r(93924),a=r(66960),i=r(51025),l=r(61841),s=r(96012),o=r(18006),c=r(38113),d=r(76656),u=r(50791),m=r(82352),p=r(37563),x=r(72644),g=r(43129),h=r(97867),b=r(37966),y=r(95496),f=r(43487),v=r(2437),N=r(84605),j=r(22675),C=r(92413);let w={showHideOther:!1,bulkAction:null,showSettings:!1,settingsKind:null},T={positions:{showHideOther:!0,bulkAction:"closeAll",showSettings:!0,settingsKind:"positions"},copyTrade:{showHideOther:!1,bulkAction:"closeAllCopyTrade",showSettings:!0,settingsKind:"copyTrade"},openOrders:{showHideOther:!0,bulkAction:"cancelAllOpenOrders",showSettings:!1,settingsKind:null},triggerOrders:{showHideOther:!0,bulkAction:"cancelAllPlanOrders",showSettings:!1,settingsKind:null},ordersHistory:{showHideOther:!0,bulkAction:null,showSettings:!1,settingsKind:null},tpsl:{showHideOther:!0,bulkAction:null,showSettings:!1,settingsKind:null},transactionHistory:w};function k(e){var t;return null!=(t=T[e])?t:w}function P(e){var t;let{$t:r,locale:w}=(0,a.B)(),T=k(e),P=(0,C.T)(),{gotoLogin:S,userId:L}=(0,i.k)((0,d.k)(e=>{var t,r;return{gotoLogin:e.gotoLogin,userId:null!=(r=null==(t=e.user)?void 0:t.userId)?r:0}})),M=!!L,{refetch:O}=(0,m.pD)(),_=(0,u.j9)(),{copyTradePositionColumnOptions:A,setCopyTradePositionColumnOptions:I,leadingTradePositionColumnOptions:q,setLeadingTradePositionColumnOptions:U}=(0,s.m)((0,d.k)(e=>({copyTradePositionColumnOptions:e.copyTradeColumnOptions,setCopyTradePositionColumnOptions:e.setCopyTradeColumnOptions,leadingTradePositionColumnOptions:e.leadingTradeColumnOptions,setLeadingTradePositionColumnOptions:e.setLeadingTradeColumnOptions}))),{positionsHideOther:E,setPositionsHideOther:Q,positionColumnOptions:D,setPositionColumnOptions:R}=(0,v.r)((0,d.k)(e=>({positionsHideOther:e.hideOther,setPositionsHideOther:e.setHideOther,positionColumnOptions:e.columnOptions,setPositionColumnOptions:e.setColumnOptions}))),{openOrdersHideOther:z,setOpenOrdersHideOther:B,setOpenOrdersPageNum:F}=(0,y.yx)((0,d.k)(e=>({openOrdersHideOther:e.hideOther,setOpenOrdersHideOther:e.setHideOther,setOpenOrdersPageNum:e.setPageNum}))),{triggerOrdersHideOther:H,setTriggerOrdersHideOther:V,setTriggerOrdersPageNum:Z}=(0,j.a5)((0,d.k)(e=>({triggerOrdersHideOther:e.hideOther,setTriggerOrdersHideOther:e.setHideOther,setTriggerOrdersPageNum:e.setPageNum}))),{tpslHideOther:K,setTpslHideOther:W,setTpslPageNum:G}=(0,N.hv)((0,d.k)(e=>({tpslHideOther:e.hideOther,setTpslHideOther:e.setHideOther,setTpslPageNum:e.setPageNum}))),{orderHistoryHideOther:J,setOrderHistoryHideOther:$,setOrderHistoryPageNum:Y}
1=(0,f.dw)((0,d.k)(e=>({orderHistoryHideOther:e.hideOther,setOrderHistoryHideOther:e.setHideOther,setOrderHistoryPageNum:e.setPageNum}))),X=(()=>{switch(e){case"openOrders":return z;case"triggerOrders":return H;case"ordersHistory":return J;case"tpsl":return K;case"positions":return E;default:return!1}})(),ee=(0,o.useMutation)({mutationFn:async e=>{if(!L)return null;switch(e){case"closeAll":return(0,l.ue)({locale:w,params:{userId:Number(L),symbol:X?P:void 0}});case"cancelAllOpenOrders":return(0,l.$t)({locale:w,params:{userId:Number(L),symbol:X?P:""}});case"cancelAllPlanOrders":{let e={locale:w,params:{userId:Number(L),symbol:X?P:""}};return(0,l.PT)(e)}case"closeAllCopyTrade":return(0,l.xz)({locale:w,params:{userId:Number(L),closeSource:0}})}},onSuccess:(e,t)=>{switch(t){case"closeAll":(0,h.TP)({locale:w,symbol:P,userId:L});break;case"cancelAllOpenOrders":(0,b.q)("openOrders",P);break;case"cancelAllPlanOrders":(0,b.q)("triggerOrders",P);break;case"closeAllCopyTrade":O()}n.toast.success(r("Success"))}}),{copyTradeIsTrader:et,hasBulkTarget:er,bulkDialogTitle:en,bulkDialogDescription:ea,bulkDialogNote:ei,bulkActionLabel:el}=function(){let{$t:e}=(0,a.B)(),t=(0,g.J)(e=>e.activeContractTab),r=(0,c.useMemo)(()=>k(t).bulkAction,[t]),n=(0,C.T)(),i=(0,x.eu)({enabled:"positions"===t}),l=(0,p._t)({enabled:"copyTrade"===t}),{currentOrders:s,currentOrdersHideOther:o}=(0,y.yx)((0,d.k)(e=>({currentOrders:e.items,currentOrdersHideOther:e.hideOther}))),{triggerOrders:u,triggerOrdersHideOther:m}=(0,j.a5)((0,d.k)(e=>({triggerOrders:e.items,triggerOrdersHideOther:e.hideOther}))),h=o?s.filter(e=>e.symbol===n).length:s.length,b=m?u.filter(e=>e.symbol===n).length:u.length;return(0,c.useMemo)(()=>"closeAll"===r?{copyTradeIsTrader:l.isTrader,hasBulkTarget:i.items.length>0,bulkDialogTitle:e("Close All"),bulkDialogDescription:e("Are you sure to close all positions at the market price and cancel all orders?"),bulkDialogNote:e("Note: when the market flutuates greatly, the market transaction may fail, and the orders will be cancelled."),bulkActionLabel:e("Close All")}:"closeAllCopyTrade"===r?{copyTradeIsTrader:l.isTrader,hasBulkTarget:l.total>0,bulkDialogTitle:e("Close All"),bulkDialogDescription:e("Are you sure to close all positions at the market price and cancel all orders?"),bulkDialogNote:e("Note: when the market flutuates greatly, the market transaction may fail, and the orders will be cancelled."),bulkActionLabel:e("Close All")}:"cancelAllOpenOrders"===r||"cancelAllPlanOrders"===r?{copyTradeIsTrader:l.isTrader,hasBulkTarget:"cancelAllOpenOrders"===r?h>0:b>0,bulkDialogTitle:e("Cancel All"),bulkDialogDescription:e("Batch Cancellation Confirmationï¼"),bulkDialogNote:"",bulkActionLabel:e("Cancel All")}:{copyTradeIsTrader:l.isTrader,hasBulkTarget:!1,bulkDialogTitle:"",bulkDialogDescription:"",bulkDialogNote:"",bulkActionLabel:""},[t,r,l.isTrader,l.total,h,i.items.length,b,e])}();return{showHideOther:T.showHideOther,hideOtherChecked:!!M&&X,onHideOtherChange:function(t){if(!M)return void S();if(T.showHideOther)switch(e){case"openOrders":B(t),F(1);return;case"triggerOrders":V(t),Z(1);return;case"ordersHistory":$(t),Y(1);return;case"tpsl":W(t),G(1);return;case"positions":Q(t);return}},showBulkAction:(t={isLogged:M,bulkAction:T.bulkAction,hasBulkTarget:er}).isLogged&&!!t.bulkAction&&t.hasBulkTarget,canTriggerBulkAction:er,bulkActionLabel:el,openBulkActionDialog:function(){if(!M||!T.bulkAction||!er)return;let e=T.bulkAction;_.showLayer({title:en,description:ea,note:ei,onConfirm:async()=>{await ee.mutateAsync(e)}})},showSettings:M&&T.showSettings,settingsKind:T.settingsKind,copyTradeIsTrader:et,positionColumnOptions:D,setPositionColumnOptions:R,copyTradePositionColumnOptions:A,setCopyTradePositionColumnOptions:I,leadingTradePositionColumnOptions:q,setLeadingTradePositionColumnOptions:U}}},37901:(e,t,r)=>{r.d(t,{r:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,n.jsx)("path",{d:"M375.1424 58.1632a38.4 38.4 0 0 1 7.8336 43.008A408.0128 408.0128 0 0 0 922.8288 641.024a38.4 38.4 0 0 1 50.8416 50.8416 484.864 484.864 0 0 1-441.9584 285.184A484.8128 484.8128 0 0 1 332.1344 50.3296a38.4 38.4 0 0 1 43.008 7.8336zM280.0128 171.1616A408.0128 408.0128 0 1 0 852.8384 743.936 484.8128 484.8128 0 0 1 280.064 171.1616z"})}));l.displayName="MoonIcon"},37973:(e,t,r)=>{function n(e){let t=Number(e);return Number.isFinite(t)?t:0}function a(e){let t=n(e.previousTriggerPrice),r=n(e.nextTriggerPrice),a=n(e.comparePrice);return!!t&&!!r&&!!a&&(t<=a&&r>=a||t>=a&&r<=a)}r.d(t,{C:()=>a})},39042:(e,t,r)=>{r.d(t,{N7:()=>c,cS:()=>s,fb:()=>o});var n=r(79237),a=r(46540),i=r(51430),l=r(81407);function s(e){let{filledQuantity:t,quantity:r}=e,n=(0,i.qQ)(Number(t)/Number(r)*100,2);return isNaN(Number(n))?"--":"".concat(n,"%")}function o(e){var t;return null==(t=e)||""===String(t).trim()?"--":isNaN(Number(e))?String(e):(0,l.ac)(e)}function c(e,t){let r=e.orderType,i=(0,l.Tz)(r,t.orderType);
1switch(r){case"planLimit":return t.limitOrderType[e.planType||""]||i;case"planMarket":return t.marketOrderType[e.planType||""]||i;case"postOnly":default:return i;case"fok":return(0,n.jsx)(a.Tooltip,{content:i,side:"top",children:(0,n.jsx)("span",{className:"cursor-help",children:"FOK"})});case"ioc":return(0,n.jsx)(a.Tooltip,{content:i,side:"top",children:(0,n.jsx)("span",{className:"cursor-help",children:"IOC"})})}}},39450:(e,t,r)=>{r.d(t,{E:()=>o});var n=r(79237),a=r(19490),i=r(90477);function l(e){let{items:t,side:r,precision:l,getQuantity:o,onDepthFill:c,...d}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex min-h-0 flex-1 flex-col","sell"===r?"justify-end":void 0),children:t.map((e,t)=>{let i=o(e.quantity,"",e.price),u=o(e.total,"",e.price);return(0,n.jsx)(s,{item:e,side:r,quantityValue:i,quantityText:(0,a.x0)(i,l),totalValue:u,totalText:(0,a.x0)(u,l),onDepthFill:c,...d},"".concat(r,"-").concat(e.price,"-").concat(t))})})}function s(e){let{item:t,side:r,max:l,onDepthFill:s,quantityValue:o,quantityText:c,totalValue:d,totalText:u,variant:m}=e,p="pc"===m,x=l>0?Math.min(Number(t.quantity)/l*100,100):0,g=s?"cursor-pointer hover:opacity-80":"cursor-default";return(0,n.jsxs)("div",{className:(0,i.cn)("relative h-[20px] items-center",p?"grid grid-cols-3 gap-[2px]":"flex gap-3"),children:[(0,n.jsx)("div",{className:(0,i.cn)("absolute top-0 right-0 h-full","sell"===r?"bg-p3/10":"bg-p2/10"),style:{width:"".concat(x,"%")}}),(0,n.jsx)("button",{type:"button",onClick:()=>null==s?void 0:s({price:t.price},r),"aria-disabled":!s,className:(0,i.cn)("relative z-10 min-w-0 truncate text-left",p?"text-c12":"text-c11","sell"===r?"text-p3":"text-p2",p?void 0:"w-[62px] shrink-0",g),children:(0,a.iT)(t.price)}),(0,n.jsx)("button",{type:"button",onClick:()=>null==s?void 0:s({price:t.price,quantity:o},r),"aria-disabled":!s,className:(0,i.cn)("text-t1 relative z-10 min-w-0 flex-1 truncate text-right",p?"text-c12":"text-c11",g),children:c}),p?(0,n.jsx)("button",{type:"button",onClick:()=>null==s?void 0:s({price:t.price,quantity:d},r),"aria-disabled":!s,className:(0,i.cn)("text-c12 text-t1 relative z-10 min-w-0 flex-1 truncate text-right",g),children:u}):null]})}function o(e){let{variant:t,asks:r,bids:a,showAskList:i=!0,showBidList:s=!0,max:o,onDepthFill:c,precision:d,getQuantity:u,centerSlot:m}=e;return(0,n.jsxs)("div",{className:"gap-s2 flex h-full min-h-0 flex-col md:gap-0",children:[i?(0,n.jsx)(l,{items:r,side:"sell",variant:t,max:o,onDepthFill:c,precision:d,getQuantity:u}):null,(0,n.jsx)("div",{className:"shrink-0",children:m}),s?(0,n.jsx)(l,{items:a,side:"buy",variant:t,max:o,onDepthFill:c,precision:d,getQuantity:u}):null]})}},39679:(e,t,r)=>{r.d(t,{$w:()=>o,IQ:()=>l,Ir:()=>x,JF:()=>s,Op:()=>g,TR:()=>d,_j:()=>h,az:()=>b,m6:()=>m,p0:()=>u,tt:()=>p});var n=r(122);function a(e,t){return e&&t?new n.A(e).mul(t).toNumber():0}function i(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UP";if(!Number.isFinite(e))return 0;let a=l(null==t?void 0:t.precision,2),i=String((null==t?void 0:t.minPriceChange)||""),s="UP"===r?n.A.ROUND_UP:n.A.ROUND_DOWN,o=new n.A(e).toDecimalPlaces(a,s).toFixed(a);if(i.endsWith("5")){let e=o.slice(-1),t=o.slice(0,-1);o="".concat(t).concat(5>Number(e)?"0":"5")}return Number(o)}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=Number(e);return Number.isFinite(r)?r:t}function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;if(""===e)return"";if(!/^\d*\.?\d*$/.test(e))return null;let[r,n=""]=e.split(".");return n.length>t?null:e}function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return""===e||"-"===e?e:Number.isNaN(Number(e))||(e.split(".")[1]||"").length>t?null:e}function c(e){return e.replace(/[^\d.]+/g,"")}function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8,r=function(e,t){let r=e.split(".");if(r.length>2)return null;let[n,a=""]=r;return a.length<=t?e:"".concat(n,".").concat(a.slice(0,t))}(c(e),t);if(null===r)return null;let n=Number(r);return!Number.isNaN(n)&&n>=0&&n<1e8?r:null}function u(e){let t=c(e.value);if("1"===e.tradeUnit){let e=parseInt(t,10);return Number.isNaN(e)?"":e<1e10?String(e):null}let r=Number(t);if(Number.isNaN(r)||r<0||r>=1e10)return null;var a=e.precision;if(!t)return t;let i=t.toString().replace(/^0+(\d+)/,"$1"),[,l=""]=i.split(".");return l.length>=a&&(i=new n.A(i).toDecimalPlaces(a,n.A.ROUND_DOWN).toString()),i}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return"-"===e?e:s(e,t)}function p(e){let{orderType:t,orderPrice:r,triggerPrice:n,lastPrice:a=0}=e;return"limit"===t||"postOnly"===t?Number(r||0)||a:"planLimit"===t?Number(r||0)||Number(n||0)||a:"planMarket"===t&&Number(n||0)||a}function x(e){let{orderbook:t,lastPrice:r=0,orderType:n,orderPrice:l,triggerPrice:s,contract:o}=e,c=(null==t?void 0:t.asks)||[],d=(null==t?void 0:t.bids)||[],u=c.length?c[c.length-1]:void 0,m=d[0]?Number(d[0].price):0,p=u?Number(u.price):0,x=Number(l||0
1),g=Number(s||0),h="planLimit"===n?x||g||r:x,b=Number(null==o?void 0:o.costPriceMultiplier),y=0,f=0;return"market"===n?p&&m?(y=a(p,b),f=a(m,b)):(y=r,f=r):"planMarket"===n?p&&m?(y=g?a(g,b):0,f=g?a(g,b):0):(y=g,f=g):p&&m?h>=p?(y=a(h,b),f=a(h,b)):h<=m?(y=a(h,b),f=h?a(m,b):0):(y=a(h,b),f=a(h,b)):(y=h,f=h),{buy:i(y,o),sell:i(f,o)}}function g(e){let{quantityCont:t,longLeverage:r,shortLeverage:a,prices:i,contract:l,siteConfig:s}=e,o=Number((null==l?void 0:l.multiplier)||0),c=Number((null==s?void 0:s.takerFeeRate)||0),d=new n.A(t).mul(2).mul(o).mul(i.buy).mul(c),u=new n.A(t).mul(2).mul(o).mul(i.sell).mul(c),m=r?new n.A(t).mul(o).mul(i.buy).div(r):new n.A(0),p=a?new n.A(t).mul(o).mul(i.sell).div(a):new n.A(0);return{buy:d.plus(m).toDecimalPlaces(10,n.A.ROUND_FLOOR).toNumber(),sell:u.plus(p).toDecimalPlaces(10,n.A.ROUND_FLOOR).toNumber()}}function h(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=e.find(e=>t>=e.levelMin&&t<=e.levelMax);return Number((null==r?void 0:r.quantityMax)||0)}function b(e){let{availableBalance:t,costOne:r}=e;return t<=0?{buy:0,sell:0}:{buy:r.buy?new n.A(t).div(r.buy).toDecimalPlaces(0,n.A.ROUND_FLOOR).toNumber():0,sell:r.sell?new n.A(t).div(r.sell).toDecimalPlaces(0,n.A.ROUND_FLOOR).toNumber():0}}},39720:(e,t,r)=>{r.d(t,{A7:()=>g,AZ:()=>l,I0:()=>c,Po:()=>b,RE:()=>v,aW:()=>p,bf:()=>d,c6:()=>o,cl:()=>f,ic:()=>s,jo:()=>x,l$:()=>m,sZ:()=>y,u1:()=>i,wy:()=>u,zr:()=>h});var n=r(59292),a=r(10935);let i=e=>n.request.get("/api/usdt-rouse-api/grants/list",e),l=e=>n.request.get("/api/usdt-rouse-api/activity/reward/records",e),s=e=>n.request.post("/api/usdt-rouse-api/grants/use",e),o=e=>n.request.post("/api/usdt-rouse-api/grants/cash/apply",e),c=e=>n.request.post("/api/usdt-rouse-api/grants/cash/get",e),d=e=>n.request.get("/api/usdt-rouse-api/grants/deposit/info",e),u=e=>n.request.post("/api/usdt-rouse-api/activity/reward/record/use",e),m=e=>n.request.get("/api/usdt-rouse-api/activity/reward/record/usedDetail",e),p=e=>n.request.get("/api/usdt-rouse-api/activity/reward/record/orderHiss",e),x=e=>n.request.get("/api/usdt-rouse-api/profit/plus/order/list",e),g=e=>n.request.get("/api/usdt-rouse-api/grants/pnlRecord",e),h=e=>n.request.get("/api/usdt-rouse-api/grants/pnl/record",e),b=e=>n.request.get("/api/usdt-rouse-api/grants/deposit/lossRecord",e),y=e=>n.request.post("/api/usdt-rouse-api/grants/position/open",{...e,body:e.params,params:void 0,requestType:a.Yw.JsonString}),f=e=>n.request.get("/api/exchange-account-center-api/asset/totalPreestimate",e);function v(e){return n.request.get("/api/usdt-rouse-api/usdt-siml/activity/info",e)}},39824:(e,t,r)=>{r.d(t,{E:()=>s});var n=r(79237),a=r(30511),i=r(66960);function l(e){let{gotoLogin:t,gotoRegister:r}=e,{$t:a}=(0,i.B)();return(0,n.jsxs)("div",{className:"text-mm14 text-t3 md:text-b14 flex min-h-[180px] items-center justify-center gap-1 px-4 py-20 text-center md:h-full md:min-h-0 md:gap-[6px] md:px-0 md:py-0",children:[(0,n.jsx)("button",{type:"button",onClick:()=>t(),className:"text-p1-dark hover:text-p1/80",children:a("Log In")}),(0,n.jsx)("span",{children:a("or")}),(0,n.jsx)("button",{type:"button",onClick:()=>r(),className:"text-p1-dark hover:text-p1/80",children:a("Register Now")}),(0,n.jsx)("span",{children:a("to trade")})]})}function s(e){let{children:t,gotoLogin:r,gotoRegister:i,isLogged:s,userReady:o}=e;return o?s?t:(0,n.jsx)(l,{gotoLogin:r,gotoRegister:i}):(0,n.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,n.jsx)(a.t,{size:"l"})})}},40056:(e,t,r)=>{r.d(t,{u:()=>d});var n=r(28824),a=r(12733),i=r(17883),l=r(4390),s=r(77222),o=r(38113),c=r(5408);function d(e){let t=(0,s.useParams)(),r="string"==typeof(null==t?void 0:t.locale)?t.locale:void 0,d=(0,a.bZ)(t=>t.symbolsConfigBySymbol[e]),u=!!(e&&(0,i.cL)(d)),[m,p]=(0,o.useState)(Date.now()),{data:x,dataUpdatedAt:g,refetch:h}=(0,l.useQuery)({queryKey:["futures-contract-market-session",r,e],queryFn:()=>(0,n.vc)({...r?{locale:r}:{}
1,params:{symbol:e}}),enabled:u,refetchOnWindowFocus:!0,staleTime:1e4}),b=(0,o.useMemo)(()=>(null==x?void 0:x.code)===200?(0,c.sw)(x.data):null,[x]);return(0,o.useEffect)(()=>{p(Date.now())},[e,g]),(0,o.useEffect)(()=>{if(!(null==b?void 0:b.nextMarketStatusStartTime))return;let e=window.setInterval(()=>{p(Date.now())},1e3);return()=>window.clearInterval(e)},[null==b?void 0:b.nextMarketStatusStartTime]),(0,o.useEffect)(()=>{(null==b?void 0:b.nextMarketStatusStartTime)&&0>=(0,c.Ad)(b,m)&&h()},[b,m,h]),(0,o.useMemo)(()=>({data:b}),[b])}},40249:(e,t,r)=>{r.d(t,{f:()=>x});var n=r(749),a=r(26212),i=r(41760),l=r(96620),s=r(13288),o=r(38113),c=r(43129),d=r(33149),u=r(95496),m=r(92413),p=r(27644);function x(e){let{symbol:t,panelHeight:r,centerHeight:x,rowHeight:g,dualSideFallbackRows:h,singleSideFallbackRows:b,reservedHeight:y=0,roundMode:f="floor"}=e,v=(0,m.T)(),N=t||v,j=(0,c.J)(e=>e.orderBookView),C=(0,c.J)(e=>e.mergedPrec),w=(0,u.yx)(e=>e.items),T=function(){let e=(0,c.J)(e=>e.strategyMode),t=(0,d.T)(e=>e.actions.onNumberFieldChange),r=(0,d.T)(e=>e.actions.onQuantityModeChange);return(0,o.useMemo)(()=>{if(e!==n.n1.Grid)return e=>{let{price:n,quantity:a}=e;n&&(t("orderPrice")(String(n)),void 0!==a&&(r("quantity"),t("quantity")(String(a))))}},[t,r,e])}(),{unit:k}=(0,p.A)({symbol:N}),P="buy"!==j,S="sell"!==j,L=P&&S?h:b,M=(0,i.pj)(l.p.USDT.ORDER_BOOK(N))||{asks:[],bids:[]},O=a.ep.getConfig(N),_=null==O?void 0:O.precision,A=C[N],I=(0,s.g$)(M.asks,"ask",_,A),q=(0,s.g$)(M.bids,"bid",_,A),U=w.filter(e=>e.symbol===N),{newAsks:E,newBids:Q}=(0,s.YI)(I,q,U,_,A),D=(0,s.Lu)(Q.slice(0,20)),R=(0,s.Lu)(E.slice(-20)),z=Number(D)?Number((100*D/(D+R)).toFixed(0)):0,B=Number(R)?100-Number(z):0,F=function(e){let{panelHeight:t,centerHeight:r,rowHeight:n,dualSide:a,fallbackRows:i,reservedHeight:l=0,roundMode:s="floor"}=e;if(t<=0)return i;let o=Math.max(t-r-l,0);return Math.max(("ceil"===s?Math.ceil:Math.floor)((a?o/2:o)/n),1)}({panelHeight:r,centerHeight:x,rowHeight:g,dualSide:P&&S,fallbackRows:L,reservedHeight:y,roundMode:f}),H=(0,o.useMemo)(()=>P?E.slice(-F).map(e=>({...e,side:"sell"})):[],[E,P,F]),V=(0,o.useMemo)(()=>S?Q.slice(0,F).map(e=>({...e,side:"buy"})):[],[Q,S,F]),Z=(0,o.useMemo)(()=>Math.max(0,...[...V,...H].map(e=>Number(e.quantity)||0)),[H,V]);return{symbol:N,orderBookView:j,showAskList:P,showBidList:S,unit:k,buyRatio:z,sellRatio:B,visibleRows:F,visibleAskList:H,visibleBidList:V,max:Z,handleDepthFill:T}}},40394:(e,t,r)=>{r.d(t,{k:()=>n});function n(e,t){return"Cont"===e?t("Cont"):e}},40472:(e,t,r)=>{r.d(t,{L5:()=>S,N7:()=>w,RH:()=>P,WE:()=>M,X0:()=>T,Z7:()=>C,aF:()=>L,tf:()=>k});var n=r(79237),a=r(51924),i=r(55872),l=r(7370),s=r(46540),o=r(93924),c=r(66960),d=r(10935),u=r(90477),m=r(81407),p=r(32523),x=r(18006),g=r(38113),h=r(21219),b=r(25749),y=r(39422),f=r(28373),v=r(39731);let N="text-t4 hover:text-t1 flex size-5 items-center justify-center rounded-none border-0 bg-transparent p-0 transition-colors",j="text-t1 hover:text-p1 flex size-[14px] shrink-0 items-center justify-center rounded-none border-0 bg-transparent p-0 transition-colors disabled:cursor-not-allowed disabled:opacity-40 [&_svg]:size-3.5";function C(e,t){let r=(0,m.Tz)(e.triggerWay,t.triggerWay),n=(0,m.Tz)(e.triggerDirection,t.triggerDirection),a=(0,m.ac)(e.triggerPrice);return"".concat(r).concat(n).concat(a)}function w(e,t){let r=e.orderType,a=(0,m.Tz)(r,t.orderType);switch(r){case"planLimit":return t.limitOrderType[e.planType||""]||a;case"planMarket":return t.marketOrderType[e.planType||""]||a;case"postOnly":default:return a;case"fok":return(0,n.jsx)(s.Tooltip,{content:a,side:"top",children:(0,n.jsx)("span",{className:"cursor-help",children:"FOK"})});case"ioc":return(0,n.jsx)(s.Tooltip,{content:a,side:"top",children:(0,n.jsx)("span",{className:"cursor-help",children:"IOC"})})}}function T(e){var t;let{item:r,isEditing:s,isSubmitting:o,onStartEdit:c,onCancelEdit:d,onConfirmEdit:p}=e,[x,h]=g.useState(String(null!=(t=r.contQuantity)?t:""));return(g.useEffect(()=>{if(s){var e;h(String(null!=(e=r.contQuantity)?e:""))}},[s,r.contQuantity]),s)?(0,n.jsxs)("div",{className:(0,u.cn)("border-p1 flex h-8 items-center gap-1 rounded-r1 border bg-transparent px-2","w-[116px] whitespace-nowrap"),children:[(0,n.jsx)("button",{type:"button","aria-label":"Cancel trigger order quantity edit",disabled:o,onClick:d,className:j,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),(0,n.jsx)("input",{autoFocus:!0,value:x,onChange:e=>h(e.target.value.replace(/[^\d]+/g,"")),className:"text-m12 text-t1 min-w-0 flex-1 border-0 bg-transparent p-0 text-center leading-4 font-medium outline-none placeholder:text-t4"}),(0,n.jsx)("button",{type:"button","aria-label":"Confirm trigger order quantity edit",disabled:o,onClick:()=>null==p?void 0:p(x),className:j,children:(0,n.jsx)(i.S,{className:"size-3.5"})})]}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default whitespace-nowrap",children:(0,m.ac)(r.contQuantity)}),r.planId&&"waitTrigger"===r.status?(0,n.jsx)("button",{type:"button","aria-label":"Edit trigger order quantity",onClick:()=>{var e;h(String(null!=(e=r.contQuantity)?e:"")),null==c||c()},className:N,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function k(e){var t;let{item:r,isEditing:s,isSubmitting:o,onStartEdit:d,onCancelEdit:m,onConfirmEdit:x}=e,{$t:h}=(0,c.B)(),[b,y]=g.useState(String(null!=(t=r.triggerPrice)?t:""));return(g.useEffect(()=>{if(s){var e;y(String(null!=(e=r.triggerPrice)?e:""))}},[s,r.triggerPrice]),s)?(0,n.jsx)(p.ho,{autoFocus:!0,value:b,symbol:r.symbol,disabled:o,onChange:y,className:(0,u.cn)("rounded-r1 border-p1 h-8 w-[160px] border bg-transparent px-2","[&_input]:text-m12 [&_input]:text-t1 [&_input]:placeholder:text-t4 [&_input]:border-0 [&_input]:bg-transparent [&_input]:p-0 [&_input]:text-center [&_input]:leading-4 [&_input]:font-medium [&_input]:outline-none","[&_svg]:size-3.5"),prefix:(0,n.jsx)("button",{type:"button","aria-label":"Cancel trigger order trigger price edit",disabled:o,onClick:m,className:j,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),suffix:(0,n.jsx)("button",{type:"button","aria-label":"Confirm trigger order trigger price edit",disabled:o,onClick:()=>null==x?void 0:x(b),className:j,children:(0,n.jsx)(i.S,{className:"size-3.5"})})}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default whitespace-nowrap",children:C(r,{triggerWay:{latest:h("Last Price"),mark:h("Mark Price")},triggerDirection:{gt:">=",eq:"=",lt:"<="}})}),r.planId&&"waitTrigger"===r.status?(0,n.jsx)("button",{type:"button","aria-label":"Edit trigger order trigger price",onClick:()=>{var e;y(String(null!=(e=r.triggerPrice)?e:"")),null==d||d()},className:N,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function P(e){var t,r;let{item:s,isEditing:o,isSubmitting:d,onStartEdit:x,onCancelEdit:h,onConfirmEdit:b}=e,{$t:y}=(0,c.B)(),f=null==(t=s.orderType)?void 0:t.toLowerCase().includes("market"),[v,C]=g.useState(String(null!=(r=s.orderPrice)?r:""));return(g.useEffect(()=>{if(o){var e;C(String(null!=(e=s.orderPrice)?e:""))}},[o,s.orderPrice]),o)?(0,n.jsx)(p.ho,{autoFocus:!0,value:v,symbol
1:s.symbol,disabled:d,onChange:C,className:(0,u.cn)("rounded-r1 border-p1 h-8 w-[160px] border bg-transparent px-2","[&_input]:text-m12 [&_input]:text-t1 [&_input]:placeholder:text-t4 [&_input]:border-0 [&_input]:bg-transparent [&_input]:p-0 [&_input]:text-center [&_input]:leading-4 [&_input]:font-medium [&_input]:outline-none","[&_svg]:size-3.5"),prefix:(0,n.jsx)("button",{type:"button","aria-label":"Cancel trigger order price edit",disabled:d,onClick:h,className:j,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),suffix:(0,n.jsx)("button",{type:"button","aria-label":"Confirm trigger order price edit",disabled:d,onClick:()=>null==b?void 0:b(v),className:j,children:(0,n.jsx)(i.S,{className:"size-3.5"})})}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default whitespace-nowrap",children:(0,m.Iz)({marketLabel:y("Market"),orderPrice:s.orderPrice,orderType:s.orderType})}),!f&&s.planId&&"waitTrigger"===s.status?(0,n.jsx)("button",{type:"button","aria-label":"Edit trigger order price",onClick:()=>{var e;C(String(null!=(e=s.orderPrice)?e:"")),null==x||x()},className:N,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function S(e){let{item:t,onBeforeOpen:r}=e,a=(0,b.ve)();return(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default whitespace-nowrap",children:(0,m.iN)({takeProfit:t.tpTriggerPrice,stopLoss:t.slTriggerPrice})}),"waitTrigger"===t.status?(0,n.jsx)("button",{type:"button","aria-label":"Edit trigger order TP/SL",onClick:()=>{t.planId&&(null==r||r(),a.showLayer({type:"triggerOrder",item:t}))},disabled:!t.planId,className:"text-t3 hover:text-t2 disabled:text-t4 inline-flex cursor-pointer items-center transition-colors disabled:cursor-not-allowed",children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function L(e){let{item:t,buttonClassName:r}=e,{$t:a,locale:i}=(0,c.B)(),l=(0,h.T)(),s=(0,x.useMutation)({mutationFn:async e=>(0,y.Pr)({locale:i,requestType:d.Yw.JsonString,body:{planId:String(e)}}),onSuccess:async e=>{(null==e?void 0:e.code)===200&&((0,o.toast)({type:"success",title:a("Success")}),await Promise.all([(0,f.hT)({locale:i,symbol:l}),(0,v.JH)()]))}});return"waitTrigger"!==t.status?(0,n.jsx)("span",{className:"text-c12 text-t3 cursor-default whitespace-nowrap",children:"--"}):(0,n.jsx)("button",{type:"button",disabled:!t.planId||s.isPending,onClick:()=>{t.planId&&!s.isPending&&s.mutate(t.planId)},className:(0,u.cn)("text-c12 text-p1-dark hover:text-p1/80 disabled:text-t4 transition-colors disabled:cursor-not-allowed",r),children:a("Cancel")})}function M(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Full Position";return"position"===e.tpslType?t:"".concat((0,m.ac)(e.triggerQuantity),"/").concat((0,m.ac)(e.quantity)," ").concat(e.unit||"").trim()}},41387:(e,t,r)=>{r.d(t,{Z:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,n.jsx)("path",{d:"M512 128a42.666667 42.666667 0 0 1 42.666667 42.666667v579.669333l183.168-183.168a42.666667 42.666667 0 0 1 60.330666 60.330667l-256 256a42.666667 42.666667 0 0 1-60.330666 0l-256-256a42.666667 42.666667 0 1 1 60.330666-60.330667L469.333333 750.336V170.666667a42.666667 42.666667 0 0 1 42.666667-42.666667z"})}));l.displayName="ArrowDownIcon"},41445:(e,t,r)=>{r.d(t,{t:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,n.jsx)("path",{d:"M485.333333 77.226667a28.8 28.8 0 0 1 53.333334 0l108.928 261.973333a28.885333 28.885333 0 0 0 24.32 17.664l282.88 22.698667c25.6 2.048 35.925333 33.962667 16.426666 50.645333l-215.466666 184.618667a28.885333 28.885333 0 0 0-9.386667 28.586666l65.92 276.053334a28.8 28.8 0 0 1-43.093333 31.232l-242.176-147.882667a28.842667 28.842667 0 0 0-30.037334 0L254.72 950.741333a28.8 28.8 0 0 1-43.093333-31.274666l65.92-276.053334a28.8 28.8 0 0 0-9.386667-28.586666l-215.466667-184.618667a28.885333 28.885333 0 0 1 16.469334-50.645333l282.88-22.698667a28.842667 28.842667 0 0 0 24.32-17.664l108.928-261.973333z"})}));l.displayName="FavoriteOnIcon"},43231:(e,t,r)=>{r.d(t,{K:()=>L});var n=r(79237),a=r(90477),i=r(12733),l=r(17883),s=r(40056),o=r(92413),c=r(50791),d=r(74494);function u(e){return"CN_STOCK"===e?"CN":"HK_STOCK"===e?"HK":null}function m(e){return"OPENING_AUCTION"===e||"REGULAR_MARKET"===e||"MIDDAY_BREAK"===e||"MARKET_CLOSED"===e}function p(e){return"number"==typeof e&&Number.isFinite(e)&&e>0}let x=["auction","morning","midday","afternoon"];function g(e,t){var r,n,a;let i=null!=(a=null==e?void 0:e.items)?a:[];if(!Array.isArray(i))throw Error("Invalid CN/HK session list");if(!i.length)return{timezoneLabel:t,items:[]};if(i.length!==x.length)throw Error("Invalid CN/HK session count");let l=x.map((e,t)=>{var r;let n=i[t];if(!n||n.title!==d.yf[e]||!(null==(r=n.timeDesc)?void 0:r.trim())||"LOW"!==n.liquidityLevel&&"HIGH"!==n.liquidityLevel)throw Error("Invalid CN/HK session configuration");return{id:e,timeRange:n.timeDesc,liquidityLevel:n.liquidityLevel}}
1);return{timezoneLabel:(null==(n=l[0])||null==(r=n.timeRange.match(/\s+(\(UTC[^)]*\)|CST|HKT)$/))?void 0:r[1])||t,items:l}}var h=r(12407),b=r(38113),y=r(11834),f=r(28824),v=r(14275),N=r(4390),j=r(77222);function C(){return JSON.stringify([Intl.DateTimeFormat().resolvedOptions().timeZone,new Date().getTimezoneOffset()])}function w(e){return e.data?{state:"ready",data:e.data}:e.isError?{state:"error"}:e.isPending?{state:"loading"}:{state:"empty"}}var T=r(66411);let k=(0,h.default)(()=>r.e(2287).then(r.bind(r,32287)),{loadableGenerated:{webpack:()=>[32287]},ssr:!1});function P(e){let{snapshot:t,refresh:r}=e;return(0,y._)(t,r),null}function S(e){var t;let{market:r,symbol:i,className:l}=e,[s,o]=(0,b.useState)(!1),c=function(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=(0,j.useParams)(),a="string"==typeof(null==n?void 0:n.locale)?n.locale:void 0,i=function(){let[e,t]=(0,b.useState)(C);return(0,b.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&t(C())};window.addEventListener("focus",e),document.addEventListener("visibilitychange",e);let r=window.setInterval(e,3e4);return()=>{window.clearInterval(r),window.removeEventListener("focus",e),document.removeEventListener("visibilitychange",e)}},[]),e}(),l=(0,b.useMemo)(()=>({market:e,symbol:t,contextKey:JSON.stringify([a,i])}),[e,t,a,i]),s=(0,v.useQueryClient)(),o=["cn-hk-market-session",e,t,l.contextKey],c=(0,N.useQuery)({queryKey:o,enabled:!!t,queryFn:async()=>{var e;let r=await (0,f.vc)({...a?{locale:a}:{}
1,params:{symbol:t}});if(200!==r.code)throw Error("CN/HK market session request failed");let n=function(e,t,r){if(!e)return null;if(u(e.contractScope)!==t.market||!p(e.timestamp))throw Error("Invalid CN/HK session identity or timestamp");let n=m(e.currentMarketStatus)?e.currentMarketStatus:"UNKNOWN";if("UNKNOWN"!==n&&"HIGH"!==e.liquidityLevel&&"LOW"!==e.liquidityLevel)throw Error("Invalid CN/HK liquidity level");let a=m(e.nextMarketStatus)&&p(e.nextMarketStatusStartTime)?{status:e.nextMarketStatus,startsAtMs:e.nextMarketStatusStartTime}:void 0,i="OPENING_AUCTION"===n?"auction":"MIDDAY_BREAK"===n?"midday":"REGULAR_MARKET"===n&&(null==a?void 0:a.status)==="MIDDAY_BREAK"?"morning":"REGULAR_MARKET"===n&&(null==a?void 0:a.status)==="MARKET_CLOSED"?"HK"===t.market&&"HALF_DAY"===e.specialTag?"morning":"afternoon":void 0;return{...t,status:n,liquidityLevel:"UNKNOWN"===n?"LOW":"HIGH"===e.liquidityLevel?"HIGH":"LOW",serverTimeMs:e.timestamp,receivedAtMonotonicMs:r,next:a,currentSessionId:i,specialTag:"HALF_DAY"===e.specialTag||"HOLIDAY"===e.specialTag||"WEEKEND"===e.specialTag?e.specialTag:void 0}}(r.data,l,performance.now());return n?(0,d.xz)(n,null!=(e=s.getQueryData(o))?e:void 0):null},staleTime:1e4,retry:!1,refetchOnWindowFocus:!0}),x=(0,N.useQuery)({queryKey:["cn-hk-market-session-config",e,t,l.contextKey],enabled:!!(t&&r),queryFn:async()=>{let e=await (0,f.TH)({...a?{locale:a}:{}
1,params:{symbol:t}});if(200!==e.code)throw Error("CN/HK session config request failed");var r=e.data,n=Intl.DateTimeFormat().resolvedOptions().timeZone;if(!r)return null;if(u(r.contractScope)!==l.market)throw Error("Invalid CN/HK config identity");return{...l,groups:{local:g(r.local,n),market:g(r.market,"CN"===l.market?"CST":"HKT")}}},staleTime:3e5,retry:!1,refetchOnWindowFocus:!1}),{refetch:h}=c,{refetch:y}=x,T=(0,b.useCallback)(async()=>{await h({throwOnError:!0,cancelRefetch:!1})},[h,l]),k=(0,b.useCallback)(async()=>{await y({throwOnError:!0,cancelRefetch:!1})},[y,l]);return{...l,status:w(c),config:w(x),onRefreshStatus:T,onRefreshConfig:k}}(r,i,s);if("ready"!==c.status.state)return null;let x=c.status.data,h=e=>{e.stopPropagation(),e.currentTarget.blur(),o(!0)};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(P,{snapshot:x,refresh:c.onRefreshStatus},c.contextKey),(0,n.jsx)("span",{role:"button",tabIndex:0,"data-component":"CnHkLiquidityBadge",className:(0,a.cn)("border-l1 rounded-r1 hover:bg-bg2 inline-flex h-[18px] shrink-0 cursor-pointer items-center border px-1 transition-colors",l),onClick:h,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),h(e))},children:(0,n.jsx)(T.u,{level:null!=(t=x.liquidityLevel)?t:(0,d.LE)(x.status),size:"badge",className:"text-t2"})}),s&&(0,n.jsx)("div",{onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:(0,n.jsx)(k,{...c,open:s,onOpenChange:o})})]})}function L(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,o.T)(),r=(0,i.bZ)(e=>e.symbolsConfigBySymbol[t]),a=u(null==r?void 0:r.contractScope);return a?(0,l.cL)(r)?(0,n.jsx)(S,{market:a,symbol:t,...e},"".concat(a,":").concat(t)):null:(0,n.jsx)(M,{...e})}function M(){let{className:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,o.T)(),r=(0,c.Te)(),{data:i}=(0,s.u)(t);if(!i)return null;let l=e=>{e.stopPropagation(),e.currentTarget.blur(),r.showLayer({initialData:i})},d=(0,a.cn)("border-l1 rounded-r1 hover:bg-bg2 inline-flex h-[18px] shrink-0 cursor-pointer items-center border px-1 transition-colors",e),u=(0,n.jsx)(T.u,{level:i.liquidityLevel,size:"badge",className:"text-t2"});return(0,n.jsx)("span",{role:"button",tabIndex:0,"data-component":"LiquidityBadge",className:d,onClick:l,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),l(e))},children:u})}},44844:(e,t,r)=>{r.d(t,{q:()=>c});var n=r(28598),a=r(22354),i=r(11529),l=r(39731),s=r(31150);function o(e,t){if(!t)return;let r=(0,n.Hp)(t)||t;switch(e){case"openOrders":return a.yx.getState().hideOther?r:void 0;case"triggerOrders":return s.a5.getState().hideOther?r:void 0;case"ordersHistory":return i.dw.getState().hideOther?r:void 0;case"tpsl":return l.hv.getState().hideOther?r:void 0;default:return}}async function c(e,t){var r,n,c,d;let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(e){case"positions":return;case"openOrders":await (0,a.j6)({pageNum:null!=(r=u.pageNum)?r:a.yx.getState().pagination.pageNum,symbol:o("openOrders",t)});return;case"triggerOrders":await (0,s.WJ)({pageNum:null!=(n=u.pageNum)?n:s.a5.getState().pagination.pageNum,symbol:o("triggerOrders",t)});return;case"ordersHistory":await (0,i.k2)({pageNum:null!=(c=u.pageNum)?c:i.dw.getState().pagination.pageNum,symbol:o("ordersHistory",t)});return;case"tpsl":await (0,l.JH)({pageNum:null!=(d=u.pageNum)?d:l.hv.getState().pagination.pageNum,symbol:o("tpsl",t)});return}}},45328:(e,t,r)=>{r.d(t,{X:()=>o});var n=r(79237),a=r(70659),i=r(66960),l=r(90477),s=r(51025);function o(){let{className:e,buttonClassName:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{gotoLogin:r,gotoRegister:o}=(0,s.k)(),{$t:c}=(0,i.B)();return(0,n.jsxs)("div",{className:(0,l.cn)("gap-s2 grid grid-cols-1 py-4",e),children:[(0,n.jsx)(a.$,{size:"m",className:(0,l.cn)("h-10 w-full font-semibold",t),onClick:()=>o(),children:c("Register")}),(0,n.jsx)(a.$,{variant:"secondary",size:"m",className:(0,l.cn)("h-10 w-full font-semibold",t),onClick:()=>r(),children:c("Log In")})]})}},45341:(e,t,r)=>{r.d(t,{N:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>
1(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,n.jsx)("path",{d:"M85.333333 512C85.333333 276.352 276.352 85.333333 512 85.333333a425.472 425.472 0 0 1 301.781333 125.056c27.306667 27.306667 56.533333 61.056 82.218667 92.288V170.666667a42.666667 42.666667 0 1 1 85.333333 0v256a42.666667 42.666667 0 0 1-42.666666 42.666666h-256a42.666667 42.666667 0 1 1 0-85.333333h169.386666c-29.568-37.077333-66.261333-80.938667-98.602666-113.28a341.333333 341.333333 0 1 0 86.570666 336.128 42.666667 42.666667 0 0 1 81.962667 23.637333C870.613333 808.448 706.56 938.666667 512 938.666667 276.352 938.666667 85.333333 747.648 85.333333 512z"})}));l.displayName="ResetIcon"},46420:(e,t,r)=>{r.d(t,{a:()=>C});var n=r(79237),a=r(24983),i=r(85002),l=r(66960),s=r(90477),o=r(23209),c=r(99251),d=r(66249),u=r(38113),m=r(76656),p=r(32955),x=r(74709),g=r(25060),h=r(28598),b=r(40472),y=r(81407),f=r(39731),v=r(68237);function N(e){return{slot:"item",labelClassName:"text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",valueClassName:(0,s.cn)("text-cm12 text-t1 flex-1 [&_span]:!text-cm12",e)}}function j(e){return(0,h.Hp)(e)||"--"}function C(e){let{mode:t="pc"}=e,{$t:r,locale:h}=(0,l.B)(),C="h5"===t,w=(0,u.useMemo)(()=>(0,o.Y)(r),[r]),T=(0,u.useMemo)(()=>({takeProfit:r("TP"),stopLoss:r("SL")}),[r]),k=(0,x.Z)(),P=(0,p.D)(),S=(0,g.e)(),{rawItems:L,loading:M,initialized:O,pagination:_,setPageNum:A}=(0,f.hv)((0,m.k)(e=>({rawItems:e.items,loading:e.loading,initialized:e.initialized,pagination:e.pagination,setPageNum:e.setPageNum}))),I=(Array.isArray(L)?L:[]).map(e=>({...e,quantity:P(e.quantity||0,e.symbol||"",e.orderPrice),triggerQuantity:P(e.triggerQuantity||0,e.symbol||"",e.orderPrice),unit:S(e.symbol)})),q=!!(k.userReady&&k.isLogged&&!O)||!!M,U=Math.max(1,Math.ceil(Math.max(0,_.total)/Math.max(1,_.pageSize))),E=U>1||_.pageNum>1?(0,n.jsx)("div",{className:(0,s.cn)("py-s3 flex",C?"justify-center px-4":"justify-end px-[10px]"),children:(0,n.jsxs)(a.Pagination,{variant:"number",children:[(0,n.jsx)(a.PaginationItem,{type:"button",icon:"first",disabled:q||1===_.pageNum,onClick:()=>{q||1===_.pageNum||A(1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"prev",disabled:q||1===_.pageNum,onClick:()=>{q||1===_.pageNum||A(Math.max(1,_.pageNum-1))}}),(0,n.jsx)(a.PaginationItem,{type:"number",active:!0,children:_.pageNum}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"next",disabled:q||_.pageNum>=U,onClick:()=>{q||_.pageNum>=U||A(Math.min(U,_.pageNum+1))}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"last",disabled:q||_.pageNum>=U,onClick:()=>{q||_.pageNum>=U||A(U)}})]})}):null,Q=(0,u.useMemo)(()=>[{title:(0,n.jsx)("span",{className:c.CZ,children:r("Symbol")}),key:"symbol",width:152,fixed:"left",render:(e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:(0,s.cn)("h-4 w-1 rounded-[1px]","openShort"===t.direction||"closeLong"===t.direction?"bg-p3":"bg-p2")}),(0,n.jsx)(v.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:c.pd,children:j(t.symbol)})})]}),mobile:{slot:"header",label:(e,t)=>(0,n.jsx)(v.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:"text-tm14 text-t1 block min-w-0 truncate",children:j(t.symbol)})}),value:(e,t)=>"waitTrigger"===t.status?(0,n.jsx)(b.aF,{item:t,buttonClassName:"text-mm12 shrink-0"}):null,labelClassName:"min-w-0 flex-1",valueClassName:"flex-none justify-end"}},{title:(0,n.jsx)("span",{className:c.CZ,children:r("Side")}),key:"direction",width:112,render:(e,t)=>(0,n.jsx)("span",{className:(0,s.cn)(c._U,(0,y.N)(t.direction)),children:(0,y.Tz)(t.direction,w.direction)}),mobile:N()},{title:(0,n.jsx)("span",{className:c.CZ,children:r("P/L")}),key:"planType",width:88,render:(e,t)=>(0,n.jsx)("span",{className:c.pd,children:T[t.planType||""]||"--"}),mobile:N()},{title:(0,n.jsx)("span",{className:c.CZ,children:r("Type")}),key:"orderType",width:108,render:(e,t)=>(0,n.jsx)("span",{className:c.pd,children:(0,b.N7)(t,w)}),mobile:N()}
1,{title:(0,n.jsx)("span",{className:c.CZ,children:r("Trigger Conditions")}),key:"triggerCondition",width:188,render:(e,t)=>(0,n.jsx)("span",{className:c.pd,children:(0,b.Z7)(t,w)}),mobile:N()},{title:(0,n.jsx)("span",{className:c.CZ,children:r("Status")}),key:"status",width:120,render:(e,t)=>(0,n.jsx)("span",{className:c.pd,children:(0,y.Tz)(t.status,w.planStatus)}),mobile:N()},{title:(0,n.jsx)("span",{className:c.CZ,children:r("Trigger Amt./Order Amt.")}),key:"triggerAllQuantity",width:180,render:(e,t)=>(0,n.jsx)("span",{className:c.pd,children:(0,b.WE)(t,r("Full Position"))}),mobile:N()},{title:(0,n.jsx)("span",{className:c.CZ,children:r("Executed Price")}),key:"orderPrice",width:120,render:(e,t)=>(0,n.jsx)("span",{className:c.pd,children:(0,y.Iz)({marketLabel:r("Market"),orderPrice:t.orderPrice,orderType:t.orderType})}),mobile:N()},{title:(0,n.jsx)("span",{className:c.CZ,children:r("Setup Time_2")}),key:"editTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:c.pd,children:(0,y.r6)(t.editTime)}),mobile:N()},{title:(0,n.jsx)("span",{className:c.CZ,children:r("Triggering Time")}),key:"updateTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:c.pd,children:"waitTrigger"===t.status?"--":(0,y.r6)(t.updateTime)}),mobile:N()},{title:(0,n.jsx)("span",{className:"".concat(c.CZ," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",width:108,fixed:"right",render:(e,t)=>(0,n.jsx)(b.aF,{item:t}),mobile:{hidden:!0}}],[r,w,T]);return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsx)(i.AdvancedTable,{columns:Q,dataSource:I,locale:h,rowKey:(e,t)=>"".concat(e.planId||0,"-").concat(e.symbol||t),loading:q,className:C?"[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-divider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0":d.hL,outlined:!1,containerClassName:C?void 0:d.CL,tableClassName:C?void 0:"[&_tbody_tr]:!h-14",fixedCellClassName:C?void 0:d.dA,pagination:!1,scroll:C?void 0:{x:1650},responsive:C,mobileMode:C?"card":"table",mobileCardClassName:C?"bg-bg7":void 0}),E]})}},47317:(e,t,r)=>{r.d(t,{Z:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>(0,n.jsxs)(i.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:[(0,n.jsx)("path",{d:"M512 426.666667a85.333333 85.333333 0 1 0 0 170.666666 85.333333 85.333333 0 0 0 0-170.666666z m-170.666667 85.333333a170.666667 170.666667 0 1 1 341.333334 0 170.666667 170.666667 0 0 1-341.333334 0z"}),(0,n.jsx)("path",{d:"M406.784 119.509333c50.944-73.386667 159.488-73.386667 210.389333 0l54.784 79.018667a42.666667 42.666667 0 0 0 31.573334 18.218667l95.744 7.893333c89.088 7.381333 143.36 101.418667 105.216 182.186667l-41.045334 86.954666a42.666667 42.666667 0 0 0 0 36.437334l41.045334 86.912c38.144 80.810667-16.128 174.848-105.216 182.186666l-95.786667 7.936a42.666667 42.666667 0 0 0-31.530667 18.218667L617.173333 904.533333c-50.901333 73.386667-159.445333 73.386667-210.346666 0L352 825.472a42.666667 42.666667 0 0 0-31.573333-18.218667l-95.744-7.936c-89.088-7.338667-143.36-101.376-105.216-182.186666l41.045333-86.912a42.666667 42.666667 0 0 0 0-36.437334L119.466667 406.869333c-38.144-80.810667 16.128-174.848 105.216-182.186666l95.786666-7.936a42.666667 42.666667 0 0 0 31.530667-18.218667L406.784 119.466667z m140.288 48.64a42.666667 42.666667 0 0 0-70.144 0L422.186667 247.125333a128 128 0 0 1-94.634667 54.613334L231.68 309.76a42.666667 42.666667 0 0 0-35.029333 60.714667l41.002666 86.912a128 128 0 0 1 0 109.312l-41.002666 86.912a42.666667 42.666667 0 0 0 35.029333 60.714666l95.829333 7.936a128 128 0 0 1 94.634667 54.613334l54.741333 79.018666a42.666667 42.666667 0 0 0 70.144 0l54.741334-78.976a128 128 0 0 1 94.634666-54.613333l95.786667-7.978667a42.666667 42.666667 0 0 0 35.072-60.714666l-41.002667-86.912a128 128 0 0 1 0-109.312l41.002667-86.912a42.666667 42.666667 0 0 0-35.072-60.714667l-95.786667-7.936a128 128 0 0 1-94.634666-54.613333L547.072 168.106667z"})]}));l.displayName="SettingsIcon"},47562:(e,t,r)=>{r.d(t,{$:()=>i});var n=r(41809);let a=()=>({orderEntry:{availableBalanceText:"0",quoteAsset:"USDT"},quantity:{quantityMode:"quantity",quantityModeOptions:[],tradeUnitV
1alue:"coin",tradeUnitOptions:[],quantityValueHint:"",sliderPercent:0,hasDirectionalQuantity:!1},footer:{loading:!1,quoteAsset:"USDT",unitLabel:"",maxLeft:"0",maxRight:"0",costLeft:"0",costRight:"0"},dialogs:{marginDisabled:!1,settingsLoading:!1,settingsSaving:!1,maxLeverage:1,serviceSymbol:"",symbol:"",quantityCont:0,longQuantityCont:0,shortQuantityCont:0,multiplier:0,precision:2,coinPrecision:0,oneContCostBuy:0,oneContCostSell:0,lastPrice:0,markPrice:0,calcPrice:0,confirmItems:[],confirmLoading:!1,baseAsset:"BTC"}}),i=(0,n.v)(e=>({...a(),syncComputed:t=>e(t),resetComputed:()=>e(a())}))},48157:(e,t,r)=>{r.d(t,{X:()=>j});var n=r(79237),a=r(85002),i=r(66960),l=r(66249),s=r(38113),o=r(40314),c=r(72644),d=r(7370),u=r(62309),m=r(70659),p=r(90477),x=r(31483),g=r(50791),h=r(50965),b=r(97867);function y(e){let{item:t}=e,{$t:r,locale:a}=(0,i.B)(),l=(0,g.J5)(),{borderTone:c,canEditLeverage:m,handleOpenLeverage:x,handleSwitchSymbol:h,leverageText:b,leverageTone:y,symbolText:f}=(0,o.jr)(t),v=(0,s.useCallback)(()=>{l.showLayer({item:t})},[t,l]);return(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:(0,p.cn)("flex min-w-0 items-center gap-1","fa"===a?"border-r-4 pr-1":"border-l-4 pl-1",c),children:[(0,n.jsxs)("button",{type:"button",className:"text-tm14 text-t1 -my-1 -ml-1 inline-flex min-h-7 shrink-0 cursor-pointer items-center gap-1 rounded py-1 pr-0.5 pl-1",onClick:h,children:[(0,n.jsx)("span",{children:f}),(0,n.jsx)("span",{className:"text-mm14 text-t3",children:r("Perp")})]}),(0,n.jsx)("div",{className:"shrink-0",children:(0,n.jsx)(o.Vk,{item:t,barClassName:"h-3 w-[3px]"})}),m?(0,n.jsxs)("button",{type:"button",className:"text-t3 hover:text-t1 flex shrink-0 cursor-pointer items-center gap-1",onClick:x,children:[(0,n.jsx)("span",{className:(0,p.cn)("text-mm12",y),children:b}),(0,n.jsx)(d.q,{className:"size-3.5"})]}):(0,n.jsx)("span",{className:(0,p.cn)("text-mm12 shrink-0",y),children:b})]}),(0,n.jsx)("button",{type:"button",className:"text-t1 flex size-4 shrink-0 items-center justify-center",onClick:v,children:(0,n.jsx)(u.l,{className:"size-4"})})]})}function f(e){let{item:t}=e,r=(0,o._H)(t);return(0,n.jsxs)("div",{className:"flex items-center justify-end",children:[(0,n.jsx)("span",{className:(0,p.cn)("text-cm12",r.pnlClassName),children:r.pnlText}),(0,n.jsx)("span",{className:(0,p.cn)("text-cm12",r.roeClassName),children:r.roeText})]})}function v(e){var t;let{item:r}=e,{$t:a,locale:l}=(0,i.B)(),s=r.tradeType,o=r.entireTpsl||{},c=o.tp||{},d=o.sl||{},u=r.partialTpsls,p=null!=(t=null==u?void 0:u.length)?t:0;return(0,n.jsx)(m.$,{variant:"secondary",size:"s",disabled:"follower"===r.tradeType,className:"rounded-rb1 text-mm12 h-8 min-w-0 flex-1 px-3",onClick:()=>{if("follower"===r.tradeType)return;if(p>0)return void(0,g.NK)(h.k.PlanListLayer,{positionId:r.id,tradeType:r.tradeType,position:r});let e={triggerPrice_TP:c.triggerPrice,triggerPrice_SL:d.triggerPrice,triggerWay_TP:c.triggerWay,triggerWay_SL:d.triggerWay,orderPrice_TP:c.orderPrice,orderPrice_SL:d.orderPrice,orderType_TP:c.orderType,orderType_SL:d.orderType},t={...r,contQuantity:r.quantity};(0,g.NK)(h.k.PlanCloseOrder,{param:"common"===s?null:x.uj.CopyTrade,TPSLType:x.zb.Normal,isEdit:!1,onSubmitSuccess:()=>(0,b.nJ)({locale:l,symbol:r.symbol}),modelState:{values:e,position:t}})},children:p>0?"".concat(a("TP/SL"),"(").concat(p,")"):a("TP/SL")})}function N(e){let{item:t}=e,{$t:r}=(0,i.B)();return(0,n.jsxs)("div",{className:"flex w-full gap-2",children:[(0,n.jsx)(v,{item:t}),(0,n.jsx)(o.wX,{item:t,label:r("Close_r_1"),buttonClassName:"h-8 min-w-0 flex-1 rounded-rb1 px-3 text-mm12"}),(0,n.jsx)(o.em,{item:t,buttonClassName:"h-8 min-w-0 flex-1 rounded-rb1 px-3 text-mm12"})]})}function j(e){let{mode:t="pc"}=e,{locale:r}=(0,i.B)(),{isLoading:d,items:u}=(0,c.eu)(),m="h5"===t,p=!d&&0===u.length,x=(0,o.c_)(u),g=(0,o.P8)({renderers:{Header:y,PnlRoe:f,Actions:N}}),h=m?g:x,b=(0,s.useMemo)(()=>x.reduce((e,t)=>e+(t.width||120),0),[x]);return(0,n.jsx)("div",{className:"flex h-full min-h-0 flex-col",children:(0,n.jsx)(a.AdvancedTable,{columns:h,dataSource:u,locale:r,rowKey:"id",loading:d,className:m?"gap-0 [&_[data-slot=advanced-table-card-div
1ider]]:mx-4 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-2 [&_[data-slot=advanced-table-card]]:px-4 [&_[data-slot=advanced-table-card]]:py-4 [&_[data-slot=advanced-table-card]>div]:gap-0":l.hL,outlined:!1,containerClassName:m?void 0:p?l.gg:l.ih,tableClassName:m?void 0:"".concat("[&_tbody_tr:has([data-position-operation-active=true])_td]:![--table-cell-hover-overlay:var(--color-bg2)]"," [&_tbody_tr]:!h-14"),fixedCellClassName:m?void 0:l.dA,pagination:!1,scroll:m?void 0:{x:b},responsive:m,mobileMode:m?"card":"table",mobileCardClassName:m?"bg-bg7":void 0})})}},50048:(e,t,r)=>{r.d(t,{y:()=>s});var n=r(79237),a=r(31073),i=r(90160),l=r(38113);function s(e){let{symbol:t,pricePrecision:r,mergedPrec:s,setMergedPrec:o,clearMergedPrec:c,triggerClassName:d,valueContainerClassName:u,valueClassName:m,triggerSize:p}=e,x=r||1,g=s[t],h=x-2,b=(0,i.A)(g)&&g>h&&g<=x,y=b?g:x;(0,l.useEffect)(()=>{b||void 0===g||void 0===r||c(t)},[c,b,r,g,t]);let f=[];for(let e=x;e>h;e--)f.push({label:e>0?(1/Math.pow(10,e)).toFixed(e):1/Math.pow(10,e),value:"".concat(e)});return(0,n.jsxs)(a.Select,{value:"".concat(y),mobileHeaderVisible:!1,mobileSearchVisible:!1,mobileDrawerContentClassName:'max-md:[&[data-vaul-drawer-direction="bottom"]]:min-h-0',listHeight:124,onValueChange:e=>{o(t,Number(e))},children:[(0,n.jsx)(a.SelectTrigger,{size:p,className:d||"text-c12 [&>span:last-child]:ml-s1 h-[28px] w-[104px] rounded-[6px] border-none bg-transparent !px-0 focus:border-none focus:ring-0 data-[state=open]:border-none data-[state=open]:ring-0",children:(0,n.jsx)("span",{className:"flex min-w-0 flex-1 ".concat(u||"justify-end text-right"),children:(0,n.jsx)(a.SelectValue,{className:m||"block min-w-0 truncate text-right"})})}),(0,n.jsx)(a.SelectContent,{align:"end",children:f.map(e=>(0,n.jsx)(a.SelectItem,{value:e.value,children:e.label},e.value))})]})}},50962:(e,t,r)=>{r.d(t,{X:()=>j});var n=r(79237),a=r(85002),i=r(66960),l=r(66249),s=r(38113),o=r(33212),c=r(70744),d=r(7370),u=r(62309),m=r(70659),p=r(90477),x=r(31483),g=r(25749),h=r(54327),b=r(28373);function y(e){let{item:t}=e,{$t:r,locale:a}=(0,i.B)(),l=(0,g.J5)(),{borderTone:c,canEditLeverage:m,handleOpenLeverage:x,handleSwitchSymbol:h,leverageText:b,leverageTone:y,symbolText:f}=(0,o.jr)(t),v=(0,s.useCallback)(()=>{l.showLayer({item:t})},[t,l]);return(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:(0,p.cn)("flex min-w-0 items-center gap-1","fa"===a?"border-r-4 pr-1":"border-l-4 pl-1",c),children:[(0,n.jsxs)("button",{type:"button",className:"text-tm14 text-t1 -my-1 -ml-1 inline-flex min-h-7 shrink-0 cursor-pointer items-center gap-1 rounded py-1 pr-0.5 pl-1",onClick:h,children:[(0,n.jsx)("span",{children:f}),(0,n.jsx)("span",{className:"text-mm14 text-t3",children:r("Perp")})]}),(0,n.jsx)("div",{className:"shrink-0",children:(0,n.jsx)(o.Vk,{item:t,barClassName:"h-3 w-[3px]"})}),m?(0,n.jsxs)("button",{type:"button",className:"text-t3 hover:text-t1 flex shrink-0 cursor-pointer items-center gap-1",onClick:x,children:[(0,n.jsx)("span",{className:(0,p.cn)("text-mm12",y),children:b}),(0,n.jsx)(d.q,{className:"size-3.5"})]}):(0,n.jsx)("span",{className:(0,p.cn)("text-mm12 shrink-0",y),children:b})]}),(0,n.jsx)("button",{type:"button",className:"text-t1 flex size-4 shrink-0 items-center justify-center",onClick:v,children:(0,n.jsx)(u.l,{className:"size-4"})})]})}function f(e){let{item:t}=e,r=(0,o._H)(t);return(0,n.jsxs)("div",{className:"flex items-center justify-end",children:[(0,n.jsx)("span",{className:(0,p.cn)("text-cm12",r.pnlClassName),children:r.pnlText}),(0,n.jsx)("span",{className:(0,p.cn)("text-cm12",r.roeClassName),children:r.roeText})]})}function v(e){var t;let{item:r}=e,{$t:a,locale:l}=(0,i.B)(),s=r.entireTpsl||{},c=s.tp||{},d=s.sl||{},u=r.partialTpsls,p=null!=(t=null==u?void 0:u.length)?t:0;return(0,n.jsx)(m.$,{variant:"secondary",size:"s",className:"rounded-rb1 text-mm12 h-8 min-w-0 flex-1 px-3",onClick:()=>{if(p>0){let e=(0,o.ec)(r);(0,g.NK)(h.k.PlanListLayer,{positionId:r.id,tradeType:r.tradeType,isDemoTrading:!0,position:e});return}let e={triggerPrice_TP:c.triggerPrice,triggerPrice_SL:d.triggerPrice,triggerWay_TP:c.triggerWay,triggerWay_SL:d.triggerWay,orderPrice_TP:c.orderPrice,orderPrice_SL:d.orderPrice,orderType_TP:c.orderType,orderType_SL:d.orderType},t=(0,o.ec)(r);(0,g.NK)(h.k.PlanCloseOrder,{param:null,TPSLType:x.zb.Normal,isDemoTrading:!0,isEdit:!1,onSubmitSuccess:()=>
1(0,b.nJ)({locale:l,symbol:r.symbol}),modelState:{values:e,position:t}})},children:p>0?"".concat(a("TP/SL"),"(").concat(p,")"):a("TP/SL")})}function N(e){let{item:t}=e,{$t:r}=(0,i.B)();return(0,n.jsxs)("div",{className:"flex w-full gap-2",children:[(0,n.jsx)(v,{item:t}),(0,n.jsx)(o.wX,{item:t,label:r("Close_r_1"),buttonClassName:"h-8 min-w-0 flex-1 rounded-rb1 px-3 text-mm12"})]})}function j(e){let{mode:t="pc"}=e,{locale:r}=(0,i.B)(),{isLoading:d,items:u}=(0,c.eu)(),m="h5"===t,p=!d&&0===u.length,x=(0,o.c_)(u),g=(0,o.P8)({renderers:{Header:y,PnlRoe:f,Actions:N}}),h=m?g:x,b=(0,s.useMemo)(()=>x.reduce((e,t)=>e+(t.width||120),0),[x]);return(0,n.jsx)("div",{className:"flex h-full min-h-0 flex-col",children:(0,n.jsx)(a.AdvancedTable,{columns:h,dataSource:u,locale:r,rowKey:"id",loading:d,className:m?"gap-0 [&_[data-slot=advanced-table-card-divider]]:mx-4 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-2 [&_[data-slot=advanced-table-card]]:px-4 [&_[data-slot=advanced-table-card]]:py-4 [&_[data-slot=advanced-table-card]>div]:gap-0":l.hL,outlined:!1,containerClassName:m?void 0:p?l.gg:l.ih,tableClassName:m?void 0:"".concat("[&_tbody_tr:has([data-position-operation-active=true])_td]:![--table-cell-hover-overlay:var(--color-bg2)]"," [&_tbody_tr]:!h-14"),fixedCellClassName:m?void 0:l.dA,pagination:!1,scroll:m?void 0:{x:b},responsive:m,mobileMode:m?"card":"table",mobileCardClassName:m?"bg-bg7":void 0})})}},51662:(e,t,r)=>{r.d(t,{m:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1066 1024",...e,children:(0,n.jsx)("path",{d:"M518.101333 128a384 384 0 1 0 0 768 384 384 0 0 0 0-768z m-469.333333 384c0-259.2 210.133333-469.333333 469.333333-469.333333s469.333333 210.133333 469.333334 469.333333-210.133333 469.333333-469.333334 469.333333-469.333333-210.133333-469.333333-469.333333z m469.333333-213.333333a42.666667 42.666667 0 0 1 42.666667 42.666666v170.666667a42.666667 42.666667 0 1 1-85.333333 0V341.333333a42.666667 42.666667 0 0 1 42.666666-42.666666z m-42.666666 384a42.666667 42.666667 0 0 1 42.666666-42.666667h0.426667a42.666667 42.666667 0 1 1 0 85.333333h-0.426667a42.666667 42.666667 0 0 1-42.666666-42.666666z"})}));l.displayName="AlertCircleIcon"},52612:(e,t,r)=>{r.d(t,{o:()=>_});var n=r(79237),a=r(24983),i=r(85002),l=r(66960),s=r(35349),o=r(96620),c=r(90477),d=r(17305),u=r(23209),m=r(99251),p=r(66249),x=r(38113),g=r(76656),h=r(32955),b=r(74709),y=r(93924),f=r(25825),v=r(37973),N=r(18006),j=r(25749),C=r(54327),w=r(39422),T=r(31150),k=r(25060),P=r(28598),S=r(40472),L=r(81407),M=r(68237);function O(e){return{slot:"item",labelClassName:"text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",valueClassName:(0,c.cn)("text-cm12 text-t1 flex-1 [&_span]:!text-cm12",e)}}function _(e){let{mode:t="pc"}=e,{$t:r,locale:_}=(0,l.B)(),A="h5"===t,I=(0,u.Y)(r),q=(0,b.Z)(),U=(0,h.D)(),E=(0,k.e)(),{rawItems:Q,loading:D,initialized:R,pagination:z,setPageNum:B}=(0,T.a5)((0,g.k)(e=>({rawItems:e.items,loading:e.loading,initialized:e.initialized,pagination:e.pagination,setPageNum:e.setPageNum}))),F=(Array.isArray(Q)?Q:[]).map(e=>{var t;return{...e,contQuantity:e.quantity,quantity:U(null!=(t=e.quantity)?t:0,e.symbol||"",e.orderPrice),triggerQuantity:U(e.triggerQuantity||0,e.symbol||"",e.orderPrice),unit:E(e.symbol)}}),H=!!(q.userReady&&q.isLogged&&!R)||!!D,V=(0,x.useMemo)(()=>Array.from(new Set(F.map(e=>e.symbol).filter(e=>!!e))).map(e=>o.p.USDT.SIMPLE_TICKER(e)),[F]),{getPriceInlineEditProps:Z,getQuantityInlineEditProps:K,getTriggerPriceInlineEditProps:W,resetInlineEdit:G}=function(){let{$t:e,locale:t}=(0,l.B)(),[r,n]=(0,x.useState)(null),a=(0,N.useMutation)({mutationFn:async e=>(0,w.NN)({locale:t,params:e}),onSuccess:async t=>{(null==t?void 0:t.code)===200&&((0,y.toast)({type:"success",title:e("Order place success")}),n(null),await (0,T.WJ)())}}),i=e=>{e.planId&&"waitTrigger"===e.status&&n({type:"quantity",planId:String(e.planId)})},s=e=>{e.planId&&"waitTrigger"===e.status&&n({type:"triggerPrice",planId:String(e.planId)})},c=e=>{e.planId&&"waitTrigger"===e.status&&n({type:"price",planId:String(e.planId)})},d=()=>n(null),u=async(t,r)=>{if(t.planId){if(!Number(r))return void(0,y.toast)({type:"error",title:e("Please enter the quantity")});n(null),await a.mutateAsync({planId:t.planId,quantity:Number(r)})}},m=async(e,t)=>{let r=await a.mutateAsync({planId:e.planId,triggerPrice:t});return(null==r?void 0:r.code)===200},p=async(t,r)=>{if(!t.planId)return;if(0>=Number(r))return void(0,y.toast)({type:"error",title:e("Please enter the correct trigger price")});let n=function(e){if(!e.symbol)return 0;let t=f.G.getState().topicData[o.p.USDT.SIMPLE_TICKER(e.symbol)],r=Number("mark"===e.triggerWay?null==t?void 0:t.markPrice:null==t?void 0:t.last);return Number.isFinite(r)?r:0}(t);if((0,v.C)({previousTriggerPrice:t.triggerPrice,nextTriggerPrice:r,comparePrice:n}))return void(0,j.NK)(C.k.PlanTriggered,{triggerPrice:r,onConfirm:()=>m(t,r)});await m(t,r)},g=async(t,r)=>{if(t.planId){if(0>=Number(r))return void(0,y.toast)({type:"error",title:e("Please enter the correct price")});await a.mutateAsync({planId:t.planId,orderPrice:r})}},h=(e,t,n,i)=>({isEditing:(null==r?void 0:r.type)===e&&r.planId===String(t.planId),isSubmitting:a.isPending,onStartEdit:()=>n(t),onCancelEdit:d,onConfirmEdit:e=>i(t,e)});
1return{resetInlineEdit:d,getQuantityInlineEditProps:e=>h("quantity",e,i,u),getPriceInlineEditProps:e=>h("price",e,c,g),getTriggerPriceInlineEditProps:e=>h("triggerPrice",e,s,p)}}(),{hasNextPage:J,shouldShowPagination:$}=(0,d.d)({pageNum:z.pageNum,pageSize:z.pageSize,currentSize:F.length});(0,s.kO)(V);let Y=$?(0,n.jsx)("div",{className:(0,c.cn)("py-s3 flex",A?"justify-center px-4":"justify-end px-[10px]"),children:(0,n.jsxs)(a.Pagination,{variant:"number",children:[(0,n.jsx)(a.PaginationItem,{type:"button",icon:"first",disabled:H||1===z.pageNum,onClick:()=>{H||B(1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"prev",disabled:H||1===z.pageNum,onClick:()=>{H||B(Math.max(1,z.pageNum-1))}}),(0,n.jsx)(a.PaginationItem,{type:"number",active:!0,children:z.pageNum}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"next",disabled:H||!J,onClick:()=>{!H&&J&&B(z.pageNum+1)}})]})}):null,X=[{title:(0,n.jsx)("span",{className:m.CZ,children:r("Symbol")}),key:"symbol",dataIndex:"symbol",width:140,fixed:"left",render:(e,t)=>(0,n.jsx)(M.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:m.pd,children:(0,P.Hp)(t.symbol||"")||"--"})}),mobile:{slot:"header",label:(e,t)=>(0,n.jsx)(M.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:"text-tm14 text-t1 block min-w-0 truncate",children:(0,P.Hp)(t.symbol||"")||"--"})}),value:(e,t)=>"waitTrigger"===t.status?(0,n.jsx)(S.aF,{item:t,buttonClassName:"text-mm12 shrink-0"}):null,labelClassName:"min-w-0 flex-1",valueClassName:"flex-none justify-end"}},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Side")}),key:"direction",width:112,render:(e,t)=>(0,n.jsx)("span",{className:(0,c.cn)(m._U,(0,L.N)(t.direction)),children:(0,L.Tz)(t.direction,I.direction)}),mobile:O()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Margin Mode")}),key:"marginMode",width:120,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,L.Tz)(t.marginMode,I.mode)}),mobile:O()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Leverage")}),key:"leverage",width:100,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,L.Uy)(t.leverage)}),mobile:O()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Type")}),key:"orderType",width:108,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,S.N7)(t,I)}),mobile:O()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Quantity_1")}),key:"quantity",width:132,render:(e,t)=>{let r=(0,L.ac)(t.quantity);return(0,n.jsx)("span",{className:m.pd,children:"--"===r?r:"".concat(r," ").concat(t.unit||"").trim()})},mobile:O()},{title:(0,n.jsx)("span",{className:m.CZ,children:"".concat(r("Quantity_1"),"(").concat(r("Cont"),")")}),key:"contQuantity",width:140,render:(e,t)=>(0,n.jsx)(S.X0,{item:t,...K(t)}),mobile:{...O("[&>div]:justify-end"),label:"".concat(r("Quantity_1")," (").concat(r("Cont"),")")}}
1,{title:(0,n.jsx)("span",{className:m.CZ,children:r("Trigger Conditions")}),key:"triggerConditions",width:188,render:(e,t)=>(0,n.jsx)(S.tf,{item:t,...W(t)}),mobile:O("[&>div]:!w-auto [&>div]:justify-end")},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Price_3")}),key:"orderPrice",width:120,render:(e,t)=>(0,n.jsx)(S.RH,{item:t,...Z(t)}),mobile:O()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Status")}),key:"status",width:120,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,L.Tz)(t.status,I.planStatus)}),mobile:O()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Setup Time")}),key:"createTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:(0,L.r6)(t.createTime)}),mobile:O()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("Triggering Time")}),key:"updateTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:m.pd,children:"waitTrigger"===t.status?"--":(0,L.r6)(t.updateTime)}),mobile:O()},{title:(0,n.jsx)("span",{className:m.CZ,children:r("TP/SL")}),key:"tpsl",width:140,render:(e,t)=>(0,n.jsx)(S.L5,{item:t,onBeforeOpen:G}),mobile:O("[&>div]:justify-end")},{title:(0,n.jsx)("span",{className:"".concat(m.CZ," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",width:108,fixed:"right",render:(e,t)=>(0,n.jsx)(S.aF,{item:t}),mobile:{hidden:!0}}];return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsx)(i.AdvancedTable,{columns:X,dataSource:F,locale:_,rowKey:(e,t)=>"".concat(e.planId||0,"-").concat(e.symbol||t),loading:H,className:A?"[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-divider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0":p.hL,outlined:!1,containerClassName:A?void 0:p.CL,tableClassName:A?void 0:"[&_tbody_tr]:!h-14",fixedCellClassName:A?void 0:p.dA,pagination:!1,scroll:A?void 0:{x:1860},responsive:A,mobileMode:A?"card":"table",mobileCardClassName:A?"bg-bg7":void 0}),Y]})}},53303:(e,t,r)=>{r.d(t,{E:()=>p});var n=r(79237),a=r(66960),i=r(34131),l=r(92413),s=r(47387),o=r(56272),c=r(38113),d=r(82352);function u(e){return"".concat("contract_usdt.fundingInterval_").concat(e)}var m=r(68924);function p(){let{locale:e}=(0,a.B)(),t=(0,l.T)(),{countdown:r,showTooltip:p,fundingInterval:x}=function(e){let{data:t,isLoading:r,isFetching:n,refetch:a}=(0,d.O0)(e),i=null==t?void 0:t.data,[l,m]=(0,c.useState)(0),[p,x]=(0,c.useState)(!1),[g,h]=(0,c.useState)(""),[b]=(0,o.A)({leftTime:e&&l>0?l:0,interval:1e3,onEnd:()=>{e&&a()}});return(0,c.useEffect)(()=>{if(!e||!i){m(0),x(!1),h("");return}let t=Number(i.fundingInterval||0);m(1e3*function(e,t){let r=Number(e||0),n=Number(t||0);return r&&n?Math.max(0,Math.floor(r-n)):0}(i.fundingTime,i.currentTime)),x(function(e,t){let r=u(e),n=s.hv.get(r);return null!=n&&""!==n?String(n)!==String(t||""):!!(t&&8!==t)}(e,t)),h(t?String(t):""),s.hv.set({[u(e)]:t})},[i]),(0,c.useEffect)(()=>{if(!e)return;let t=()=>{"visible"===document.visibilityState&&a()};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[a,e]),(0,c.useEffect)(()=>{if(!e||!i||b>0)return;let t=window.setInterval(()=>{a()},1e3);return()=>window.clearInterval(t)},[b,i,a,e]),{countdown:Math.max(0,Math.floor(b/1e3)),showTooltip:p,fundingInterval:g,isLoading:r||n&&!i}}(t);return(0,n.jsx)(i.E,{symbol:t,countdown:r,showTooltip:p,fundingInterval:x,fundingRateHref:(0,m.lX)(e,t)})}},55896:(e,t,r)=>{r.d(t,{$:()=>i});var n=r(41809);let a=()=>({orderEntry:{availableBalanceText:"0",quoteAsset:"XUSDT"},quantity:{quantityMode:"quantity",quantityModeOptions:[],tradeUnitValue:"coin",tradeUnitOptions:[],quantityValueHint:"",sliderPercent:0,hasDirectionalQuantity:!1},footer:{loading:!1,quoteAsset:"XUSDT",unitLabel:"",maxLeft:"0",maxRight:"0",costLeft:"0",costRight:"0"},dialogs:{marginDisabled:!1,settingsLoading:!1,settingsSaving:!1,maxLeverage:1,serviceSymbol
1:"",symbol:"",quantityCont:0,longQuantityCont:0,shortQuantityCont:0,multiplier:0,precision:2,coinPrecision:0,oneContCostBuy:0,oneContCostSell:0,lastPrice:0,markPrice:0,calcPrice:0,confirmItems:[],confirmLoading:!1,baseAsset:"BTC"}}),i=(0,n.v)(e=>({...a(),syncComputed:t=>e(t),resetComputed:()=>e(a())}))},56233:(e,t,r)=>{r.d(t,{g:()=>i});var n=r(79237),a=r(90477);function i(e){let{active:t=!0,view:r}=e;return(0,n.jsxs)("span",{className:(0,a.cn)("relative block h-4 w-4 transition-opacity",t?"opacity-100":"opacity-30"),"aria-hidden":!0,children:["all"===r?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"bg-p3 absolute top-[2px] left-[1px] h-[5px] w-[5px]"}),(0,n.jsx)("span",{className:"bg-p2 absolute bottom-[2px] left-[1px] h-[5px] w-[5px]"})]}):(0,n.jsx)("span",{className:(0,a.cn)("absolute top-[2px] left-[1px] h-[12px] w-[5px]","sell"===r?"bg-p3":"bg-p2")}),(0,n.jsx)("span",{className:"bg-t1 absolute top-[2px] right-[1px] h-[2px] w-[7px]"}),(0,n.jsx)("span",{className:"bg-t1 absolute top-[7px] right-[1px] h-[2px] w-[7px]"}),(0,n.jsx)("span",{className:"bg-t1 absolute top-[12px] right-[1px] h-[2px] w-[7px]"})]})}},57625:(e,t,r)=>{r.d(t,{k:()=>x});var n=r(79237),a=r(66960),i=r(82410),l=r(38113),s=r(70744),o=r(22354),c=r(39731),d=r(31150);function u(e){return Number(e||0)}function m(e){return e?void 0!==e.waitTriggerCount&&null!==e.waitTriggerCount?u(e.waitTriggerCount):u(e.total):0}var p=r(2639);function x(e){let{className:t,listClassName:r,triggerClassName:x}=e,{$t:g,locale:h}=(0,a.B)(),b=function(){var e;let t=(0,o.yx)(e=>e.pagination),r=(0,d.a5)(e=>e.pagination),n=(0,c.hv)(e=>e.pagination);return{contract:{positions:u((e={positionsTotal:(0,s.rr)(),currentOrdersTotal:t.total,triggerOrders:r,tpslOrders:n}).positionsTotal),openOrders:u(e.currentOrdersTotal),triggerOrders:m(e.triggerOrders),tpsl:m(e.tpslOrders)}}}(),y=(0,p.J)(e=>e.activeContractTab),f=(0,p.J)(e=>e.setActiveContractTab),v=(0,l.useMemo)(()=>[{key:"positions",label:(0,i.V)(g("Positions_1"),b.contract.positions)},{key:"openOrders",label:(0,i.V)(g("Open Orders_r_1"),b.contract.openOrders)},{key:"triggerOrders",label:(0,i.V)(g("Trigger Orders_1_r_1"),b.contract.triggerOrders)},{key:"ordersHistory",label:g("Orders History")},{key:"tpsl",label:(0,i.V)(g("TP/SL"),b.contract.tpsl)}],[g,b]);return(0,n.jsx)(i.Z,{activeTab:y,items:v,onActiveTabChange:f,locale:h,className:t,listClassName:r,triggerClassName:x})}},58454:(e,t,r)=>{r.d(t,{e:()=>l});var n=r(79237),a=r(32730),i=r(37563);function l(e){let{mode:t="pc"}=e,{isLoading:r,items:l,role:s}=(0,i.ri)();return(0,n.jsx)(a.eP,{dataSource:l,loading:r,mode:t,role:null!=s?s:"follower"})}},59189:(e,t,r)=>{r.d(t,{c:()=>a});var n=r(19490);function a(e,t,r){let a=String(e||"0"),i=Number(a.replace("%","")),l=a.includes("%")?i/100:i,s=l>0?"+":"",o=(0,n.BY)(l)||"--",c="".concat(s).concat(o),d=l>0?"text-p2":l<0?"text-p3":"text-t3",u=function(e,t){let r=Number(e);if(!Number.isFinite(r))return"";let a=r>0?"+":r<0?"-":"",i="number"==typeof t&&Number.isInteger(t)&&t>=0?Math.abs(r).toFixed(t):String(Math.abs(r));return"".concat(a).concat((0,n.iT)(i))}(t,r);return{className:d,percentText:c,text:u?"".concat(u,"(").concat(c,")"):c}}},59514:(e,t,r)=>{r.d(t,{A:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1066 1024",...e,children:(0,n.jsx)("path",{d:"M658.602667 97.834667a42.666667 42.666667 0 0 1 60.330666 0l170.666667 170.666666a42.666667 42.666667 0 0 1 0 60.330667l-170.666667 170.666667a42.666667 42.666667 0 0 1-60.330666-60.330667L756.437333 341.333333H176.768a42.666667 42.666667 0 0 1 0-85.333333h579.669333l-97.834666-97.834667a42.666667 42.666667 0 0 1 0-60.330666z m-281.002667 426.666666a42.666667 42.666667 0 0 1 0 60.330667L279.765333 682.666667h579.669334a42.666667 42.666667 0 1 1 0 85.333333H279.765333l97.834667 97.834667a42.666667 42.666667 0 1 1-60.330667 60.330666l-1
170.666666-170.666666a42.666667 42.666667 0 0 1 0-60.330667l170.666666-170.666667a42.666667 42.666667 0 0 1 60.330667 0z"})}));l.displayName="SwitchIcon"},60096:(e,t,r)=>{r.d(t,{k:()=>n});function n(e){return e?"/resource-upload/".concat(e.split("-")[0],".png"):""}},60886:(e,t,r)=>{r.d(t,{a:()=>j});var n=r(79237),a=r(24983),i=r(85002),l=r(66960),s=r(3529),o=r(90477),c=r(23209),d=r(99251),u=r(66249),m=r(38113),p=r(76656),x=r(97450),g=r(72219),h=r(36106),b=r(26426),y=r(81407),f=r(84605),v=r(82359);function N(e){return{slot:"item",labelClassName:"text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",valueClassName:(0,o.cn)("text-cm12 text-t1 flex-1 [&_span]:!text-cm12",e)}}function j(e){let{mode:t="pc"}=e,{$t:r,locale:j}=(0,l.B)(),C="h5"===t,w=(0,m.useMemo)(()=>(0,c.Y)(r),[r]),T=(0,m.useMemo)(()=>({takeProfit:r("TP"),stopLoss:r("SL")}),[r]),k=(0,g.Z)(),P=(0,x.D)(),S=(0,h.e)(),{rawItems:L,loading:M,initialized:O,pagination:_,setPageNum:A}=(0,f.hv)((0,p.k)(e=>({rawItems:e.items,loading:e.loading,initialized:e.initialized,pagination:e.pagination,setPageNum:e.setPageNum}))),I=(Array.isArray(L)?L:[]).map(e=>({...e,quantity:P(e.quantity||0,e.symbol||"",e.orderPrice),triggerQuantity:P(e.triggerQuantity||0,e.symbol||"",e.orderPrice),unit:S(e.symbol)})),q=!!(k.userReady&&k.isLogged&&!O)||!!M,U=Math.max(1,Math.ceil(Math.max(0,_.total)/Math.max(1,_.pageSize))),E=U>1||_.pageNum>1?(0,n.jsx)("div",{className:(0,o.cn)("py-s3 flex",C?"justify-center px-4":"justify-end px-[10px]"),children:(0,n.jsxs)(a.Pagination,{variant:"number",children:[(0,n.jsx)(a.PaginationItem,{type:"button",icon:"first",disabled:q||1===_.pageNum,onClick:()=>{q||1===_.pageNum||A(1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"prev",disabled:q||1===_.pageNum,onClick:()=>{q||1===_.pageNum||A(Math.max(1,_.pageNum-1))}}),(0,n.jsx)(a.PaginationItem,{type:"number",active:!0,children:_.pageNum}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"next",disabled:q||_.pageNum>=U,onClick:()=>{q||_.pageNum>=U||A(Math.min(U,_.pageNum+1))}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"last",disabled:q||_.pageNum>=U,onClick:()=>{q||_.pageNum>=U||A(U)}})]})}):null,Q=(0,m.useMemo)(()=>[{title:(0,n.jsx)("span",{className:d.CZ,children:r("Symbol")}),key:"symbol",width:152,fixed:"left",render:(e,t)=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("span",{className:(0,o.cn)("h-4 w-1 rounded-[1px]","openShort"===t.direction||"closeLong"===t.direction?"bg-p3":"bg-p2")}),(0,n.jsx)(v.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:d.pd,children:(0,s.A2)(t.symbol||"")||"--"})})]}),mobile:{slot:"header",label:(e,t)=>(0,n.jsx)(v.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:"text-tm14 text-t1 block min-w-0 truncate",children:(0,s.A2)(t.symbol||"")||"--"})}),value:(e,t)=>"waitTrigger"===t.status?(0,n.jsx)(b.aF,{item:t,buttonClassName:"text-mm12 shrink-0"}):null,labelClassName:"min-w-0 flex-1",valueClassName:"flex-none justify-end"}},{title:(0,n.jsx)("span",{className:d.CZ,children:r("Side")}),key:"direction",width:112,render:(e,t)=>(0,n.jsx)("span",{className:(0,o.cn)(d._U,(0,y.N)(t.direction)),children:(0,y.Tz)(t.direction,w.direction)}),mobile:N()},{title:(0,n.jsx)("span",{className:d.CZ,children:r("P/L")}),key:"planType",width:88,render:(e,t)=>(0,n.jsx)("span",{className:d.pd,children:T[t.planType||""]||"--"}),mobile:N()},{title:(0,n.jsx)("span",{className:d.CZ,children:r("Type")}),key:"orderType",width:108,render:(e,t)=>(0,n.jsx)("span",{className:d.pd,children:(0,b.N7)(t,w)}),mobile:N()}
1,{title:(0,n.jsx)("span",{className:d.CZ,children:r("Trigger Conditions")}),key:"triggerCondition",width:188,render:(e,t)=>(0,n.jsx)("span",{className:d.pd,children:(0,b.Z7)(t,w)}),mobile:N()},{title:(0,n.jsx)("span",{className:d.CZ,children:r("Status")}),key:"status",width:120,render:(e,t)=>(0,n.jsx)("span",{className:d.pd,children:(0,y.Tz)(t.status,w.planStatus)}),mobile:N()},{title:(0,n.jsx)("span",{className:d.CZ,children:r("Trigger Amt./Order Amt.")}),key:"triggerAllQuantity",width:180,render:(e,t)=>(0,n.jsx)("span",{className:d.pd,children:(0,b.WE)(t,r("Full Position"))}),mobile:N()},{title:(0,n.jsx)("span",{className:d.CZ,children:r("Executed Price")}),key:"orderPrice",width:120,render:(e,t)=>(0,n.jsx)("span",{className:d.pd,children:(0,y.Iz)({marketLabel:r("Market"),orderPrice:t.orderPrice,orderType:t.orderType})}),mobile:N()},{title:(0,n.jsx)("span",{className:d.CZ,children:r("Setup Time_2")}),key:"editTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:d.pd,children:(0,y.r6)(t.editTime)}),mobile:N()},{title:(0,n.jsx)("span",{className:d.CZ,children:r("Triggering Time")}),key:"updateTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:d.pd,children:"waitTrigger"===t.status?"--":(0,y.r6)(t.updateTime)}),mobile:N()},{title:(0,n.jsx)("span",{className:"".concat(d.CZ," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",width:108,fixed:"right",render:(e,t)=>(0,n.jsx)(b.aF,{item:t}),mobile:{hidden:!0}}],[r,w,T]);return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsx)(i.AdvancedTable,{columns:Q,dataSource:I,locale:j,rowKey:(e,t)=>"".concat(e.planId||0,"-").concat(e.symbol||t),loading:q,className:C?"[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-divider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0":u.hL,outlined:!1,containerClassName:C?void 0:u.CL,tableClassName:C?void 0:"[&_tbody_tr]:!h-14",fixedCellClassName:C?void 0:u.dA,pagination:!1,scroll:C?void 0:{x:1650},responsive:C,mobileMode:C?"card":"table",mobileCardClassName:C?"bg-bg7":void 0}),E]})}},63394:(e,t,r)=>{r.d(t,{i:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>(0,n.jsxs)(i.B,{ref:t,viewBox:"0 0 1024 1024",color:"#000000",...e,children:[(0,n.jsx)("path",{d:"M896 810.666667a42.666667 42.666667 0 1 1 0 85.333333H128a42.666667 42.666667 0 1 1 0-85.333333h768z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M85.333333 853.333333v-165.504a42.666667 42.666667 0 0 1 9.941334-27.349333L527.829333 143.232l2.944-3.157333a42.666667 42.666667 0 0 1 57.941334-1.493334l164.778666 144.810667a42.666667 42.666667 0 0 1 4.48 59.52L304.853333 880.853333a42.666667 42.666667 0 0 1-65.28-55.04l426.197334-505.898666-100.565334-88.32L170.666667 703.274667V853.333333a42.666667 42.666667 0 1 1-85.333334 0z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M436.565333 292.693333a42.709333 42.709333 0 0 1 60.117334-5.461333l128 106.666667a42.666667 42.666667 0 0 1-54.656 65.578666l-128-106.666666a42.709333 42.709333 0 0 1-5.461334-60.16z",fill:"currentColor"})]}));l.displayName="IntroductionIcon"},66411:(e,t,r)=>{r.d(t,{u:()=>d});var n=r(79237),a=r(66960),i=r(90477),l=r(5408);let s={HIGH:"text-p2",MEDIUM:"text-p4",LOW:"text-p3"},o={HIGH:"bg-p2",MEDIUM:"bg-p4",LOW:"bg-p3"},c={LOW:1,MEDIUM:2,HIGH:3};function d(e){let{className:t,level:r,showSuffix:d=!0,size:u="dialog"}=e,{$t:m}=(0,a.B)(),p=(0,l.Vd)(m,r,d);return(0,n.jsxs)("span",{className:(0,i.cn)("badge"===u?"text-cm11":"text-c12","badge"===u?"gap-0":"gap-s1","inline-flex shrink-0 items-center whitespace-nowrap",s[r],t),children:[(0,n.jsx)("span",{children:p}),(0,n.jsx)("span",{className:"relative size-4 shrink-0 overflow-hidden",children:[1,2,3].map(e=>{let t=e<=c[r];return(0,n.jsx)("span",{className:(0,i.cn)("absolute top-1 h-2 w-[2px] rounded-[2px]",1===e?"left-[3px]":2===e?"left-[7px]":"left-[11px]",t?o[r]:"bg-bg6")},e)})})]})}},68237:(e,t,r)=>{r.d(t,{z:()=>c});var n=r(79237),a=r(90477),i=r(38113),l=r(21219),s=r(82510),o=r(13034);function c(e){let{symbol:t,className:r,children:c}=e,d=(0,l.T)(),{toggleSymbol:u}=(0,s.k)(),m=i.useCallback(()=>
1{if(!t)return;let e=(0,o.cP)(t);e&&e!==(0,o.cP)(d)&&u(e)},[d,t,u]);return(0,n.jsx)("button",{type:"button",className:(0,a.cn)("-m-1 inline-flex min-h-6 max-w-full min-w-0 cursor-pointer items-center overflow-hidden rounded p-1 text-left whitespace-nowrap",r),onClick:m,children:c})}},68699:(e,t,r)=>{r.d(t,{n:()=>n});let n=(0,r(41809).v)()(e=>({currentBreakpoint:null,layoutResetVersion:0,setCurrentBreakpoint:t=>e({currentBreakpoint:t}),requestLayoutReset:()=>e(e=>({layoutResetVersion:e.layoutResetVersion+1}))}))},70744:(e,t,r)=>{r.d(t,{eu:()=>y,rr:()=>f});var n=r(41760),a=r(96620),i=r(52293),l=r(89719),s=r(38113),o=r(2815),c=r(21219),d=r(32955),u=r(74709),m=r(25060),p=r(36527),x=r(90178),g=r(28598);function h(e){return(Array.isArray(e)?e:[]).filter(e=>!e.tradeType||"common"===e.tradeType)}function b(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{enabled:n=!0}=r,a=(0,u.Z)(),i=(0,o.$)(),{data:l,isLoading:s}=(0,x.pD)(),c=null!=(t=null==l||null==(e=l.data)?void 0:e.positions)?t:[],d=!!(n&&a.userReady&&a.isLogged&&s)||!!(n&&a.userReady&&a.isLogged&&null===i);return{authState:a,complexResponse:l,isLoading:d,positionSwitch:i,rawPositions:c,restPositions:c,wsPositions:[]}}function y(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=function(){var e,t;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{enabled:l=!0}=r,s=b(r),o=(0,c.T)(),d=l&&s.authState.userReady&&s.authState.isLogged,u=(0,n.N1)(d&&o?a.p.USDT.SIMPLE_TICKER(o):void 0),m=(0,n.N1)(d&&o?a.p.USDT.INDEX_PRICE(o):void 0),p=(0,n.N1)(d?a.p.USDT.SIMPLE_TICKER_ALL():void 0),x=(0,i.bZ)(e=>e.symbolsConfigBySymbol),g=(0,i.bZ)(e=>e.siteConfig),h=function(e){let{restAccountOverview:t,wsAccountOverview:r}=e;return r||t||{}}({restAccountOverview:null==(t=s.complexResponse)||null==(e=t.data)?void 0:e.account,wsAccountOverview:void 0});return{...s,accountOverview:h,currentMarkPrice:null==m?void 0:m.markPrice,currentSymbol:o,siteConfig:g,symbolsConfigBySymbol:x,tickers:[...(null==u?void 0:u.symbol)?[u]:[],...Array.isArray(p)?p:[]].filter(e=>null==e?void 0:e.symbol)}}(e),r=(0,l.wc)(),u=(0,d.D)(),x=(0,m.e)(),y=(0,o.Lc)(),f=(0,p.r)(e=>e.hideOther),v=function(e,t){let[r,n]=(0,s.useState)(e),a=(0,s.useRef)(e),i=(0,s.useRef)(Date.now()),l=(0,s.useRef)(null);return(0,s.useEffect)(()=>{a.current=e;let t=()=>{l.current=null,i.current=Date.now(),n(a.current)},r=Date.now()-i.current;if(r>=1e3){l.current&&clearTimeout(l.current),t();return}l.current||(l.current=setTimeout(t,1e3-r))},[t,e]),(0,s.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]),r}({currentMarkPrice:t.currentMarkPrice,currentSymbol:t.currentSymbol,rawPositions:t.rawPositions,tickers:t.tickers},1e3),N=function(e,t){if(!t.enabled||!t.symbol)return e;let r=(0,g.oI)(t.symbol);return e.filter(e=>{let t=(0,g.oI)(e.symbol);return t&&t===r})}(function(e,t,r,n){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i=Array.isArray(e)?e:[],l=new Map,s=(0,g.oI)(a.currentSymbol),o=a.currentMarkPrice;return n.forEach(e=>{if(!(null==e?void 0:e.symbol))return;let t=(0,g.oI)(e.symbol),r=(0,g.Hp)(e.symbol);[e.symbol,t,r].forEach(t=>{t&&!l.has(t)&&l.set(t,e.last)})}),i.map(e=>{let n=e.symbol||"",a=(0,g.oI)(n),i=(0,g.Hp)(n),c=a||n,d=null!=o&&String(o).trim()&&a&&a===s?o:e.markPrice,u=l.get(n)||l.get(a)||l.get(i);return{...e,contAvailableQuantity:e.availableQuantity,contQuantity:e.quantity,last:u,markPrice:d,displayQuantity:t(e.quantity,c,u),displayAvailableQuantity:t(e.availableQuantity,c,u),unit:r(c)}})}(y(h(v.rawPositions),r),u,x,v.tickers,{currentMarkPrice:v.currentMarkPrice,currentSymbol:v.currentSymbol}),{enabled:f,symbol:t.currentSymbol});return{isLoading:t.isLoading,items:N}}function f(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{enabled:t=!0}=e,r=b(e);return t&&r.authState.isLogged?h(r.rawPositions).length:0}},72433:(e,t,r)=>{r.d(t,{Z:()=>a,n:()=>n});let n=(0,r(41809).v)()((e,t)=>{let r=()=>{let r=t().guideTooltipTimer;r&&(window.clearTimeout(r),e({guideTooltipTimer:null}))};return{currentBreakpoint:null,guideTooltipVisible:!1,guideTooltipTimer:null,layoutRe
1setVersion:0,setCurrentBreakpoint:t=>e({currentBreakpoint:t}),setGuideTooltipVisible:t=>e({guideTooltipVisible:t}),showGuideTooltip:()=>{r();let t=window.setTimeout(()=>{e({guideTooltipTimer:null,guideTooltipVisible:!1})},3e3);e({guideTooltipTimer:t,guideTooltipVisible:!0})},hideGuideTooltip:()=>{r(),e({guideTooltipVisible:!1})},requestLayoutReset:()=>e(e=>({layoutResetVersion:e.layoutResetVersion+1}))}});function a(){let e=n(e=>e.guideTooltipVisible);return{guideTooltipVisible:e,showGuideTooltip:n(e=>e.showGuideTooltip),hideGuideTooltip:n(e=>e.hideGuideTooltip)}}},74494:(e,t,r)=>{r.d(t,{LE:()=>s,Lj:()=>c,Tl:()=>l,c3:()=>a,ee:()=>m,qm:()=>u,qv:()=>o,xM:()=>d,xz:()=>i,yf:()=>n});let n={auction:"OPENING_AUCTION",morning:"REGULAR_MARKET",midday:"MIDDAY_BREAK",afternoon:"REGULAR_MARKET"};function a(e,t){return e.market===t.market&&e.symbol===t.symbol&&e.contextKey===t.contextKey}function i(e,t){var r,n,i,l;return t&&a(t,e)&&t.serverTimeMs===e.serverTimeMs&&(null==(r=t.next)?void 0:r.startsAtMs)===(null==(n=e.next)?void 0:n.startsAtMs)&&(null==(i=t.next)?void 0:i.status)===(null==(l=e.next)?void 0:l.status)?{...e,receivedAtMonotonicMs:t.receivedAtMonotonicMs}:e}function l(e){return"UNKNOWN"===e?"MARKET_CLOSED":e}function s(e){return"REGULAR_MARKET"===e?"HIGH":"LOW"}function o(e){let t=e.next;return"UNKNOWN"!==e.status&&t&&t.status!==e.status&&Number.isFinite(t.startsAtMs)&&!(t.startsAtMs<=0)&&Number.isFinite(e.serverTimeMs)&&!(e.serverTimeMs<=0)&&Number.isFinite(e.receivedAtMonotonicMs)&&!(e.receivedAtMonotonicMs<0)?t:null}function c(e,t){let r=o(e);return r&&Number.isFinite(t)?Math.max(0,r.startsAtMs-e.serverTimeMs-Math.max(0,t-e.receivedAtMonotonicMs)):null}function d(e){let t=Math.max(0,Math.floor(e/1e3)),r=Math.floor(t/86400),n=[Math.floor(t%86400/3600),Math.floor(t%3600/60),t%60].map(e=>String(e).padStart(2,"0")).join(":");return r?"".concat(r,"D ").concat(n):n}function u(e){let t=["auction","morning","midday","afternoon"];return!!e.timezoneLabel.trim()&&e.items.length===t.length&&e.items.every((e,r)=>e.id===t[r]&&!!e.timeRange.trim())}function m(){let e=null,t=null;return(r,n,a)=>{if(t)return t;let i=o(r),l=i?JSON.stringify([r.market,r.symbol,r.contextKey,i.startsAtMs]):null;return"boundary"!==n||l&&e!==l?("boundary"===n&&(e=l),t=Promise.resolve().then(a).finally(()=>{t=null})):Promise.resolve()}}},74526:(e,t,r)=>{r.d(t,{Y:()=>T});var n=r(79237),a=r(24983),i=r(85002),l=r(66960),s=r(90477),o=r(18746),c=r(39042),d=r(17305),u=r(81407),m=r(23209),p=r(99251),x=r(66249),g=r(38113),h=r(76656),b=r(32955),y=r(74709),f=r(25060),v=r(25749),N=r(81559),j=r(13156),C=r(11529);function w(e){return{slot:"item",labelClassName:"text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",valueClassName:(0,s.cn)("text-cm12 text-t1 flex-1 [&_span]:!text-cm12",e)}}function T(e){let{mode:t="pc"}=e,{$t:r,locale:T}=(0,l.B)(),k="h5"===t,P=(0,g.useMemo)(()=>(0,m.Y)(r),[r]),S=(0,y.Z)(),L=(0,b.D)(),M=(0,f.e)(),O=(0,v.T3)(),{initialized:_,loading:A,pagination:I,rawItems:q,setPageNum:U}=(0,C.dw)((0,h.k)(e=>({initialized:e.initialized,loading:e.loading,pagination:e.pagination,rawItems:e.items,setPageNum:e.setPageNum}))),E=(0,g.useMemo)(()=>q.map(e=>{var t;return{...e,quantity:L(null!=(t=e.quantity)?t:0,e.symbol||"",e.averagePrice),calcQuantity:L(e.filledQuantity||0,e.symbol||"",e.averagePrice),unit:M(e.symbol)}}),[L,M,q]),Q=!!(S.userReady&&S.isLogged&&!_)||!!A,{hasNextPage:D,shouldShowPagination:R}=(0,d.d)({pageNum:I.pageNum,pageSize:I.pageSize,currentSize:E.length}),z=R?(0,n.jsx)("div",{className:(0,s.cn)("py-s3 flex",k?"justify-center px-4":"justify-end px-[10px]"),children:(0,n.jsxs)(a.Pagination,{variant:"number",children:[(0,n.jsx)(a.PaginationItem,{type:"button",icon:"first",disabled:Q||1===I.pageNum,onClick:()=>{Q||U(1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"prev",disabled:Q||1===I.pageNum,onClick:()=>{Q||U(Math.max(1,I.pageNum-1))}}),(0,n.jsx)(a.PaginationItem,{type:"number",active:!0,children:I.pageNum}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"next",disabled:Q||!D,onClick:()=>{!Q&&D&&U(I.pageNum+1)}})]})}):null,[B,F]=(0,g.useState)(!1),[H,V]=(0,g.useState)(null),Z=async e=>{if(!e.orderId||!e.symbol)return;let t=await (0,j.ff)({locale:T,params:{orderId:e.orderId,symbol:e.symbol}});if((null==t?void 0:t.code)!==200)return;let n=Number(t.data||0),a=Number(e.averagePrice||0),i=Number(e.leverage||0),l="closeLong"===e.direction,s=i?n/i:0,o=s?(l?a-n:n-a)/s:0;V({theme:document.documentElement.classList.contains("dark")?"dark":"light",type:"perpetual",template:"historyEntrustMain",header:{label:"Perpetual"}
1,top:{symbol:{coin:(e.symbol||"").replace("-SWAP","USDT"),mode:r("DEMO"),tags:[{type:"other",class:l?"is-up":"is-down",label:l?r("Long"):r("Short")},{type:"leverage",class:"is-primary",label:(0,u.Uy)(e.leverage)}]},inset:{type:"perpetual"}},core:{rate:[{type:"roe",label:r("ROE"),value:Number.isFinite(o)?o:0},{type:"pnl",label:"".concat(r("PNL"),"(USDT)"),value:Number(e.profit||0)}],menu:[{type:"default",label:r("Entry Price"),value:n},{type:"default",label:r("Close Price"),value:a}]},referral:{link:"".concat(window.location.origin,"/").concat(T,"/invite/{0}")},check:{leverage:!0,pnl:!0,referral:!0}}),F(!0)},K=e=>{O.showLayer({item:{orderId:e.orderId,symbol:e.symbol,direction:e.direction,leverage:e.leverage},mode:t})},W=(0,g.useMemo)(()=>[{title:(0,n.jsx)("span",{className:p.CZ,children:r("Symbol")}),key:"symbol",dataIndex:"symbol",width:176,fixed:"left",render:(e,t)=>(0,n.jsx)(N.JE,{item:t}),mobile:{slot:"header",label:(e,t)=>(0,n.jsx)(N.JE,{item:t}),value:(e,t)=>(0,n.jsx)(N.QA,{item:t,onShare:Z,onCheck:K,unavailableFallback:null}),labelClassName:"min-w-0 flex-1",valueClassName:"flex-none justify-end"}},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Side")}),key:"direction",width:112,render:(e,t)=>(0,n.jsx)("span",{className:(0,s.cn)(p._U,(0,u.N)(t.direction)),children:(0,u.Tz)(t.direction,P.direction)}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Margin Mode")}),key:"marginMode",width:120,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,u.Tz)(t.marginMode,P.mode)}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Leverage")}),key:"leverage",width:100,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,u.Uy)(t.leverage)}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Type")}),key:"orderType",width:108,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,c.N7)(t,P)}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Quantity_1")}),key:"quantity",width:132,render:(e,t)=>{let r=(0,u.ac)(t.quantity);return(0,n.jsx)("span",{className:p.pd,children:"--"===r?r:"".concat(r," ").concat(t.unit||"").trim()})},mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Price_3")}),key:"orderPrice",width:120,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,N.J7)({marketLabel:r("Market"),orderPrice:t.orderPrice,orderType:t.orderType})}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Filled Qty")}),key:"filledQuantity",width:132,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,u.ac)(t.calcQuantity)}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Filled Price")}),key:"averagePrice",width:112,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:"liquidation"===t.orderType?"--":(0,u.ac)(t.averagePrice)}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Fee")}),key:"fee",width:100,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,u.ac)(t.fee)}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:"".concat(r("Profit_1"),"(USDT)")}),key:"profit",width:108,render:(e,t)=>(0,n.jsx)("span",{className:(0,s.cn)(p.pd,"direction-ltr"),children:(0,c.fb)(t.profit)}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Status")}),key:"status",width:120,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,u.Tz)(t.status,P.orderStatus)}),mobile:w()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Time_r_1")}),key:"orderTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,u.r6)(t.orderTime)}),mobile:w()},{title:(0,n.jsx)("span",{className:"".concat(p.CZ," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",width:108,fixed:"right",render:(e,t)=>(0,n.jsx)(N.QA,{item:t,onShare:Z,onCheck:K}),mobile:{hidden:!0}}],[r,K,Z,P]);return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsx)(i.AdvancedTable,{columns:W,dataSource:E,locale:T,rowKey:"orderId",loading:Q,className:k?"[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-divider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0":x.hL,outlined:!1,containerClassName:k?void 0:x.CL,tableClassName:k?void 0:"[&_tbody_tr]:!h-14",fixedCellClassName:k?void 0:x.dA,pagination:!1,scroll:k?void 0:{x:1760},responsive:k,mobileMode:k?"card":"table",mobileCardClassName:k?"bg-bg7":void 0}),z,B&&H?(0,n.jsx)(o.A,{config:H,onClose:()=>{F(!1),V(null)}}):null]})}},74709:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(51025),a=r(76656);function i(){let{gotoLogin:e,gotoRegister:t,isLogged:r,userReady:i}
1=(0,n.k)((0,a.k)(e=>{var t;return{gotoLogin:e.gotoLogin,gotoRegister:e.gotoRegister,isLogged:!!(null==(t=e.user)?void 0:t.userId),userReady:!!e.userLoadFromStorage}}));return{gotoLogin:e,gotoRegister:t,isLogged:r,userReady:i}}},76856:(e,t,r)=>{r.d(t,{R:()=>d});var n=r(93924),a=r(66960),i=r(18006),l=r(38113),s=r(25749),o=r(16393),c=r(28373);function d(e){let{locale:t,symbol:r,isLoggedIn:d,gotoLogin:u,activityInfo:m,isActivityEnd:p}=e,{$t:x}=(0,a.B)(),g=(0,s.N5)(),h=(0,i.useMutation)({mutationFn:async()=>{let e=await (0,o.Gb)({locale:t,params:{}});return(null==e?void 0:e.code)===200&&((0,n.toast)({type:"success",title:x("Success")}),(0,c.BJ)({locale:t,symbol:r}).catch(e=>{console.error("[useDemoAccountResetAction] å·æ°æ¨¡æç reset åæ°æ®å¤±è´¥:",e)}),!0)}}),b=(0,l.useCallback)(async()=>h.mutateAsync().catch(()=>!1),[h]);return{handleResetDemoFund:(0,l.useCallback)(()=>{var e;return d?!0!==(e=null==m?void 0:m.isJoin)&&1!==e&&"1"!==e&&"true"!==e||p?void b():void g.showLayer({resetNumLeft:null==m?void 0:m.resetNumLeft,resetNumLimit:null==m?void 0:m.resetNumLimit,onConfirm:b}):void u()},[m,g,u,p,d,b]),resetting:h.isPending}}},78493:(e,t,r)=>{r.d(t,{b:()=>S});var n=r(93924),a=r(81742),i=r(66960),l=r(4362),s=r(749),o=r(41760),c=r(96620),d=r(19490),u=r(3529),m=r(12733),p=r(17883),x=r(51025),g=r(89719),h=r(10022),b=r(35263),y=r(59189),f=r(76656),v=r(50791),N=r(25704),j=r(65198),C=r(68924),w=r(43129),T=r(72433),k=r(92413),P=r(27644);function S(){var e;let{$t:t,locale:r}=(0,i.B)(),{theme:S,setTheme:L}=(0,a.W)(),M=(0,k.T)(),O=(0,m.bZ)((0,f.k)(e=>e.symbolsConfigBySymbol[M])),_=(0,o.N1)(c.p.USDT.SIMPLE_TICKER(M)),{unit:A,getQuantity:I}=(0,P.A)({symbol:M}),q=(0,b.W)(M),U=(0,x.k)(e=>e.user),E=(0,x.k)(e=>e.gotoLogin),Q=(0,w.J)(e=>e.strategyMode),D=(0,w.J)(e=>e.setStrategyMode),R=(0,h.ZC)(e=>e.changeTheme),{guideTooltipVisible:z}=(0,T.Z)(),B=(0,T.n)(e=>e.requestLayoutReset),F=(0,g.TY)(e=>e.configs.usdtContract_grid_protocol),H=(0,v.TH)(),V=(0,v.T5)(),Z=(0,v.zx)(),K=(0,v.wT)(),W=(0,v.Ui)(),G=!!(null==U?void 0:U.userId),J=Number(null==_?void 0:_.volume),$=Number(null==_?void 0:_.oi),Y=(0,y.c)(null==_?void 0:_.change,null==_?void 0:_.absChange,null!=(e=null==O?void 0:O.precision)?e:2);return{summary:{symbol:M,displaySymbol:(0,u.A2)(M),contractBrief:(0,p.D2)(null==O?void 0:O.contractScope)&&"string"==typeof(null==O?void 0:O.ban)?O.ban.trim():"",isTradfi:(0,p.D2)(null==O?void 0:O.contractScope),isPreIpo:(0,p.YV)(O),rawticker:_,lastPrice:(null==_?void 0:_.last)?(0,d.iT)(_.last):"--",lastPriceClassName:"up"===q?"text-p2":"down"===q?"text-p3":"text-t1",changeText:Y.text,changePercentText:Y.percentText,changeClassName:Y.className,markPrice:(null==_?void 0:_.markPrice)?(0,d.iT)(_.markPrice):"--",indexPrice:(null==_?void 0:_.indexPrice)?(0,d.iT)(_.indexPrice):"--",highPrice:(null==_?void 0:_.high)?(0,d.iT)(_.high):"--",lowPrice:(null==_?void 0:_.low)?(0,d.iT)(_.low):"--",volumeText:isNaN(J)?"--":(0,d.iT)(I(J,M,null==_?void 0:_.last))||"--",volumeUnit:A,openInterestText:(0,d.iT)(I(isNaN($)?0:$,M,null==_?void 0:_.markPrice))||"0",openInterestUnit:A},state:{isLogged:G,strategyMode:Q,guideTooltipVisible:z,theme:S},actions:{handleGuideClick:()=>{if(Q===s.n1.Grid)return void Z.showLayer();V.showLayer()},handleSettingsClick:()=>{if(!G)return void E();H.showLayer()},handleCalculatorClick:()=>{W.showLayer()},handleThemeClick:()=>{let e="dark"===S?"light":"dark";(0,j.r)(e),L(e),(0,l.hx)(S,e,"live"),R(e)},handleStrategyModeChange:e=>{let a=e?s.n1.Grid:s.n1.Standard,i=(0,N.aw)({currentStrategyMode:Q,nextStrategyMode:a,symbol:M,symbolConfig:O});if("noop"!==i.status){if("blocked"===i.status)return void(0,n.toast)({type:"error",title:t("This pair does not support grid trading.")});a===s.n1.Grid&&G&&"1"!==F&&K.showLayer(),D(a),(0,N.wC)((0,C.Cv)(r,M,a))}},handleLayoutReset:B}}}},81559:(e,t,r)=>{r.d(t,{J7:()=>C,JE:()=>w,QA:()=>L,io:()=>k,wD:()=>P,xT:()=>S,yc:()=>T});var n=r(79237),a=r(51924),i=r(55872),l=r(7370),s=r(62309),o=r(93924),c=r(70659),d=r(66960),u=r(90477),m=r(81407),p=r(32523),x=r(18006),g=r(38113),h=r(25749),b=r(68237),y=r(39422),f=r(22354),v=r(28598);let N="text-t4 hover:text-t1 flex size-5 items-center justify-center rounded-none border-0 bg-transparent p-0 transition-colors",j="text-t1 hover:text-p1 flex size-[14px] shrink-0 items-center justify-center rounded-none border-0 bg-transparent p-0 transition-colors disabled:cursor-not-allowed disabled:opacity-40 [&_svg]:size-3.5";function C(e){let{marketLabel:t,orderPrice:r,orderType:n}=e;return n&&n.toLowerCase().includes("market")?t:(0,m.ac)(r)}function w(e){let{item:t}=e,{$t:r}=(0,d.B)(),a="openShort"===t.direction||"closeLong"===t.direction?"#FC3C56":"#00BF75",i=(0,v.Hp)(t.symbol||"")||"--";return(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-1 inline-block h-3 w-1 shrink-0",style:{background:a}}),(0,n.jsx)(b.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:"text-c12 text-t1 leading-4",children:i})})]})}function T(e){var t;let{item:r,isEditing:s,isSubmitting:o,onStartEdit:c,onCancelEdit:d,onConfirmEdit:p}=e,[x,h]=g.useState(String(null!=(t=r.openQuantity)?t:""));return(g.useEffect(()=>{if(s){var e;h(String(null!=(e=r.openQuantity)?e:""))}},[s,r.openQuantity]),s)?(0,n.jsxs)("div",{className:(0,u.cn)("border-p1 flex h-8 items-center gap-1 rounded-r1 border bg-transparent px-2","w-[160px] whitespace-nowrap"),children:[(0,n.jsx)("button",{type:"button","aria-label":"Cancel open order quantity edit",disabled:o,onClick:d,className:j,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),(0,n.jsx)("input",{autoFocus:!0,value:x,onChange:e=>h(e.target.value.replace(/[^\d]+/g,"")),className:"text-m12 text-t1 min-w-0 flex-1 border-0 bg-transparent p-0 text-center leading-4 font-medium outline-none placeholder:text-t4"}),(0,n.jsx)("button",{type:"button","aria-label":"Confirm open order quantity edit",disabled:o,onClick:()=>null==p?void 0:p(x),className:j,children:(0,n.jsx)(i.S,{className:"size-3.5"})})]}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default",children:(0,m.ac)(r.openQuantity)}),r.orderId?(0,n.jsx)("button",{type:"button","aria-label":"Edit open order quantity",onClick:()=>{var e;h(String(null!=(e=r.openQuantity)?e:"")),null==c||c()},className:N,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function k(e){var t,r;let{item:s,isEditing:o,isSubmitting:c,onStartEdit:x,onCancelEdit:h,onConfirmEdit:b}=e,{$t:y}=(0,d.B)(),f=null==(t=s.orderType)?void 0:t.toLowerCase().includes("market"),[v,C]=g.useState(String(null!=(r=s.orderPrice)?r:""));return(g.useEffect(()=>{if(o){var e;C(String(null!=(e=s.orderPrice)?e:""))}},[o,s.orderPrice]),o)?(0,n.jsx)(p.ho,{autoFocus:!0,value:v,symbol
1:s.symbol,disabled:c,onChange:C,className:(0,u.cn)("rounded-r1 border-p1 h-8 w-[160px] border bg-transparent px-2","[&_input]:text-m12 [&_input]:text-t1 [&_input]:placeholder:text-t4 [&_input]:border-0 [&_input]:bg-transparent [&_input]:p-0 [&_input]:text-center [&_input]:leading-4 [&_input]:font-medium [&_input]:outline-none","[&_svg]:size-3.5"),prefix:(0,n.jsx)("button",{type:"button","aria-label":"Cancel open order price edit",disabled:c,onClick:h,className:j,children:(0,n.jsx)(a.U,{className:"size-3.5"})}),suffix:(0,n.jsx)("button",{type:"button","aria-label":"Confirm open order price edit",disabled:c,onClick:()=>null==b?void 0:b(v),className:j,children:(0,n.jsx)(i.S,{className:"size-3.5"})})}):(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default",children:(0,m.Iz)({marketLabel:y("Market"),orderPrice:s.orderPrice,orderType:s.orderType})}),!f&&s.orderId?(0,n.jsx)("button",{type:"button","aria-label":"Edit open order price",onClick:()=>{var e;C(String(null!=(e=s.orderPrice)?e:"")),null==x||x()},className:N,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function P(e){let{item:t}=e,r=(0,h.ve)(),a="openLong"===t.direction||"openShort"===t.direction;return(0,n.jsxs)("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)("span",{className:"text-c12 text-t1 cursor-default",children:(0,m.iN)({takeProfit:t.takeProfitPrice,stopLoss:t.stopLossPrice})}),a?(0,n.jsx)("button",{type:"button","aria-label":"Edit open order TP/SL",onClick:()=>{t.orderId&&r.showLayer({type:"openOrder",item:t})},disabled:!t.orderId,className:N,children:(0,n.jsx)(l.q,{className:"size-4"})}):null]})}function S(e){let{item:t,onSuccess:r,buttonClassName:a}=e,{$t:i,locale:l}=(0,d.B)(),s=(0,x.useMutation)({mutationFn:async e=>(0,y.Ck)({locale:l,params:{orderId:String(e)}}),onSuccess:async e=>{if((null==e?void 0:e.code)===200){(0,o.toast)({type:"success",title:i("Order cancel submitted")}),r?await r():await (0,f.j6)();return}(null==e?void 0:e.code)===10325&&(r?await r():await (0,f.j6)())}});return(0,n.jsx)("button",{type:"button",disabled:!t.orderId||s.isPending,onClick:()=>{t.orderId&&!s.isPending&&s.mutate(t.orderId)},className:(0,u.cn)("text-c12 text-p1-dark hover:text-p1/80 disabled:text-t4 cursor-pointer transition-colors disabled:cursor-not-allowed",a),children:i("Cancel_2")})}function L(e){let{item:t,onShare:r,onCheck:a,unavailableFallback:i}=e,{$t:l}=(0,d.B)();return"filled"!==t.status&&"partiallyFilled"!==t.status&&"partiallyCanceled"!==t.status?void 0!==i?(0,n.jsx)(n.Fragment,{children:i}):(0,n.jsx)("span",{className:"text-t3",children:"--"}):(0,n.jsxs)("div",{className:"flex flex-row-reverse items-center justify-end gap-2 md:flex-row",children:[("closeLong"===t.direction||"closeShort"===t.direction)&&"liquidation"!==t.orderType?(0,n.jsx)(c.$,{variant:"line",size:"xs",className:"text-t3 hover:text-t1 h-8 min-h-8 w-8 min-w-8 rounded-none border-0 bg-transparent p-0 hover:bg-transparent [&_svg]:h-4 [&_svg]:w-4",onClick:()=>r(t),children:(0,n.jsx)(s.l,{className:"text-c16"})}):null,(0,n.jsx)(c.$,{variant:"line",size:"xs",onClick:()=>a(t),className:"text-c14 text-p1-dark hover:text-p1 h-auto rounded-none border-0 bg-transparent !px-0 leading-5 font-normal hover:bg-transparent",children:l("Check")})]})}},82359:(e,t,r)=>{r.d(t,{z:()=>c});var n=r(79237),a=r(90477),i=r(38113),l=r(92413),s=r(42384),o=r(25704);function c(e){let{symbol:t,className:r,children:c}=e,d=(0,l.T)(),{toggleSymbol:u}=(0,s.k)(),m=i.useCallback(()=>{if(!t)return;let e=(0,o.cP)(t);e&&e!==(0,o.cP)(d)&&u(e)},[d,t,u]);return(0,n.jsx)("button",{type:"button",className:(0,a.cn)("-m-1 inline-flex min-h-6 max-w-full min-w-0 cursor-pointer items-center overflow-hidden rounded p-1 text-left whitespace-nowrap",r),onClick:m,children:c})}},82410:(e,t,r)=>{r.d(t,{V:()=>s,Z:()=>o});var n=r(79237),a=r(13603),i=r(19490),l=r(90477);function s(e,t){return void 0===t?e:"".concat(e," ").concat((0,i.YH)(t))}function o(e){let{activeTab:t,items:r,onActiveTabChange:i,locale:s,className:o,listClassName:c,triggerClassName:d}=e,u="fa"!==s?{rootClassName:void 0,listClassName:void 0}:{rootClassName:"[direction:rtl]",listClassName:"[direction:rtl]"};return(0,n.jsx)("div",{className:(0,l.cn)("px-s4 min-w-0 flex-1",u.rootClassName),children:(0,n.jsx)(a.Tabs,{value:t,onValueChange:e=>i(e),variant:"text",size:"s",className:(0,l.cn)("min-w-0 flex-1",o),children:(0,n.jsx)(a.TabsList,{className:(0,l.cn)("h-auto w-full justify-start gap-5 bg-transparent px-4",c,u.listClassName),underlineClassName:"border-transparent",scrollGradientClass:"to-bg7",scrollArrowBgClass:"bg-bg7",children:r.map(e=>(0,n.jsx)(a.TabsTrigger,{value:e.key,className:(0,l.cn)("rounded-none whitespace-nowrap px-0 !text-m14 text-t3 data-[state=active]:!text-t1 focus-visible:ring-0 focus-visible:ring-offset-0",d),children:e.label},e.key))})})})}},84137:(e,t,r)=>{r.d(t,{o:()=>S});var n=r(79237),a=r(24983),i=r(85002),l=r(66960),s=r(90477),o=r(39042),c=r(81407),d=r(23209),u=r(99251),m=r(66249),p=r(38113),x=r(76656),g=r(21219),h=r(93924),b=r(18006),y=r(39422),f=r(32955),v=r(74709),N=r(25060),j=r(28598),C=r(81559),w=r(44844),T=r(22354),k=r(68237);function P(e){return{slot:"item",labelClassName:"text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",valueClassName:(0,s.cn)("text-cm12 text-t1 flex-1 [&_span]:!text-cm12",e)}}function S(e){let{mode:t="pc"}=e,{$t:r,locale:S}=(0,l.B)(),L=(0,g.T)(),M="h5"===t,O=(0,p.useMemo)(()=>(0,d.Y)(r),[r]),_=(0,v.Z)(),A=(0,f.D)(),I=(0,N.e)(),{getPriceInlineEditProps:q,getQuantityInline
1EditProps:U}=function(){let{$t:e,locale:t}=(0,l.B)(),[r,n]=(0,p.useState)(null),a=(0,b.useMutation)({mutationFn:async e=>(0,y.mZ)({locale:t,params:e}),onSuccess:async t=>{if((null==t?void 0:t.code)===200){(0,h.toast)({type:"success",title:e("Order place success")}),n(null);return}}}),i=e=>{e.orderId&&n({type:"quantity",orderId:String(e.orderId)})},s=e=>{e.orderId&&n({type:"price",orderId:String(e.orderId)})},o=()=>n(null),c=async(t,r)=>{if(t.orderId){if(!Number(r))return void(0,h.toast)({type:"error",title:e("Please enter the quantity")});await a.mutateAsync({orderId:String(t.orderId),quantity:Number(r)})}},d=async(t,r)=>{if(t.orderId){if(0>=Number(r))return void(0,h.toast)({type:"error",title:e("Please enter the correct price")});await a.mutateAsync({orderId:String(t.orderId),orderPrice:r})}},u=(e,t,n,i)=>({isEditing:(null==r?void 0:r.type)===e&&r.orderId===String(t.orderId),isSubmitting:a.isPending,onStartEdit:()=>n(t),onCancelEdit:o,onConfirmEdit:e=>i(t,e)});return{getQuantityInlineEditProps:e=>u("quantity",e,i,c),getPriceInlineEditProps:e=>u("price",e,s,d)}}(),{rawItems:E,loading:Q,initialized:D,pagination:R,setPageNum:z}=(0,T.yx)((0,x.k)(e=>({rawItems:e.items,loading:e.loading,initialized:e.initialized,pagination:e.pagination,setPageNum:e.setPageNum}))),B=(Array.isArray(E)?E:[]).map(e=>{var t,r;return{...e,contQuantity:e.quantity,openQuantity:e.quantity,quantity:A(null!=(t=e.quantity)?t:0,e.symbol||"",e.orderPrice),availableQuantity:A(null!=(r=e.availableQuantity)?r:0,e.symbol||"",e.orderPrice),calcQuantity:A(e.filledQuantity||0,e.symbol||"",e.orderPrice),remainingQuantity:A(Number(e.quantity||0)-Number(e.filledQuantity||0),e.symbol||"",e.orderPrice),unit:I(e.symbol)}}),F=!!(_.userReady&&_.isLogged&&!D)||!!Q,H=Math.max(1,R.totalPage||Math.ceil(R.total/Math.max(1,R.pageSize))),V=H>1||R.pageNum>1,Z=async()=>(0,w.q)("openOrders",L),K=(0,p.useMemo)(()=>[{title:(0,n.jsx)("span",{className:u.CZ,children:r("Symbol")}),key:"symbol",dataIndex:"symbol",width:140,fixed:"left",render:(e,t)=>(0,n.jsx)(k.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:u.pd,children:(0,j.Hp)(t.symbol||"")||"--"})}),mobile:{slot:"header",label:(e,t)=>(0,n.jsx)(k.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:"text-tm14 text-t1 block min-w-0 truncate",children:(0,j.Hp)(t.symbol||"")||"--"})}),value:(e,t)=>(0,n.jsx)(C.xT,{item:t,onSuccess:Z,buttonClassName:"text-mm12 shrink-0"}),labelClassName:"min-w-0 flex-1",valueClassName:"flex-none justify-end"}},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Side")}),key:"direction",width:112,render:(e,t)=>(0,n.jsx)("span",{className:(0,s.cn)(u._U,(0,c.N)(t.direction)),children:(0,c.Tz)(t.direction,O.direction)}),mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Margin Mode")}),key:"marginMode",width:120,render:(e,t)=>(0,n.jsx)("span",{className:u.pd,children:(0,c.Tz)(t.marginMode,O.mode)}),mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Leverage")}),key:"leverage",width:100,render:(e,t)=>(0,n.jsx)("span",{className:u.pd,children:(0,c.Uy)(t.leverage)}),mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Type")}),key:"orderType",width:108,render:(e,t)=>(0,n.jsx)("span",{className:u.pd,children:(0,o.N7)(t,O)}),mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Quantity_1")}),key:"quantity",width:132,render:(e,t)=>{let r=(0,c.ac)(t.quantity);return(0,n.jsx)("span",{className:u.pd,children:"--"===r?r:"".concat(r," ").concat(t.unit||"").trim()})},mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:"".concat(r("Quantity_1"),"(").concat(r("Cont"),")")}),key:"openQuantity",width:196,render:(e,t)=>(0,n.jsx)(C.yc,{item:t,...U(t)}),mobile:{...P("[&>div]:justify-end"),label:"".concat(r("Quantity_1")," (").concat(r("Cont"),")")}},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Price_3")}),key:"orderPrice",width:196,render:(e,t)=>(0,n.jsx)(C.io,{item:t,...q(t)}),mobile:P("[&>div]:!w-auto [&>div]:justify-end")},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Value")}),key:"orderValue",width:108,render:(e,t)=>{let r="canceled"===t.status?"--":(0,c.ac)(t.orderValue);return(0,n.jsx)("span",{className:u.pd,children:r})},mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Filled Qty")}),key:"filledQuantity",width:132,render:(e,t)=>(0,n.jsx)("span",{className:u.pd,children:(0,c.ac)(t.calcQuantity)}),mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Remaining")}),key:"availableQuantity",width:132,render:(e,t)=>{let r=(0,c.ac)(t.availableQuantity);return(0,n.jsx)("span",{className:u.pd,children:"--"===r?r:"".concat(r," ").concat(t.unit||"").trim()})},mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Fill Price")}),key:"averagePrice",width:112,render:(e,t)=>{let r="liquidation"===t.orderType?"--":(0,c.ac)(t.averagePrice);return(0,n.jsx)("span",{className:u.pd,children:r})},mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Setup Time")}),key:"orderTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:u.pd,children:(0,c.r6)(t.orderTime)}),mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("Filled%")}),key:"filledPercentage",width:98,render:(e,t)=>(0,n.jsx)("span",{className:u.pd,children:(0,o.cS)({filledQuantity:t.calcQuantity,quantity:t.quantity})}),mobile:P()},{title:(0,n.jsx)("span",{className:u.CZ,children:r("TP/SL")}),key:"tpsl",width:140,render:(e,t)=>(0,n.jsx)(C.wD,{item:t}),mobile:P("[&>div]:justify-end")},{title:(0,n.jsx)("span",{className:"".concat(u.CZ," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",width:108,fixed:"right",render:(e,t)=>(0,n.jsx)(C.xT,{item:t,onSuccess:Z}),mobile:{hidden:!0}}],[r,q,U,O,Z]),W=V?(0,n.jsx)("div",{className:(0,s.cn)("py-s3 flex",M?"justify-center px-4":"justify-end px-[10px]"),children:(0,n.jsxs)(a.Pagination,{variant:"number",children:[(0,n.jsx)(a.PaginationItem,{type:"button",icon:"first",disabled:F||1===R.pageNum,onClick:()=>{F||z(1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"prev",disabled:F||1===R.pageNum,onClick:()=>{F||z(Math.max(1,R.pageNum-1))}}),(0,n.jsx)(a.PaginationItem,{type:"number",active:!0,children:R.pageNum}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"next",disabled:F||R.pageNum>=H,onClick:()=>{F||R.pageNum>=H||z(R.pageNum+1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"last",disabled:F||R.pageNum>=H,onClick:()=>{F||R.pageNum>=H||z(H)}})]})}):null;return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsx)(i.AdvancedTable,{columns:K,dataSource:B,locale:S,rowKey:"orderId",loading:F,className:M?"[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-div
1ider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0":m.hL,outlined:!1,containerClassName:M?void 0:m.CL,tableClassName:M?void 0:"[&_tbody_tr]:!h-14",fixedCellClassName:M?void 0:m.dA,pagination:!1,scroll:M?void 0:{x:2060},responsive:M,mobileMode:M?"card":"table",mobileCardClassName:M?"bg-bg7":void 0}),W]})}},86617:(e,t,r)=>{r.d(t,{o:()=>A});var n=r(79237),a=r(24983),i=r(85002),l=r(66960),s=r(35349),o=r(96620),c=r(3529),d=r(90477),u=r(17305),m=r(23209),p=r(99251),x=r(66249),g=r(38113),h=r(76656),b=r(97450),y=r(72219),f=r(93924),v=r(25825),N=r(95696),j=r(51025),C=r(37973),w=r(18006),T=r(50791),k=r(50965),P=r(22675),S=r(36106),L=r(26426),M=r(81407),O=r(82359);function _(e){return{slot:"item",labelClassName:"text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",valueClassName:(0,d.cn)("text-cm12 text-t1 flex-1 [&_span]:!text-cm12",e)}}function A(e){let{mode:t="pc"}=e,{$t:r,locale:A}=(0,l.B)(),I="h5"===t,q=(0,m.Y)(r),U=(0,y.Z)(),E=(0,b.D)(),Q=(0,S.e)(),{rawItems:D,loading:R,initialized:z,pagination:B,setPageNum:F}=(0,P.a5)((0,h.k)(e=>({rawItems:e.items,loading:e.loading,initialized:e.initialized,pagination:e.pagination,setPageNum:e.setPageNum}))),H=(Array.isArray(D)?D:[]).map(e=>{var t;return{...e,contQuantity:e.quantity,quantity:E(null!=(t=e.quantity)?t:0,e.symbol||"",e.orderPrice),triggerQuantity:E(e.triggerQuantity||0,e.symbol||"",e.orderPrice),unit:Q(e.symbol)}}),V=!!(U.userReady&&U.isLogged&&!z)||!!R,Z=(0,g.useMemo)(()=>Array.from(new Set(H.map(e=>e.symbol).filter(e=>!!e))).map(e=>o.p.USDT.SIMPLE_TICKER(e)),[H]),{getQuantityInlineEditProps:K,getTriggerPriceInlineEditProps:W,getOrderPriceInlineEditProps:G,resetInlineEdit:J}=function(){let{$t:e,locale:t}=(0,l.B)(),r=(0,j.k)(e=>{var t,r;return null!=(r=null==(t=e.user)?void 0:t.userId)?r:0}),[n,a]=(0,g.useState)(null),i=(0,w.useMutation)({mutationFn:async e=>(0,N.I$)({locale:t,params:e}),onSuccess:async t=>{if((null==t?void 0:t.code)!==200){(null==t?void 0:t.code)===10307&&(0,T.NK)(k.k.InsufficientBalance);return}(0,f.toast)({type:"success",title:e("Order placed successfully")}),a(null),await (0,P.WJ)()}}),s=e=>{e.planId&&"waitTrigger"===e.status&&a({type:"quantity",planId:String(e.planId)})},c=e=>{e.planId&&"waitTrigger"===e.status&&a({type:"triggerPrice",planId:String(e.planId)})},d=e=>{e.planId&&"waitTrigger"===e.status&&"planMarket"!==e.orderType&&a({type:"orderPrice",planId:String(e.planId)})},u=()=>a(null),m=async(t,n)=>{if(t.planId&&r){if(!Number(n))return void(0,f.toast)({type:"error",title:e("Please enter the quantity")});a(null),await i.mutateAsync({planId:t.planId,userId:r,quantity:Number(n)})}},p=async(e,t)=>{let n=await i.mutateAsync({planId:e.planId,userId:r,triggerPrice:t});return(null==n?void 0:n.code)===200},x=async(t,n)=>{if(!t.planId||!r)return;if(0>=Number(n))return void(0,f.toast)({type:"error",title:e("Please enter the correct trigger price")});let a=function(e){if(!e.symbol)return 0;let t=v.G.getState().topicData[o.p.USDT.SIMPLE_TICKER(e.symbol)],r=Number("mark"===e.triggerWay?null==t?void 0:t.markPrice:null==t?void 0:t.last);return Number.isFinite(r)?r:0}(t);if((0,C.C)({previousTriggerPrice:t.triggerPrice,nextTriggerPrice:n,comparePrice:a}))return void(0,T.NK)(k.k.PlanTriggered,{triggerPrice:n,onConfirm:()=>p(t,n)});await p(t,n)},h=async(t,n)=>{if(t.planId&&r){if(0>=Number(n))return void(0,f.toast)({type:"error",title:e("Please enter the correct price")});await i.mutateAsync({planId:t.planId,userId:r,orderPrice:n})}},b=(e,t,r,a)=>({isEditing:(null==n?void 0:n.type)===e&&n.planId===String(t.planId),isSubmitting:i.isPending,onStartEdit:()=>r(t),onCancelEdit:u,onConfirmEdit:e=>a(t,e)});return{resetInlineEdit:u,getQuantityInlineEditProps:e=>b("quantity",e,s,m),getTriggerPriceInlineEditProps:e=>b("triggerPrice",e,c,x),getOrderPriceInlineEditProps:e=>b("orderPrice",e,d,h)}}(),{hasNextPage:$,shouldShowPagination:Y}=(0,u.d)({pageNum:B.pageNum,pageSize:B.pageSize,currentSize:H.length});(0,s.kO)(Z);let X=Y?(0,n.jsx)("div",{className:(0,d.cn)("py-s3 flex",I?"justify-center px-4":"justify-end px-[10px]"),children:(0,n.jsxs)(a.Pagination,{variant:"number",children:[(0,n.jsx)(a.PaginationItem,{type:"button",icon:"first",disabled:V||
11===B.pageNum,onClick:()=>{V||F(1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"prev",disabled:V||1===B.pageNum,onClick:()=>{V||F(Math.max(1,B.pageNum-1))}}),(0,n.jsx)(a.PaginationItem,{type:"number",active:!0,children:B.pageNum}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"next",disabled:V||!$,onClick:()=>{!V&&$&&F(B.pageNum+1)}})]})}):null,ee=[{title:(0,n.jsx)("span",{className:p.CZ,children:r("Symbol")}),key:"symbol",dataIndex:"symbol",width:140,fixed:"left",render:(e,t)=>(0,n.jsx)(O.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:p.pd,children:(0,c.A2)(t.symbol||"")||"--"})}),mobile:{slot:"header",label:(e,t)=>(0,n.jsx)(O.z,{symbol:t.symbol,children:(0,n.jsx)("span",{className:"text-tm14 text-t1 block min-w-0 truncate",children:(0,c.A2)(t.symbol||"")||"--"})}),value:(e,t)=>"waitTrigger"===t.status?(0,n.jsx)(L.aF,{item:t,buttonClassName:"text-mm12 shrink-0"}):null,labelClassName:"min-w-0 flex-1",valueClassName:"flex-none justify-end"}},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Side")}),key:"direction",width:112,render:(e,t)=>(0,n.jsx)("span",{className:(0,d.cn)(p._U,(0,M.N)(t.direction)),children:(0,M.Tz)(t.direction,q.direction)}),mobile:_()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Margin Mode")}),key:"marginMode",width:120,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,M.Tz)(t.marginMode,q.mode)}),mobile:_()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Leverage")}),key:"leverage",width:100,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,M.Uy)(t.leverage)}),mobile:_()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Type")}),key:"orderType",width:108,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,L.N7)(t,q)}),mobile:_()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Quantity_1")}),key:"quantity",width:132,render:(e,t)=>{let r=(0,M.ac)(t.quantity);return(0,n.jsx)("span",{className:p.pd,children:"--"===r?r:"".concat(r," ").concat(t.unit||"").trim()})},mobile:_()},{title:(0,n.jsx)("span",{className:p.CZ,children:"".concat(r("Quantity_1"),"(").concat(r("Cont"),")")}),key:"contQuantity",width:140,render:(e,t)=>(0,n.jsx)(L.X0,{item:t,...K(t)}),mobile:{..._("[&>div]:justify-end"),label:"".concat(r("Quantity_1")," (").concat(r("Cont"),")")}}
1,{title:(0,n.jsx)("span",{className:p.CZ,children:r("Trigger Conditions")}),key:"triggerConditions",width:188,render:(e,t)=>(0,n.jsx)(L.tf,{item:t,...W(t)}),mobile:_("[&>div]:!w-auto [&>div]:justify-end")},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Price_3")}),key:"orderPrice",width:120,render:(e,t)=>(0,n.jsx)(L.RH,{item:t,...G(t)}),mobile:_()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Status")}),key:"status",width:120,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,M.Tz)(t.status,q.planStatus)}),mobile:_()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Setup Time")}),key:"createTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:(0,M.r6)(t.createTime)}),mobile:_()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("Triggering Time")}),key:"updateTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:p.pd,children:"waitTrigger"===t.status?"--":(0,M.r6)(t.updateTime)}),mobile:_()},{title:(0,n.jsx)("span",{className:p.CZ,children:r("TP/SL")}),key:"tpsl",width:140,render:(e,t)=>(0,n.jsx)(L.L5,{item:t,onBeforeOpen:J}),mobile:_("[&>div]:justify-end")},{title:(0,n.jsx)("span",{className:"".concat(p.CZ," block w-full text-right"),children:r("Operation")}),key:"operation",align:"right",width:108,fixed:"right",render:(e,t)=>(0,n.jsx)(L.aF,{item:t}),mobile:{hidden:!0}}];return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsx)(i.AdvancedTable,{columns:ee,dataSource:H,locale:A,rowKey:(e,t)=>"".concat(e.planId||0,"-").concat(e.symbol||t),loading:V,className:I?"[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-divider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0":x.hL,outlined:!1,containerClassName:I?void 0:x.CL,tableClassName:I?void 0:"[&_tbody_tr]:!h-14",fixedCellClassName:I?void 0:x.dA,pagination:!1,scroll:I?void 0:{x:1860},responsive:I,mobileMode:I?"card":"table",mobileCardClassName:I?"bg-bg7":void 0}),X]})}},87052:(e,t,r)=>{r.d(t,{T:()=>ee});var n=r(79237),a=r(40247),i=r(46890),l=r(47776),s=r(87042),o=r(13207),c=r(37392),d=r
1(41445),u=r(30511),m=r(44031),p=r(82586),x=r(53678),g=r(84980),h=r(69938),b=r(91405),y=r(66960),f=r(749),v=r(51430),N=r(41760),j=r(96620),C=r(19490),w=r(3529),T=r(90477),k=r(12733),P=r(17883),S=r(83125),L=r(81039),M=r(38113),O=r(76656),_=r(92413),A=r(19024),I=r(42384),q=r(15934);let U={field:null,direction:null};function E(e,t){return String(null!=e?e:"").toUpperCase().includes(t)}function Q(e){return[...e].sort((e,t)=>Number(t.usdtVolume||0)-Number(e.usdtVolume||0))}function D(e,t){return e.filter(e=>e.baseAsset.includes(t))}function R(e,t){return Q(D(e,t).filter(e=>e.baseAsset.startsWith(t)))}function z(e,t){return Q(R(e,t).filter(e=>e.baseAsset===t))}function B(e,t){let r=D(e,t),n=[...R(e,t),...z(e,t)];return Q(r.filter(e=>!n.some(t=>t.baseAsset===e.baseAsset)))}function F(e,t){return Q(e.filter(()=>"USDT".includes(t)))}function H(e,t){var r,n;let a=null==(n=e.groupList)||null==(r=n.find(e=>e.groupCode===t))?void 0:r.sort;return"number"==typeof a?a:Number.MAX_SAFE_INTEGER}var V=r(60096),Z=r(43129),K=r(9106);let W="grid grid-cols-[minmax(0,180px)_minmax(0,1fr)] md:hidden",G="flex h-12 items-center px-0 py-0 text-tm14 text-t1 md:h-10 md:px-s2 md:text-c12";function J(e){let t=null==e?void 0:e.ban;return"string"==typeof t?t.trim():""}function $(e){return null===e?(0,n.jsx)(a.b,{className:"text-t3 size-3"}):"asc"===e?(0,n.jsx)(i.y,{className:"text-t3 size-3"}):(0,n.jsx)(i.y,{className:"text-t3 size-3",style:{transform:"rotate(180deg)"}})}let Y=(0,M.memo)(function(e){let{alt:t,className:r,size:a,src:i}=e,[l,s]=(0,M.useState)(!1);return((0,M.useEffect)(()=>{s(!1)},[i]),!i||l)?(0,n.jsx)("div",{className:"bg-bg2 shrink-0 rounded-full ".concat(r||""),style:{height:a,width:a}}):(0,n.jsx)(S.Image,{src:i,alt:t,width:a,height:a,bucket:"res",className:r,onError:()=>s(!0)})});function X(e){let{activeField:t,align:r="left",children:a,className:i,direction:l,field:s,onSort:o}=e;return(0,n.jsx)("button",{type:"button",className:(0,T.cn)("flex h-9 w-full items-center px-0 py-0 text-cm12 text-t3 font-normal md:h-10 md:px-0","cursor-pointer select-none","right"===r?"justify-end text-right rtl:text-left":"justify-start text-left rtl:text-right",i),"aria-pressed":t===s&&null!==l,onClick:()=>o(s),children:(0,n.jsxs)("span",{className:(0,T.cn)("flex w-full items-center gap-[2px]","right"===r?"justify-end":"justify-start"),children:[(0,n.jsx)("span",{children:a}),$(t===s?l:null)]})})}function ee(){let{desktopSubtitlePrefixSlot:e,trigger:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{$t:r}=(0,y.B)(),a=(0,b.no)(),{favoriteList:i,favoriteLoading:S,gotoLogin:D,isLogged:ee,isSymbolFavorite:et,toggleSymbolFavorite:er}=(0,A.C)(),{activeTab:en,contractGroupList:ea,setActiveTab:ei,symbolsConfig:el}=(0,k.bZ)((0,O.k)(e=>({activeTab:e.activeTab,contractGroupList:e.contractGroupList,setActiveTab:e.setActiveTab,symbolsConfig:e.symbolsConfig}))),es=(0,_.T)(),eo=(0,Z.J)(e=>e.strategyMode)===f.n1.Standard,{toggleSymbol:ec}=(0,I.k)(),[ed,eu]=(0,M.useState)(!1),em=(0,M.useRef)(!1),ep=(0,N.N1)(ed?j.p.USDT.SIMPLE_TICKER_ALL():void 0)||[],ex=(0,w.A2)(es),eg=(0,V.k)(es),eh="2"!==en&&en?en:"All",eb="1"!==eh||ee?eh:"All",ey=(0,M.useMemo)(()=>{let e=Array.isArray(ea)?ea.filter(e=>e.groupCode):[],t=e.some(e=>"All"===e.groupCode)?e:[{groupCode:"All",name:r("All")},...e];return[...ee?[{groupCode:"1",name:r("Favorites"),favorite:!0}]:[],...t]},[r,ea,ee]),ef=(0,M.useMemo)(()=>{let e=ee?el:el.filter(e=>1===e.special),t=[];return e.forEach(e=>{let r=ep.find(t=>t.symbol===e.symbol);r&&t.push({...e,...r,usdtVolume:(0,v.n7)(Number(r.volume)*Number(e.multiplier)*Number(r.last),2),favorited:+!!et(e.symbol)})}),t},[es,i,ee,et,el,ep]),{displayList:ev,handleSort:eN,search:ej,setSearch:eC,showTabs:ew,sort:eT}=function(e){let{allItems:t,activeTab:r,currentGroup:n="All",isLogged:a}=e,[i,l]=(0,M.useState)(""),[s,o]=(0,M.useState)(U),c=!!i,d=(0,M.useMemo)(()=>t.filter(e=>1===e.favorited),[t]),u=(0,M.useMemo)(()=>c?t:a&&"1"===r?d:"All"===n||"1"===r?t:t.filter(e=>{var t;return null==(t=e.groupList)?void 0:t.some(e=>e.groupCode===n)}).sort((e,t)=>H(e,n)-H(t,n)),[r,t,n,d,c,a]);return{displayList:(0,M.useMemo)(()=>{var e=function(e,t){let r=t.toUpperCase();if(!r)return e;
1var n=z(e,r).concat(R(e,r)).concat(B(e,r)).concat(F(e,r)).concat(function(e,t){let r=z(e,t).concat(R(e,t)).concat(B(e,t)).concat(F(e,t)),n=e.filter(e=>(0,w.A2)(e.symbol).includes(t));return n.some(e=>r.find(t=>t.symbol===e.symbol))?[]:n}(e,r)).concat(Q(e.filter(e=>E(e.ban,r)||E(e.en,r))));let a=new Set;return n.reduce((e,t)=>(a.has(t.symbol)||(a.add(t.symbol),e.push(t)),e),[])}(u,i);if(!s.field||!s.direction)return e;let t=[...e];return"desc"===s.direction&&("symbol"===s.field&&t.sort((0,q.p)(s.field,"string")),"last"===s.field&&t.sort((0,q.p)(s.field)),"change"===s.field&&t.sort((0,q.p)(s.field)),"usdtVolume"===s.field&&t.sort((0,q.p)(s.field))),"asc"===s.direction&&("symbol"===s.field&&t.sort((0,q.F)(s.field,"string")),"last"===s.field&&t.sort((0,q.F)(s.field)),"change"===s.field&&t.sort((0,q.F)(s.field)),"usdtVolume"===s.field&&t.sort((0,q.F)(s.field))),t},[u,i,s]),handleSort:e=>{o(t=>t.field!==e?{field:e,direction:"asc"}:"asc"===t.direction?{field:e,direction:"desc"}:"desc"===t.direction?U:{field:e,direction:"asc"})},search:i,setSearch:l,showTabs:!c,sort:s}}({allItems:ef,activeTab:eb,currentGroup:eb,isLogged:ee}),ek=(0,M.useRef)(null),eP=(0,L.Te)({count:ev.length,getScrollElement:()=>ek.current,estimateSize:()=>48,overscan:8,initialRect:{height:a?720:617,width:a?393:440}}),eS=ed&&(0===el.length&&0===ef.length||0===ep.length),eL=(0,M.useMemo)(()=>{var e,t;return null!=(t=null!=(e=ef.find(e=>e.symbol===es))?e:el.find(e=>e.symbol===es))?t:null},[ef,es,el]),eM=(0,P.D2)(null==eL?void 0:eL.contractScope),eO=(0,P.YV)(eL),e_=J(eL),eA=eM?e_||ex:"",eI=eo&&ew&&ey.length>0,eq=e=>{ec(e.symbol)&&eu(!1)},eU=async(e,t)=>{if(t.stopPropagation(),!ee)return void D();S[e.symbol]||await er(e.symbol,1===e.favorited)},eE=eg?(0,n.jsx)(Y,{src:eg,alt:es,size:a?20:24,className:"rounded-full"}):(0,n.jsx)("div",{className:(0,T.cn)("bg-bg5 rounded-full",a?"size-5":"size-6")}),eQ=null!=t?t:(0,n.jsxs)("button",{type:"button",className:"gap-s2 flex cursor-pointer items-center",children:[eE,(0,n.jsxs)("div",{className:"gap-s1 flex min-w-0 items-center",children:[(0,n.jsx)("span",{className:"text-t1 text-t16 whitespace-nowrap",children:ex}),(0,n.jsx)("span",{className:"text-t3 text-m14 whitespace-nowrap",children:r("Perpetual")}),eO?(0,n.jsx)(K.b,{}):null]})]}),eD=(0,n.jsxs)("button",{type:"button",className:"gap-s1 -mt-3 flex min-w-0 cursor-pointer items-center pt-3",children:[(0,n.jsx)("span",{className:"text-t1 text-b16 block truncate",children:ex}),(0,n.jsx)("span",{className:"bg-bg2 text-t3 text-cm12 rounded-r1 px-1.5 py-0.5 font-medium whitespace-nowrap",children:r("Perp")}),(0,n.jsx)(l.C,{className:(0,T.cn)("text-t3 size-3 shrink-0 transition-transform duration-200",ed&&"rotate-180")})]}),eR=e||eA||eO?(0,n.jsxs)("div",{className:"mt-[2px] flex max-w-[240px] items-center gap-1",children:[e?(0,n.jsx)("span",{className:"shrink-0",children:e}):null,eA?(0,n.jsx)("span",{className:"text-c12 text-t3 block min-w-0 truncate text-left rtl:text-right",title:eA,children:eA}):null,eO?(0,n.jsx)("span",{className:"shrink-0",onPointerEnter:()=>{em.current=!0,eu(!1)},onPointerLeave:()=>{em.current=!1},children:(0,n.jsx)(K.b,{})}):null]}):null,ez=()=>(0,n.jsxs)("div",{className:"bg-m1 md:py-s4 relative flex min-h-0 flex-1 flex-col md:h-[var(--radix-popover-content-available-height)] md:bg-transparent",children:[eS?(0,n.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,n.jsx)(u.t,{type:"global",size:"s"})}):null,(0,n.jsx)("div",{className:"px-s4",children:(0,n.jsx)(m.Input,{size:"s",value:ej,onChange:e=>{eC(e.target.value)},clearable:!0,onClear:()=>eC(""),placeholder:a?r("Coin/Token/Symbol"):r("Symbol"),leftSlot:(0,n.jsx)(s.W,{className:"text-t4 h-4 w-4"}),wrapperClassName:"bg-bg2 h-9 rounded-r2 md:h-10"})}),eI?(0,n.jsx)("div",{className:"scrollbar-none border-l1 mt-s2 flex h-9 w-full shrink-0 items-stretch gap-4 overflow-x-auto overflow-y-hidden border-b px-s4",children:ey.map(e=>{let t=e.groupCode||"",r=eb===t;return(0,n.jsxs)("button",{type:"button",className:(0,T.cn)('text-c12 relative flex h-full shrink-0 cursor-pointer items-center gap-1 leading-4 whitespace-nowrap after:absolute after:right-0 after:bottom-0 after:left-0 after:h-0.5 after:content-[""] md:text-b14',r?"text-t1 after:bg-t1 font-medium":"text-t3 after:bg-transparent"),onClick:()=>(e=>{if("1"===e&&!ee)return void D();ei(e)})(t),children:[e.favorite?(0,n.jsx)(o.V,{className:"h-3.5 w-3.5"}):null,(0,n.jsx)("span",{children:e.name||t})]},t)})}):null,(0,n.jsxs)("div",{className:"mt-0 flex h-0 flex-1 flex-col",children:[(0,n.jsxs)("div",{className:"px-s4",children:[(0,n.jsxs)("div",{className:(0,T.cn)(W,"h-9 shrink-0 items-center"),role:"row",children:[(0,n.jsxs)("div",{className:"flex min-w-0 items-center",children:[(0,n.jsx)(X,{field:"symbol",className:"!w-auto
1shrink-0",activeField:eT.field,direction:eT.direction,onSort:eN,children:r("Symbol")}),(0,n.jsx)("span",{className:"text-t5 mx-1 shrink-0",children:"/"}),(0,n.jsx)(X,{field:"usdtVolume",className:"!w-auto shrink-0",activeField:eT.field,direction:eT.direction,onSort:eN,children:r("24h Vol_2")})]}),(0,n.jsxs)("div",{className:"flex min-w-0 items-center justify-end",children:[(0,n.jsx)(X,{field:"last",align:"right",className:"!w-auto shrink-0",activeField:eT.field,direction:eT.direction,onSort:eN,children:r("Last Price")}),(0,n.jsx)("span",{className:"text-t5 mx-1 shrink-0",children:"/"}),(0,n.jsx)(X,{field:"change",align:"right",className:"!w-auto shrink-0",activeField:eT.field,direction:eT.direction,onSort:eN,children:r("Change")})]})]}),(0,n.jsxs)("div",{className:"hidden h-9 shrink-0 grid-cols-[minmax(0,1fr)_100px_80px] gap-4 md:grid",role:"row",children:[(0,n.jsxs)("div",{className:"text-cm12 text-t3 flex items-center font-normal",children:[(0,n.jsxs)("button",{type:"button",className:"flex h-full shrink-0 cursor-pointer items-center gap-[2px]","aria-pressed":"symbol"===eT.field&&null!==eT.direction,onClick:()=>eN("symbol"),children:[(0,n.jsx)("span",{children:r("Symbol")}),$("symbol"===eT.field?eT.direction:null)]}),(0,n.jsx)("span",{className:"text-t5 mx-[2px] shrink-0",children:"/"}),(0,n.jsxs)("button",{type:"button",className:"flex h-full shrink-0 cursor-pointer items-center gap-[2px]","aria-pressed":"usdtVolume"===eT.field&&null!==eT.direction,onClick:()=>eN("usdtVolume"),children:[(0,n.jsx)("span",{children:r("24h Vol_r_1")}),$("usdtVolume"===eT.field?eT.direction:null)]})]}),(0,n.jsx)(X,{field:"last",align:"right",className:"md:px-0",activeField:eT.field,direction:eT.direction,onSort:eN,children:r("Last Price")}),(0,n.jsx)(X,{field:"change",align:"right",className:"md:px-0",activeField:eT.field,direction:eT.direction,onSort:eN,children:r("Change")})]})]}),(0,n.jsx)(p.ScrollArea,{className:"min-h-0 flex-1",viewportRef:ek,children:ev.length?(0,n.jsx)("div",{children:(0,n.jsx)("div",{className:"text-bm14 relative w-full text-left",style:{height:eP.getTotalSize()},children:eP.getVirtualItems().map(e=>{let t=ev[e.index];if(!t)return null;let r=function(e){let t=String(e||"0"),r=Number(t.replace("%","")),n=t.includes("%")?r/100:r,a=n>0?"+":"",i=(0,C.BY)(n)||"--";return{className:n>0?"text-p2":n<0?"text-p3":"text-t3",text:"".concat(a).concat(i)}}(t.change),i=(0,V.k)(t.symbol),l=function(e){let{isTradfi:t,item:r}=e,n=J(r);return t?n||r.baseAssetName||r.en||"":r.baseAssetName||r.en||""}({isTradfi:(0,P.D2)(t.contractScope),item:t}),s=(0,C.x0)(t.usdtVolume||0),u=(0,w.A2)(t.symbol);return(0,n.jsx)("div",{className:"absolute top-0 left-0 w-full",style:{transform:"translateY(".concat(e.start,"px)")},children:a?(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>eq(t),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),eq(t))},className:(0,T.cn)(W,"hover:bg-bg2 rounded-r3 px-s4 w-full cursor-pointer transition-colors"),children:[(0,n.jsx)("div",{className:(0,T.cn)(G,"rounded-l-r3 pr-3"),children:(0,n.jsxs)("div",{className:"flex min-w-0 items-start gap-1 md:gap-[6px]",children:[(0,n.jsx)("button",{type:"button","aria-label":"toggle favorite",onClick:e=>eU(t,e),className:"text-t3 hover:text-p1 flex h-[14px] w-[14px] shrink-0 items-center justify-center",disabled:S[t.symbol],children:S[t.symbol]?(0,n.jsx)(c.m,{className:"text-p1 h-3.5 w-3.5 animate-spin"}):1===t.favorited?(0,n.jsx)(d.t,{className:"text-p1 h-3.5 w-3.5"}):(0,n.jsx)(o.V,{className:"text-t3 h-3.5 w-3.5"})}),(0,n.jsx)(Y,{src:i,alt:t.baseAsset||t.symbol,size:16,className:"shrink-0 rounded-full"}),(0,n.jsxs)("span",{className:"min-w-0",children:[(0,n.jsx)("span",{className:"text-tm12 text-t1 block truncate",children:u}),(0,n.jsx)("span",{className:"text-cm12 text-t3 flex min-w-0 items-center md:hidden",children:l?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"min-w-0 truncate",children:l}),(0,n.jsx)("span",{className:"text-t5 mx-1 shrink-0",children:"|"}),(0,n.jsx)("span",{className:"shrink-0",children:s})]}):(0,n.jsx)("span",{className:"min-w-0 truncate",children:s})})]})]})}),(0,n.jsx)("div",{className:(0,T.cn)(G,"justify-end text-right rtl:text-left",r.className),children:(0,n.jsxs)("span",{className:"min-w-0",children:[(0,n.jsx)("span",{className:"text-mm12 text-t1 block truncate font-medium md:font-normal md:text-current",children:(0,C.iT)(t.last)||"--"}),(0,n.jsx)("span",{className:(0,T.cn)("text-cm12 block truncate md:hidden",r.className),children:r.text})]})})]}):(0,n.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>eq(t),onKeyDown:e=>
1{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),eq(t))},className:(0,T.cn)("hidden md:grid md:grid-cols-[minmax(0,1fr)_100px_80px] md:gap-4","hover:bg-bg2 rounded-r3 px-s4 w-full cursor-pointer transition-colors"),children:[(0,n.jsx)("div",{className:"flex h-12 min-w-0 items-center",children:(0,n.jsxs)("div",{className:"flex min-w-0 items-start gap-1",children:[(0,n.jsx)("button",{type:"button","aria-label":"toggle favorite",onClick:e=>eU(t,e),className:"text-t3 hover:text-p1 flex h-[14px] w-[14px] shrink-0 items-center justify-center",disabled:S[t.symbol],children:S[t.symbol]?(0,n.jsx)(c.m,{className:"text-p1 h-3.5 w-3.5 animate-spin"}):1===t.favorited?(0,n.jsx)(d.t,{className:"text-p1 h-3.5 w-3.5"}):(0,n.jsx)(o.V,{className:"text-t3 h-3.5 w-3.5"})}),(0,n.jsx)(Y,{src:i,alt:t.baseAsset||t.symbol,size:16,className:"shrink-0 rounded-full"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("span",{className:"text-tm12 text-t1 block truncate",children:u}),(0,n.jsx)("span",{className:"text-c12 text-t3 mt-[2px] flex min-w-0 items-center",children:l?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{className:"block min-w-0 truncate",title:l,children:l}),(0,n.jsx)("span",{className:"text-t5 mx-1 shrink-0",children:"|"}),(0,n.jsx)("span",{className:"shrink-0",children:s})]}):(0,n.jsx)("span",{className:"block min-w-0 truncate",children:s})})]})]})}),(0,n.jsx)("div",{className:"text-c12 text-t1 flex h-12 items-center justify-end text-right rtl:text-left",children:(0,n.jsx)("span",{className:"block truncate",children:(0,C.iT)(t.last)||"--"})}),(0,n.jsx)("div",{className:(0,T.cn)("text-c12 flex h-12 items-center justify-end text-right rtl:text-left",r.className),children:(0,n.jsx)("span",{className:"block truncate",children:r.text})})]})},t.symbol)})})}):(0,n.jsxs)(x.Sv,{className:"mx-auto flex-none pt-[80px]",children:[(0,n.jsx)(x.HY,{size:"m",src:"https://cdn.tapbit.mobi/next-web/common/no-record.png",alt:"empty",className:"size-16"}),(0,n.jsx)(x.Ou,{className:"text-c12 mb-0",children:r("No result")})]})})]}),ee?null:(0,n.jsx)("div",{className:"text-b14 text-t3 mt-auto flex shrink-0 items-center justify-center py-[10px]",children:(0,n.jsx)("button",{type:"button",className:"[&>span]:text-p1 cursor-pointer",onClick:()=>D(),dangerouslySetInnerHTML:{__html:r("<span>{0}</span> to view more",[r("Log In")])}})})]});return a?(0,n.jsx)(g.Drawer,{trigger:eQ,open:ed,onOpenChange:eu,direction:"bottom",title:(0,n.jsx)("span",{className:"text-t16 text-t1 font-semibold",children:r("Markets")}),className:'bg-m1 rounded-t-r5 border-l1 [&[data-vaul-drawer-direction="bottom"]]:h-[90dvh] [&[data-vaul-drawer-direction="bottom"]]:max-h-[90dvh]',headerClassName:"px-4 pt-4 pb-4",bodyClassName:"flex min-h-0 flex-1 flex-col overflow-hidden p-0",footer:!1,children:ez()}):(0,n.jsxs)(h.Popover,{trigger:"hover",hoverCloseDelay:300,disableHoverTriggerClick:!0,open:ed,onOpenChange:e=>{e&&em.current||eu(e)},children:[t?(0,n.jsx)(h.PopoverTrigger,{asChild:!0,children:t}):(0,n.jsx)(h.PopoverAnchor,{asChild:!0,children:(0,n.jsxs)("div",{className:"flex w-fit items-center gap-2",children:[eE,(0,n.jsxs)("div",{className:"flex min-w-0 flex-col items-start",children:[(0,n.jsx)(h.PopoverTrigger,{asChild:!0,children:eD}),eR]})]})}),(0,n.jsx)(h.PopoverContent,{showArrow:!1,side:"bottom",align:"start",alignOffset:-16,avoidCollisions:!1,className:"border-bg6 bg-m3 rounded-r4 w-[440px] p-0",onOpenAutoFocus:e=>e.preventDefault(),children:ez()})]})}},89505:(e,t,r)=>{r.d(t,{BV:()=>N});var n=r(79237),a=r(24983),i=r(31073),l=r(85002),s=r(66960),o=r(90477),c=r(17305),d=r(81407),u=r(66249),m=r(38113),p=r(76656),x=r(72219),g=r(26426),h=r(43115);let b="__all__",y="text-c12 text-t3 font-normal whitespace-nowrap",f="text-c12 text-t1 cursor-default whitespace-nowrap";function v(e){return{slot:"item",labelClassName:"text-cm12 text-t3 flex-none whitespace-nowrap [&>span]:!text-cm12",valueClassName:(0,o.cn)("text-cm12 text-t1 flex-1 [&_span]:!text-cm12",e)}}function N(e){let{mode:t="pc"}=e,{$t:r,locale:N}=(0,s.B)(),j="h5"===t,C=(0,x.Z)(),{items:w,loading:T,initialized:k,pagination:P,scene:S,scenes:L,setScene:M,setPageNum:O}=(0,h.tM)((0,p.k)(e=>({items:e.items,loading:e.loading,initialized:e.initialized,pagination:e.pagination,scene:e.scene,scenes:e.scenes,setScene:e.setScene,setPageNum:e.setPageNum}))),_=Array.isArray(w)?w:[],A=!!(C.userReady&&C.isLogged&&!k)||!!T,{hasNextPage:I,shouldShowPagination:q}=(0,c.d)({pageNum:P.pageNum,pageSize:P.pageSize,currentSize:_.length}),U=q?(0,n.jsx)("div",{className:(0,o.cn)("py-s3 flex",j?"justify-center px-4":"justify-end px-4"),children:(0,n.jsxs)(a.Pagination,{variant:"number",children:[(0,n.jsx)(a.PaginationItem,{type:"button",icon:"first",disabled:A||1===P.pageNum,onClick:()=>{A||1===P.pageNum||O(1)}}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"prev",disabled:A||1===P.pageNum,onClick:()=>{A||1===P.pageNum||O(Math.max(1,P.pageNum-1))}}),(0,n.jsx)(a.PaginationItem,{type:"number",active:!0,children:P.pageNum}),(0,n.jsx)(a.PaginationItem,{type:"button",icon:"next",disabled:A||!I,onClick:()=>{!A&&I&&O(P.pageNum+1)}})]})}):null,E=(0,m.useMemo)(()=>[{label:r("All Types"),value:b},...L.map(e=>({label:String(e.name||""),value:String(e.value||"")}))],[r,L]),Q=(0,m.useMemo)(()=>(function(e){let{$t:t,billScenes:r}=e;return[{title:(0,n.jsx)("span",{className:y,children:t("Time_r_1")}),key:"transTime",width:180,render:(e,t)=>(0,n.jsx)("span",{className:f,children:(0,d.r6)(t.transTime)}),mobile:{slot:"header",label:(e,t)=>
1(0,n.jsx)("span",{className:"text-tm14 text-t1 block min-w-0 truncate",children:(0,d.r6)(t.transTime)}),labelClassName:"min-w-0 flex-1"}},{title:(0,n.jsx)("span",{className:y,children:t("Type")}),key:"scene",width:200,render:(e,t)=>(0,n.jsx)("span",{className:f,children:(0,g.Vg)(String(t.scene||""),r)}),mobile:v()},{title:(0,n.jsx)("span",{className:y,children:t("Total_1")}),key:"amount",width:140,render:(e,t)=>(0,n.jsx)("span",{className:f,children:(0,d.ac)(t.amount)}),mobile:v()},{title:(0,n.jsx)("span",{className:y,children:t("Asset")}),key:"asset",width:120,render:(e,t)=>(0,n.jsx)("span",{className:f,children:String(t.asset||"--")}),mobile:v()},{title:(0,n.jsx)("span",{className:"text-c12 text-t3 block w-full text-right font-normal whitespace-nowrap",children:t("Contract Name")}),key:"contract",width:180,align:"right",render:(e,t)=>(0,n.jsx)("span",{className:"text-m12 text-t1 block w-full cursor-default text-right whitespace-nowrap",children:(0,g.Hf)(String(t.contract||""))}),mobile:{...v(),label:t("Operation")}}]})({$t:r,billScenes:L}),[r,L]);return(0,n.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,n.jsxs)("div",{className:(0,o.cn)("px-4",j?"flex flex-col items-stretch gap-2 pt-4 pb-0":"flex items-center gap-2 pt-4 pb-1"),children:[j?null:(0,n.jsx)("span",{className:"text-t3 text-cm12",children:r("Type")}),(0,n.jsxs)(i.Select,{value:S||b,onValueChange:e=>{M(e===b?"":e),O(1)},children:[(0,n.jsx)(i.SelectTrigger,{className:(0,o.cn)("bg-bg3 h-8 rounded-[6px] px-3 text-left",j?"text-bm14 w-full":"w-[260px]"),children:(0,n.jsx)(i.SelectValue,{placeholder:r("All Types")})}),(0,n.jsx)(i.SelectContent,{children:E.map(e=>(0,n.jsx)(i.SelectItem,{value:e.value,children:e.label||r("All Types")},"".concat(e.value||"all")))})]}),(0,n.jsxs)("span",{className:"text-t3 text-cm12",children:["*",r("Last 7 days data")]})]}),(0,n.jsx)("div",{className:(0,o.cn)("flex min-h-0 flex-1 flex-col"),children:(0,n.jsx)(l.AdvancedTable,{columns:Q,dataSource:_,locale:N,rowKey:(e,t)=>[String(e.billsId||"bill-row"),String(e.transTime||""),String(e.scene||""),String(e.asset||"none"),String(e.amount||"none"),String(e.contract||"none"),String(t)].join("-"),loading:A,className:j?"[&_[data-slot=advanced-table-card]]:border-l1 gap-0 px-4 [&_[data-slot=advanced-table-card-divider]]:hidden [&_[data-slot=advanced-table-card-row]]:min-h-6 [&_[data-slot=advanced-table-card-row]]:py-1 [&_[data-slot=advanced-table-card]]:gap-1 [&_[data-slot=advanced-table-card]]:border-b [&_[data-slot=advanced-table-card]]:px-0 [&_[data-slot=advanced-table-card]]:py-3 [&_[data-slot=advanced-table-card]>div]:gap-0":u.hL,outlined:!1,containerClassName:j?void 0:u.CL,tableClassName:j?void 0:"[&_thead_tr]:!h-8 [&_thead_th]:!px-0 [&_thead_th]:!py-0 [&_tbody_td]:!px-0 [&_tbody_td]:!py-2 [&_tbody_tr]:!h-14",fixedCellClassName:j?void 0:u.dA,pagination:!1,scroll:j?void 0:{x:900},responsive:j,mobileMode:j?"card":"table",mobileCardClassName:j?"bg-bg7":void 0})}),U]})}},92155:(e,t,r)=>{r.d(t,{q:()=>o});var n=r(79237),a=r(44031),i=r(91405),l=r(66960),s=r(7126);function o(e){let t=(0,i.no)(),{i18n:r,locale:o}=(0,l.B)(),c=r.dir(o),d=t?e.placeholder||e.label:e.placeholder,u="".concat(e.inputClassName||"!text-b14 placeholder:!text-t4 !leading-none"," ").concat("rtl"===c?"!text-right":""),m=t?"".concat(e.wrapperClassName||s.w," !h-[44px] !rounded-r2 !px-[8px] ").concat(s.$):e.wrapperClassName?"".concat(e.wrapperClassName," ").concat(s.$):"".concat(s.w," !h-10 !rounded-r2 !px-[12px]");return(0,n.jsxs)("div",{className:"flex flex-col ".concat(t?"gap-0":"gap-1"),children:[t?null:(0,n.jsx)("div",{className:"text-c12 text-t3 leading-[16px] rtl:text-right",children:e.label}),(0,n.jsx)("div",{dir:t?void 0:c,children:(0,n.jsx)(a.Input,{size:"m",value:e.value,onChange:t=>e.onChange(t.target.value),placeholder:d,enablePlaceholderMotion:t,disabled:e.disabled,wrapperClassName:m,className:u,leftSlot:"rtl"===c&&t?e.suffix:void 0,rightSlot:"rtl"===c&&t?void 0:e.suffix})}),e.note?(0,n.jsx)("div",{className:"text-c12 text-t3",children:e.note}):null]})}},95370:(e,t,r)=>{r.d(t,{g:()=>l});var n=r(79237),a=r(38113),i=r(65375);let l=a.forwardRef((e,t)=>
1(0,n.jsx)(i.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,n.jsx)("path",{d:"M512 42.6496c23.552 0 42.6496 19.0976 42.6496 42.7008v85.2992a42.6496 42.6496 0 0 1-85.2992 0V85.3504c0-23.552 19.0976-42.7008 42.6496-42.7008zM178.8928 178.8928a42.6496 42.6496 0 0 1 60.3648 0L299.52 239.2576A42.6496 42.6496 0 1 1 239.2576 299.52L178.8928 239.2576a42.6496 42.6496 0 0 1 0-60.3648z m666.2144 0a42.6496 42.6496 0 0 1 0 60.3648L784.7936 299.52a42.6496 42.6496 0 1 1-60.3648-60.3136l60.3648-60.3648a42.6496 42.6496 0 0 1 60.3136 0zM512 341.3504a170.6496 170.6496 0 1 0 0 341.2992 170.6496 170.6496 0 0 0 0-341.2992zM256 512a256 256 0 1 1 512 0 256 256 0 0 1-512 0zM42.6496 512c0-23.552 19.0976-42.6496 42.7008-42.6496h85.2992a42.6496 42.6496 0 1 1 0 85.2992H85.3504A42.6496 42.6496 0 0 1 42.6496 512z m768 0c0-23.552 19.0976-42.6496 42.7008-42.6496h85.2992a42.6496 42.6496 0 0 1 0 85.2992h-85.2992a42.6496 42.6496 0 0 1-42.7008-42.6496z m-511.0784 212.5824a42.6496 42.6496 0 0 1 0 60.3648l-60.3136 60.3136a42.6496 42.6496 0 1 1-60.3648-60.3136l60.3648-60.3648a42.6496 42.6496 0 0 1 60.3136 0z m424.8576 0a42.6496 42.6496 0 0 1 60.3648 0l60.3136 60.3648a42.6496 42.6496 0 1 1-60.3136 60.3136l-60.3648-60.3136a42.6496 42.6496 0 0 1 0-60.3648zM512 810.6496c23.552 0 42.6496 19.0976 42.6496 42.7008v85.2992a42.6496 42.6496 0 1 1-85.2992 0v-85.2992c0-23.552 19.0976-42.7008 42.6496-42.7008z"})}));l.displayName="SunIcon"},97492:(e,t,r)=>{r.d(t,{n:()=>a});var n=r(79237);function a(e){return e.isPercentage?null:"open"===e.activeTab?Number(e.longQuantity||0)||Number(e.shortQuantity||0)?(0,n.jsxs)("button",{type:"button",className:"text-b14 block w-full min-w-0 overflow-hidden text-left leading-none text-ellipsis whitespace-nowrap",onClick:e.onClear,children:[(0,n.jsx)("span",{className:"text-p2 text-c12",children:e.longQuantity||"0"}),(0,n.jsx)("span",{className:"text-t4 mx-[2px]",children:"/"}),(0,n.jsx)("span",{className:"text-p3 text-c12",children:e.shortQuantity||"0"})]}):null:Number(e.shortQuantity||0)||Number(e.longQuantity||0)?(0,n.jsxs)("button",{type:"button",className:"text-b14 block w-full min-w-0 overflow-hidden text-left leading-none text-ellipsis whitespace-nowrap",onClick:e.onClear,children:[(0,n.jsx)("span",{className:"text-p3 text-c12",children:e.shortQuantity||"0"}),(0,n.jsx)("span",{className:"text-t4 mx-[2px]",children:"/"}),(0,n.jsx)("span",{className:"text-p2 text-c12",children:e.longQuantity||"0"})]}):null}},99251:(e,t,r)=>{r.d(t,{CZ:()=>n,_U:()=>i,pd:()=>a});let n="text-c12 text-t3 font-normal whitespace-nowrap",a="text-c12 text-t1 cursor-default whitespace-nowrap",i="text-c12 cursor-default whitespace-nowrap"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.