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]="02f3c6a5-d6c6-469c-84b7-b544f720ee1a",e._sentryDebugIdIdentifier="sentry-dbid-02f3c6a5-d6c6-469c-84b7-b544f720ee1a")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3951,6872],{5694:(e,t,r)=>{r.d(t,{w:()=>g});var a=r(83054),i=r(19490),n=r(122);function l(e){return"1"===e.tradeUnit?"Cont":"2"===e.tradeUnit?"USDT":e.baseAsset}function o(e){let{quantityCont:t,tradeUnit:r,multiplier:i,price:n,usdtPrecision:l}=e;return(0,a.Sm)({quantityCont:t,tradeUnit:r,multiplier:i,price:n,usdtPrecision:l})}function s(e){let{quantity:t,tradeUnit:r,multiplier:i,price:n,usdtCost:l,costOne:o,isCalculator:s}=e;return(0,a.KP)({quantity:t,tradeUnit:r,multiplier:i,price:n,usdtCost:l,costOne:o,isCalculator:s})}function c(e){let{tradeUnit:t,contractPrecision:r,coinPrecision:a}=e;return"1"===t?0:"2"===t?r:a}function d(e,t,r){return"".concat((0,i.iT)((Number.isFinite(e)?e:0).toFixed(t))," ").concat(r)}function u(e){let{displayQuantity:t,side:r="buy",tradeUnit:a,multiplier:i,usdtCost:l,oneContCostBuy:o,oneContCostSell:s,calcPrice:c,coinPrecision:u,baseAsset:p}=e;if(!t||!i)return d(0,u,p);let m=new n.A(0);if("0"===a)m=new n.A(t);else if("1"===a)m=new n.A(t).mul(i||0);else if("1"===l){let e=new n.A("buy"===r?o||0:s||0);m=(e.gt(0)?new n.A(t).div(e).toDecimalPlaces(0,n.A.ROUND_DOWN):new n.A(0)).mul(i||0)}else m=(c?new n.A(t).div(new n.A(c).mul(i||0)).toDecimalPlaces(0,n.A.ROUND_DOWN):new n.A(0)).mul(i||0);return"2"===a&&m.lt(i||0)&&(m=new n.A(0)),d(m.toNumber(),u,p)}function p(e){let{quantityCont:t,side:r="buy",tradeUnit:a,multiplier:n,price:l,quantityPrecision:s,unitLabel:c,usdtCost:d,oneContCostBuy:p,oneContCostSell:m,coinPrecision:g,baseAsset:f}=e,h=o({quantityCont:t,tradeUnit:a,multiplier:n,price:l}),b="".concat((0,i.iT)(Number(h).toFixed(s))," ").concat(c);if("0"===a)return b;let x=u({displayQuantity:Number(h),side:r,tradeUnit:a,multiplier:n,usdtCost:d,oneContCostBuy:p,oneContCostSell:m,calcPrice:l,coinPrecision:g,baseAsset:f});return"".concat(b," ").concat("1"===a?"=":"â"," ").concat(x)}function m(e){let{quantityCont:t,side:r="buy",tradeUnit:a,multiplier:l,price:s,quantityPrecision:c,unitLabel:u,usdtCost:p,oneContCostBuy:m,oneContCostSell:g,coinPrecision:f,baseAsset:h}=e;if("0"===a){let e=o({quantityCont:t,tradeUnit:a,multiplier:l,price:s});return"".concat((0,i.iT)(Number(e).toFixed(c))," ").concat(u)}if("1"===a){let e="".concat((0,i.iT)(Number(t).toFixed(c))," ").concat(u);return"".concat(e," = ").concat(d(t*l,f,h))}let b=o({quantityCont:t,tradeUnit:"2",multiplier:l,price:s}),x="".concat((0,i.iT)(new n.A(b).toDecimalPlaces(c,n.A.ROUND_DOWN).toFixed(c))," ").concat(u);return"".concat(x," â ").concat(d(t*l,f,h))}let g=(0,r(41809).v)(()=>({getDisplayUnitLabel:l,convertContToDisplay:o,convertDisplayToCont:s,getQuantityPrecisionByUnit:c,formatBaseAssetQuantityValue:d,getBaseAssetHintValue:u,getQuantityDisplayText:p,getConfirmQuantityDisplayText:m}))},7126:(e,t,r)=>{r.d(t,{$:()=>a,w:()=>i});let a="focus-within:!border-p1 focus-within:!bg-white dark:focus-within:!bg-bg3",i="!bg-bg2 !border-transparent ".concat(a)},10522:(e,t,r)=>{r.d(t,{Jh:()=>o,Mr:()=>l});var a=r(47387),i=r(41809);let n=e=>({symbol:e,activeTab:"open",orderType:a.hv.get("orderType")||"limit",triggerPrice:"",orderPrice:"",quantity:"",longQuantity:"",shortQuantity:"",percentage:0,isPercentage:!1,checkedTpsl:!1,takeProfitPrice:"",stopLossPrice:"",tpOrderPrice:"",slOrderPrice:"",takeProfitRate:"",stopLossRate:"",takeProfitRateAbout:"",stopLossRateAbout:"",triggerWay:"mark",tpTriggerWay:"mark",slTriggerWay:"mark",tpPriceType:"market",slPriceType:"market",tpslActiveTab:"openLong",tpslAdvancedEdited:!1,tradeUnit:a.hv.get("tradeUnit")||"0",usdtCost:"1"===a.hv.get("usdtCost")?"1":"0",marginMode:"crossed",positionMode:"merged",longLeverage:10,shortLeverage:10}),l=(0,i.v)((e,t)=>({form:n("BTC-USDT"),initialize:(t,r)=>e(e=>{if(e.form.symbol===t)return e;let a=Number((null==r?void 0:r.longLeverage)||0),i=Number((null==r?void 0:r.shortLeverage)||0);return{form:{...n(t),marginMode:e.form.marginMode,...a>0?{longLeverage:a}:{},...i>0?{shortLeverage:i}:{}}}}),update:t=>e(e=>({form:{...e.form,...t}})),setOrderType:t=>{a.hv.set({orderType:t}),e(e=>({form:{...e.form,orderType:t,triggerPrice:"planLimit"===t||"planMarket"===t?e.form.triggerPrice:"",orderPrice:"market"===t||"planMarket"===t?"":e.form.orderPrice}}))},setTradeUnit:(t,r)=>{a.hv.set({tradeUnit:t,..."2"===t&&r?{usdtCost:r}:{}}),e(e=>({form:{...e.form,tradeUnit:t,..."2"===t&&r?{usdtCost:r}:{}}}))},resetQuantity:()=>e(e=>({form:{...e.form,quantity:"",longQuantity:"",shortQuantity:"",percentage:0}}))}));function o(e){l.setState(t=>({form:{...t.form,...e}}))}},11636:(e,t,r)=>{r.d(t,{w:()=>h});var a=r(83054),i=r(19490),n=r(122),l=r(41809),o=r(28598);function s(e){return"1"===e.tradeUnit?"Cont":"2"===e.tradeUnit?o.QT:e.baseAsset}function c(e){let{quantityCont:t,tradeUnit:r,multiplier:i,price:n}=e;return(0,a.Sm)({quantityCont:t,tradeUnit:r,multiplier:i,price:n})}function d(e){let{quantity:t,tradeUnit:r,multiplier:i,price:n,usdtCost:l,costOne:o}=e;return(0,a.KP)({quantity:t,tradeUnit:r,multiplier:i,price:n,usdtCost:l,costOne:o})}function u(e){let{tradeUnit:t,contractPrecision:r,coinPrecision:a}=e;return"1"===t?0:"2"===t?r:a}function p(e,t,r){return"".concat((0,i.iT)((Number.isFinite(e)?e:0).toFixed(t))," ").concat(r)}function m(e){let{displayQuantity:t,side:r="buy",tradeUnit:a,multiplier:i,usdtCost:l,oneContCostBuy:o,oneContCostSell:s,calcPr
1ice:c,coinPrecision:d,baseAsset:u}=e;if(!t||!i)return p(0,d,u);let m=new n.A(0);if("0"===a)m=new n.A(t);else if("1"===a)m=new n.A(t).mul(i||0);else if("1"===l){let e=new n.A("buy"===r?o||0:s||0);m=(e.gt(0)?new n.A(t).div(e).toDecimalPlaces(0,n.A.ROUND_DOWN):new n.A(0)).mul(i||0)}else m=(c?new n.A(t).div(new n.A(c).mul(i||0)).toDecimalPlaces(0,n.A.ROUND_DOWN):new n.A(0)).mul(i||0);return"2"===a&&m.lt(i||0)&&(m=new n.A(0)),p(m.toNumber(),d,u)}function g(e){let{quantityCont:t,side:r="buy",tradeUnit:a,multiplier:n,price:l,quantityPrecision:o,unitLabel:s,usdtCost:d,oneContCostBuy:u,oneContCostSell:p,coinPrecision:g,baseAsset:f}=e,h=c({quantityCont:t,tradeUnit:a,multiplier:n,price:l}),b="".concat((0,i.iT)(Number(h).toFixed(o))," ").concat(s);if("0"===a)return b;let x=m({displayQuantity:Number(h),side:r,tradeUnit:a,multiplier:n,usdtCost:d,oneContCostBuy:u,oneContCostSell:p,calcPrice:l,coinPrecision:g,baseAsset:f});return"".concat(b," ").concat("1"===a?"=":"â"," ").concat(x)}function f(e){let{quantityCont:t,side:r="buy",tradeUnit:a,multiplier:l,price:o,quantityPrecision:s,unitLabel:d,usdtCost:u,oneContCostBuy:m,oneContCostSell:g,coinPrecision:f,baseAsset:h}=e;if("0"===a){let e=c({quantityCont:t,tradeUnit:a,multiplier:l,price:o});return"".concat((0,i.iT)(Number(e).toFixed(s))," ").concat(d)}if("1"===a){let e="".concat((0,i.iT)(Number(t).toFixed(s))," ").concat(d);return"".concat(e," = ").concat(p(t*l,f,h))}let b=c({quantityCont:t,tradeUnit:"2",multiplier:l,price:o}),x="".concat((0,i.iT)(new n.A(b).toDecimalPlaces(s,n.A.ROUND_DOWN).toFixed(s))," ").concat(d);return"".concat(x," â ").concat(p(t*l,f,h))}let h=(0,l.v)(()=>({getDisplayUnitLabel:s,convertContToDisplay:c,convertDisplayToCont:d,getQuantityPrecisionByUnit:u,formatBaseAssetQuantityValue:p,getBaseAssetHintValue:m,getQuantityDisplayText:g,getConfirmQuantityDisplayText:f}))},18983:(e,t,r)=>{r.d(t,{b:()=>l});var a=r(79237),i=r(38113),n=r(65375);let l=i.forwardRef((e,t)=>(0,a.jsx)(n.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,a.jsx)("path",{d:"M197.290667 283.392L104.362667 190.464 156.16 138.752l722.432 722.389333-51.754667 51.754667-119.381333-118.954667-17.109333-17.109333c-55.04 21.973333-115.328 34.218667-178.474667 34.218667-203.733333 0-377.728-126.72-448.213333-305.578667A480.938667 480.938667 0 0 1 216.021333 302.08l-18.773333-18.773333z m518.272 222.037333a203.818667 203.818667 0 0 0-203.733334-203.733333c-26.453333 0-51.328 5.290667-74.581333 14.677333L349.269333 228.352a474.496 474.496 0 0 1 162.133334-28.501333c203.733333 0 377.728 126.72 448.213333 305.578666a481.450667 481.450667 0 0 1-139.733333 193.536l-118.997334-118.954666c9.386667-23.253333 14.677333-48.085333 14.677334-74.581334z m-385.877334-89.6a201.941333 201.941333 0 0 0-21.589333 89.6 203.818667 203.818667 0 0 0 203.733333 203.733334c32.213333 0 62.336-8.106667 89.642667-21.589334l-63.146667-63.146666c-8.533333 2.048-17.493333 3.242667-26.453333 3.242666a122.069333 122.069333 0 0 1-122.282667-122.197333c0-8.96 1.237333-17.92 3.285334-26.496l-63.146667-63.146667z m304 96.554667l-128.341333-128.341333 6.912-0.426667a122.069333 122.069333 0 0 1 122.24 122.282667l-0.853333 6.485333z"})}));l.displayName="EyeOff1Icon"},24626:(e,t,r)=>{r.r(t),r.d(t,{Checkbox:()=>f,CheckboxContainer:()=>u,CheckboxControl:()=>p,CheckboxText:()=>m});var a=r(79237),i=r(90477),n=r(74422),l=r(38113),o=r(65375);let s=l.forwardRef((e,t)=>(0,a.jsx)(o.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,a.jsx)("path",{d:"M695.168 339.626667a42.666667 42.666667 0 1 1 60.330667 60.330666L471.04 684.373333a42.666667 42.666667 0 0 1-61.610667-1.365333l-142.208-155.136a42.666667 42.666667 0 0 1 62.890667-57.685333l112.085333 122.282666 252.970667-252.885333z"})}));s.displayName="CheckboxIcon";let c=l.createContext(null);function d(){return l.useContext(c)}let u=l.forwardRef((e,t)=>{let{className:r,children:n,...o}=e,s=l.useId(),[d,u]=l.useState(!1),p=l.useMemo(()=>({controlId:"".concat(s,"-control"),textId:"".concat(s,"-text"),disabled:d,setDisabled:u}),[s,d]);return(0,a.jsx)(c.Provider,{value:p,children:(0,a.jsx)("label",{ref:t,"data-slot":"checkbox-container","data-disabled":d?"true":void 0,className:(0,i.Q)("inline-flex items-center gap-2 cursor-pointer select-none text-t1 data-[disabled=true]:cursor-not-allowed data-[disabled=true]:text-t5",r),...o,children:n})})});u.displayName="Checkbox";let p=l.forwardRef((e,t)=>
1{var r;let{className:o,id:c,"aria-describedby":u,disabled:p,...m}=e,g=l.useId(),f=d(),h=null!=(r=null!=c?c:null==f?void 0:f.controlId)?r:"".concat(g,"-control"),b=null!=u?u:null==f?void 0:f.textId;return l.useEffect(()=>{var e;null==f||null==(e=f.setDisabled)||e.call(f,!!p)},[p,f]),(0,a.jsx)(n.bL,{ref:t,id:h,"data-slot":"checkbox","aria-describedby":b,disabled:p,className:(0,i.Q)("flex size-4 shrink-0 p-[1.2px] rounded-r1 transition-shadow outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 disabled:cursor-not-allowed border-l3 data-[state=checked]:border-p1 data-[state=indeterminate]:border-p1",o),...m,children:(0,a.jsxs)(n.C1,{forceMount:!0,"data-slot":"checkbox-indicator",className:"flex h-full w-full items-center justify-center rounded-r1 border-2 border-t4 data-[state=checked]:border-transparent data-[state=indeterminate]:border-transparent data-[state=checked]:bg-p1 data-[state=indeterminate]:bg-p1 [&>svg]:hidden [&>span]:hidden data-[state=checked]:[&>svg]:block data-[state=indeterminate]:[&>span]:block",children:[(0,a.jsx)(s,{className:"text-black"}),(0,a.jsx)("span",{className:"h-0.5 w-2 rounded-full bg-current text-black"})]})})});p.displayName="Checkbox.Control";let m=l.forwardRef((e,t)=>{var r,n;let{className:o,id:s,...c}=e,u=l.useId(),p=d(),m=null!=(r=null!=s?s:null==p?void 0:p.textId)?r:"".concat(u,"-text"),g=null!=(n=null==p?void 0:p.disabled)&&n;return(0,a.jsx)("span",{ref:t,id:m,"data-slot":"checkbox-text",className:(0,i.Q)("text-b14 flex-1 leading-none",g?"text-t5":"text-inherit",o),...c})});m.displayName="Checkbox.Text";let g=l.forwardRef((e,t)=>{let{className:r,children:i,indeterminate:n,onCheckedChange:l,onChange:o,labelClassName:s,name:c,value:d,...g}=e,f=!0===n?"indeterminate":void 0!==g.checked?g.checked:void 0;return(0,a.jsxs)(u,{className:s,children:[(0,a.jsx)(p,{ref:t,className:r,checked:f,name:c,value:d,onCheckedChange:e=>{null==l||l(e),o&&o({target:{checked:!0===e,indeterminate:"indeterminate"===e,name:c,value:d,type:"checkbox"},preventDefault:()=>{},stopPropagation:()=>{}})},...g}),i&&(0,a.jsx)(m,{children:i})]})});g.displayName="Checkbox";let f=Object.assign(g,{Control:p,Text:m,Label:u})},25749:(e,t,r)=>{r.d(t,{H3:()=>C,HC:()=>T,Hx:()=>b,J5:()=>g,Lt:()=>x,N5:()=>y,NK:()=>o,T3:()=>j,TH:()=>d,g2:()=>L,j9:()=>c,ki:()=>h,me:()=>P,oK:()=>w,oh:()=>k,r4:()=>m,ve:()=>u,vs:()=>v,wZ:()=>s,x3:()=>O,x9:()=>f,xO:()=>p,zR:()=>N,zr:()=>A});var a=r(42959),i=r(80004),n=r(54327);function l(e){let t=(0,a.Z)(e);return{visible:t.visible,params:t.params,status:t.status,error:t.error,preload:t.preload,showLayer:t.open,hideLayer:t.close}}function o(e,t){(0,i.c2)(e,t)}function s(e){(0,i.mC)(e)}let c=()=>l(n.b.ContractBulkActionDialog),d=()=>l(n.b.OrderSettingsDrawer),u=()=>l(n.b.TpslEditorDialog),p=()=>l(n.b.PositionLeverageDialog),m=()=>l(n.b.PositionAdjustMarginDialog),g=()=>l(n.b.PositionShareDialog),f=()=>l(n.b.PositionCloseDifferenceDialog),h=()=>l(n.b.PositionCloseOrderConfirmDialog),b=()=>l(n.b.PlaceOrderSettings),x=()=>l(n.b.PlaceOrderTpslAdvanced),v=()=>l(n.b.PlaceOrderDifference),P=()=>l(n.b.PlaceOrderConfirm),y=()=>l(n.b.AccountResetConfirm),C=()=>l(n.b.PlaceTriggerOrdersNotice),k=()=>l(n.b.OpenService),N=()=>l(n.b.ChangeOpenOrder),T=()=>l(n.b.CancelOrder),L=()=>l(n.b.CancelPlan),w=()=>l(n.b.ChangePlanOrder),O=()=>l(n.b.CancelTriggerOrder),j=()=>l(n.b.OrderHistoryTradeDetails),A=()=>l(n.b.PlanTriggered)},27442:(e,t,r)=>{r.d(t,{y:()=>l});var a=r(79237),i=r(38113),n=r(65375);let l=i.forwardRef((e,t)=>(0,a.jsx)(n.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,a.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"},28598:(e,t,r)=>{r.d(t,{Hp:()=>d,QT:()=>i,bh:()=>c,kG:()=>u,lf:()=>o,oI:()=>s});var a=r(3529);let i="XUSDT",n="-SWAP";function l(e){let t=null==e?void 0:e.trim().toUpperCase();if(!t)return"";if(t.endsWith("XUSDT"))return(0,a.IK)(t,"");if(t.endsWith(n)){if(!t.endsWith(n))return t;let e=t.slice(0,-n.length);return e.length>1&&e.endsWith("X")?"".concat(e.slice(0,-1)).concat(n):t}return t.endsWith("-USDT")?(0,a.Qx)(t,"-"):t.endsWith("USDT")?(0,a.Qx)(t,""):""}function o(e){return l(e)||l("BTCXUSDT")}function s(e){return l(e)}function c(e){return(0,a.oA)(o(e),"")}function d(e){let t=l(e);return t?(0,a.oA)(t,""):""}function u(e){return e?"/resource-upload/".concat(e.split("-")[0],".png"):""}},33149:(e,t,r)=>{r.d(t,{T:()=>s});var a=r(41809);let i=()=>{},n=async()=>{},l=()=>i,o=()=>({onTransfer:i,onSetOrderType:i,onNumberFieldChange:l,onToggleReferencePriceField:i,onFillLastPrice:i,onQuantityModeChange:i,onQuantityChange:i,onTradeUnitChange:i,onPercentageChange:i,onSliderChange:i,onClearQuantity:i,onPrimaryAction:i,onSecondaryAction:i,onOpenSettings:i,onOpenCalculator:i,onChangeActiveTab:i,onDisableTpsl:i,onEnableTpsl:i,onOpenTpslAdvanced:i,onToggleTpslTriggerWay:i,onTpslNumberFieldChange:l,getMaxPositionLabel:()=>"",onSettingsConfirm:n,onTpslConfirm:i,onDifferenceConfirm:n,onConfirmSubmit:i}),s=(0,a.v)(e=>({actions:o(),syncActions:t=>e({actions:t}),resetActions:()=>e({actions:o()})}))},33162:(e,t,r)=>{r.d(t,{c:()=>l});var a=r(79237),i=r(38113),n=r(65375);let l=i.forwardRef((e,t)=>
1(0,a.jsx)(n.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,a.jsx)("path",{d:"M512 207.061333c-100.394667 0-191.232 28.16-272.512 84.821334C158.165333 348.586667 99.754667 421.845333 64 512c35.541333 90.197333 93.952 163.712 175.488 220.117333 81.28 56.618667 172.117333 84.864 272.512 84.864 100.394667 0 191.232-28.245333 272.512-84.906666 81.322667-56.618667 139.733333-129.92 175.488-220.074667-35.541333-90.197333-93.952-163.712-175.488-220.117333C703.232 235.264 612.394667 207.018667 512 207.018667z m0 508.842667c-36.864 0-70.826667-9.088-101.973333-27.562667a209.493333 209.493333 0 0 1-74.368-74.368A196.266667 196.266667 0 0 1 308.053333 512a196.266667 196.266667 0 0 1 27.562667-101.973333A209.493333 209.493333 0 0 1 410.026667 335.701333 196.181333 196.181333 0 0 1 512 308.053333c36.864 0 70.826667 9.088 101.973333 27.562667a209.493333 209.493333 0 0 1 74.368 74.410667c18.432 31.061333 27.562667 65.066667 27.562667 101.930666a196.266667 196.266667 0 0 1-27.562667 101.973334 209.365333 209.365333 0 0 1-74.368 74.368 196.266667 196.266667 0 0 1-101.973333 27.562666z m0-325.845333c-34.218667 0-63.317333 11.776-86.613333 35.328-23.552 23.552-35.328 52.394667-35.328 86.613333 0 34.218667 11.776 63.317333 35.328 86.613333 23.552 23.552 52.394667 35.328 86.613333 35.328 34.218667 0 63.317333-11.776 86.613333-35.328 23.552-23.552 35.328-52.394667 35.328-86.613333 0-34.218667-11.776-63.317333-35.328-86.613333-23.296-23.552-52.394667-35.328-86.613333-35.328z"})}));l.displayName="Eye1Icon"},39679:(e,t,r)=>{r.d(t,{$w:()=>s,IQ:()=>l,Ir:()=>g,JF:()=>o,Op:()=>f,TR:()=>d,_j:()=>h,az:()=>b,m6:()=>p,p0:()=>u,tt:()=>m});var a=r(122);function i(e,t){return e&&t?new a.A(e).mul(t).toNumber():0}function n(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"UP";if(!Number.isFinite(e))return 0;let i=l(null==t?void 0:t.precision,2),n=String((null==t?void 0:t.minPriceChange)||""),o="UP"===r?a.A.ROUND_UP:a.A.ROUND_DOWN,s=new a.A(e).toDecimalPlaces(i,o).toFixed(i);if(n.endsWith("5")){let e=s.slice(-1),t=s.slice(0,-1);s="".concat(t).concat(5>Number(e)?"0":"5")}return Number(s)}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 o(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,a=""]=e.split(".");return a.length>t?null:e}function s(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[a,i=""]=r;return i.length<=t?e:"".concat(a,".").concat(i.slice(0,t))}(c(e),t);if(null===r)return null;let a=Number(r);return!Number.isNaN(a)&&a>=0&&a<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 i=e.precision;if(!t)return t;let n=t.toString().replace(/^0+(\d+)/,"$1"),[,l=""]=n.split(".");return l.length>=i&&(n=new a.A(n).toDecimalPlaces(i,a.A.ROUND_DOWN).toString()),n}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return"-"===e?e:o(e,t)}function m(e){let{orderType:t,orderPrice:r,triggerPrice:a,lastPrice:i=0}=e;return"limit"===t||"postOnly"===t?Number(r||0)||i:"planLimit"===t?Number(r||0)||Number(a||0)||i:"planMarket"===t&&Number(a||0)||i}function g(e){let{orderbook:t,lastPrice:r=0,orderType:a,orderPrice:l,triggerPrice:o,contract:s}=e,c=(null==t?void 0:t.asks)||[],d=(null==t?void 0:t.bids)||[],u=c.length?c[c.length-1]:void 0,p=d[0]?Number(d[0].price):0,m=u?Number(u.price):0,g=Number(l||0),f=Number(o||0),h="planLimit"===a?g||f||r:g,b=Number(null==s?void 0:s.costPriceMultiplier),x=0,v=0;return"market"===a?m&&p?(x=i(m,b),v=i(p,b)):(x=r,v=r):"planMarket"===a?m&&p?(x=f?i(f,b):0,v=f?i(f,b):0):(x=f,v=f):m&&p?h>=m?(x=i(h,b),v=i(h,b)):h<=p?(x=i(h,b),v=h?i(p,b):0):(x=i(h,b),v=i(h,b)):(x=h,v=h),{buy:n(x,s),sell:n(v,s)}}function f(e){let{quantityCont:t,longLeverage:r,shortLeverage:i,prices:n,contract:l,siteConfig:o}=e,s=Number((null==l?void 0:l.multiplier)||0),c=Number((null==o?void 0:o.takerFeeRate)||0),d=new a.A(t).mul(2).mul(s).mul(n.buy).mul(c),u=new a.A(t).mul(2).mul(s).mul(n.sell).mul(c),p=r?new a.A(t).mul(s).mul(n.buy).div(r):new a.A(0),m=i?new a.A(t).mul(s).mul(n.sell).div(i):new a.A(0);return{buy:d.plus(p).toDecimalPlaces(10,a.A.ROUND_FLOOR).toNumber(),sell:u.plus(m).toDecimalPlaces(10,a.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 a.A(t).div(r.buy).toDecimalPlaces(0,a.A.ROUND_FLOOR).toNumber():0,sell:r.sell?new a.A(t).div(r.sell).toDecimalPlaces(0,a.A.ROUND_FLOOR).toNumber():0}}},40394:(e,t,r)=>{r.d(t,{k:()=>a});function a(e,t){return"Cont"===e?t("Cont"):e}},44031:(e,t,r)=>{r.r(t),r.d(t,{Input:()=>b,OTPInput:()=>
1P,PasswordInput:()=>v,TextArea:()=>x});var a=r(79237),i=r(90477),n=r(4487),l=r(38113),o=r(71591),s=r(65375);let c=l.forwardRef((e,t)=>(0,a.jsx)(s.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,a.jsx)("path",{d:"M829.013333 516.096a51.2 51.2 0 1 1 72.362667 72.405333l-301.653333 301.738667a51.242667 51.242667 0 0 1-72.448-72.448l301.696-301.653333z m-63.402666-358.997333a51.2 51.2 0 0 1 72.405333 72.405333l-597.333333 597.333333a51.2 51.2 0 0 1-72.405334-72.405333l597.333334-597.333333z"})}));c.displayName="TextAreaIcon";var d=r(33162),u=r(18983);let p=(0,n.F)(["w-0","flex-1","border-0","bg-transparent","outline-none","text-t1","placeholder:text-t3","transition-all","duration-200","disabled:cursor-not-allowed","disabled:text-t5","disabled:placeholder:text-t5"],{variants:{variant:{default:[],filled:[]},size:{l:["text-bm16","placeholder:text-bm16"],m:["text-bm14","placeholder:text-bm14"],s:["text-bm14","placeholder:text-bm14"]}},defaultVariants:{variant:"default",size:"l"}}),m=(0,n.F)(["relative","flex","items-center","w-full","rounded-r2","transition-all","duration-200"],{variants:{variant:{default:["bg-bg2","border","border-transparent"],focused:["bg-bg3","border","border-p1"]},size:{l:["h-12","px-s4"],m:["h-10","px-s4"],s:["h-9","px-s3"]}},defaultVariants:{variant:"default",size:"l"}}),g=(0,n.F)(["block","mb-2","text-t1"],{variants:{size:{l:"text-bm14",m:"text-bm14",s:"text-bm14"}},defaultVariants:{size:"l"}}),f=(0,n.F)(["relative","flex","w-full","rounded-r3","transition-all","duration-200"],{variants:{variant:{default:["bg-bg2","border","border-transparent"],focused:["bg-bg3","border","border-p1"]},size:{m:["min-h-[150px]","p-s4","text-bm14"]}},defaultVariants:{variant:"default",size:"m"}}),h=e=>{let{placeholder:t,className:r,disabled:n,value:o,hasValue:s,isFocused:c,inputRef:d,leftInset:u=0,rightInset:p=0,onFocus:m,onBlur:g,onChange:f,onCompositionStart:h,onCompositionEnd:b,readOnly:x,...v}=e,P=l.useRef(null),y=l.useCallback(e=>{P.current=e,"function"==typeof d?d(e):d&&(d.current=e)},[d]),C=c||s,k=l.useMemo(()=>({marginLeft:u>0?"".concat(u,"px"):void 0,marginRight:p>0?"".concat(p,"px"):void 0}),[u,p]);return(0,a.jsx)("div",{className:"relative min-w-0 flex-1 cursor-text","data-motion-state":C?"raised":"idle",onMouseDown:e=>{var t;n||x||e.target!==P.current&&(e.preventDefault(),null==(t=P.current)||t.focus())},children:(0,a.jsxs)("div",{className:"relative h-full min-w-0",style:k,children:[(0,a.jsx)("input",{ref:y,disabled:n,value:o,readOnly:x,placeholder:" ",className:(0,i.Q)("peer h-full w-full border-0 bg-transparent px-0 pt-[16px] pb-[2px] outline-none","text-bm14 text-t1 placeholder:text-transparent","disabled:text-t5 disabled:cursor-not-allowed",r),onFocus:m,onBlur:g,onChange:f,onCompositionStart:h,onCompositionEnd:b,...v}),t?(0,a.jsx)("label",{"aria-hidden":"true",className:(0,i.Q)("text-bm14 pointer-events-none absolute top-1/2 right-0 left-0 origin-left truncate leading-[20px] will-change-transform rtl:origin-right","font-normal transition-all duration-300 ease-[cubic-bezier(0.22,1,0.36,1)]",C?"text-t1 -translate-y-[18px] scale-[0.785714]":"text-t4 -translate-y-1/2 scale-100"),children:t}):null]})})},b=l.forwardRef((e,t)=>{let{className:r,variant:n="borderless",size:s="l",label:c,labelClassName:d,error:u,leftSlot:f,rightSlot:b,clearable:x,onClear:v,wrapperClassName:P,enablePlaceholderMotion:y=!1,placeholder:C,disabled:k,value:N,type:T="text",onChange:L,defaultValue:w,onFocus:O,onBlur:j,onCompositionStart:A,onCompositionEnd:R,...D}=e,[S,Q]=l.useState(!1),[U,W]=l.useState(!1),M=void 0!==N,[F,E]=l.useState(M?null!=N?N:"":null!=w?w:""),B=l.useRef(null),z=l.useRef(null),_=l.useRef(null),[I,q]=l.useState(0),[G,H]=l.useState(0),V=l.useCallback(e=>{B.current=e,"function"==typeof t?t(e):t&&(t.current=e)},[t]);l.useEffect(()=>{!U&&M&&E(null!=N?N:"")},[M,N,U]);let $=M?U?F:null!=N?N:"":F,K=""!==$,X="outlined"===n,Z=y&&"hidden"!==T;l.useLayoutEffect(()=>{if(!Z){q(0),H(0);return}let e=z.current,t=_.current,r=()=>{var r,a;let i=null!=(r=null==e?void 0:e.offsetWidth)?r:0,n=null!=(a=null==t?void 0:t.offsetWidth)?a:0;q(i>0?i:0),H(n>0?n:0)};if(r(),"undefined"==typeof ResizeObserver)return;let a=new ResizeObserver(r);return e&&a.observe(e),t&&a.observe(t),()=>{a.disconnect()}},[Z,f,b,x,K,k,D.readOnly]);let J=e=>{let t=!!e.nativeEvent.isComposing;(!M||U||t)&&E(e.target.value),null==L||L(e)},Y=()=>{if(k||D.readOnly)return;M||E("");let e=B.current;if(e){var t;let r=null==(t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))?void 0:t.set;null==r||r.call(e,"");let a=new Event("input",{bubbles:!0});e.dispatchEvent(a)}null==v||v()};return(0,a.jsxs)("div",{className:"w-full",children:[c&&(0,a.jsx)("label",{className:(0,i.Q)(g({size:s}),d),children:c}),(0,a.jsxs)("div",{className:(0,i.Q)(m({variant:S?"focused":"default",size:s}),!Z&&"l"===s&&"!rounded-r3",Z&&"!rounded-r2 px-s2 py-s1 h-[44px] items-stretch",X&&"bg-transparent",X&&!S&&"border-l1",k&&"bg-bg07 border-l1 cursor-not-allowed",P),children:[Z?(0,a.jsx)(h,{...D,inputRef:V,type:T,disabled:k,readOnly:D.readOnly,value:$,hasValue:K,isFocused:S,placeholder:C,className:r,leftInset:I,rightInset:G,onFocus:e=>{Q(!0),null==O||O(e)},onBlur:e=>{Q(!1),null==j||j(e)},onChange:J,onCompositionStart:e=>{W(!0),E(e.currentTarget.value),null==A||A(e)},onCompositionEnd:e=>{W(!1),E(e.currentTarget.value),null==R||R(e)}}):(0,a.jsxs)(a.Fragment,{children:[f&&(0,a.jsx)("div",{className:"mr-2 flex items-center rtl:mr-0 rtl:ml-2",children:f}),(0,a.jsx)("input",{ref:V,type:T,disabled:k,value:$,placeholder:C,className:(0,i.Q)(p({size:s}),r),onFocus:e=>{Q(!0),null==O||O(e)},onBlur:e=>{Q(!1),null==j||j(e)},onChange:J,onCompositionStart:e=>{W(!0),E(e.currentTarget.value),null==A||A(e)},onCompositionEnd:e=>{W(!1),E(e.currentTarget.value),null==R||R(e)},...D})]}),Z&&f&&(0,a.jsx)("div",{ref:z,className:"left-s2 absolute top-1/2 z-[1] flex -translate-y-1/2 items-center",children:f}
1),Z?(b||x&&K&&!k&&!D.readOnly)&&(0,a.jsxs)("div",{ref:_,className:"right-s2 absolute top-1/2 z-[1] flex -translate-y-1/2 items-center gap-1",children:[x&&K&&!k&&!D.readOnly&&(0,a.jsx)("button",{type:"button",onClick:Y,className:"text-t3 hover:text-t1 cursor-pointer leading-0 transition-colors","aria-label":"Clear input",children:(0,a.jsx)(o.v,{className:"h-5 w-5 cursor-pointer"})}),b&&(0,a.jsx)("div",{className:"flex items-center",children:b})]}):(0,a.jsxs)(a.Fragment,{children:[x&&K&&!k&&!D.readOnly&&(0,a.jsx)("button",{type:"button",onClick:Y,className:"text-t3 hover:text-t1 ml-2 cursor-pointer leading-0 transition-colors rtl:mr-2 rtl:ml-0","aria-label":"Clear input",children:(0,a.jsx)(o.v,{className:"h-5 w-5 cursor-pointer"})}),b&&(0,a.jsx)("div",{className:"ml-2 flex items-center rtl:mr-2 rtl:ml-0",children:b})]})]}),u&&(0,a.jsx)("p",{className:"text-b14 mt-1 text-red-500",children:u})]})});b.displayName="Input";let x=l.forwardRef((e,t)=>{let{className:r,variant:n="borderless",label:o,error:s,wrapperClassName:d,showCount:u,maxLength:p,showResizeIndicator:m=!0,size:h="m",value:b,defaultValue:x,onChange:v,onFocus:P,onBlur:y,disabled:C,...k}=e,[N,T]=l.useState(!1),L=void 0!==b,[w,O]=l.useState(L?null!=b?b:"":null!=x?x:""),j=l.useRef(null),A=l.useCallback(e=>{j.current=e,"function"==typeof t?t(e):t&&(t.current=e)},[t]);l.useEffect(()=>{L&&O(null!=b?b:"")},[L,b]);let R=L?null!=b?b:"":w,D=R.length,S=null!=u?u:void 0!==p;return(0,a.jsxs)("div",{className:"w-full",children:[o&&(0,a.jsx)("label",{className:g({
1size:"s"}),children:o}),(0,a.jsxs)("div",{className:(0,i.Q)(f({variant:N?"focused":"default",size:h}),"outlined"===n&&"bg-transparent","outlined"===n&&!N&&"border-l1","gap-s1 flex-col items-start justify-center",C&&"bg-bg07 border-l1 cursor-not-allowed",d),children:[(0,a.jsx)("textarea",{ref:A,value:R,disabled:C,maxLength:p,className:(0,i.Q)("text-t1 placeholder:text-t3 w-full flex-1 resize-none border-0 bg-transparent outline-none","disabled:text-t5 disabled:placeholder:text-t5","text-b14 placeholder:text-b14",C&&"cursor-not-allowed",r),onFocus:e=>{T(!0),null==P||P(e)},onBlur:e=>{T(!1),null==y||y(e)},onChange:e=>{L||O(e.target.value),null==v||v(e)},...k}),S&&(0,a.jsxs)("div",{className:"text-c11 gap-s0 flex w-full items-center justify-end text-right",children:[(0,a.jsx)("span",{className:(0,i.Q)("pointer-events-none select-none",0===D?"text-t4":"text-t1"),children:D}),void 0!==p&&(0,a.jsxs)("span",{className:"text-t4 pointer-events-none select-none",children:["/",p]})]}),m&&(0,a.jsx)("button",{type:"button","aria-label":"Resize textarea",className:"text-t4 right-s1 bottom-s1 absolute inline-flex size-3 cursor-ns-resize items-center justify-center p-0",onPointerDown:e=>{if(!m||C||k.readOnly)return;let t=j.current;if(!t)return;e.preventDefault();let r=e.clientY,a=t.getBoundingClientRect().height,i=Number.parseFloat(window.getComputedStyle(t).minHeight)||0;t.style.height="".concat(a,"px");let n=e=>{let n=Math.max(i,a+(e.clientY-r));t.style.height="".concat(n,"px")},l=()=>{window.removeEventListener("pointermove",n),window.removeEventListener("pointerup",l),window.removeEventListener("pointercancel",l)};window.addEventListener("pointermove",n),window.addEventListener("pointerup",l),window.addEventListener("pointercancel",l)},children:(0,a.jsx)(c,{className:"size-3"})})]}),s&&(0,a.jsx)("p",{className:"text-b14 mt-1 text-red-500",children:s})]})});x.displayName="TextArea";let v=l.forwardRef((e,t)=>{let[r,i]=l.useState(!1);return(0,a.jsx)(b,{...e,ref:t,type:r?"text":"password",rightSlot:(0,a.jsx)("button",{type:"button",onClick:()=>i(!r),className:"text-t3 hover:text-t1 cursor-pointer leading-0 transition-colors","aria-label":r?"Hide password":"Show password",children:r?(0,a.jsx)(d.c,{className:"h-5 w-5"}):(0,a.jsx)(u.b,{className:"h-5 w-5"})})})});v.displayName="PasswordInput";let P=l.forwardRef((e,t)=>{let{length:r=6,onChange:n,value:o="",disabled:s,className:c}=e,d=l.useRef([]),[u,p]=l.useState(o.split("").concat(Array(r).fill("")).slice(0,r)),[m,g]=l.useState(-1);l.useEffect(()=>{p(o.split("").concat(Array(r).fill("")).slice(0,r))},[o,r]);let f=e=>{var t;e.preventDefault();let a=e.clipboardData.getData("text/plain").slice(0,r),i=a.split("").concat(Array(r).fill("")).slice(0,r);p(i),null==n||n(i.join(""));let l=Math.min(a.length,r-1);null==(t=d.current[l])||t.focus()};return(0,a.jsx)("div",{ref:t,className:(0,i.Q)("gap-s2 flex",c),children:Array.from({length:r}).map((e,t)=>{u[t];let l=m===t;return(0,a.jsx)("div",{className:(0,i.Q)("rounded-r2 flex h-11 w-11 items-center justify-center border transition-all md:h-15 md:w-15","bg-bg2 border-l1",l&&"bg-bg3 border-p1",s&&"cursor-not-allowed opacity-30"),children:(0,a.jsx)("input",{ref:e=>{d.current[t]=e},type:"text",inputMode:"numeric",maxLength:1,value:u[t]||"",onChange:e=>((e,t)=>{if(t&&!/^\d$/.test(t))return;let a=[...u];if(a[e]=t,p(a),null==n||n(a.join("")),t&&e<r-1){var i;null==(i=d.current[e+1])||i.focus()}})(t,e.target.value),onKeyDown:e=>((e,t)=>{if("Backspace"===t.key&&!u[e]&&e>0){var r;null==(r=d.current[e-1])||r.focus()}})(t,e),onFocus:()=>g(t),onBlur:()=>g(-1),onPaste:f,disabled:s,className:"text-tm24 text-t1 h-full w-full border-0 bg-transparent text-center font-semibold outline-none"})},t)})})});P.displayName="OTPInput"},46629:(e,t,r)=>{r.d(t,{G5:()=>g,Kf:()=>h,e:()=>m,oO:()=>b,tk:()=>f});var a=r(79237),i=r(47776),n=r(27442),l=r(24626),o=r(27737),s=r(44031),c=r(56044),d=r(66960),u=r(19490),p=r(7126);function m(e){return(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsx)(l.Checkbox,{disabled:e.disabled,labelClassName:e.disabled?"gap-1 cursor-not-allowed":"gap-1 cursor-pointer",checked:e.checked,onCheckedChange:t=>e.onCheckedChange(!!t),children:(0,a.jsx)("span",{className:"text-c12 text-t1 leading-4",children:e.label})}),e.checked?(0,a.jsxs)(o.DropdownMenu,{modal:!1,children:[(0,a.jsx)(o.DropdownMenuTrigger,{asChild:!0,showIcon:!1,children:(0,a.jsxs)("button",{type:"button",className:"text-c12 text-t1 inline-flex h-5 cursor-pointer items-center gap-1 leading-4",children:[(0,a.jsx)("span",{children:e.dropdownLabel}),(0,a.jsx)(i.C,{className:"text-t3 size-3 shrink-0 transition-transform group-data-[state=open]:rotate-180"})]})}),(0,a.jsx)(o.DropdownMenuContent,{align:"end",sideOffset:6,className:"!border-l1 !bg-m1 !shadow-2 !flex !min-w-[160px] !flex-col !gap-1 !rounded-[8px] !py-2",children:e.options.map(t=>(0,a.jsx)(o.DropdownMenuItem,{className:"!rounded-r1 !text-bm14 !mx-2 !min-h-10 !px-3 !py-[10px] ".concat(t.label===e.dropdownLabel?"!bg-bg2 !text-t1 hover:!bg-bg2 !shadow-[inset_0_0_0_1px_var(--line-1)]":"!text-t1 hover:!bg-bg2"),onClick:()=>e.onSelect(t.value),children:t.label},t.value))})]}):null]})}function g(e){return(0,a.jsx)(s.Input,{size:"m",value:e.value,placeholder:e.placeholder,wrapperClassName:"".concat(p.w," !h-10 !rounded-r3 !px-3"),className:"!text-bm14 placeholder:!text-t4",leftSlot:e.prefix?(0,a.jsx)("span",{className:"text-bm14 text-t1 shrink-0",children:e.prefix}):null,rightSlot:(0,a.jsxs)("button",{type:"button",className:"text-b14 max-md:text-c12 text-t1 inline-flex cursor-pointer items-center gap-2",onClick:e.onSwitchTriggerWay,children:[(0,a.jsx)("span",{children:e.triggerWayLabel}),(0,a.jsx)(n.y,{className:"text-t3 size-3"})]}),onChange:t=>e.onChange(t.target.value)})}function f(e){return(0,a.jsx)(s.Input,{size:"m",value:e.value,placeholder:e.placeholder,wrapperClassName:"".concat(p.w," !h-10 !rounded-r3 !px-3"),className:"!text-bm14 placeholder:!text-t4",rightSlot:e.suffix,onChange:t=>e.onChange(t.target.value),onFocus:e.onFocus,onBlur:e.onBlur})}function h(e){return(0,a.jsx)(c.Slider,{className:"mt-0.5",value:e.value,onValueChange:e.onChange,showIndicatorOnDragging:!0,marks:[{value:0,label:"0%",displayValue:0},{value:20,label:"20%",displayValue:20},{value:100,label:"500%",displayValue:500}],activeColor:"var(--color-p1)",SliderBarclassName:"!bg-bg6",SliderThumbclassName:"size-4"})}function b(e){let{$t:t}=(0,d.B)(),r="--"===e.rateText?"--":"".concat(e.rateText,"%");return(0,a.jsx)("div",{className:"text-c12 text-t3 min-w-0 leading-4 break-words whitespace-normal",dangerouslySetInnerHTML:{__html:t("When {0} reaches {1}, it will trigger a {2}, and the EST.PNL will be {3}",{0:e.triggerWayLabel.toLowerCase(),1:'<span class="text-t1">
1'.concat((0,u.iT)(e.triggerPrice)||"--"," USDT</span>"),2:t("limit"===e.priceType?"limit order":"market order"),3:'<span class="text-t1">'.concat(e.pnlText||"--"," USDT(").concat(r,")</span>")})}})}},47562:(e,t,r)=>{r.d(t,{$:()=>n});var a=r(41809);let i=()=>({orderEntry:{availableBalanceText:"0",quoteAsset:"USDT"},quantity:{quantityMode:"quantity",quantityModeOptions:[],tradeUnitValue:"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"}}),n=(0,a.v)(e=>({...i(),syncComputed:t=>e(t),resetComputed:()=>e(i())}))},50791:(e,t,r)=>{r.d(t,{H3:()=>A,HC:()=>Q,Hx:()=>N,J5:()=>v,Lt:()=>L,NK:()=>o,T3:()=>F,T5:()=>c,TH:()=>u,Te:()=>j,Ui:()=>T,W5:()=>R,g2:()=>U,gO:()=>C,hQ:()=>h,j9:()=>d,ki:()=>y,kw:()=>f,me:()=>O,oK:()=>W,og:()=>k,oh:()=>D,r4:()=>x,ve:()=>p,vs:()=>w,wT:()=>g,wZ:()=>s,x3:()=>M,x9:()=>P,xO:()=>b,zR:()=>S,zr:()=>E,zx:()=>m});var a=r(42959),i=r(80004),n=r(50965);function l(e){let t=(0,a.Z)(e);return{visible:t.visible,params:t.params,status:t.status,error:t.error,preload:t.preload,showLayer:t.open,hideLayer:t.close}}function o(e,t){(0,i.c2)(e,t)}function s(e){(0,i.mC)(e)}let c=()=>l(n.b.GuideDialog),d=()=>l(n.b.ContractBulkActionDialog),u=()=>l(n.b.OrderSettingsDrawer),p=()=>l(n.b.TpslEditorDialog),m=()=>l(n.b.GridGuideDialog),g=()=>l(n.b.GridServiceDialog),f=()=>l(n.b.GridOrderSettings),h=()=>l(n.b.GridOrderConfirm),b=()=>l(n.b.PositionLeverageDialog),x=()=>l(n.b.PositionAdjustMarginDialog),v=()=>l(n.b.PositionShareDialog),P=()=>l(n.b.PositionCloseDifferenceDialog),y=()=>l(n.b.PositionCloseOrderConfirmDialog),C=()=>l(n.b.PositionReverseConfirmDialog),k=()=>l(n.b.GridStopStrategyDialog),N=()=>l(n.b.PlaceOrderSettings),T=()=>l(n.b.PlaceOrderCalculator),L=()=>l(n.b.PlaceOrderTpslAdvanced),w=()=>l(n.b.PlaceOrderDifference),O=()=>l(n.b.PlaceOrderConfirm),j=()=>l(n.b.LiquidityStatus),A=()=>l(n.b.PlaceTriggerOrdersNotice),R=()=>l(n.b.InsufficientBalance),D=()=>l(n.b.OpenService),S=()=>l(n.b.ChangeOpenOrder),Q=()=>l(n.b.CancelOrder),U=()=>l(n.b.CancelPlan),W=()=>l(n.b.ChangePlanOrder),M=()=>l(n.b.CancelTriggerOrder),F=()=>l(n.b.OrderHistoryTradeDetails),E=()=>l(n.b.PlanTriggered)},50965:(e,t,r)=>{r.d(t,{b:()=>a,k:()=>a});var a=function(e){return e.GuideDialog="futuresGuider",e.GridGuideDialog="gridGuider",e.ContractBulkActionDialog="contractBulkActionDialog",e.OrderSettingsDrawer="setOrderSettings",e.TpslEditorDialog="tpslEditorLayer",e.GridServiceDialog="gridService",e.GridOrderSettings="gridOrderSettings",e.GridOrderConfirm="gridOrderConfirm",e.PositionLeverageDialog="positionLeverageLayer",e.PositionAdjustMarginDialog="positionAdjustMarginLayer",e.PositionShareDialog="positionShareLayer",e.PositionCloseDifferenceDialog="placeDifferenceLayer",e.PositionCloseOrderConfirmDialog="placeCloseOrderConfirm",e.PositionReverseConfirmDialog="placeReverseOrderConfirm",e.GridStopStrategyDialog="stopGrid",e.PlaceOrderSettings="placeOrderSettings",e.PlaceOrderCalculator="placeOrderCalculator",e.PlaceOrderTpslAdvanced="placeOrderTpslAdvanced",e.PlaceOrderDifference="placeOrderDifference",e.PlaceOrderConfirm="placeOrderConfirm",e.LiquidityStatus="liquidityStatusLayer",e.PlaceTriggerOrdersNotice="placeTriggerOrdersNotice",e.InsufficientBalance="insufficientBalanceLayer",e.OpenService="openService",e.ChangeOpenOrder="changeOpenOrder",e.CancelOrder="cancelOrderLayer",e.CancelPlan="cancelPlanLayer",e.ChangePlanOrder="changePlanOrderLayer",e.CancelTriggerOrder="cancelTriggerOrderLayer",e.OrderHistoryTradeDetails="orderHistoryTradeDetailsLayer",e.PlanCloseOrder="planCloseOrder",e.PlanTriggered="planTriggeredLayer",e.PlanListLayer="planListLayer",e}({})},51430:(e,t,r)=>{r.d(t,{eh:()=>l,n7:()=>i,qQ:()=>n});var a=r(122);function i(e,t){let r=Number(e);return Number.isNaN(r)?"0":new a.A(r).toFixed(t,a.A.ROUND_UP)}function n(e,t){let r=Number(e);return Number.isNaN(r)?"0":new a.A(r).toFixed(t,a.A.ROUND_DOWN)}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=Number(e);return r>0?function(e,t){let r=Number(e);return Number.isNaN(r)?"0":new a.A(r).toFixed(t,a.A.ROUND_FLOOR)}(r,t):function(e,t){let r=Number(e);return Number.isNaN(r)?"0":new a.A(r).toFixed(t,a.A.ROUND_CEIL)}(r,t)}},53951:(e,t,r)=>{r.r(t),r.d(t,{Dialog:()=>k,DialogClose:()=>f,DialogContent:()=>b,DialogDescription:()=>y,DialogFooter:()=>v,DialogHeader:()=>x,DialogOverlay:()=>h,DialogPortal:()=>g,DialogRoot:()=>p,DialogTitle:()=>P,DialogTrigger:()=>m});var a=r(79237),i=r(91405),n=r(90477),l=r(45056),o=r(12407),s=r(61058),c=r(38113),d=r(51924),u=r(70659);let p=l.bL,m=l.l9,g=l.ZL,f=l.bm,h=c.forwardRef((e,t)=>
1{let{className:r,...i}=e;return(0,a.jsx)(l.hJ,{ref:t,className:(0,n.Q)("bg-p6 fixed inset-0 z-300","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...i})});h.displayName=l.hJ.displayName;let b=c.forwardRef((e,t)=>{let{className:r,children:i,style:o,overlayClassName:s,...c}=e;return(0,a.jsxs)(g,{children:[(0,a.jsx)(h,{className:s}),(0,a.jsx)(l.UC,{ref:t,style:o,className:(0,n.Q)("fixed top-[50%] left-[50%] z-300 translate-x-[-50%] translate-y-[-50%] outline-none","w-[420px] max-md:w-[calc(100vw-var(--spacing-s8)-var(--spacing-s8))] max-md:max-w-[420px]","flex flex-col","border-l1 bg-m1 p-s6 shadow-3 rounded-[12px] border","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",r),...c,children:i})]})});b.displayName=l.UC.displayName;let x=e=>{let{className:t,...r}=e;return(0,a.jsx)("div",{className:(0,n.Q)("gap-s4 flex flex-col",t),...r})};x.displayName="DialogHeader";let v=e=>{let{className:t,layout:r="horizontal",...i}=e;return(0,a.jsx)("div",{className:(0,n.Q)("gap-s2 flex w-full","horizontal"===r?"flex-row":"flex-col",t),...i})};v.displayName="DialogFooter";let P=c.forwardRef((e,t)=>{let{className:r,showClose:i=!0,onClose:o,children:s,...c}=e;return(0,a.jsxs)("div",{className:"gap-s6 flex items-center justify-between",children:[(0,a.jsx)(l.hE,{ref:t,className:(0,n.Q)("text-t1 text-tm18 flex-1",r),...c,children:s}),i&&(0,a.jsx)(f,{className:"flex h-[22px] cursor-pointer items-center justify-center px-0 py-[2px] focus:outline-none",onClick:o,children:(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsx)(d.U,{className:"text-t3 size-5"})})})]})});P.displayName=l.hE.displayName;let y=c.forwardRef((e,t)=>{let{className:r,...i}=e;return(0,a.jsx)(l.VY,{ref:t,className:(0,n.Q)("text-t2 text-b14",r),...i})});y.displayName=l.VY.displayName;let C=(0,o.default)(()=>Promise.all([r.e(2243),r.e(3447)]).then(r.bind(r,33447)),{loadableGenerated:{webpack:()=>[33447]},ssr:!1}),k=e=>{let{trigger:t,defaultOpen:r,open:l,onOpenChange:o,title:d,description:g,showClose:h=!0,okText:k,cancelText:N,onOk:T,onCancel:L,okButtonProps:w,cancelButtonProps:O,footerLayout:j,footer:A=null,children:R,onClose:D,className:S,hideHeader:Q=!1,headerClassName:U,bodyClassName:W,footerClassName:M,preventOutsideClose:F=!1,preventEscapeClose:E=!1,variant:B="default",overlayClassName:z,onOpenAutoFocus:_}=e,I=(0,i.no)(),[q,G]=c.useState(!1);c.useEffect(()=>{G(!0)},[]);let[H,V]=c.useState(null!=r&&r),$=void 0!==l,K=$?l:H,X=$?o:e=>{V(e),null==o||o(e)},Z=j||(k&&N?"horizontal":"single"),J="vertical"===Z?"vertical":"horizontal",Y=!Q&&(d||g||h),ee=(e,t,r,a,i)=>{let{className:l,onClick:o,variant:s,size:c,...d}=e||{};return{...d,variant:s||t,size:c||r,className:(0,n.Q)(a,l),onClick:((e,t)=>r=>{null==e||e(r),r.defaultPrevented||null==t||t()})(o,i)}};return"drawer"===B&&q&&I?(0,a.jsx)(C,{open:K,onOpenChange:X,trigger:t,title:d,description:g,showClose:h,okText:k,cancelText:N,onOk:T,onCancel:L,okButtonProps:w,cancelButtonProps:O,footerLayout:j,footer:A,onClose:D,className:S,hideHeader:Q,headerClassName:U,bodyClassName:W,footerClassName:M,dismissible:!F,overlayClassName:z,children:R}):(0,a.jsxs)(p,{open:K,onOpenChange:X,children:[t&&(0,a.jsx)(m,{asChild:!0,children:t}),(0,a.jsxs)(b,{"aria-describedby":g?"dialog-description":void 0,className:S,overlayClassName:z,onOpenAutoFocus:_,onInteractOutside:e=>{F&&e.preventDefault()},onPointerDownOutside:e=>{F&&e.preventDefault()},onEscapeKeyDown:e=>{E&&e.preventDefault()},children:[Y?(0,a.jsxs)(x,{className:U,children:[(0,a.jsx)(P,{showClose:h,onClose:()=>{null==X||X(!1),null==D||D()},children:d}),g&&(0,a.jsx)(y,{children:g})]}):(0,a.jsx)(s.bL,{children:(0,a.jsx)(P,{showClose:h,children:d})}),R&&(0,a.jsx)("div",{className:(0,n.Q)(Y?"mt-s4":"mt-0",W),children:R}),(()=>{if(!1===A)return null;let e=A;return A||(e=(0,a.jsx)(v,{layout:J,children:"single"===Z?(0,a.jsx)(a.Fragment,{children:k?(0,a.jsx)(u.$,{...ee(w,"primary","m","w-full",T),children:k}):N?(0,a.jsx)(f,{asChild:!0,children:(0,a.jsx)(u.$,{...ee(O,"secondary","m","w-full",L),children:N})}):null}):"vertical"===Z?(0,a.jsxs)(a.Fragment,{children:[k&&(0,a.jsx)(u.$,{...ee(w,"primary","l","h-11 w-full md:h-12",T),children:k}),N&&(0,a.jsx)(f,{asChild:!0,children:(0,a.jsx)(u.$,{...ee(O,"white","l","text-t3 h-11 w-full border-none md:h-12",L),children:N})})]}):(0,a.jsxs)(a.Fragment,{children:[N&&(0,a.jsx)(f,{asChild:!0,children:(0,a.jsx)(u.$,{...ee(O,"secondary","m","h-10 flex-1",L),children:N})}),k&&(0,a.jsx)(u.$,{...ee(w,"primary","m",N?"h-10 flex-1":"h-10 w-full",T),children:k})]})})),(0,a.jsx)("div",{className:(0,n.Q)("mt-s7",M),children:e})})()]})]})};k.displayName="Dialog"},54327:(e,t,r)=>{r.d(t,{b:()=>a,k:()=>a});var a=function(e){return e.ContractBulkActionDialog="contractBulkActionDialog",e.OrderSettingsDrawer="setOrderSettings",e.TpslEditorDialog="tpslEditorLayer",e.PositionLeverageDialog="positionLeverageLayer",e.PositionAdjustMarginDialog="positionAdjustMarginLayer",e.PositionShareDialog="positionShareLayer",e.PositionCloseDifferenceDialog="placeDifferenceLayer",e.PositionCloseOrderConfirmDialog="placeCloseOrderConfirm",e.PlaceOrderSettings="placeOrderSettings",e.PlaceOrderTpslAdvanced="placeOrderTpslAdvanced",e.PlaceOrderDifference="placeOrderDifference",e.PlaceOrderConfirm="placeOrderConfirm",e.AccountResetConfirm="accountResetLayer",e.PlaceTriggerOrdersNotice="placeTriggerOrdersNotice",e.OpenService="openService",e.ChangeOpenOrder="changeOpenOrder",e.CancelOrder="cancelOrderLayer",e.CancelPlan="cancelPlanLayer",e.ChangePlanOrder="changePlanOrderLayer",e.CancelTriggerOrder="cancelTriggerOrderLayer",e.OrderHistoryTradeDetails="orderHistoryTradeDetailsLayer",e.PlanCloseOrder="planCloseOrder",e.PlanTriggered="planTriggeredLayer",e.PlanListLayer="planListLayer",e}({})},55896:(e,t,r)=>{r.d(t,{$:()=>n});var a=r(41809);let i=()=>({orderEntry:{availableBalanceText:"0",quoteAsset:"XUSDT"},quantity:{quantityMode:"quantity",quantityModeOptions:[],tradeUnitV
1alue:"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:"",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"}}),n=(0,a.v)(e=>({...i(),syncComputed:t=>e(t),resetComputed:()=>e(i())}))},56856:(e,t,r)=>{r.d(t,{Jh:()=>o,Mr:()=>l});var a=r(47387),i=r(41809);let n=e=>({symbol:e,activeTab:"open",orderType:a.Nm.get("orderType")||"limit",triggerPrice:"",orderPrice:"",quantity:"",longQuantity:"",shortQuantity:"",percentage:0,isPercentage:!1,checkedTpsl:!1,takeProfitPrice:"",stopLossPrice:"",tpOrderPrice:"",slOrderPrice:"",takeProfitRate:"",stopLossRate:"",takeProfitRateAbout:"",stopLossRateAbout:"",triggerWay:"mark",tpTriggerWay:"mark",slTriggerWay:"mark",tpPriceType:"market",slPriceType:"market",tpslActiveTab:"openLong",tpslAdvancedEdited:!1,tradeUnit:a.Nm.get("tradeUnit")||"0",usdtCost:"1"===a.Nm.get("usdtCost")?"1":"0",marginMode:"crossed",positionMode:"merged",longLeverage:10,shortLeverage:10}),l=(0,i.v)((e,t)=>({form:n("BTC-USDT"),initialize:(t,r)=>e(e=>{if(e.form.symbol===t)return e;let a=Number((null==r?void 0:r.longLeverage)||0),i=Number((null==r?void 0:r.shortLeverage)||0);return{form:{...n(t),marginMode:e.form.marginMode,...a>0?{longLeverage:a}:{},...i>0?{shortLeverage:i}:{}}}}),update:t=>e(e=>({form:{...e.form,...t}})),setOrderType:t=>{a.Nm.set({orderType:t}),e(e=>({form:{...e.form,orderType:t,triggerPrice:"planLimit"===t||"planMarket"===t?e.form.triggerPrice:"",orderPrice:"market"===t||"planMarket"===t?"":e.form.orderPrice}}))},setTradeUnit:(t,r)=>{a.Nm.set({tradeUnit:t,..."2"===t&&r?{usdtCost:r}:{}}),e(e=>({form:{...e.form,tradeUnit:t,..."2"===t&&r?{usdtCost:r}:{}}}))},resetQuantity:()=>e(e=>({form:{...e.form,quantity:"",longQuantity:"",shortQuantity:"",percentage:0}}))}));function o(e){l.setState(t=>({form:{...t.form,...e}}))}},60088:(e,t,r)=>{r.d(t,{Z:()=>i});var a=r(38113);function i(e){let t=a.useRef({value:e,previous:e});return a.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}},66249:(e,t,r)=>{r.d(t,{CL:()=>l,ZS:()=>i,dA:()=>u,gg:()=>d,hL:()=>a,ih:()=>c,wv:()=>o});let a="min-h-0 flex-1 px-4 [&>div:first-child]:min-h-0 [&>div:first-child]:flex-1 [&>div:first-child]:overflow-hidden [&>div:first-child>div]:h-full [&>div:first-child>div]:min-h-0 [&>div:first-child>div]:overflow-hidden [&>div:first-child>div]:!bg-transparent [&_thead_th]:!h-8 [&_thead_th]:!border-l3 [&_thead_th]:!py-0 [&_tbody_td]:!border-l3",i="[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",n="h-full min-h-0 !border-0 !rounded-none ".concat(i),l="".concat(n," bg-bg7"),o="".concat(n," bg-transparent"),s="h-auto max-h-full min-h-0 overflow-x-scroll !rounded-none !border-0 bg-transparent",c="".concat(s," [scrollbar-color:auto] [scrollbar-width:auto] [&::-webkit-scrollbar]:h-1.5 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:cursor-all-scroll [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-transparent hover:[&::-webkit-scrollbar-thumb]:bg-bg6 hover:[&::-webkit-scrollbar-thumb:hover]:bg-bg2 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-corner]:bg-transparent"),d="".concat(s," [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"),u="bg-bg7"},71591:(e,t,r)=>{r.d(t,{v:()=>l});var a=r(79237),i=r(38113),n=r(65375);let l=i.forwardRef((e,t)=>(0,a.jsx)(n.B,{ref:t,viewBox:"0 0 1024 1024",...e,children:(0,a.jsx)("path",{d:"M85.333333 512c0 235.648 191.018667 426.666667 426.666667 426.666667s426.666667-191.018667 426.666667-426.666667S747.648 85.333333 512 85.333333 85.333333 276.352 85.333333 512z m549.76-183.253333a42.538667 42.538667 0 0 1 60.16 60.16l-111.786666 111.786666a16 16 0 0 0 0 22.613334l111.786666 111.786666a42.538667 42.538667 0 1 1-60.16 60.16l-111.786666-111.786666a16 16 0 0 0-22.613334 0l-111.786666 111.786666a42.538667 42.538667 0 1 1-60.16-60.16l111.786666-111.786666a16 16 0 0 0 0-22.613334l-111.786666-111.786666a42.538667 42.538667 0 0 1 60.16-60.16l111.786666 111.786666a16 16 0 0 0 22.613334 0l111.786666-111.786666z"})}));l.displayName="ClearIcon"},74422:(e,t,r)=>{r.d(t,{C1:()=>k,bL:()=>y});var a=r(38113),i=r(25479),n=r(78985),l=r(24668),o=r(94904),s=r(60088),c=r(96200),d=r(17787),u=r(18912),p=r(79237),m="Checkbox",[g,f]=(0,n.A)(m),[h,b]=g(m);function x(e){let{__scopeCheckbox:t,checked:r,children:i,defaultChecked:n,disabled:l,form:s,name:c,onCheckedChange:d,required:u,value:g="on",internal_do_not_use_render:f}=e,[b,x]=(0,o.i)({prop:r,defaultProp:null!=n&&n,onChange:d,caller:m}),[v,P]=a.useState(null),[y,C]=a.useState(null),k=a.useRef(!1),N=!v||!!s||!!v.closest("form"),T={checked:b,disabled:l,setChecked:x,control:v,setControl:P,name:c,form:s,value:g,hasConsumerStoppedPropagationRef:k,required:u,defaultChecked:!L(n)&&n,isFormControl:N,bubbleInput:y,setBubbleInput:C};return(0,p.jsx)(h,{scope:t,...T,children:"function"==typeof f?f(T):i})}var v="CheckboxTrigger",P=a.forwardRef((e,t)=>
1{let{__scopeCheckbox:r,onKeyDown:n,onClick:o,...s}=e,{control:c,value:d,disabled:m,checked:g,required:f,setControl:h,setChecked:x,hasConsumerStoppedPropagationRef:P,isFormControl:y,bubbleInput:C}=b(v,r),k=(0,i.s)(t,h),N=a.useRef(g);return a.useEffect(()=>{let e=null==c?void 0:c.form;if(e){let t=()=>x(N.current);return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[c,x]),(0,p.jsx)(u.sG.button,{type:"button",role:"checkbox","aria-checked":L(g)?"mixed":g,"aria-required":f,"data-state":w(g),"data-disabled":m?"":void 0,disabled:m,value:d,...s,ref:k,onKeyDown:(0,l.mK)(n,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,l.mK)(o,e=>{x(e=>!!L(e)||!e),C&&y&&(P.current=e.isPropagationStopped(),P.current||e.stopPropagation())})})});P.displayName=v;var y=a.forwardRef((e,t)=>{let{__scopeCheckbox:r,name:a,checked:i,defaultChecked:n,required:l,disabled:o,value:s,onCheckedChange:c,form:d,...u}=e;return(0,p.jsx)(x,{__scopeCheckbox:r,checked:i,defaultChecked:n,disabled:o,required:l,onCheckedChange:c,name:a,form:d,value:s,internal_do_not_use_render:e=>{let{isFormControl:a}=e;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(P,{...u,ref:t,__scopeCheckbox:r}),a&&(0,p.jsx)(T,{__scopeCheckbox:r})]})}})});y.displayName=m;var C="CheckboxIndicator",k=a.forwardRef((e,t)=>{let{__scopeCheckbox:r,forceMount:a,...i}=e,n=b(C,r);return(0,p.jsx)(d.C,{present:a||L(n.checked)||!0===n.checked,children:(0,p.jsx)(u.sG.span,{"data-state":w(n.checked),"data-disabled":n.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});k.displayName=C;var N="CheckboxBubbleInput",T=a.forwardRef((e,t)=>{let{__scopeCheckbox:r,...n}=e,{control:l,hasConsumerStoppedPropagationRef:o,checked:d,defaultChecked:m,required:g,disabled:f,name:h,value:x,form:v,bubbleInput:P,setBubbleInput:y}=b(N,r),C=(0,i.s)(t,y),k=(0,s.Z)(d),T=(0,c.X)(l);a.useEffect(()=>{if(!P)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set,t=!o.current;if(k!==d&&e){let r=new Event("click",{bubbles:t});P.indeterminate=L(d),e.call(P,!L(d)&&d),P.dispatchEvent(r)}},[P,k,d,o]);let w=a.useRef(!L(d)&&d);return(0,p.jsx)(u.sG.input,{type:"checkbox","aria-hidden":!0,defaultChecked:null!=m?m:w.current,required:g,disabled:f,name:h,value:x,form:v,...n,tabIndex:-1,ref:C,style:{...n.style,...T,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});function L(e){return"indeterminate"===e}function w(e){return L(e)?"indeterminate":e?"checked":"unchecked"}T.displayName=N},75072:(e,t,r)=>{r.r(t),r.d(t,{default:()=>O});var a=r(79237),i=r(66960),n=r(19490),l=r(40394),o=r(76656),s=r(25749),c=r(56856),d=r(90604),u=r(55896),p=r(11636);function m(e){let{rawQuantity:t,getConfirmQuantityDisplayText:r,...a}=e;if("2"!==a.tradeUnit){var i,l,o=a.unitLabel;let e=Number(t||0);return"".concat((0,n.iT)(e)," ").concat(o)}return(null==(l=(i=r(a)).split(" â ")[0])?void 0:l.split(" = ")[0])||i}var g=r(61554),f=r(70659),h=r(53951),b=r(46629),x=r(66249),v=r(38113),P=r(39679);function y(e,t){return Number.isFinite(e)?e.toFixed(t).replace(/\.?0+$/,""):""}function C(e){let{direction:t,price:r,openPrice:a,leverage:i}=e;return r&&a&&i?y("openLong"===t?(r-a)*i*100/a:(a-r)*i*100/a,1):""}function k(e){let{direction:t,price:r,openPrice:a,quantityCont:i,multiplier:n}=e;if(!r||!a||!i||!n)return"";let l=("openLong"===t?r-a:a-r)*i*n,o=(Math.floor(100*l)/100).toFixed(2);return l>0?"+".concat(o):o}function N(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=Number(e||0);if(!Number.isFinite(r))return 0;let a=Math.max(0,Math.min(t?Math.abs(r):r,500));return a<=20?a:20+(a-20)/480*80}function T(e){let t=Math.max(0,Math.min(e,100));return t<=20?t:20+(t-20)/80*480}function L(e){return!Number.isFinite(e)||e<=0?"":y(e,1)}function w(e){let{$t:t}=(0,i.B)(),{draft:r,leverage:n,tpPnl:l,slPnl:o,canSubmit:s,updateDraft:c,handleTpCheckedChange:d,handleSlCheckedChange:u,resetDraftValues:p,handlePriceInput:m,handleRateInput:w,handleTpPriceTypeChange:O,handleSlPriceTypeChange:j,buildConfirmPatch:A}=function(e){let t=(0,v.useRef)(!1),[r,a]=(0,v.useState)({...e.values,tpChecked:!0,slChecked:!0});(0,v.useEffect)(()=>{e.open&&!t.current&&a({...e.values,tpChecked:!0,slChecked:!0}),t.current=e.open},[e.open,e.values]);let i="openLong"===r.tpslActiveTab?e.longLeverage:e.shortLeverage,n="openLong"===r.tpslActiveTab?e.longQuantityCont:e.shortQuantityCont,l=Number("limit"===r.tpPriceType?r.tpOrderPrice||0:r.takeProfitPrice||0),o=Number("limit"===r.slPriceType?r.slOrderPrice||0:r.stopLossPrice||0),s=(0,v.useMemo)(()=>k({direction:r.tpslActiveTab,price:l,openPrice:e.openPrice,quantityCont:n,multiplier:e.multiplier}),[r.tpslActiveTab,e.multiplier,e.openPrice,n,l]),c=(0,v.useMemo)(()=>k({direction:r.tpslActiveTab,price:o,openPrice:e.openPrice,quantityCont:n,multiplier:e.multiplier}),[r.tpslActiveTab,e.multiplier,e.openPrice,n,o]),d=(r.tpChecked||r.slChecked)&&(!r.tpChecked||!!r.takeProfitPrice&&!!r.takeProfitRate&&0!==Number(r.takeProfitRate))&&(!r.slChecked||!!r.
1stopLossPrice&&!!r.stopLossRate&&"-"!==r.stopLossRate),u=e=>{a(t=>({...t,...e}))};return{draft:r,leverage:i,tpPnl:s,slPnl:c,canSubmit:d,updateDraft:u,handleTpCheckedChange:e=>{(e||r.slChecked)&&u({tpChecked:e})},handleSlCheckedChange:e=>{(e||r.tpChecked)&&u({slChecked:e})},resetDraftValues:e=>{u({tpslActiveTab:e,takeProfitPrice:"",stopLossPrice:"",tpOrderPrice:"",slOrderPrice:"",takeProfitRate:"",stopLossRate:"",takeProfitRateAbout:"",stopLossRateAbout:""})},handlePriceInput:t=>a=>{let n=(0,P.TR)(a,e.precision);if(null===n)return;let l=Number(n||0);if("takeProfitPrice"===t||"tpOrderPrice"===t){let a="takeProfitPrice"===t&&"market"===r.tpPriceType||"tpOrderPrice"===t&&"limit"===r.tpPriceType,o=a?C({direction:r.tpslActiveTab,price:l,openPrice:e.openPrice,leverage:i}):void 0;u({[t]:n,...a?{takeProfitRate:o,takeProfitRateAbout:o}:{},..."takeProfitPrice"===t&&"market"===r.tpPriceType?{tpOrderPrice:""}:{}});return}let o="stopLossPrice"===t&&"market"===r.slPriceType||"slOrderPrice"===t&&"limit"===r.slPriceType,s=o?C({direction:r.tpslActiveTab,price:l,openPrice:e.openPrice,leverage:i}):void 0;u({[t]:n,...o?{stopLossRate:s,stopLossRateAbout:s}:{},..."stopLossPrice"===t&&"market"===r.slPriceType?{slOrderPrice:""}:{}})},handleRateInput:t=>a=>{let n="stopLossRate"===t&&a&&!a.startsWith("-")?"-".concat(a):a,l=(0,P.m6)(n.startsWith("-")?n.slice(1):n,1);if(""!==n&&"-"!==n&&null===l)return;let o="stopLossRate"===t?"-"===n||""===n?n:"-".concat(l):null!=l?l:n,s=""===o||"-"===o,c=s?0:Number(o),d=s||!Number.isFinite(c)||0===c?"":function(e){let{direction:t,openPrice:r,leverage:a,rate:i,precision:n}=e;if(!r||!a||!Number.isFinite(i))return"";let l=r/a*(i/100);return y(Math.max("openLong"===t?r+l:r-l,0),n)}({direction:r.tpslActiveTab,openPrice:e.openPrice,leverage:i,rate:c,precision:e.precision});if("takeProfitRate"===t)return void u({takeProfitRate:o,takeProfitRateAbout:o,..."market"===r.tpPriceType?{takeProfitPrice:d,tpOrderPrice:""}:{tpOrderPrice:d,takeProfitPrice:d}});u({stopLossRate:o,stopLossRateAbout:o,..."market"===r.slPriceType?{stopLossPrice:d,slOrderPrice:""}:{slOrderPrice:d,stopLossPrice:d}})},handleTpPriceTypeChange:e=>{u({tpPriceType:e,tpOrderPrice:"market"===e?"":r.takeProfitPrice})},handleSlPriceTypeChange:e=>{u({slPriceType:e,slOrderPrice:"market"===e?"":r.stopLossPrice})},buildConfirmPatch:()=>({checkedTpsl:r.tpChecked||r.slChecked,takeProfitPrice:r.tpChecked?r.takeProfitPrice:"",stopLossPrice:r.slChecked?r.stopLossPrice:"",tpOrderPrice:r.tpChecked&&"limit"===r.tpPriceType?r.tpOrderPrice:"",slOrderPrice:r.slChecked&&"limit"===r.slPriceType?r.slOrderPrice:"",takeProfitRate:r.tpChecked?r.takeProfitRate:"",stopLossRate:r.slChecked?r.stopLossRate:"",takeProfitRateAbout:r.tpChecked?r.takeProfitRateAbout:"",stopLossRateAbout:r.slChecked?r.stopLossRateAbout:"",tpTriggerWay:r.tpTriggerWay,slTriggerWay:r.slTriggerWay,tpPriceType:r.tpChecked?r.tpPriceType:"market",slPriceType:r.slChecked?r.slPriceType:"market",tpslActiveTab:r.tpslActiveTab,tpslAdvancedEdited:!0})}}({open:e.open,values:e.values,openPrice:e.openPrice,longLeverage:e.longLeverage,shortLeverage:e.shortLeverage,longQuantityCont:e.longQuantityCont,shortQuantityCont:e.shortQuantityCont,multiplier:e.multiplier,precision:e.precision}),R="openLong"===r.tpslActiveTab?t("Open Long"):t("Open Short"),D="openLong"===r.tpslActiveTab?e.longQuantityText:e.shortQuantityText,S=y(e.openPrice||0,e.precision)||"--",Q="".concat(t("Trigger Price"),"(USDT)"),U=e=>"latest"===e?t("Last"):t("Mark"),W=e=>"limit"===e?t("Limit Order"):t("Market Order"),M=(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pb-1",children:[(0,a.jsxs)("div",{className:"flex shrink-0 flex-col gap-4 px-6 max-md:px-4",children:[(0,a.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,a.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:(0,a.jsxs)("div",{className:"text-bm14 flex items-center gap-2 leading-[1.4]",children:[(0,a.jsx)("span",{className:"text-t3",children:e.symbol}),(0,a.jsx)("span",{className:"bg-t3/30 h-3 w-px shrink-0"}),(0,a.jsxs)("span",{className:"".concat("openLong"===r.tpslActiveTab?"text-p2":"text-p3"," font-medium"),children:[R," ",n,"X"]})]})})}),(0,a.jsxs)("div",{className:"bg-bg2 rounded-r2 shrink-0 p-3",children:[(0,a.jsxs)("div",{className:"text-c12 flex items-center justify-between leading-4",children:[(0,a.jsx)("span",{className:"text-t3",children:t("Entry Price")}),(0,a.jsx)("span",{className:"text-t1",children:S})]}),(0,a.jsxs)("div",{className:"text-c12 mt-3 flex items-center justify-between leading-4",children:[(0,a.jsx)("span",{className:"text-t3",children:t("Quantity")}),(0,a.jsx)("span",{className:"text-t1",children:D})]})]}),(0,a.jsx)("div",{className:"bg-bg05 rounded-r2 flex h-10 shrink-0 items-center p-1",children:["openLong","o
1penShort"].map(e=>{let i=r.tpslActiveTab===e;return(0,a.jsx)("button",{type:"button",className:"text-bm14 rounded-r1 flex h-8 flex-1 cursor-pointer items-center justify-center font-medium transition-colors ".concat(i?"".concat("openLong"===e?"bg-p2":"bg-p3"," font-semibold text-white"):"text-t3 hover:bg-c2 hover:text-t1"),onClick:()=>p(e),children:"openLong"===e?t("Open Long"):t("Open Short")},e)})})]}),(0,a.jsx)("div",{className:"mt-4 min-h-0 flex-1 overflow-y-auto ".concat(x.ZS),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 px-6 max-md:px-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(b.e,{checked:r.tpChecked,disabled:r.tpChecked&&!r.slChecked,label:t("Take Profit"),dropdownLabel:W(r.tpPriceType),options:[{label:t("Market Order"),value:"market"},{label:t("Limit Order"),value:"limit"}],onCheckedChange:d,onSelect:O}),r.tpChecked?(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_100px] gap-2",children:[(0,a.jsx)(b.G5,{value:r.takeProfitPrice,placeholder:Q,prefix:r.takeProfitPrice?"openLong"===r.tpslActiveTab?"â¥":"â¤":void 0,triggerWayLabel:U(r.tpTriggerWay),onChange:m("takeProfitPrice"),onSwitchTriggerWay:()=>c({tpTriggerWay:"latest"===r.tpTriggerWay?"mark":"latest"})}),(0,a.jsx)(b.tk,{value:r.takeProfitRate,placeholder:t("Gain"),suffix:(0,a.jsx)("span",{className:"text-bm14 text-t1",children:"%"}),onChange:w("takeProfitRate")})]}),"limit"===r.tpPriceType?(0,a.jsx)(b.tk,{value:r.tpOrderPrice,placeholder:t("Limit Price"),suffix:(0,a.jsx)("span",{className:"text-bm14 text-t1",children:"USDT"}),onChange:m("tpOrderPrice")}):(0,a.jsx)(b.Kf,{value:N(r.takeProfitRate),onChange:e=>w("takeProfitRate")(L(T(e)))}),Number(r.takeProfitPrice||0)>0?(0,a.jsx)(b.oO,{triggerWayLabel:U(r.tpTriggerWay),triggerPrice:r.takeProfitPrice,priceType:r.tpPriceType,pnlText:l||"--",rateText:Number(r.takeProfitRateAbout||0)>0?"+".concat(r.takeProfitRateAbout):r.takeProfitRateAbout||"--"}):null]}):null]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(b.e,{checked:r.slChecked,disabled:r.slChecked&&!r.tpChecked,label:t("Stop Loss"),dropdownLabel:W(r.slPriceType),options:[{label:t("Market Order"),value:"market"},{label:t("Limit Order"),value:"limit"}],onCheckedChange:u,onSelect:j}),r.slChecked?(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_100px] gap-2",children:[(0,a.jsx)(b.G5,{value:r.stopLossPrice,placeholder:Q,prefix:r.stopLossPrice?"openLong"===r.tpslActiveTab?"â¤":"â¥":void 0,triggerWayLabel:U(r.slTriggerWay),onChange:m("stopLossPrice"),onSwitchTriggerWay:()=>c({slTriggerWay:"latest"===r.slTriggerWay?"mark":"latest"})}),(0,a.jsx)(b.tk,{value:r.stopLossRate,placeholder:t("Loss"),suffix:(0,a.jsx)("span",{className:"text-bm14 text-t1",children:"%"}),onChange:w("stopLossRate"),onFocus:()=>{r.stopLossRate||c({stopLossRate:"-"})},onBlur:()=>{"-"===r.stopLossRate&&c({stopLossRate:""})}})]}),"limit"===r.slPriceType?(0,a.jsx)(b.tk,{value:r.slOrderPrice,placeholder:t("Limit Price"),suffix:(0,a.jsx)("span",{className:"text-bm14 text-t1",children:"USDT"}),onChange:m("slOrderPrice")}):(0,a.jsx)(b.Kf,{value:N(r.stopLossRate,!0),onChange:e=>{let t=L(T(e));w("stopLossRate")(t?"-".concat(t):"")}}),Number(r.stopLossPrice||0)>0?(0,a.jsx)(b.oO,{triggerWayLabel:U(r.slTriggerWay),triggerPrice:r.stopLossPrice,priceType:r.slPriceType,pnlText:o||"--",rateText:Number(r.stopLossRateAbout||0)>0?"+".concat(r.stopLossRateAbout):r.stopLossRateAbout||"--"}):null,(0,a.jsxs)("div",{className:"bg-p4/10 text-p4 rounded-r3 mt-2 flex min-w-0 items-start gap-2 overflow-hidden px-4 py-3",children:[(0,a.jsx)(g.M,{className:"size-5 shrink-0"}),(0,a.jsx)("p",{className:"text-c12 min-w-0 flex-1 leading-4 break-words whitespace-normal",children:t("The stop loss price should not be too close to the liquidation price, in case of failure of stop loss trigger.")})]})]}):null]})]})})]}),F=(0,a.jsxs)("div",{className:"grid h-10 grid-cols-2 gap-2",children:[(0,a.jsx)(f.$,{variant:"secondary",size:"m",className:"h-10",onClick:()=>e.onOpenChange(!1),children:t("Cancel")}),(0,a.jsx)(f.$,{size:"m",className:"h-10",disabled:!s,onClick:()=>{e.onConfirm(A())},children:t("Confirm")})]});return(0,a.jsx)(h.Dialog,{open:e.open,onOpenChange:e.onOpenChange,variant:"drawer",title:"TP/SL",showClose:!0,onClose:()=>e.onOpenChange(!1),footer:(0,a.jsx)("div",{className:"px-6 pb-6 max-md:px-0 max-md:pb-0",children:F}),footerClassName:"!mt-4",preventOutsideClose:!0,preventEscapeClose:!0,className:"!rounded-r4 !border-l1 !bg-m1 shadow-3 max-md:!rounded-t-r5 !h-[min(720px,calc(100dvh-80px))] !max-h-[calc(100dvh-80px)] !w-[420px] !max-w-[calc(100vw-80px)] !overflow-hidden !border !p-0 max-md:!h-[90dvh] max-md:!max-h-[90dvh] max-md:!w-full max-md:!max-w-full max-md:!rounded-b-none",headerClassName:"px-6 pt-6 pb-0 max-md:!px-4 max-md:!pt-4 max-md:!pb-0",bodyClassName:"!mt-1 !px-0 flex min-h-0 flex-1 flex-col overflow-hidden max-md:!mt-1 max-md:!pt-0",overlayClassName:"bg-p6",children:M})}function O(){let e=function(){let{$t:e}
1=(0,i.B)(),t=(0,c.Mr)((0,o.k)(e=>({longLeverage:e.form.longLeverage,shortLeverage:e.form.shortLeverage,takeProfitPrice:e.form.takeProfitPrice,stopLossPrice:e.form.stopLossPrice,tpOrderPrice:e.form.tpOrderPrice,slOrderPrice:e.form.slOrderPrice,takeProfitRate:e.form.takeProfitRate,stopLossRate:e.form.stopLossRate,takeProfitRateAbout:e.form.takeProfitRateAbout,stopLossRateAbout:e.form.stopLossRateAbout,tpTriggerWay:e.form.tpTriggerWay,slTriggerWay:e.form.slTriggerWay,tpPriceType:e.form.tpPriceType,slPriceType:e.form.slPriceType,tpslActiveTab:e.form.tpslActiveTab,tpslAdvancedEdited:e.form.tpslAdvancedEdited,quantity:e.form.quantity,longQuantity:e.form.longQuantity,shortQuantity:e.form.shortQuantity,tradeUnit:e.form.tradeUnit,usdtCost:e.form.usdtCost}))),r=(0,u.$)((0,o.k)(e=>({symbol:e.dialogs.symbol,longQuantityCont:e.dialogs.longQuantityCont,shortQuantityCont:e.dialogs.shortQuantityCont,multiplier:e.dialogs.multiplier,precision:e.dialogs.precision,coinPrecision:e.dialogs.coinPrecision,oneContCostBuy:e.dialogs.oneContCostBuy,oneContCostSell:e.dialogs.oneContCostSell,lastPrice:e.dialogs.lastPrice,markPrice:e.dialogs.markPrice,calcPrice:e.dialogs.calcPrice,baseAsset:e.dialogs.baseAsset}))),a=(0,d.T)(e=>e.actions.onTpslConfirm),n=(0,p.w)(e=>e.getConfirmQuantityDisplayText),g=(0,p.w)(e=>e.getQuantityPrecisionByUnit),f=(0,p.w)(e=>e.getDisplayUnitLabel),h=(0,s.Lt)(),b=g({tradeUnit:t.tradeUnit,coinPrecision:r.coinPrecision,contractPrecision:r.precision}),x=(0,l.k)(f({tradeUnit:t.tradeUnit,baseAsset:r.baseAsset}),e),v={tradeUnit:t.tradeUnit,multiplier:Number(r.multiplier||0),price:r.calcPrice,quantityPrecision:b,unitLabel:x,usdtCost:t.usdtCost,oneContCostBuy:r.oneContCostBuy,oneContCostSell:r.oneContCostSell,coinPrecision:r.coinPrecision,baseAsset:r.baseAsset,getConfirmQuantityDisplayText:n},P=m({...v,rawQuantity:t.longQuantity||t.quantity,quantityCont:r.longQuantityCont,side:"buy"}),y=m({...v,rawQuantity:t.shortQuantity||t.quantity,quantityCont:r.shortQuantityCont,side:"sell"});return{open:h.visible,symbol:r.symbol,openPrice:r.calcPrice,lastPrice:r.lastPrice,markPrice:r.markPrice,longLeverage:t.longLeverage,shortLeverage:t.shortLeverage,longQuantityCont:r.longQuantityCont,shortQuantityCont:r.shortQuantityCont,longQuantityText:P,shortQuantityText:y,multiplier:r.multiplier,precision:r.precision,values:{takeProfitPrice:t.takeProfitPrice,stopLossPrice:t.stopLossPrice,tpOrderPrice:t.tpOrderPrice,slOrderPrice:t.slOrderPrice,takeProfitRate:t.takeProfitRate,stopLossRate:t.stopLossRate,takeProfitRateAbout:t.takeProfitRateAbout,stopLossRateAbout:t.stopLossRateAbout,tpTriggerWay:t.tpTriggerWay,slTriggerWay:t.slTriggerWay,tpPriceType:t.tpPriceType,slPriceType:t.slPriceType,tpslActiveTab:t.tpslActiveTab,tpslAdvancedEdited:t.tpslAdvancedEdited},onOpenChange:e=>e?h.showLayer():h.hideLayer(),onConfirm:a}}();return(0,a.jsx)(w,{...e})}},83054:(e,t,r)=>{r.d(t,{DF:()=>n,KP:()=>s,SD:()=>o,Sm:()=>l});var a=r(122),i=r(51430);function n(e){var t;let r=String(e||0);return r.includes(".")&&(null==(t=r.split(".")[1])?void 0:t.length)||0}function l(e){let{quantityCont:t,tradeUnit:r,multiplier:i,price:n,usdtPrecision:l=8}=e;if(!t)return 0;if("1"===r)return Number(t);let o=new a.A(i||0),s=new a.A(t||0);return"2"===r?s.mul(o).mul(n||0).toDecimalPlaces(l,a.A.ROUND_DOWN).toNumber():s.mul(o).toNumber()}function o(e){let{quantityCont:t,tradeUnit:r,multiplier:n,price:l,quantityPrecision:o,usdtPrecision:s}=e;if("2"===r&&l){let e=new a.A(t||0).mul(n||0).mul(Number(l)).toNumber();return(0,i.qQ)(e,null!=s?s:o)}return new a.A(t||0).mul("1"===r?1:n||0).toFixed(o)}function s(e){let{quantity:t,tradeUnit:r,multiplier:i,price:l,usdtCost:o,costOne:s,isCalculator:c}=e;if(!t)return 0;if("1"===r)return Number(t);let d=new a.A(i||0);if("2"===r){if("1"===o&&s&&!c)return new a.A(t).div(s).toDecimalPlaces(0,a.A.ROUND_DOWN).toNumber();if(d.lte(0)||!l)return 0;let e=new a.A(t).div(l),r=n(i);return(s?e.gt(0)&&e.lt(d.mul(2))?d:e.toDecimalPlaces(r,a.A.ROUND_DOWN):e.toDecimalPlaces(r,a.A.ROUND_UP)).div(d).toDecimalPlaces(0,a.A.ROUND_DOWN).toNumber()}return d.lte(0)?0:new a.A(t).div(d).toDecimalPlaces(0,a.A.ROUND_DOWN).toNumber()}},90604:(e,t,r)=>{r.d(t,{T:()=>s});var a=r(41809);let i=()=>{},n=async()=>{},l=()=>i,o=()=>({onSetOrderType:i,onNumberFieldChange:l,onToggleReferencePriceField:i,onFillLastPrice:i,onQuantityModeChange:i,onQuantityChange:i,onTradeUnitChange:i,onPercentageChange:i,onSliderChange:i,onClearQuantity:i,onPrimaryAction:i,onSecondaryAction:i,onResetDemoFund:i,onOpenSettings:i,onChangeActiveTab:i,onDisableTpsl:i,onEnableTpsl:i,onOpenTpslAdvanced:i,onToggleTpslTriggerWay:i,onTpslNumberFieldChange:l,getMaxPositionLabel:()=>"",onSettingsConfirm:n,onTpslConfirm:i,onDifferenceConfirm:n,onConfirmSubmit:i}),s=(0,a.v)(e=>({actions:o(),syncActions:t=>e({actions:t}),resetActions:()=>e({actions:o()})}))},91829:(e,t,r)=>{r.r(t),r.d(t,{default:()=>O});var a=r(79237),i=r(66960),n=r(19490),l=r(40394),o=r(76656),s=r(50791),c=r(10522),d=r(33149),u=r(47562),p=r(5694);function m(e){let{rawQuantity:t,getConfirmQuantityDisplayText:r,...a}=e;if("2"!==a.tradeUnit){var i,l,o=a.unitLabel;let e=Number(t||0);return"".concat((0,n.iT)(e)," ").concat(o)}return(null==(l=(i=r(a)).split(" â ")[0])?void 0:l.split(" = ")[0])||i}var g=r(61554),f=r(70659),h=r(53951),b=r(46629),x=r(66249),v=r(38113),P=r(39679);function y(e,t){return Number.isFinite(e)?e.toFixed(t).replace(/\.?0+$/,""):""}function C(e){let{direction:t,price:r,openPrice:a,leverage:i}=e;return r&&a&&i?y("openLong"===t?(r-a)*i*100/a:(a-r)*i*100/a,1):""}function k(e){let{direction:t,price:r,openPrice:a,quantityCont:i,multiplier:n}=e;if(!r||!a||!i||!n)return"";let l=("openLong"===t?r-a:a-r)*i*n,o=(Math.floor(100*l)/100).toFixed(2);return l>0?"+".concat(o):o}function N(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=Number(e||0);if(!Number.isFinite(r))return 0;let a=Math.max(0,Math.min(t?Math.abs(r):r,500));return a<=20?a:20+(a-20)/480*80}function T(e){let t=Math.max(0,Math.min(e,100));return t<=20?t:20+(t-20)/80*480}function L(e){return!Number.isFinite(e)||e<=0?"":y(e,1)}function w(e){let{$t:t}=(0,i.B)(),{draft:r,leverage:n,tpPnl:l,slPnl:o,canSubmit:s,updateDraft:c,handleTpCheckedChange:d,handleSlCheckedChange:u,resetDraftValues:p,handlePriceInput:m,handleRateInput:w,handleTpPriceTypeChange:O,handleSlPriceTypeChange:j,buildConfirmPatch:A}=function(e){let t=(0,v.useRef)(!1),[r,a]=(0,v.useState)({...e.values,tpChecked:!0,slChecked:!0});(0,v.useEffect)(()=>{e.open&&!t.current&&a({...e.values,tpChecked:!0,slChecked:!0}),t.current=e.open},[e.open,e.values]);let i="openLong"===r.tpslActiveTab?e.longLeverage:e.shortLeverage,n="openLong"===r.tpslActiveTab?e.longQuantityCont:e.shortQuantityCont,l=Number("limit"===r.tpPriceType?r.tpOrderPrice||0:r.takeProfitPrice||0),o=Number("limit"===r.slPriceType?r.slOrderPrice||0:r.stopLossPrice||0),s=(0,v.useMemo)(()=>k({direction:r.tpslActiveTab,price:l,openPrice:e.openPrice,quantityCont:n,multiplier:e.multiplier}),[r.tpslActiveTab,e.multiplier,e.openPrice,n,l]),c=(0,v.useMemo)(()=>k({direction:r.tpslActiveTab,price:o,openPrice:e.openPrice,quantityCont:n,multiplier:e.multiplier}),[r.tpslActiveTab,e.multiplier,e.openPrice,n,o]),d=(r.tpChecked||r.slChecked)&&(!r.tpChecked||!!r.takeProfitPrice&&!!r.takeProfitRate&&0!==Number(r.takeProfitRate))&&(!r.slChecked||!!r.
1stopLossPrice&&!!r.stopLossRate&&"-"!==r.stopLossRate),u=e=>{a(t=>({...t,...e}))};return{draft:r,leverage:i,tpPnl:s,slPnl:c,canSubmit:d,updateDraft:u,handleTpCheckedChange:e=>{(e||r.slChecked)&&u({tpChecked:e})},handleSlCheckedChange:e=>{(e||r.tpChecked)&&u({slChecked:e})},resetDraftValues:e=>{u({tpslActiveTab:e,takeProfitPrice:"",stopLossPrice:"",tpOrderPrice:"",slOrderPrice:"",takeProfitRate:"",stopLossRate:"",takeProfitRateAbout:"",stopLossRateAbout:""})},handlePriceInput:t=>a=>{let n=(0,P.TR)(a,e.precision);if(null===n)return;let l=Number(n||0);if("takeProfitPrice"===t||"tpOrderPrice"===t){let a="takeProfitPrice"===t&&"market"===r.tpPriceType||"tpOrderPrice"===t&&"limit"===r.tpPriceType,o=a?C({direction:r.tpslActiveTab,price:l,openPrice:e.openPrice,leverage:i}):void 0;u({[t]:n,...a?{takeProfitRate:o,takeProfitRateAbout:o}:{},..."takeProfitPrice"===t&&"market"===r.tpPriceType?{tpOrderPrice:""}:{}});return}let o="stopLossPrice"===t&&"market"===r.slPriceType||"slOrderPrice"===t&&"limit"===r.slPriceType,s=o?C({direction:r.tpslActiveTab,price:l,openPrice:e.openPrice,leverage:i}):void 0;u({[t]:n,...o?{stopLossRate:s,stopLossRateAbout:s}:{},..."stopLossPrice"===t&&"market"===r.slPriceType?{slOrderPrice:""}:{}})},handleRateInput:t=>a=>{let n="stopLossRate"===t&&a&&!a.startsWith("-")?"-".concat(a):a,l=(0,P.m6)(n.startsWith("-")?n.slice(1):n,1);if(""!==n&&"-"!==n&&null===l)return;let o="stopLossRate"===t?"-"===n||""===n?n:"-".concat(l):null!=l?l:n,s=""===o||"-"===o,c=s?0:Number(o),d=s||!Number.isFinite(c)||0===c?"":function(e){let{direction:t,openPrice:r,leverage:a,rate:i,precision:n}=e;if(!r||!a||!Number.isFinite(i))return"";let l=r/a*(i/100);return y(Math.max("openLong"===t?r+l:r-l,0),n)}({direction:r.tpslActiveTab,openPrice:e.openPrice,leverage:i,rate:c,precision:e.precision});if("takeProfitRate"===t)return void u({takeProfitRate:o,takeProfitRateAbout:o,..."market"===r.tpPriceType?{takeProfitPrice:d,tpOrderPrice:""}:{tpOrderPrice:d,takeProfitPrice:d}});u({stopLossRate:o,stopLossRateAbout:o,..."market"===r.slPriceType?{stopLossPrice:d,slOrderPrice:""}:{slOrderPrice:d,stopLossPrice:d}})},handleTpPriceTypeChange:e=>{u({tpPriceType:e,tpOrderPrice:"market"===e?"":r.takeProfitPrice})},handleSlPriceTypeChange:e=>{u({slPriceType:e,slOrderPrice:"market"===e?"":r.stopLossPrice})},buildConfirmPatch:()=>({checkedTpsl:r.tpChecked||r.slChecked,takeProfitPrice:r.tpChecked?r.takeProfitPrice:"",stopLossPrice:r.slChecked?r.stopLossPrice:"",tpOrderPrice:r.tpChecked&&"limit"===r.tpPriceType?r.tpOrderPrice:"",slOrderPrice:r.slChecked&&"limit"===r.slPriceType?r.slOrderPrice:"",takeProfitRate:r.tpChecked?r.takeProfitRate:"",stopLossRate:r.slChecked?r.stopLossRate:"",takeProfitRateAbout:r.tpChecked?r.takeProfitRateAbout:"",stopLossRateAbout:r.slChecked?r.stopLossRateAbout:"",tpTriggerWay:r.tpTriggerWay,slTriggerWay:r.slTriggerWay,tpPriceType:r.tpChecked?r.tpPriceType:"market",slPriceType:r.slChecked?r.slPriceType:"market",tpslActiveTab:r.tpslActiveTab,tpslAdvancedEdited:!0})}}({open:e.open,values:e.values,openPrice:e.openPrice,longLeverage:e.longLeverage,shortLeverage:e.shortLeverage,longQuantityCont:e.longQuantityCont,shortQuantityCont:e.shortQuantityCont,multiplier:e.multiplier,precision:e.precision}),R="openLong"===r.tpslActiveTab?t("Open Long"):t("Open Short"),D="openLong"===r.tpslActiveTab?e.longQuantityText:e.shortQuantityText,S=y(e.openPrice||0,e.precision)||"--",Q="".concat(t("Trigger Price"),"(USDT)"),U=e=>"latest"===e?t("Last"):t("Mark"),W=e=>"limit"===e?t("Limit Order"):t("Market Order"),M=(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pb-1",children:[(0,a.jsxs)("div",{className:"flex shrink-0 flex-col gap-4 px-6 max-md:px-4",children:[(0,a.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,a.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:(0,a.jsxs)("div",{className:"text-bm14 flex items-center gap-2 leading-[1.4]",children:[(0,a.jsx)("span",{className:"text-t3",children:e.symbol}),(0,a.jsx)("span",{className:"bg-t3/30 h-3 w-px shrink-0"}),(0,a.jsxs)("span",{className:"".concat("openLong"===r.tpslActiveTab?"text-p2":"text-p3"," font-medium"),children:[R," ",n,"X"]})]})})}),(0,a.jsxs)("div",{className:"bg-bg2 rounded-r2 shrink-0 p-3",children:[(0,a.jsxs)("div",{className:"text-c12 flex items-center justify-between leading-4",children:[(0,a.jsx)("span",{className:"text-t3",children:t("Entry Price")}),(0,a.jsx)("span",{className:"text-t1",children:S})]}),(0,a.jsxs)("div",{className:"text-c12 mt-3 flex items-center justify-between leading-4",children:[(0,a.jsx)("span",{className:"text-t3",children:t("Quantity")}),(0,a.jsx)("span",{className:"text-t1",children:D})]})]}),(0,a.jsx)("div",{className:"bg-bg05 rounded-r2 flex h-10 shrink-0 items-center p-1",children:["openLong","o
1penShort"].map(e=>{let i=r.tpslActiveTab===e;return(0,a.jsx)("button",{type:"button",className:"text-bm14 rounded-r1 flex h-8 flex-1 cursor-pointer items-center justify-center font-medium transition-colors ".concat(i?"".concat("openLong"===e?"bg-p2":"bg-p3"," font-semibold text-white"):"text-t3 hover:bg-c2 hover:text-t1"),onClick:()=>p(e),children:"openLong"===e?t("Open Long"):t("Open Short")},e)})})]}),(0,a.jsx)("div",{className:"mt-4 min-h-0 flex-1 overflow-y-auto ".concat(x.ZS),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 px-6 max-md:px-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(b.e,{checked:r.tpChecked,disabled:r.tpChecked&&!r.slChecked,label:t("Take Profit"),dropdownLabel:W(r.tpPriceType),options:[{label:t("Market Order"),value:"market"},{label:t("Limit Order"),value:"limit"}],onCheckedChange:d,onSelect:O}),r.tpChecked?(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_100px] gap-2",children:[(0,a.jsx)(b.G5,{value:r.takeProfitPrice,placeholder:Q,prefix:r.takeProfitPrice?"openLong"===r.tpslActiveTab?"â¥":"â¤":void 0,triggerWayLabel:U(r.tpTriggerWay),onChange:m("takeProfitPrice"),onSwitchTriggerWay:()=>c({tpTriggerWay:"latest"===r.tpTriggerWay?"mark":"latest"})}),(0,a.jsx)(b.tk,{value:r.takeProfitRate,placeholder:t("Gain"),suffix:(0,a.jsx)("span",{className:"text-bm14 text-t1",children:"%"}),onChange:w("takeProfitRate")})]}),"limit"===r.tpPriceType?(0,a.jsx)(b.tk,{value:r.tpOrderPrice,placeholder:t("Limit Price"),suffix:(0,a.jsx)("span",{className:"text-bm14 text-t1",children:"USDT"}),onChange:m("tpOrderPrice")}):(0,a.jsx)(b.Kf,{value:N(r.takeProfitRate),onChange:e=>w("takeProfitRate")(L(T(e)))}),Number(r.takeProfitPrice||0)>0?(0,a.jsx)(b.oO,{triggerWayLabel:U(r.tpTriggerWay),triggerPrice:r.takeProfitPrice,priceType:r.tpPriceType,pnlText:l||"--",rateText:Number(r.takeProfitRateAbout||0)>0?"+".concat(r.takeProfitRateAbout):r.takeProfitRateAbout||"--"}):null]}):null]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(b.e,{checked:r.slChecked,disabled:r.slChecked&&!r.tpChecked,label:t("Stop Loss"),dropdownLabel:W(r.slPriceType),options:[{label:t("Market Order"),value:"market"},{label:t("Limit Order"),value:"limit"}],onCheckedChange:u,onSelect:j}),r.slChecked?(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_100px] gap-2",children:[(0,a.jsx)(b.G5,{value:r.stopLossPrice,placeholder:Q,prefix:r.stopLossPrice?"openLong"===r.tpslActiveTab?"â¤":"â¥":void 0,triggerWayLabel:U(r.slTriggerWay),onChange:m("stopLossPrice"),onSwitchTriggerWay:()=>c({slTriggerWay:"latest"===r.slTriggerWay?"mark":"latest"})}),(0,a.jsx)(b.tk,{value:r.stopLossRate,placeholder:t("Loss"),suffix:(0,a.jsx)("span",{className:"text-bm14 text-t1",children:"%"}),onChange:w("stopLossRate"),onFocus:()=>{r.stopLossRate||c({stopLossRate:"-"})},onBlur:()=>{"-"===r.stopLossRate&&c({stopLossRate:""})}})]}),"limit"===r.slPriceType?(0,a.jsx)(b.tk,{value:r.slOrderPrice,placeholder:t("Limit Price"),suffix:(0,a.jsx)("span",{className:"text-bm14 text-t1",children:"USDT"}),onChange:m("slOrderPrice")}):(0,a.jsx)(b.Kf,{value:N(r.stopLossRate,!0),onChange:e=>{let t=L(T(e));w("stopLossRate")(t?"-".concat(t):"")}}),Number(r.stopLossPrice||0)>0?(0,a.jsx)(b.oO,{triggerWayLabel:U(r.slTriggerWay),triggerPrice:r.stopLossPrice,priceType:r.slPriceType,pnlText:o||"--",rateText:Number(r.stopLossRateAbout||0)>0?"+".concat(r.stopLossRateAbout):r.stopLossRateAbout||"--"}):null,(0,a.jsxs)("div",{className:"bg-p4/10 text-p4 rounded-r3 mt-2 flex min-w-0 items-start gap-2 overflow-hidden px-4 py-3",children:[(0,a.jsx)(g.M,{className:"size-5 shrink-0"}),(0,a.jsx)("p",{className:"text-c12 min-w-0 flex-1 leading-4 break-words whitespace-normal",children:t("The stop loss price should not be too close to the liquidation price, in case of failure of stop loss trigger.")})]})]}):null]})]})})]}),F=(0,a.jsxs)("div",{className:"grid h-10 grid-cols-2 gap-2",children:[(0,a.jsx)(f.$,{variant:"secondary",size:"m",className:"h-10",onClick:()=>e.onOpenChange(!1),children:t("Cancel")}),(0,a.jsx)(f.$,{size:"m",className:"h-10",disabled:!s,onClick:()=>{e.onConfirm(A())},children:t("Confirm")})]});return(0,a.jsx)(h.Dialog,{open:e.open,onOpenChange:e.onOpenChange,variant:"drawer",title:"TP/SL",showClose:!0,onClose:()=>e.onOpenChange(!1),footer:(0,a.jsx)("div",{className:"px-6 pb-6 max-md:px-0 max-md:pb-0",children:F}),footerClassName:"!mt-4",preventOutsideClose:!0,preventEscapeClose:!0,className:"!rounded-r4 !border-l1 !bg-m1 shadow-3 max-md:!rounded-t-r5 !h-[min(720px,calc(100dvh-80px))] !max-h-[calc(100dvh-80px)] !w-[420px] !max-w-[calc(100vw-80px)] !overflow-hidden !border !p-0 max-md:!h-[90dvh] max-md:!max-h-[90dvh] max-md:!w-full max-md:!max-w-full max-md:!rounded-b-none",headerClassName:"px-6 pt-6 pb-0 max-md:!px-4 max-md:!pt-4 max-md:!pb-0",bodyClassName:"!mt-1 !px-0 flex min-h-0 flex-1 flex-col overflow-hidden max-md:!mt-1 max-md:!pt-0",overlayClassName:"bg-p6",children:M})}function O(){let e=function(){let{$t:e}
1=(0,i.B)(),t=(0,c.Mr)((0,o.k)(e=>({longLeverage:e.form.longLeverage,shortLeverage:e.form.shortLeverage,takeProfitPrice:e.form.takeProfitPrice,stopLossPrice:e.form.stopLossPrice,tpOrderPrice:e.form.tpOrderPrice,slOrderPrice:e.form.slOrderPrice,takeProfitRate:e.form.takeProfitRate,stopLossRate:e.form.stopLossRate,takeProfitRateAbout:e.form.takeProfitRateAbout,stopLossRateAbout:e.form.stopLossRateAbout,tpTriggerWay:e.form.tpTriggerWay,slTriggerWay:e.form.slTriggerWay,tpPriceType:e.form.tpPriceType,slPriceType:e.form.slPriceType,tpslActiveTab:e.form.tpslActiveTab,tpslAdvancedEdited:e.form.tpslAdvancedEdited,quantity:e.form.quantity,longQuantity:e.form.longQuantity,shortQuantity:e.form.shortQuantity,tradeUnit:e.form.tradeUnit,usdtCost:e.form.usdtCost}))),r=(0,u.$)((0,o.k)(e=>({symbol:e.dialogs.symbol,longQuantityCont:e.dialogs.longQuantityCont,shortQuantityCont:e.dialogs.shortQuantityCont,multiplier:e.dialogs.multiplier,precision:e.dialogs.precision,coinPrecision:e.dialogs.coinPrecision,oneContCostBuy:e.dialogs.oneContCostBuy,oneContCostSell:e.dialogs.oneContCostSell,lastPrice:e.dialogs.lastPrice,markPrice:e.dialogs.markPrice,calcPrice:e.dialogs.calcPrice,baseAsset:e.dialogs.baseAsset}))),a=(0,d.T)(e=>e.actions.onTpslConfirm),n=(0,p.w)(e=>e.getConfirmQuantityDisplayText),g=(0,p.w)(e=>e.getQuantityPrecisionByUnit),f=(0,p.w)(e=>e.getDisplayUnitLabel),h=(0,s.Lt)(),b=g({tradeUnit:t.tradeUnit,coinPrecision:r.coinPrecision,contractPrecision:r.precision}),x=(0,l.k)(f({tradeUnit:t.tradeUnit,baseAsset:r.baseAsset}),e),v={tradeUnit:t.tradeUnit,multiplier:Number(r.multiplier||0),price:r.calcPrice,quantityPrecision:b,unitLabel:x,usdtCost:t.usdtCost,oneContCostBuy:r.oneContCostBuy,oneContCostSell:r.oneContCostSell,coinPrecision:r.coinPrecision,baseAsset:r.baseAsset,getConfirmQuantityDisplayText:n},P=m({...v,rawQuantity:t.longQuantity||t.quantity,quantityCont:r.longQuantityCont,side:"buy"}),y=m({...v,rawQuantity:t.shortQuantity||t.quantity,quantityCont:r.shortQuantityCont,side:"sell"});return{open:h.visible,symbol:r.symbol,openPrice:r.calcPrice,lastPrice:r.lastPrice,markPrice:r.markPrice,longLeverage:t.longLeverage,shortLeverage:t.shortLeverage,longQuantityCont:r.longQuantityCont,shortQuantityCont:r.shortQuantityCont,longQuantityText:P,shortQuantityText:y,multiplier:r.multiplier,precision:r.precision,values:{takeProfitPrice:t.takeProfitPrice,stopLossPrice:t.stopLossPrice,tpOrderPrice:t.tpOrderPrice,slOrderPrice:t.slOrderPrice,takeProfitRate:t.takeProfitRate,stopLossRate:t.stopLossRate,takeProfitRateAbout:t.takeProfitRateAbout,stopLossRateAbout:t.stopLossRateAbout,tpTriggerWay:t.tpTriggerWay,slTriggerWay:t.slTriggerWay,tpPriceType:t.tpPriceType,slPriceType:t.slPriceType,tpslActiveTab:t.tpslActiveTab,tpslAdvancedEdited:t.tpslAdvancedEdited},onOpenChange:e=>e?h.showLayer():h.hideLayer(),onConfirm:a}}();return(0,a.jsx)(w,{...e})}}}]);
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.