1!function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};t.SENTRY_RELEASE={id:"btse@5f19a485"};var e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="267799b3-0209-416e-8142-2750bfbf0324",t._sentryDebugIdIdentifier="sentry-dbid-267799b3-0209-416e-8142-2750bfbf0324")}catch(i){}}();import{g as t,r as e,ar as i,ak as a,a9 as s,am as r,aa as n,as as o,B as l,a6 as c,aL as d,aM as u,a8 as h,ab as g,aN as p,ac as m,af as y,ag as v,b6 as f,aK as b,aT as C,ae as S,bi as T,aX as w,bk as D,bH as I,a5 as P,ah as k,ad as $,aU as x,b7 as B,an as L,aF as N,ao as _,aW as R,al as M,bJ as A,bN as O,bE as E}from"./PmfENnFs.js";import{bK as U,bL as F,bM as H,bN as z,bO as G,bP as W,j as V,bQ as Z,bR as Y,bS as j,bT as q,aL as K,b8 as Q,bU as X,_ as J,bV as tt,bW as et,bX as it,bY as at,bj as st,bZ as rt,b_ as nt,U as ot,b$ as lt,aT as ct,c0 as dt,ai as ut,c1 as ht,c2 as gt,c3 as pt,c4 as mt,c5 as yt,K as vt,c6 as ft,c7 as bt,c8 as Ct,c9 as St,ca as Tt,cb as wt,cc as Dt,p as It,cd as Pt,ce as kt,cf as $t,cg as xt,u as Bt,ch as Lt,ci as Nt,cj as _t,aW as Rt,ck as Mt,aX as At,e as Ot,cl as Et,cm as Ut,by as Ft,bx as Ht,a0 as zt,cn as Gt,R as Wt,co as Vt,cp as Zt,az as Yt,n as jt,k as qt,cq as Kt,l as Qt,cr as Xt,X as Jt,cs as te,ct as ee,cu as ie,x as ae,cv as se,cw as re,cx as ne,cy as oe,cz as le,cA as ce,P as de,cB as ue,h as he,cC as ge,N as pe,Y as me,at as ye,ad as ve,cD as fe,S as be,cE as Ce,ab as Se,ac as Te,cF as we,aC as De}from"./BhKTELSe.js";import{_ as Ie}from"./CRPzHAml.js";import{i as Pe,L as ke,u as $e,a as xe,b as Be,c as Le,d as Ne}from"./chunk-echarts.AHWYl6Ef.js";import{T as _e,W as Re,N as Me,a as Ae}from"./ByOB-9wo.js";const Oe=t("futuresUi",(()=>{const t=e(!1),i=e({...H}),a=e(!1),s=e(!1),r=e(!1),n=e(!1),o=e(null),l=e(!1),c=e(!1),d=e(!0);return{showTransferPopup:t,transferConfig:i,hideInsufficientBalancePopup:a,showFirstTimeTradeQuiz:s,showFeatureVerificationCheckDialog:r,isShowLeverageDialog:n,leverageDialogData:o,isShowGridBotForm:l,enableOrderFormTpSl:c,isShowAllPositions:d,toggleTransferPopup:function(e){const a=U.state.accountInfo;if((null==a?void 0:a.walletUpgradeStatus)===F.IN_PROGRESS)return t.value=!1,void U.commit("setShowUnifiedWalletUpgradeDialog",!0);e&&(e.from||(null==e?void 0:e.to))||(e={...H}),U.state.isUnifiedWallet&&(e.from===z&&(e.from=G),e.to&&e.to===z&&(e.to=G)),i.value={...e},t.value=!t.value},closeTransferPopup:function(){t.value=!1,i.value={...H}},toggleHideInsufficientBalancePopup:function(t){a.value=t},setShowFirstTimeTradeQuiz:function(t){s.value=t},setShowFeatureVerificationCheckDialog:function(t){r.value=t},setLeverageDialog:function(t){const{show:e,data:i}=t;n.value=e||!1,o.value=i||null},setIsShowGridBotForm:function(t){l.value=t},setEnableOrderFormTpSl:function(t){c.value=t},updateShowAllPositions:function(t){U.dispatch("updateUserConfigByKey",{key:W.SHOW_FUTURES_ALL_POSITION_SETTING,value:t}),d.value=t}}}));const Ee=Ie({name:"IconTransfer",components:{Icon:V},props:{width:{type:[Number,String],default:26},height:{type:[Number,String],default:26}},emits:["click"]},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{width:o.width,height:o.height,"aria-label":"Transfer Icon",viewBox:"0 0 26 26",onClick:e[0]||(e[0]=e=>t.$emit("click",e))},{default:r((()=>e[1]||(e[1]=[n("g",{stroke:"currentColor","stroke-width":".6"},[n("path",{d:"M17.38 4.199c0 .402-.316.718-.719.718H.647C.285 4.917 0 4.6 0 4.199c0-.388.285-.718.647-.718l15.201-.001-2.409-2.409c-.251-.251-.251-.64 0-.892.239-.239.64-.239.88 0l3.768 3.769c.252.251.252.64 0 .892l-3.769 3.769c-.113.113-.276.176-.44.176-.163 0-.326-.063-.439-.176-.251-.252-.251-.641 0-.892l2.689-2.701h1.206c.351 0 .628-.277.628-.628 0-.34-.277-.629-.628-.629h-.106c.095.123.151.276.151.44z",transform:"translate(4.545 4.545) rotate(-180 9.138 4.392)"}),n("path",{d:"M17.38 4.199c0 .402-.316.718-.719.718H.647C.285 4.917 0 4.6 0 4.199c0-.388.285-.718.647-.718l15.201-.001-2.409-2.409c-.251-.251-.251-.64 0-.892.239-.239.64-.239.88 0l3.768 3.769c.252.251.252.64 0 .892l-3.769 3.769c-.113.113-.276.176-.44.176-.163 0-.326-.063-.439-.176-.251-.252-.251-.641 0-.892l2.689-2.701h1.206c.351 0 .628-.277.628-.628 0-.34-.277-.629-.628-.629h-.106c.095.123.151.276.151.44z",transform:"translate(1 1) matrix(-1 0 0 1 21.821 13) rotate(-180 9.138 4.392)"})],-1)]))),_:1,__:[1]},8,["width","height"])}]]);const Ue=Ie({name:"IconDownloadSolid",components:{Icon:V},props:{width:{type:[Number,String],default:16},height:{type:[Number,String],default:16}}},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{"aria-label":"Download Icon",width:o.width,height:o.height,viewBox:"0 0 16 16"},{default:r((()=>e[0]||(e[0]=[n("g",{"clip-path":"url(#iconDownloadSolidclip0)","fill-rule":"evenodd","clip-rule":"evenodd"},[n("path",{d:"M2 13.5c0-.828.252-1.5.563-1.5h10.874c.311 0 .563.672.563 1.5s-.252 1.5-.563 1.5H2.563C2.252 15 2 14.328 2 13.5z"}),n("path",{d:"M5.5 2h-2C2.672 2 2 2.672 2 3.5v11c0 .828.672 1.5 1.5 1.5h9c.828 0 1.5-.672 1.5-1.5v-11c0-.828-.672-1.5-1.5-1.5h-2v1h2c.276 0 .5.224.5.5v11c0 .276-.224.5-.5.5h-9c-.276 0-.5-.224-.5-.5v-11c0-.276.224-.5.5-.5h2V2z"}),n("circle",{cx:"5.5",cy:"2.5",r:".5"}),n("circle",{cx:"10.5",cy:"2.5",r:".5"}),n("path",{d:"M8.031 0c.363 0 .656.294.656.656v7.025l1.508-1.491c.257-.255.673-.253.928.005.255.257.252.673-.005.928L8.593 9.62l-.228.226-.367.362-.462-.466L4.94 7.118c-.255-.258-.253-.673.005-.928.257-.255.673-.253.928.005l1.502 1.518V.656c0-.362.294-.656.656-.656z"})],-1),n("defs",null,[n("clipPath",{id:"iconDownloadSolidclip0"},[n("path",{d:"M0 0H16V16H0z"})])],-1)]))),_:1,__:[0]},8,["width","height"])}
1]]),Fe={__name:"BrandLogo",setup:t=>(t,e)=>(s(),a(o(Z)))};function He(){return{asks:[],bids:[]}}function ze(t){return t.sort(((t,e)=>+e[0]-+t[0]))}function Ge(t,e){return e?t.length-1:0}function We(t,e,i){var a;const s=(null==(a=t[Ge(t,!i)])?void 0:a.total)||0;e.price=+e.price,e.size=+e.size,e.total=l(s).plus(e.size).toNumber(),t[i?"unshift":"push"](e)}function Ve(t,e,i){var a,s;if(0===e.length)return t;const r=[];let n=Ge(t,i),o=Ge(e,i);const l=i?-1:1;for(;t[n]||e[o];){const c=t[n]||{},d={price:+(null==(a=e[o])?void 0:a[0]),size:+(null==(s=e[o])?void 0:s[1])},u=i?d.price<c.price:d.price>c.price,h=c.price===d.price;h||void 0===c.price||u?(o+=l,0!==d.size&&We(r,d,i),h&&(n+=l)):(n+=l,We(r,c,i))}return r}const Ze=t("orderBook",(()=>{const t=Y(),i=e(0),a=e(null),s=e({asks:[],bids:[]}),r=c((()=>{const t=s.value.asks,e=t.length,i=new Array(e);for(let a=e-1;a>=0;a--){const{price:e,size:s}=t[a];i[t.length-1-a]=[`${e}`,`${s}`]}return i})),n=c((()=>s.value.bids.map((({price:t,size:e})=>[`${t}`,`${e}`])))),o=c((()=>{var e;const i=s.value.symbol;return(null==(e=U.state.futures.marketDetailMap)?void 0:e[i])||t.getExchangeInfoBySymbol(i)})),d=c((()=>{var t;return null==(t=o.value)?void 0:t.minPriceIncrement})),u=c((()=>{var t,e;return(null==(t=o.value)?void 0:t.priceFilter)??(null==(e=o.value)?void 0:e.priceDecimal)})),h=c((()=>{var t,e;const i=null==(e=null==(t=s.value.asks)?void 0:t[s.value.asks.length-1])?void 0:e.price;return void 0!==i?l(i).dp(u.value??2,l.ROUND_DOWN).toNumber():void 0})),g=c((()=>{var t,e;const i=null==(e=null==(t=s.value.bids)?void 0:t[0])?void 0:e.price;return void 0!==i?l(i).dp(u.value??2,l.ROUND_DOWN).toNumber():void 0})),p=c((()=>{const t=void 0===h.value,e=void 0===g.value;if(t&&e)return"";const i=d.value||0;return t?l(g.value).plus(i).toNumber():e?l(h.value).minus(i).toNumber():l(h.value).plus(g.value).div(2).toNumber()}));function m(){s.value={asks:[],bids:[]}}return{groupingIndex:i,groupingDecimalPlaces:a,orderBook:s,normalizedAsks:r,normalizedBids:n,bestAskPrice:h,bestBidPrice:g,midPrice:p,updateGroupingIndex:function(t){i.value=t},updateGroupingDecimalPlaces:function(t){a.value=t},update:function(t,e=!1){const{asks:i,bids:a}=e?s.value:{asks:[],bids:[]};e&&(ze(t.asks),ze(t.bids)),t.asks=Ve(i,t.asks,!0),t.bids=Ve(a,t.bids,!1),s.value=t},reset:m,$reset:function(){i.value=0,a.value=null,m()}}})),Ye=t("tradingDepth",{state:()=>({buyDepth:[],sellDepth:[],groupingIndex:0}),actions:{updateGroupIndex(t){this.groupingIndex=t},resetOrderDepth(){this.buyDepth=[],this.sellDepth=[]}
1,processDepthData(t,e,i=!1){if(0===t.length)return[];const a=i?[...t].reverse():t,s=a.reduce(((t,i,a)=>{const s=i[1];return t.push({type:e,price:i[0],size:s,culmulativeTotal:t[a].culmulativeTotal+Number(s)}),t}),[{type:e,price:a[0][0],size:a[0][1],culmulativeTotal:0}]);return i?s.reverse():s},updateOrderDepth({bids:t=[],asks:e=[]}){this.buyDepth=j(this.processDepthData(t,"buy")),this.sellDepth=j(this.processDepthData(e,"sell",!0))}}}),je=["Backspace","Delete","Tab","Enter","Escape","ArrowLeft","ArrowRight","Home","End"];function qe(t){if(""===t||null==t)return"";const e=t.toString().split(".");return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),e.join(".")}function Ke(t,{precision:e,max:i,value:a}){if(t.ctrlKey||t.metaKey||je.includes(t.key))return;const s=q(t.key);if(!/^[0-9.-]$/.test(s))return void t.preventDefault();const r=t.target,n=r.selectionStart,o=r.selectionEnd,l=q(r.value),c=(l.slice(0,n)+s+l.slice(o)).replace(/,/g,"");if(/^-?(\d+)?(\.\d*)?$/.test(c)){if(e>-1&&c.includes(".")){const i=c.split(".");if(i[1]&&i[1].length>e)return void t.preventDefault()}a>=i&&t.preventDefault()}else t.preventDefault()}function Qe(t,{precision:e,updateValue:i}){t.preventDefault();const a=(t.clipboardData||window.clipboardData).getData("text"),s=q(a).replace(/[^0-9.-]/g,"");if(!s||isNaN(Number(s)))return;const r=t.target,n=r.selectionStart,o=r.selectionEnd,l=r.value;
1let c=(l.slice(0,n)+s+l.slice(o)).replace(/,/g,"");if(e>-1&&c.includes(".")){const t=c.split("."),i=t[0];let a=t[1];a.length>e&&(a=a.slice(0,e)),c=`${i}.${a}`}i(c,!1)}const Xe={name:"TradingInput",components:{IconClose:Q},props:{id:{type:String,default:()=>K()},label:{type:String,default:""},value:{type:[String,Number],default:""},type:{type:String,default:"text"},placeholder:{type:[String,Number],default:""},maxlength:{type:[String,Number],default:""},max:{type:[Number,String],default:1/0},min:{type:[Number,String],default:-1/0},step:{type:[Number,String],default:1},disabled:{type:Boolean,default:!1},errorContent:{type:String,default:""},tipShown:{type:Boolean,default:!1},errorShown:{type:Boolean,default:!1},errorPlacement:{type:String,default:""},errorMsg:{type:String,default:""},maxDecimalPlaces:{type:Number,default:-1},disableLimitDecimalPlaces:{type:Boolean,default:!1},mobileStyle:{type:Boolean,default:!1},desktopStyle:{type:Boolean,default:!1},inputmode:{type:String,default:"default"},hideSpin:{type:Boolean,default:!0},canClear:{type:Boolean,default:!1},integerOnly:{type:Boolean,default:!1},prependFocusInput:{type:Boolean,default:!0},bgTransparent:{type:Boolean,default:!1},enableThousandSeparator:{type:Boolean,default:!1},onEnter:{type:Function,default:null},enablePlaceZero:{type:Boolean,default:!1},colorWhite:{type:Boolean,default:!1},enableCountBtn:{type:Boolean,default:null}},emits:["focus","blur","input","update:value"],expose:["focusInput"],data:()=>({timeoutId:null,intervalId:null,isFocus:!1,isHover:!1}),computed:{...d(["isApp"]),isMobileStyle(){return!this.desktopStyle&&(this.isMobile||this.mobileStyle)},isShowMobileHeader(){return!!this.isMobileStyle&&(this.$slots.prepend||this.$slots.append||this.label)},inputClass(){const{isMobileStyle:t,shouldPlaceZero:e,hideSpin:i,colorWhite:a}=this,s=!t||e;return{"tx-align--right":s,"tx-align--center":!s,"hide-spin":i,"pr-0":e,"color-white":a}},showCountBtn(){if(null!==this.enableCountBtn)return this.enableCountBtn;const t="number"===this.type||this.enableThousandSeparator;return this.isMobileStyle&&t},showError(){return this.isFocus&&this.errorShown},showTip(){return this.isFocus&&this.tipShown},computedType(){return this.enableThousandSeparator?"text":this.type},computedInputMode(){return this.enableThousandSeparator?"decimal":this.inputmode},computedMin(){return this.shouldPlaceZero?l(this.min).div(this.step):this.min},shouldPlaceZero(){return this.enablePlaceZero&&this.step>1},decimalPlacesNumber(){return this.disableLimitDecimalPlaces?-1:this.maxDecimalPlaces>-1?this.maxDecimalPlaces:this.step?et(this.step):et(this.min)||-1},displayValue(){return tt(this.value)?l(this.value).toString():this.shouldPlaceZero?function(t,e){if(!t)return"";const i=qe(String(t).split(".")[0]),a=Math.log10(e);let s=0,r=i.length;for(let n=i.length-1;n>=0;n--){const t=i[n];if(/[0-9]/.test(t)&&s++,s===a){r=n;break}}return i.substring(0,r)}(this.value,this.step):this.enableThousandSeparator?qe(this.value):this.value},displayPlaceZero(){return qe(this.step.toString().slice(1))},displayPlaceholder(){return J(this.placeholder)?l(this.placeholder).toString():this.placeholder},showClearIcon(){return!!this.canClear&&(this.value&&(this.isFocus||this.isHover))}},watch:{value:"onContentLengthChange",placeholder:"onContentLengthChange"},mounted(){this.updateInputWidth()},beforeUnmount(){this.clearTimer()},methods:{onContentLengthChange(t,e){String(t).length!==String(e).length&&this.updateInputWidth()},handleFocus(t){this.isFocus=!0,this.$emit("focus",t.target.value)},handleBlur(t){this.isFocus=!1,this.$emit("blur",t.target.value)},updateValue(t,e=!0){let i=e?t.target.value:t;"string"==typeof i&&(i=q(i));let a=0;if(t.target&&(a=t.target.value.length-t.target.selectionStart),this.enableThousandSeparator&&"string"==typeof i){i=i.replace(/,/g,"");/^-?\d*\.?\d*$/.test(i)||(i=i.replace(/[^\d.-]/g,""))}if(""!==i&&("number"===this.type||this.enableThousandSeparator)){if("string"==typeof i&&i.length>1&&i.startsWith("0")&&!i.includes(".")&&(i=i.replace(/^0+/,""),""===i&&(i="0")),this.maxlength>0&&Number.isInteger(this.maxlength)){let t=String(i);t.length>
1this.maxlength&&(t=t.substring(0,this.maxlength)),i=t}this.decimalPlacesNumber>-1&&(i=X(i,this.decimalPlacesNumber)),this.max!==1/0&&i>this.max&&(i=this.max),0!==i&&i<0&&this.computedMin>i&&(i=this.computedMin),e&&t.target.value!=i&&(t.target.value=this.enableThousandSeparator?qe(i):i)}this.shouldPlaceZero&&(i=l(i).times(this.step).toNumber()||0),this.$emit("update:value",i),this.$emit("input",i),t.target&&this.enableThousandSeparator&&this.$nextTick((()=>{const e=Math.max(0,t.target.value.length-a);t.target.setSelectionRange(e,e)}))},increment(){if(this.shouldPlaceZero){const t=Number(this.$refs.input.value.replace(/,/g,""));this.updateValue(l(t).plus(1).toNumber(),!1)}else this.updateValue(l(Number(this.value)).plus(this.step).toNumber(),!1)},decrement(){if(this.shouldPlaceZero){const t=Number(this.$refs.input.value.replace(/,/g,""));this.updateValue(l(t).minus(1).toNumber(),!1)}else this.updateValue(l(Number(this.value)).minus(this.step).toNumber(),!1)},startUpdateValue(t){if(this.disabled)return;const e="increment"===t?this.increment:this.decrement;this.timeoutId=setTimeout((()=>{this.updateWithInterval(e)}),200),e()},updateWithInterval(t){t(),this.intervalId=setInterval((()=>{t()}),100)},clearTimer(){this.timeoutId&&clearTimeout(this.timeoutId),this.intervalId&&clearInterval(this.intervalId)},updateInputWidth(){this.$nextTick((()=>{const t=this.$refs.input;if(!this.isMobileStyle||!t)return;const e=7*(t.value.length||t.placeholder.length)||7;t.style.width=`${e}px`}))},focusInput(){var t;
1null==(t=this.$refs.input)||t.focus(),this.isApp&&setTimeout((()=>{var t;null==(t=this.$refs.input)||t.scrollIntoView({behavior:"smooth"})}),500)},handleMouseEnter(){this.isHover=!0},handleMouseLeave(){this.isHover=!1},handleClear(){this.updateValue("",!1)},handleKeyDown(t){const e=q(t.key);"-"===e&&this.min>=0?t.preventDefault():(!(this.integerOnly||this.step>=1)||"."!==e&&"-"!==e||t.preventDefault(),this.enableThousandSeparator&&("ArrowUp"===t.key&&this.increment(),"ArrowDown"===t.key&&this.decrement(),"Enter"===t.key&&this.onEnter&&(t.preventDefault(),t.stopPropagation(),this.onEnter()),Ke(t,{precision:this.decimalPlacesNumber,max:this.max,value:this.value})))},handlePaste(t){this.enableThousandSeparator&&Qe(t,{precision:this.decimalPlacesNumber,updateValue:this.updateValue})},handlePrependClick(){this.prependFocusInput&&this.focusInput()}}},Je={key:0,class:"input-header"},ti={class:"input-header-prepend"},ei=["for"],ii={class:"input-header-append"},ai={key:0,class:"remark"},si=["id","type","placeholder","value","step","min","max","maxlength","disabled","inputmode"],ri={key:5,class:"input-group-append"},ni={class:"error-msg"};const oi=Ie(Xe,[["render",function(t,e,a,r,o,l){const c=i("IconClose"),d=u("tooltip");return s(),h("div",{class:v(["input-wrapper",{"input-wrapper--mobile":l.isMobileStyle}]),onMouseenter:e[14]||(e[14]=(...t)=>l.handleMouseEnter&&l.handleMouseEnter(...t)),onMouseleave:e[15]||(e[15]=(...t)=>l.handleMouseLeave&&l.handleMouseLeave(...t))},[l.isShowMobileHeader?(s(),h("div",Je,[n("div",ti,[t.$slots.prepend?m(t.$slots,"prepend",{key:0},void 0,!0):(s(),h("label",{key:1,for:a.id},y(a.label),9,ei))]),n("div",ii,[m(t.$slots,"append",{},void 0,!0)])])):g("",!0),p((s(),h("div",{class:v(["input-group",{"input-group--error":a.errorShown,"input-group--mobile":l.isMobileStyle,"bg-transparent":a.bgTransparent}])},[!l.isMobileStyle&&t.$slots.prepend?(s(),h("div",{key:0,class:"input-group-prepend",onClick:e[0]||(e[0]=(...t)=>l.handlePrependClick&&l.handlePrependClick(...t))},[m(t.$slots,"prepend",{},void 0,!0),t.$slots.remark?(s(),h("span",ai,[m(t.$slots,"remark",{},void 0,!0)])):g("",!0)])):g("",!0),l.showCountBtn?(s(),h("button",{key:1,class:"input-button",onClick:e[1]||(e[1]=(...t)=>l.decrement&&l.decrement(...t)),onTouchstart:e[2]||(e[2]=f((()=>l.startUpdateValue("decrement")),["prevent"])),onTouchend:e[3]||(e[3]=f(((...t)=>l.clearTimer&&l.clearTimer(...t)),["prevent"]))},e[16]||(e[16]=[n("i",{class:"action-icon el-icon-minus"},null,-1)]),32)):g("",!0),n("div",{class:v(["input-outside",{"flex-1":l.isMobileStyle}])},[n("input",{id:a.id,ref:"input",class:v(l.inputClass),autocomplete:"off",type:l.computedType,placeholder:l.displayPlaceholder,value:l.displayValue,step:a.step,min:l.computedMin,max:a.max,maxlength:a.maxlength,disabled:a.disabled,inputmode:l.computedInputMode,onInput:e[4]||(e[4]=(...t)=>l.updateValue&&l.updateValue(...t)),onFocus:e[5]||(e[5]=(...t)=>l.handleFocus&&l.handleFocus(...t)),onBlur:e[6]||(e[6]=(...t)=>l.handleBlur&&l.handleBlur(...t)),onKeydown:e[7]||(e[7]=(...t)=>l.handleKeyDown&&l.handleKeyDown(...t)),onPaste:e[8]||(e[8]=(...t)=>l.handlePaste&&l.handlePaste(...t))},null,42,si),l.shouldPlaceZero&&a.value?(s(),h("div",{key:0,class:v(["zero-place-section",{"is-input-focus":o.isFocus}]),onClick:e[9]||(e[9]=(...t)=>l.focusInput&&l.focusInput(...t))},y(l.displayPlaceZero),3)):g("",!0)],2),l.showClearIcon?(s(),h("div",{key:2,class:"cancel-btn",onClick:e[10]||(e[10]=(...t)=>l.handleClear&&l.handleClear(...t))},[b(c,{class:"clear-icon"})])):g("",!0),t.$slots.content?m(t.$slots,"content",{key:3},void 0,!0):g("",!0),l.showCountBtn?(s(),h("button",{key:4,class:"input-button",onClick:e[11]||(e[11]=(...t)=>l.increment&&l.increment(...t)),onTouchstart:e[12]||(e[12]=f((()=>l.startUpdateValue("increment")),["prevent"])),onTouchend:e[13]||(e[13]=f(((...t)=>l.clearTimer&&l.clearTimer(...t)),["prevent"]))},e[17]||(e[17]=[n("i",{class:"action-icon el-icon-plus"},null,-1)]),32)):g("",!0),!l.isMobileStyle&&t.$slots.append?(s(),h("div",ri,[m(t.$slots,"append",{},void 0,!0)])):g("",!0)],2)),[[d,{theme:"trading-input-tooltip",content:a.errorContent.replace(/\n/g,"<br/>"),shown:l.showError||l.showTip,placement:a.errorPlacement}]]),p(n("div",ni,[m(t.$slots,"errorMsg",{},(()=>
1[S(y(a.errorMsg),1)]),!0)],512),[[C,a.errorMsg||t.$slots.errorMsg]])],34)}],["__scopeId","data-v-4bc8dc2e"]]);const li=Ie({name:"IconQuestionCircle2",components:{Icon:V},props:{width:{type:Number,default:13},height:{type:Number,default:13}},emits:["click"]},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{width:o.width,height:o.height,viewBox:"0 0 13 13",onClick:e[0]||(e[0]=e=>t.$emit("click",e))},{default:r((()=>e[1]||(e[1]=[n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.2881 6.04395C12.2881 9.35765 9.6018 12.0439 6.28809 12.0439C2.97438 12.0439 0.288086 9.35765 0.288086 6.04395C0.288086 2.73024 2.97438 0.0439453 6.28809 0.0439453C9.6018 0.0439453 12.2881 2.73024 12.2881 6.04395ZM6.85896 7.55791H5.41896L5.40868 5.9842C5.95382 5.96363 6.36525 5.88134 6.63268 5.71677C6.90011 5.5522 7.03382 5.28477 7.03382 4.89391V4.74991C7.03382 4.49277 6.96182 4.29734 6.80754 4.15334C6.65325 4.01963 6.44754 3.94763 6.20068 3.94763C5.93325 3.94763 5.71725 4.02991 5.54239 4.19448C5.36754 4.35906 5.24411 4.57506 5.18239 4.82191L3.92754 4.29734C3.98925 4.09163 4.08182 3.8962 4.19496 3.70077C4.31839 3.50534 4.47268 3.33048 4.65782 3.1762C4.84296 3.02191 5.06925 2.89848 5.33668 2.79563C5.60411 2.70306 5.90239 2.65163 6.25211 2.65163C6.61211 2.65163 6.94125 2.70306 7.22925 2.80591C7.52754 2.90877 7.78468 3.05277 7.99039 3.23791C8.20639 3.42306 8.37096 3.64934 8.48411 3.90649C8.59725 4.17391 8.64868 4.46191 8.64868 4.77048C8.64868 5.05848 8.60754 5.32591 8.50468 5.5522C8.41211 5.78877 8.27839 5.99448 8.11382 6.16934C7.94925 6.3442 7.76411 6.4882 7.53782 6.59106C7.32182 6.7042 7.09554 6.7762 6.85896 6.81734V7.55791ZM6.85896 9.85163C6.71496 10.0059 6.47839 10.0779 6.14925 10.0779C5.82011 10.0779 5.59382 10.0059 5.44982 9.85163C5.30582 9.70763 5.23382 9.52249 5.23382 9.2962V9.04934C5.23382 8.83334 5.30582 8.6482 5.44982 8.49391C5.59382 8.34991 5.82011 8.26763 6.14925 8.26763C6.47839 8.26763 6.71496 8.34991 6.85896 8.49391C7.00296 8.6482 7.06468 8.83334 7.06468 9.04934V9.2962C7.06468 9.52249 7.00296 9.70763 6.85896 9.85163Z"},null,-1)]))),_:1,__:[1]},8,["width","height"])}]]);const ci=Ie({name:"IconBind",components:{Icon:V},props:{width:{type:[Number,String],default:17},height:{type:[Number,String],default:17}}},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{"aria-label":"Bind Icon",width:o.width,height:o.height,viewBox:"0 0 17 17"},{default:r((()=>e[0]||(e[0]=[n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M15.8219 1.0789C14.4315 -0.298762 12.1782 -0.298762 10.7878 1.0789L8.62959 3.21728C8.23076 3.61245 8.23076 4.25463 8.62959 4.6498C9.02647 5.04303 9.66852 5.04303 10.0654 4.6498L12.2236 2.51142L12.2236 2.51141C12.8203 1.92022 13.7894 1.92022 14.3861 2.51142C14.9808 3.10065 14.9808 4.05425 14.3861 4.64349L10.4284 8.56482C9.83174 9.15602 8.86325 9.15601 8.2666 8.56483L8.26659 8.56482C7.86971 8.17159 7.22766 8.17159 6.83078 8.56482C6.43195 8.95998 6.43195 9.60217 6.83078 9.99733C8.22123 11.375 10.4738 11.375 11.8642 9.99733L15.8219 6.07603C17.2143 4.69643 17.2143 2.4585 15.8219 1.0789ZM10.5116 6.47697C9.12537 5.10301 6.87957 5.10301 5.49334 6.47697L1.90729 10.0313C0.519183 11.4071 0.519183 13.6389 1.90729 15.0147C3.29346 16.3894 5.5394 16.3892 6.92621 15.0147L8.71894 13.2378C9.11686 12.8434 9.11686 12.2025 8.71894 11.8081C8.32287 11.4156 7.68209 11.4156 7.28606 11.8082L5.49334 13.585C4.89854 14.1746 3.93437 14.1744 3.34034 13.5853L3.34026 13.5852C2.74786 12.998 2.7479 12.048 3.34011 11.461L6.92618 7.90668L6.92619 7.90667C7.5203 7.31779 8.48464 7.31779 9.07875 7.90667L9.07876 7.90668C9.4748 8.29922 10.1156 8.29922 10.5116 7.90667C10.9095 7.51227 10.9095 6.87138 10.5116 6.47697Z"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]]);const di=Ie({name:"IconX2",components:{Icon:V},props:{width:{type:[Number,String],default:16},height:{type:[Number,String],default:16}}},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{"aria-label":"x Icon",width:o.width,height:o.height,viewBox:"0 0 16 16"},{default:r((()=>e[0]||(e[0]=[n("circle",{cx:"8",cy:"8",r:"8"},null,-1),n("path",{class:"icon-x-main",d:"M8.97525 7.2611L12.4002 3.28003H11.5886L8.61472 6.73673L6.23951 3.28003H3.5L7.09177 8.50718L3.5 12.6819H4.31164L7.4521 9.03154L9.96048 12.6819H12.7L8.97525 7.2611ZM7.8636 8.55323L7.49968 8.03273L4.60408 3.891H5.85071L8.18749 7.23351L8.55141 7.75401L11.5889 12.0988H10.3423L7.8636 8.55323Z",fill:"white"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]]);const ui=Ie({name:"IconFacebook2",components:{Icon:V},props:{width:{type:[Number,String],default:16},height:{type:[Number,String],default:16}}},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{"aria-label":"facebook",width:o.width,height:o.height,viewBox:"0 0 24 24"},{default:r((()=>e[0]||(e[0]=[n("circle",{cx:"12",cy:"12",r:"12"},null,-1),n("path",{class:"icon-facebook-main",d:"M14.4197 7.77727H15.8098V5.35423C15.5717 5.32149 14.7442 5.24707 13.7827 5.24707C11.7764 5.24707 10.4041 6.50919 10.4041 8.82805V10.9623H8.18945V13.6712H10.4041V20.4878H13.1189V13.6712H15.2442L15.5806 10.9623H13.1189V9.09595C13.1159 8.31308 13.3272 7.77727 14.4197 7.77727Z",fill:"white"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]]);const hi=Ie({name:"IconWhatsapp2",components:{Icon:V},props:{width:{type:[Number,String],default:16},height:{type:[Number,String],default:16}}},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{"aria-label":"whatsapp2",width:o.width,height:o.height,viewBox:"0 0 24 24"},{default:r((()=>e[0]||(e[0]=[n("circle",{cx:"12",cy:"12",r:"12"},null,-1),n("path",{class:"icon-whatsapp-main","fill-rule":"evenodd","clip-rule":"evenodd",d:"M17.3121 6.38124C15.9049 4.97354 14.0285 4.2002 12.0304 4.2002C7.91609 4.2002 4.56445 7.5359 4.56087 11.6307C4.56087 12.9422 4.90463 14.218 5.55634 15.3477L4.5 19.2002L8.46037 18.1667C9.55251 18.7583 10.7807 19.0719 12.0304 19.0719H12.034C16.1484 19.0719 19.5 15.7362 19.5036 11.6378C19.5 9.6528 18.723 7.78537 17.3121 6.38124ZM12.0304 17.8139C10.9132 17.8139 9.82107 17.5145 8.86858 16.9514L8.64299 16.816L6.29398 17.429L6.92062 15.1482L6.77381 14.913C6.15075 13.9293 5.8249 12.7925 5.8249 11.6271C5.8249 8.22728 8.61076 5.45465 12.034 5.45465C13.6919 5.45465 15.2496 6.0997 16.4241 7.26506C17.595 8.43398 18.2395 9.98423 18.2395 11.6343C18.236 15.0448 15.4501 17.8139 12.0304 17.8139ZM15.4358 13.1881C15.2496 13.0954 14.3329 12.6464 14.161 12.5822C13.9891 12.5217 13.8638 12.4896 13.7421 12.6749C13.6167 12.8602 13.2586 13.2807 13.1512 13.4019C13.0438 13.5266 12.9328 13.5409 12.7466 13.4482C12.5604 13.3556 11.9588 13.1596 11.2462 12.5252C10.6912 12.0334 10.3188 11.424 10.2078 11.2387C10.1004 11.0534 10.1971 10.9536 10.2902 10.8609C10.3725 10.779 10.4764 10.6435 10.5695 10.5366C10.6626 10.4297 10.6948 10.3513 10.7557 10.2266C10.8165 10.1018 10.7879 9.99492 10.7413 9.90226C10.6948 9.8096 10.3224 8.89371 10.1648 8.52308C10.0144 8.15957 9.86046 8.20946 9.74588 8.2059C9.63845 8.19877 9.51313 8.19877 9.3878 8.19877C9.26247 8.19877 9.06194 8.2451 8.89007 8.43042C8.71819 8.61573 8.23836 9.06477 8.23836 9.98067C8.23836 10.8966 8.90797 11.7768 9.00107 11.9
1016C9.09417 12.0263 10.3152 13.9008 12.188 14.7063C12.632 14.8987 12.9793 15.0127 13.2515 15.0983C13.6991 15.2408 14.1037 15.2194 14.426 15.1731C14.7841 15.1197 15.5289 14.7241 15.6864 14.2893C15.8404 13.8545 15.8404 13.4839 15.7939 13.4055C15.7473 13.3271 15.622 13.2807 15.4358 13.1881Z",fill:"white"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]]);const gi=Ie({name:"IconTelegram2",components:{Icon:V},props:{width:{type:[Number,String],default:16},height:{type:[Number,String],default:16}}},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{"aria-label":"telegram",width:o.width,height:o.height,viewBox:"0 0 24 24"},{default:r((()=>e[0]||(e[0]=[n("path",{d:"M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z"},null,-1),n("path",{class:"icon-telegram-main",d:"M5.48964 11.742L17.0631 7.27949C17.6021 7.08731 18.0709 7.41074 17.8928 8.22168L15.924 17.5029C15.7787 18.1592 15.385 18.3232 14.8412 18.0092L11.8412 15.7967L10.3928 17.1889C10.2334 17.3482 10.0975 17.4842 9.78808 17.4842L9.99902 14.4326L15.5631 9.41231C15.8068 9.20137 15.5068 9.07949 15.1881 9.29043L8.31621 13.617L5.35371 12.6936C4.71152 12.4873 4.69746 12.0514 5.48964 11.742Z",fill:"white"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]]);function pi(t){switch(t){case at.LONG.value:return"long";case at.SHORT.value:return"short";default:return"neutral"}}function mi(t){const e=(Object.values(at).find((e=>e.value===t))||{}).lang;return e?st.global.t(e):""}function yi({upperPrice:t,lowerPrice:e,gridNumber:i,priceFilter:a=2}){return t&&e&&i?l(t).minus(e).div(i).dp(a,l.ROUND_DOWN).toNumber():null}function vi({stepPrice:t,upperPrice:e,fee:i}){if(!t||!e||!J(i))return"";const a=l(i).times(l(e).times(2).minus(t)),s=l(e).minus(t);return l(t).minus(a).div(s).times(100).dp(2,l.ROUND_DOWN).toNumber()}function fi({stepPrice:t,lowerPrice:e,fee:i}){if(!t||!e||!J(i))return"";const a=l(i).times(l(e).times(2).plus(t));return l(t).minus(a).div(e).times(100).dp(2,l.ROUND_DOWN).toNumber()}function bi({stepPrice:t,midPrice:e,gridNumber:i,lowerPrice:a,priceFilter:s=2}){if(!(t&&e&&i&&a))return null;const r=e;let n=l(0),o=a;for(let c=0;c<=i;c++){const e=l(c).times(t).plus(a).dp(s,l.ROUND_DOWN).toNumber();n=n.plus(e),(Math.abs(e-r)<Math.abs(o-r)||Math.abs(e-r)===Math.abs(o-r)&&e>o)&&(o=e)}return n=n.minus(o),n.toNumber()}function Ci({stepPrice:t,upperPrice:e,lowerPrice:i,isLong:a=!0,priceFilter:s=2,gridNumber:r}){if(!(t&&e&&i&&r))return null;let n;return n=a?l(e).plus(i).minus(t).times(r).div(2):l(e).plus(i).plus(t).times(r).div(2),n.dp(s,l.ROUND_DOWN).toNumber()}function Si({sumOfGridPrices:t,leverage:e,marketDetail:i,adjConf:a}){if(!J(t)||!e||!a)return null;if(!(null==i?void 0:i.contractSize)||!(null==i?void 0:i.minOrderSize))return null;const s=l(i.contractSize).times(i.minOrderSize),r=l.min(a,.5),n=l(e).times(r);return s.times(t).div(n).times(1.02).dp(2,l.ROUND_UP).toNumber()}function Ti({sumOfGridPrices:t,leverage:e,marketDetail:i,gridNumber:a,riskLimitSize:s,adjConf:r,isLong:n,upperPrice:o,markPrice:c,stepPrice:d}){if([t,e,null==i?void 0:i.maxOrderSize,null==i?void 0:i.contractSize,a,s,o].some((t=>!J(t)||t<=0)))return null;if(n&&(!J(d)||d<=0))return null;if(!n&&(!J(c)||c<=0))return null;const u=r||1,h=l(i.maxOrderSize).times(i.contractSize);let g;if(n){const t=l(o).minus(d).times(a);if(t.isZero())return null;g=l(s).div(t)}else{const t=l.max(l(c).times(1.02),o);g=l(s).div(t).div(a)}return l.min(h,g).times(t).div(e).div(u).times(.98).dp(0,l.ROUND_DOWN).toNumber()}function wi(t){return t===it.STOPPED_HOLDING}function Di(t){return t===it.CLOSING}function Ii(t){return![it.CLOSING,it.CLOSED,it.DEACTIVATED,it.STOPPED_HOLDING].includes(t)}function Pi(t){return[it.INITIALIZING,it.RUNNING,it.STOPPED_HOLDING].includes(t)}function ki(t){switch(t){case it.RUNNING:return st.global.t("t.running");case it.INITIALIZING:case it.PENDING:return st.global.t("t.initializing");case it.CLOSING:return st.global.t("t.stopping");case it.CLOSED:return st.global.t("t.stopped");case it.DEACTIVATED:return st.global.t("t.deactivated");case it.STOPPED_HOLDING:return st.global.t("trading.bot.status.positionHeld");default:return t}}function $i(t){const e=t.gte(0)?l.ROUND_DOWN:l.ROUND_UP;return t.dp(2,e)}function xi(t){const e=l(t);
1return!e.isNaN()&&!e.isZero()}function Bi({inputPrice:t,entryPrice:e,cryptoSize:i,positionMargin:a,isLong:s}){if(!xi(t)||!xi(e)||!xi(i))return null;const r=$i((s?l(t).minus(e):l(e).minus(t)).times(i)),n=l(a),o=xi(a)?$i(r.div(n).times(100)):null;return{estPnl:r.toNumber(),estReturn:null===o?null:o.toNumber()}}function Li(t,e){if(!t)return"";let i="";switch(t.period){case nt.MINS_15:i="15 ";break;case nt.MINS_30:i="30 "}return`${i+st.global.t(rt[t.period])} ${"LONG"===e?st.global.t("t.buy"):st.global.t("t.sell")}`}function Ni({isLong:t,totalInvestment:e,totalIncome:i}){if(!Number(e)||!Number(i))return 0;return(t?l(e).div(i):l(i).div(e)).toNumber()}function _i({upperPrice:t,lowerPrice:e,minPriceIncrement:i,fee:a}){if(!t||!e||!i)return null;const s=l(t).minus(e).div(i).dp(0,l.ROUND_DOWN).toNumber();if(a<=0)return s;const r=l(2).times(a).plus(1),n=l(t).minus(e),o=l(2).times(a).times(t),c=r.times(n).div(o).dp(0,l.ROUND_DOWN).toNumber();return Math.min(c,s)}const{tradingViewLogoText:Ri}=It,Mi={name:"SharePnlDialog",components:{Dialog:ut,BrandLogo:Fe||(()=>null),HeaderLogo:dt,IconDownloadSolid:Ue,IconBind:ci,IconX2:di,IconFacebook2:ui,IconWhatsapp2:hi,IconTelegram2:gi,IconArrowBack:ct,IconShare:lt,BrandIcon:ot,QrcodeVue:D},props:{show:{type:Boolean,required:!0},position:{type:Object,required:!0},isBotSharing:{type:Boolean,default:!1},forceDayTheme:{type:Boolean,default:!1}},emits:["update:show"],setup(){const{convertToDisplaySymbol:t}=kt(),e=$t(),{userReferral:i,isEnableCommonReferralInfo:a}=P(e),{debouncePromiseGetUserReferralInfo:s}=e;return{convertToDisplaySymbol:t,userReferral:i,isEnableCommonReferralInfo:a,debouncePromiseGetUserReferralInfo:s}},data:()=>({TRADING_TYPE:Pt,share:{leverage:!0,pnl:!0,price:!0},maxThemes:3,theme:1,logoText:Ri,shareNeededAssets:{MOUNTED:!1,QR_LOGO_IMG:!1,REFERRAL_CODE:!1},timestamp:"",isReferralQrcodeLogoExist:!1,saveImagePayload:{url:null,filename:null,isError:!1,isLoading:!0},showCopiedToast:!1}),computed:{...d(["lang","isDefaultBrand","isApp"]),...w(["isNightTheme"]),...d("futures",{futuresMarkPriceMap:"futuresMarkPriceMap",futuresMarketMap:"marketMap"}),...w("futures",["initialMarginPercentage"]),...T(Y,["getExchangeInfoBySymbol"]),spotLastPrice(){return Dt().getSpotLastPrice(this.symbol)},backgroundImg(){const t=this.isNightTheme&&!this.forceDayTheme?"D":"L",e=`${this.theme}${this.isPositive?"1":"2"}.png`;return wt(`sharePnlBg/${t}${e}`)},qrLogoImg:()=>wt("sharePnlBg/qrLogo.png"),isBuySide(){return"MODE_BUY"===this.position.orderModeName},positionLeverage(){const{isolatedLeverage:t}=this.position,e=this.initialMarginPercentage(this.symbol);if(void 0===e||void 0===t)return"";return`${Tt(t,e,2)}X`},isPositive(){return this.isBotSharing?this.position.percentage>=0:this.position.positionRoe>=0},symbol(){return this.isBotTypeDca?`${this.position.symbol}-${this.position.quoteCurrency}`:this.position.symbol},displaySymbol(){return this.convertToDisplaySymbol(this.symbol)},futuresMarkPrice(){return this.futuresMarkPriceMap[this.symbol]||0},priceFormat(){var t;return{formatKey:this.isBotTypeDca?this.getExchangeInfoBySymbol(this.symbol).priceDecimal:null==(t=this.futuresMarketMap[this.symbol])?void 0:t.priceFilter,currency:this.quoteCurrency}},baseCurrency(){var t;return this.position.baseCurrency||(null==(t=this.futuresMarketMap[this.symbol])?void 0:t.baseCurrency)},quoteCurrency(){return this.isBotTypeDca?this.position.quoteCurrency:St(this.symbol)},referralLink(){return this.isEnableCommonReferralInfo?Ct(this.lang,this.userReferral.referralCode):window.location.origin},shareText(){return this.$t("futuresMain.trade.trading",{brand:this.$t("brand.name")})},pnlAmount(){return`(${this.isPositive?"+":""}${this.$filters.formatNumber(this.position.unrealizedPnlInSettleAsset,{formatKey:this.position.unrealizedPnlFilter})} ${this.position.settleWithNonUSDAsset})`},isCnLang(){return"zh-CN"===this.lang},showExtraLogo(){return this.isDefaultBrand&&this.isCnLang},isBotTypeGrid(){return this.position.botType===bt.GRID},isBotTypeDca(){return this.position.botType===bt.DCA},botTypeText(){switch(this.position.botType){case bt.GRID:return this.$t("trading.bot.grid.shareSubTitle");case bt.DCA:return this.$t("trading.bot.grid.shareSubTitle.dca");default:return""}}},watch:{"userReferral.referralCode":{handler(t){this.isEnableCommonReferralInfo&&!t||this.handleShareAssetsReady("REFERRAL_CODE")},immediate:!0}},created(){this.debouncePromiseGetUserReferralInfo()},mounted(){this.handleShareAssetsReady("MOUNTED"),this.checkQrcodeLogoExist()},methods:{async checkQrcodeLogoExist(){this.isReferralQrcodeLogoExist=await ft(this.qrLogoImg),this.isEnableCommonReferralInfo&&this.isReferralQrcodeLogoExist||this.handleShareAssetsReady("QR_LOGO_IMG")},handleShareAssetsReady(t){this.shareNeededAssets[t]=!0,Object.values(this.shareNeededAssets).every((t=>t))&&(this.saveImagePayload.isLoading=!1)},onClose(){this.$emit("update:show",!1)},switchTheme(t){this.theme+t>this.maxThemes?this.theme=1:this.theme+t<=0?this.theme=this.maxThemes:this.theme+=t},handleCopy(){this.showCopiedToast||(this.trackEvent("copy link"),this.showCopiedToast=!0,setTimeout((()=>{this.showCopiedToast=!1}),2e3))},async prepareSaveImg(){var t;if(this.timestamp=vt(Date.now(),"yyyy-MM-dd HH:mm"),await this.$nextTick(),!this.$refs.sharedContent)return;const e=this.$refs.sharedContent.querySelector("canvas"),i=this.$refs.sharedContent.cloneNode(!0),a=this.isEnableCommonReferralInfo?"share-info-with-referral":"share-info-without-referral";i.style.borderRadius="16px",i.style.overflow="hidden",i.querySelector(`.${a}`).style.display="flex";const s=null==(t=i.querySelector("canvas"))?void 0:t.getContext("2d");
1return s&&s.drawImage(e,0,0),this.$refs.tmpImgSlot.append(i),I(i,{scale:3}).then((t=>{const e=URL.createObjectURL(t),i=`share-open-position-${this.displaySymbol}.png`;this.saveImagePayload.url=e,this.saveImagePayload.filename=i})).catch((t=>{this.saveImagePayload.isError=!0})).finally((()=>{this.saveImagePayload.isLoading=!1,i.remove()}))},async handleShare(t=!1){this.saveImagePayload.isLoading||(this.saveImagePayload.isLoading=!0,await this.prepareSaveImg(),this.$nextTick((()=>{this.trackEvent(t?"save image":"default share");const{url:e,filename:i}=this.saveImagePayload;t?mt(e,i):yt({imageUrl:e,text:this.shareText,url:this.referralLink},i),this.saveImagePayload.isLoading=!1})))},handleTwitterShare(){this.trackEvent("twitter");const t=new Ae(this.referralLink,this.shareText,[this.$t("brand.name").toUpperCase()]).to;window.open(t)},handleFbShare(){this.trackEvent("facebook");const t=new Me(this.referralLink,this.$t("brand.name").toUpperCase()).to;window.open(t)},handleWhatsappShare(){this.trackEvent("whatsapp");const t=new Re(this.referralLink,this.shareText).to;window.open(t)},handleTgShare(){this.trackEvent("telegram");const t=new _e(this.referralLink,this.shareText).to;window.open(t)},trackEvent(t){this.isBotSharing||ht(pt.SHARE_POSITION_SHARE_MEDIUM_CLICKED,{s1:"futures",s2:gt(this.symbol),s3:String(this.theme),s4:String(this.share.leverage),s5:String(this.share.pnl),s6:String(this.share.price),s7:t})},getDirectionText:mi}},Ai={class:"share-dialog-body"},Oi={class:"select-theme"},Ei={ref:"sharedContent",class:"relative"},Ui={key:0,class:"extra-logo"},Fi={key:1,class:"type-title"},Hi={key:2,class:"type-title"},zi={class:"percentage"},Gi={class:"percentage"},Wi={class:"position-info"},Vi={class:"market-name"},Zi={class:"market-name"},Yi={class:"side"},ji={class:"price-row"},qi={class:"label"},Ki={class:"number"},Qi={class:"price-row"},Xi={class:"label"},Ji={class:"number"},ta={class:"price-row"},ea={class:"label"},ia={class:"number"},aa={class:"price-row"},sa={class:"label"},ra={class:"number"},na={class:"price-row"},oa={class:"label"},la={class:"number"},ca={class:"price-row"},da={class:"label"},ua={class:"number"},ha={class:"price-row"},ga={class:"label"},pa={class:"number"},ma={key:0,class:"share-info share-info-with-referral"},ya={class:"left-block"},va={key:0,class:"qr-wrapper"},fa=["src"],ba={class:"domain"},Ca={class:"info-body"},Sa={class:"ref-area"},Ta={key:0,class:"timestamp-sm"},wa={class:"ref-block"},Da={class:"ref-text"},Ia={class:"ref-code"},Pa={class:"promo-text"},ka={class:"time-area"},$a={key:0,class:"timestamp"},xa={class:"domain"},Ba={key:1,class:"share-info share-info-without-referral"},La={class:"domain"},Na={class:"timestamp"},_a={ref:"tmpImgSlot",class:"tmp-img-slot"},Ra={class:"slider-area"},Ma={class:"back-icon"},Aa={class:"dots"},Oa={class:"next-icon"},Ea={class:"share-dialog-footer"},Ua={class:"footer-title"},Fa={class:"options"},Ha={class:"footer-title"},za={class:"share-options-scroll"},Ga={class:"share-options"},Wa={class:"share-name"},Va={class:"share-item"},Za={class:"icon"},Ya={class:"share-name"},ja={class:"share-name"},qa={class:"share-item"},Ka={class:"share-item"},Qa={class:"share-item"},Xa={class:"share-item"};const Ja=Ie(Mi,[["render",function(t,e,o,l,c,d){const m=i("BrandLogo"),f=i("HeaderLogo"),T=i("BrandIcon"),w=i("QrcodeVue"),D=i("IconArrowBack"),I=i("Checkbox"),P=i("IconDownloadSolid"),L=i("IconBind"),N=i("IconShare"),_=i("IconX2"),R=i("IconFacebook2"),M=i("IconWhatsapp2"),A=i("IconTelegram2"),O=i("Dialog"),E=u("loading"),U=u("clipboard");return s(),a(O,{class:"share-pnl-dialog",width:t.isLargeSize?"620px":"90%",isBrandNewStyle:"",onClosed:d.onClose},{header:r((()=>[S(y(t.$t("trading.sharePnl.title")),1)])),body:r((()=>[n("div",Ai,[n("div",Oi,y(t.$t("trading.sharePnl.selectTheme")),1),n("div",Ei,[n("div",{class:"share-content",style:k({backgroundImage:`url(${d.backgroundImg})`})},[d.showExtraLogo?(s(),h("div",Ui,[b(m),e[12]||(e[12]=n("div",{class:"type-title"},"FUTURES",-1))])):g("",!0),b(f,{class:"logo-icon"}),o.isBotSharing?(s(),h("div",Hi,y(o.position.marketType===c.TRADING_TYPE.FUTURES?t.$t("wallets.futuresList.futures"):t.$t("t.spot"))+" | "+y(d.botTypeText),1)):(s(),h("h2",Fi,y(t.$t("wallets.futuresList.futures")),1)),o.isBotSharing?(s(),h("div",{key:4,class:v(["roe-area",{positive:d.isPositive,negative:!d.isPositive}])},[n("div",Gi,y(t.$filters.formatNumber(o.position.percentage,{formatKey:2,signed:!0,postfix:"%"})),1),p(n("div",{class:"values"}," ("+y(t.$filters.formatNumber(o.position.totalProfit,{formatKey:2,signed:!0}))+" "+y(d.quoteCurrency)+") ",513),[[C,c.share.pnl]])],2)):(s(),h("div",{key:3,class:v(["roe-area",{positive:d.isPositive,negative:!d.isPositive}])},[n("div",zi,y(t.$filters.formatNumber(o.position.positionRoe,{formatKey:2,signed:!0,postfix:"%"})),1),p(n("div",{class:"values"},y(d.pnlAmount),513),[[C,c.share.pnl]])],2)),n("div",Wi,[o.isBotSharing?(s(),h($,{key:1},[n("div",Zi,[b(T,{name:d.baseCurrency,size:"16",showName:!1},null,8,["name"]),d.isBotTypeGrid?(s(),h($,{key:0},[S(y(l.convertToDisplaySymbol(t.$filters.walletName(o.position.symbol))),1)],64)):d.isBotTypeDca?(s(),h($,{key:1},[S(y(l.convertToDisplaySymbol(o.position.symbolText)),1)],64)):g("",!0)]),d.isBotTypeGrid?(s(),h($,{key:0},[n("div",Yi,y(d.getDirectionText(o.position.direction)),1),p(n("div",{class:"leverage"},y(o.position.leverage)+" X ",513),[[C,c.share.leverage]])],64)):g("",!0)],64)):(s(),h($,{key:0},[n("div",Vi,[b(T,{name:d.baseCurrency,size:"16",showName:!1},null,8,["name"]),S(" "+y(t.$filters.walletName(o.position.marketName)),1)]),n("div",{class:v(["side",{positive:d.isBuySide,negative:!d.isBuySide}])},y(d.isBuySide?t.$t("t.long"):t.$t("t.short")),3),p(n("div",{class:"leverage"},y(d.positionLeverage),513),[[C,c.share.leverage]])],64))]),n("div",{class:v(["mt-8",{hidden:!c.share.price}])},[o.isBotSharing?(s(),h($,{key:1},[d.isBotTypeGrid?(s(),h($,{key:0},[n("div",ta,[n("div",ea,y(t.$t("trading.bot.upperPrice")),1),n("div",ia,y(t.$filters.formatNumber(o.position.detail.upperPrice,d.priceFormat)),1
1)]),n("div",aa,[n("div",sa,y(t.$t("trading.bot.lowerPrice")),1),n("div",ra,y(t.$filters.formatNumber(o.position.detail.lowerPrice,d.priceFormat)),1)]),n("div",na,[n("div",oa,y(t.$t("trading.bot.noOfGrids")),1),n("div",la,y(o.position.detail.gridNumber),1)])],64)):g("",!0),d.isBotTypeDca?(s(),h($,{key:1},[n("div",ca,[n("div",da,y(t.$t("trading.bot.averageEntryPrice")),1),n("div",ua,[o.position.averageEntryPrice>0?(s(),h($,{key:0},[S(y(t.$filters.formatNumber(o.position.averageEntryPrice,d.priceFormat)),1)],64)):(s(),h($,{key:1},[S("-")],64))])]),n("div",ha,[n("div",ga,y(t.$t("spot.order.market.lastPrice")),1),n("div",pa,y(t.$filters.formatNumber(d.spotLastPrice,d.priceFormat)),1)])],64)):g("",!0)],64)):(s(),h($,{key:0},[n("div",ji,[n("div",qi,y(t.$t("futuresMain.openPosition.entryPrice")),1),n("div",Ki,y(t.$filters.formatNumber(o.position.entryPrice,d.priceFormat)),1)]),n("div",Qi,[n("div",Xi,y(t.$t("futuresMain.openPosition.markPrice")),1),n("div",Ji,y(t.$filters.formatNumber(d.futuresMarkPrice,d.priceFormat)),1)])],64))],2)],4),l.isEnableCommonReferralInfo?p((s(),h("div",ma,[n("div",ya,[l.userReferral.referralCode?(s(),h("div",va,[b(w,{size:68,value:d.referralLink},null,8,["value"]),c.isReferralQrcodeLogoExist?(s(),h("img",{key:0,class:"qr-logo",src:d.qrLogoImg,onLoad:e[0]||(e[0]=t=>d.handleShareAssetsReady("QR_LOGO_IMG"))},null,40,fa)):g("",!0)])):g("",!0),n("div",ba,y(c.logoText),1)]),n("div",Ca,[n("div",Sa,[t.isMobile?(s(),h("div",Ta,y(t.$t("trading.sharePnl.timestamp"))+" "+y(c.timestamp),1)):g("",!0),n("div",wa,[n("div",Da,y(t.$t("register.referral-code")),1),n("div",Ia,y(l.userReferral.referralCode),1)]),n("div",Pa,y(t.$t("t.trustedExchange",{brand:t.$t("brand.name")})),1)]),n("div",ka,[t.isMobile?g("",!0):(s(),h("div",$a,y(t.$t("trading.sharePnl.timestamp"))+" "+y(c.timestamp),1)),n("div",xa,y(c.logoText),1)])])],512)),[[C,!1]]):p((s(),h("div",Ba,[n("div",La,y(c.logoText),1),n("div",Na,y(t.$t("trading.sharePnl.timestamp"))+" "+y(c.timestamp),1)],512)),[[C,!1]]),n("div",_a,null,512)],512),n("div",Ra,[n("div",Ma,[b(D,{onClick:e[1]||(e[1]=t=>d.switchTheme(-1))})]),n("div",Aa,[(s(!0),h($,null,x(c.maxThemes,(t=>(s(),h("div",{key:t,class:v(["dot",{active:t===c.theme}])},e[13]||(e[13]=[n("div",{class:"left-circle"},null,-1),n("div",{class:"mid-body"},null,-1),n("div",{class:"right-circle"},null,-1)]),2)))),128))]),n("div",Oa,[b(D,{onClick:e[2]||(e[2]=t=>d.switchTheme(1))})])])]),n("div",Ea,[n("div",Ua,y(t.$t("trading.sharePnl.optionalInfo")),1),n("div",Fa,[d.isBotTypeDca?g("",!0):(s(),a(I,{key:0,value:c.share.leverage,"onUpdate:value":e[3]||(e[3]=t=>c.share.leverage=t),isBrandNewStyle:""},{default:r((()=>[S(y(t.$t("futuresMain.trade.leverage")),1)])),_:1},8,["value"])),b(I,{value:c.share.pnl,"onUpdate:value":e[4]||(e[4]=t=>c.share.pnl=t),isBrandNewStyle:""},{default:r((()=>[S(y(t.$t("trading.sharePnl.pnlInQuote")),1)])),_:1},8,["value"]),b(I,{value:c.share.price,"onUpdate:value":e[5]||(e[5]=t=>c.share.price=t),isBrandNewStyle:""},{default:r((()=>[S(y(o.isBotSharing?t.$t("c2c.priceSettings"):t.$t("trading.sharePnl.entryMarkPrice")),1)])),_:1},8,["value"])]),n("div",Ha,y(t.$t("trading.sharePnl.shareVia")),1),n("div",za,[n("div",Ga,[t.isApp?g("",!0):(s(),h("div",{key:0,class:v(["share-item",{"is-loading":c.saveImagePayload.isLoading}])},[p((s(),h("div",{class:"icon",onClick:e[6]||(e[6]=t=>d.handleShare(!0))},[b(P,{width:22,height:22})])),[[E,c.saveImagePayload.isLoading]]),n("div",Wa,y(t.$t("t.saveImage")),1)],2)),n("div",Va,[p((s(),h("div",Za,[b(L,{width:20,height:20})])),[[U,d.referralLink,"copy"],[U,d.handleCopy,"success"]]),n("div",Ya,y(t.$t("t.copyLink")),1),b(B,{name:"fade"},{default:r((()=>[p(n("div",{class:"copy-toast"},y(t.$t("msg.copied")),513),[[C,c.showCopiedToast]])])),_:1})]),t.isMobile?(s(),h("div",{key:1,class:v(["share-item",{"is-loading":c.saveImagePayload.isLoading}])},[p((s(),h("div",{class:"icon",onClick:e[7]||(e[7]=t=>d.handleShare(!1))},[b(N,{width:20,height:20})])),[[E,c.saveImagePayload.isLoading]]),n("div",ja,y(t.$t("t.share")),1)],2)):(s(),h($,{key:2},[n("div",qa,[n("div",{class:"icon twitter-x",onClick:e[8]||(e[8]=(...t)=>d.handleTwitterShare&&d.handleTwitterShare(...t))},[b(_,{width:40,height:40})]),e[14]||(e[14]=n("div",{class:"share-name"},"X",-1))]),n("div",Ka,[n("div",{class:"icon facebook",onClick:e[9]||(e[9]=(...t)=>d.handleFbShare&&d.handleFbShare(...t))},[b(R,{width:40,height:40})]),e[15]||(e[15]=n("div",{class:"share-name"},"Facebook",-1))]),n("div",Qa,[n("div",{class:"icon whatsapp",onClick:e[10]||(e[10]=(...t)=>d.handleWhatsappShare&&d.handleWhatsappShare(...t))},[b(M,{width:40,height:40})]),e[16]||(e[16]=n("div",{class:"share-name"},"Whatsapp",-1))]),n("div",Xa,[n("div",{class:"icon telegram",onClick:e[11]||(e[11]=(...t)=>d.handleTgShare&&d.handleTgShare(...t))},[b(A,{width:40,height:40})]),e[17]||(e[17]=n("div",{class:"share-name"}
1,"Telegram",-1))])],64))])])])])),_:1},8,["width","onClosed"])}],["__scopeId","data-v-4218228c"]]);const ts=Ie({name:"IconSetting2",components:{Icon:V},emits:["click"]},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{width:"16",height:"16",fill:"none",onClick:e[0]||(e[0]=e=>t.$emit("click",e))},{default:r((()=>e[1]||(e[1]=[n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M6 6C6.55228 6 7 5.55228 7 5C7 4.44772 6.55228 4 6 4C5.44772 4 5 4.44772 5 5C5 5.55228 5.44772 6 6 6ZM6 7C6.93192 7 7.71497 6.36261 7.93699 5.5H14.25C14.6642 5.5 15 5.16421 15 4.75C15 4.33579 14.6642 4 14.25 4H7.75L7.73255 4.0002C7.38677 3.40229 6.74036 3 6 3C5.25964 3 4.61323 3.40229 4.26745 4.0002L4.25 4L1.75 4C1.33579 4 1 4.33579 1 4.75C1 5.16421 1.33579 5.5 1.75 5.5L4.06301 5.5C4.28503 6.36261 5.06808 7 6 7ZM10 12C9.44772 12 9 11.5523 9 11C9 10.4477 9.44772 10 10 10C10.5523 10 11 10.4477 11 11C11 11.5523 10.5523 12 10 12ZM10 13C9.06808 13 8.28503 12.3626 8.06301 11.5H1.75C1.33579 11.5 1 11.1642 1 10.75C1 10.3358 1.33579 10 1.75 10H8.25L8.26745 10.0002C8.61323 9.40229 9.25964 9 10 9C10.7404 9 11.3868 9.40229 11.7326 10.0002L11.75 10L14.25 10C14.6642 10 15 10.3358 15 10.75C15 11.1642 14.6642 11.5 14.25 11.5H11.937C11.715 12.3626 10.9319 13 10 13Z",fill:"currentColor"},null,-1),n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M6 6C6.55228 6 7 5.55228 7 5C7 4.44772 6.55228 4 6 4C5.44772 4 5 4.44772 5 5C5 5.55228 5.44772 6 6 6ZM6 7C6.93192 7 7.71497 6.36261 7.93699 5.5H14.25C14.6642 5.5 15 5.16421 15 4.75C15 4.33579 14.6642 4 14.25 4H7.75L7.73255 4.0002C7.38677 3.40229 6.74036 3 6 3C5.25964 3 4.61323 3.40229 4.26745 4.0002L4.25 4L1.75 4C1.33579 4 1 4.33579 1 4.75C1 5.16421 1.33579 5.5 1.75 5.5L4.06301 5.5C4.28503 6.36261 5.06808 7 6 7ZM10 12C9.44772 12 9 11.5523 9 11C9 10.4477 9.44772 10 10 10C10.5523 10 11 10.4477 11 11C11 11.5523 10.5523 12 10 12ZM10 13C9.06808 13 8.28503 12.3626 8.06301 11.5H1.75C1.33579 11.5 1 11.1642 1 10.75C1 10.3358 1.33579 10 1.75 10H8.25L8.26745 10.0002C8.61323 9.40229 9.25964 9 10 9C10.7404 9 11.3868 9.40229 11.7326 10.0002L11.75 10L14.25 10C14.6642 10 15 10.3358 15 10.75C15 11.1642 14.6642 11.5 14.25 11.5H11.937C11.715 12.3626 10.9319 13 10 13Z",fill:"currentColor"},null,-1)]))),_:1,__:[1]})}]]),{enablePrerenderWebsocket:es}=It,is=new Set(["subscribe","unsubscribe"]);function as(t,e){return JSON.stringify({op:t,args:e})}function ss(t,e){switch(t){case"timeout":return clearTimeout(e);case"interval":return clearInterval(e)}}function rs(t){for(const{type:e,id:i}of t.values())ss(e,i);t.clear()}function ns(t,e){const i=t.get(e);i&&(ss(i.type,i.id),t.delete(e))}function os(t,e){return!(!t||t.readyState!==WebSocket.OPEN)&&(t.send(e),!0)}function ls(t,i={}){const{onOpen:a,onMessage:s,onClose:r,onError:n,transformSubscriptionMessage:o=as,subscriptionCheckInterval:l=5e3,initialReconnectInterval:c=300,maxReconnectInterval:d=5e3,maxReconnectAttempts:u=10,heartbeatMessage:h="ping",heartbeatResponse:g="pong",heartbeatInterval:p=5e3,topicKey:m="topic",noFilterTopics:y=new Set}=i;let v=!1,f=null,b=0;const C=new Set,S=new Map,T=e(!0);function w(t,e){if(0===e.size)return;const i=o(t,Array.from(e));for(const a of e)ns(S,a),C["subscribe"===t?"add":"delete"](a);if(os(f,i))for(const a of e)S.set(a,{type:"timeout",id:setTimeout(os,l,f,o(t,[a]))})}function D(t){w("subscribe",t)}function I(t){w("unsubscribe",t)}function P(t){I(t),D(t)}function k(t){const e=new Set,i=new Set;for(const a of C)t.has(a)||e.add(a);for(const a of t)C.has(a)||i.add(a);I(e),D(i)}function $(){v||!es&&xt()||(f=new WebSocket(_(t)),f.onopen=()=>{b=0,null==a||a(),S.set("heartbeat",{type:"interval",id:setInterval(os,p,f,h)}),D(C)},f.onmessage=t=>{let{data:e}=t;if(e!==g)try{if(e=JSON.parse(e),is.has(e.event))for(let t=0,i=e.channel.length;t<i;t++)ns(S,e.channel[t]);else(C.has(e[m])||y.has(e[m]))&&(null==s||s(e,{subscribe:D,unsubscribe:I,resubscribe:P,updateSubscriptions:k}))}catch(i){}},f.onclose=()=>{rs(S),null==r||r(),x()},f.onerror=t=>{rs(S),null==n||n(t),x()})}function x(){if(v||b>=u)return;const t=Math.min(c*2**b,d);S.set("reconnect",{type:"timeout",id:setTimeout($,t)}),b++}function B(){null==f||f.close(1e3)}function R(){rs(S),f&&(f.onmessage=null,f.onclose=null,f.onerror=null,f.readyState===WebSocket.OPEN?B():f.onopen=B)}function M(t){T.value="online"===t.type,!T.value&&ns(S,"reconnect")}return window.addEventListener("online",M),window.addEventListener("offline",M),L([()=>_(t),T],(([t,e],i,a)=>{t&&e&&($(),a(R))}),{immediate:!0}),N((()=>{v=!0,window.removeEventListener("online",M),window.removeEventListener("offline",M),R()})),{subscribe:D,unsubscribe:I,updateSubscriptions:k}}const cs={name:"TradeSlider",props:{value:{type:[Number,null],required:!0},disabled:{type:Boolean,default:!1}},emits:["update:value","change"],data:()=>({isTouchDot:!1,barStyle:{backgroundColor:"var(--app--color--blue-grey-darker--o-3)"},labelStyle:{display:"none"},stepStyle:{display:"block",position:"absolute",top:"-1px",left:"-1px",height:"6px",width:"6px",cursor:"pointer",backgroundColor:"var(--app--color--blue-grey-dark)",borderRadius:"50%"},marks:t=>t%25==0}),computed:{sliderValue:{get(){return this.value},set(t){this.$emit("update:value",t),this.$emit("change",t)}}}},ds={class:"trade-slider-content"};const us=Ie(cs,[["render",function(t,e,a,o,l,c){const d=i("VueSlider");return s(),h("div",ds,[b(d,{ref:"slider",modelValue:c.sliderValue,"onUpdate:modelValue":e[2]||(e[2]=t=>c.sliderValue=t),dragOnClick:!1,disabled:a.disabled,dotSize:12,height:4,marks:l.marks,processStyle:l.barStyle,railStyle:l.barStyle,labelStyle:l.labelStyle,stepStyle:l.stepStyle,onDragStart:e[3]||(e[3]=t=>l.isTouchDot=!0),onDragEnd:e[4]||(e[4]=t=>l.isTouchDot=!1)},{dot:r((()=>[n("div",{class:v(["border-box custom-dot",{focus:l.isTouchDot}]),onMouseenter:e[0]||(e[0]=t=>l.isTouchDot=!0),onMouseleave:e[1]||(e[1]=t=>l.isTouchDot=!1)},null,34)])),tooltip:r((({value:t})=>[p(n("div",{class:"custom-tooltip"},y(t)+"%",513),[[C,l.isTouchDot]])])),_:1},8,["modelValue","disabled","marks","processStyle","railStyle","labelStyle","stepStyle"])])}],["__scopeId","data-v-c9cb3d25"]]),hs=_t[0],gs=`${hs}/ws/oss/futures`,ps=`${hs}/ws/oss/spot`,ms=new Set(["delta","deltaUSD"]),ys="WithRPI";function vs(t,{isTradePageMode:i=!1}={}){let a,s,r=null,n=null;const o=Bt(),l=Ze(),d=Ye(),u=Lt(),h=e(""),g=c((()=>
1t===gs)),p=c((()=>o.userConfig[W.ORDER_BOOK_SNAPSHOT_ONLY])),m=c((()=>o.userConfig[W.DEPTH_CHART])),y=c((()=>{if(!h.value)return"";return`${i&&!p.value?"update":"snapshot"}${i&&g.value&&u.isUsdOrderBookSizeType?"USD":""}${g.value?ys:""}:${h.value}_${l.groupingIndex}`})),v=c((()=>i&&m.value&&h.value?`snapshot:${h.value}_${d.groupingIndex}`:"")),f=c((()=>{const t=new Set;return y.value&&t.add(y.value),v.value&&t.add(v.value),t})),{updateSubscriptions:b}=ls(t,{onMessage({topic:t,data:e},{resubscribe:i}){if(t===y.value){const a=ms.has(e.type);if(a){if(null===r)return;if(r!==e.prevSeqNum)return r=null,void i(new Set([t]))}r=e.seqNum,l.update({...e},a)}t===v.value&&(n=e.seqNum,d.updateOrderDepth({...e}))}});return L([y,h,p],(([t,e,i],[,s,n],o)=>{t&&i===n&&e!==s&&(r&&(r=null,a=setTimeout((()=>{r||l.reset()}),300)),o((()=>clearTimeout(a))))}),{immediate:!0}),L([v,h],(([t,e],[,i],a)=>{t&&e!==i&&(n&&(n=null,s=setTimeout((()=>{n||d.resetOrderDepth()}),300)),a((()=>clearTimeout(s))))}),{immediate:!0}),L(f,(t=>b(t)),{immediate:!0}),N((()=>{l.reset(),i&&d.resetOrderDepth()})),{updateSymbol:function(t){var e;const a=Nt(o.userName),s=i?null==(e=a[W.GROUPING_SETTING])?void 0:e[t]:0;h.value=t,l.updateGroupingIndex(s??0)}}}const fs=Ie({name:"IconShare",components:{Icon:V},emits:["click"]},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{width:"20",height:"20",viewBox:"0 0 20 20","fill-rule":"evenodd",onClick:e[0]||(e[0]=e=>t.$emit("click",e))},{default:r((()=>e[1]||(e[1]=[n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.125 5C13.125 3.96447 13.9645 3.125 15 3.125C16.0355 3.125 16.875 3.96447 16.875 5C16.875 6.03553 16.0355 6.875 15 6.875C13.9645 6.875 13.125 6.03553 13.125 5ZM15 1.875C13.2741 1.875 11.875 3.27411 11.875 5C11.875 5.28039 11.9119 5.55215 11.9812 5.81069L7.45926 8.07165C6.88715 7.34305 5.99823 6.875 5 6.875C3.27411 6.875 1.875 8.27411 1.875 10C1.875 11.7259 3.27411 13.125 5 13.125C5.99824 13.125 6.88716 12.6569 7.45927 11.9283L11.9812 14.1893C11.9119 14.4478 11.875 14.7196 11.875 15C11.875 16.7259 13.2741 18.125 15 18.125C16.7259 18.125 18.125 16.7259 18.125 15C18.125 13.2741 16.7259 11.875 15 11.875C14.0018 11.875 13.1129 12.343 12.5408 13.0716L8.01885 10.8106C8.08808 10.5521 8.125 10.2803 8.125 10C8.125 9.71965 8.08808 9.44792 8.01884 9.1894L12.5408 6.92842C13.1129 7.65699 14.0018 8.125 15 8.125C16.7259 8.125 18.125 6.72589 18.125 5C18.125 3.27411 16.7259 1.875 15 1.875ZM3.125 10C3.125 8.96447 3.96447 8.125 5 8.125C6.03553 8.125 6.875 8.96447 6.875 10C6.875 11.0355 6.03553 11.875 5 11.875C3.96447 11.875 3.125 11.0355 3.125 10ZM15 13.125C13.9645 13.125 13.125 13.9645 13.125 15C13.125 16.0355 13.9645 16.875 15 16.875C16.0355 16.875 16.875 16.0355 16.875 15C16.875 13.9645 16.0355 13.125 15 13.125Z"},null,-1)]))),_:1,__:[1]})}]]),bs={name:"StrategyFilter",components:{IconChevronDown:Ot,Dropdown:At,DropdownList:Mt,DropdownItem:Rt,Icon:ot},props:{sortBy:{type:[String,Number],required:!0},placeholderTitle:{type:String,default:""},options:{type:Array,required:!0},crypto:{type:Boolean,default:!1},isFutures:{type:Boolean,default:!0}},emits:["update:sortBy","updateSelectedSortByInfo"],data(){return{innerSortBy:this.sortBy,isShowMobileSortingPanel:!1,innerSortByOnMobile:this.sortBy}},computed:{...d("futures",{futuresMarketMap:"marketMap"}),selectedSort(){return this.options.find((t=>t.value===this.innerSortBy))}},watch:{selectedSort:{deep:!0,immediate:!0,handler(t){t?(this.$emit("update:sortBy",this.innerSortBy),this.$emit("updateSelectedSortByInfo",t)):(this.$emit("update:sortBy",""),this.$emit("updateSelectedSortByInfo",""))}},isShowMobileSortingPanel(t){t&&(this.innerSortByOnMobile=this.sortBy)},sortBy(t){this.innerSortBy=t}},methods:{getCryptoName(t){var e;return this.isFutures?null==(e=this.futuresMarketMap[t])?void 0:e.baseCurrency:t},setIsOpenPanel(t){this.isShowMobileSortingPanel=t},onMobileApply(){this.innerSortBy=this.innerSortByOnMobile}}},Cs={class:"dropdown-bar"},Ss={class:"dropdown-bar-text"},Ts={class:"dropdown-item-text"};const ws=Ie(bs,[["render",function(t,e,o,l,c,d){const u=i("IconChevronDown"),p=i("Icon"),m=i("DropdownItem"),f=i("DropdownList"),C=i("Dropdown");return s(),a(C,{value:c.innerSortBy,class:"sort-filter",onInput:e[0]||(e[0]=t=>c.innerSortBy=t)},{bar:r((()=>{var t;return[n("div",Cs,[n("div",Ss,y(`${o.placeholderTitle}: ${null==(t=d.selectedSort)?void 0:t.name}`),1),b(u,{class:"icon-chevron-down"})])]})),default:r((()=>[b(f,{class:"dropdown-list"},{default:r((()=>
1[(s(!0),h($,null,x(o.options,(t=>(s(),a(m,{key:t.value,class:v(["dropdown-item",{active:t.value==o.sortBy}]),value:t.value},{default:r((()=>[o.crypto&&t.value?(s(),a(p,{key:0,class:"dropdown-item-icon",name:d.getCryptoName(t.value),showName:!1,size:"20"},null,8,["name"])):g("",!0),n("div",Ts,y(t.name),1)])),_:2},1032,["class","value"])))),128))])),_:1})])),_:1},8,["value"])}],["__scopeId","data-v-cad9eba1"]]),Ds={class:"warning-wrapper"},Is={class:"warning-text"};const Ps=Ie({name:"Warning",components:{IconError:Et},props:{text:{type:String,default:"aaa"}}},[["render",function(t,e,a,r,o,l){const c=i("IconError");return s(),h("div",Ds,[b(c),n("div",Is,[m(t.$slots,"default",{},(()=>[S(y(a.text),1)]),!0)])])}],["__scopeId","data-v-5fbaf30c"]]),ks={name:"MyStrategy",components:{IconArrowRight:zt,IconEyeClose:Ht,IconEye:Ft,Tooltip:Ut},data:()=>({totalIncome:"",botProfit:"",saleProfit:"",runningBotCount:"",isLoading:!1,originData:{}}),computed:{...d(["lang","userConfig"]),toggleValueIcon(){return this.isHideValue?Ht:Ft},isHideValue(){return this.userConfig[W.COPY_STRATEGY_HIDE_VALUE]}},created(){this.init()},methods:{...R(["updateUserConfigByKey"]),checkLongOrShort(t){if(this.isHideValue)return"";const e=this.originData[t];return e?e>0?"long":e<0?"short":void 0:""},goMyStrategy(){this.$router.push({name:Wt.MY_STRATEGY,params:{lang:this.lang}})},async init(){this.isLoading=!0;try{const{data:t}=await Gt.getTradingBotSummary();this.originData=t,this.totalIncome=this.formatText(t.totalIncome),this.botProfit=this.formatText(t.botProfit),this.saleProfit=this.formatText(t.saleProfit,!1),this.runningBotCount=t.runningBotCount||0}finally{this.isLoading=!1}},formatText(t,e=!0){return t?this.$filters.formatNumber(t,{formatKey:"max2",signed:e}):""},setHideValue(){this.updateUserConfigByKey({key:W.COPY_STRATEGY_HIDE_VALUE,value:!this.isHideValue})}}},$s={class:"my-strategy"},xs={class:"head-wrapper"},Bs={class:"flex-box"},Ls={class:"my-strategy--title"},Ns={class:"strategy-info-wrapper"},_s={class:"strategy-info"},Rs={class:"strategy-info"},Ms={class:"strategy-info"},As={class:"strategy-info"},Os={class:"strategy-info--pnl"},Es={class:"strategy-info--description"};const Us=Ie(ks,[["render",function(t,e,r,o,l,c){const d=i("IconArrowRight"),g=i("Tooltip"),m=u("loading");return p((s(),h("div",$s,[n("div",xs,[n("div",Bs,[n("div",Ls,y(t.$t("router.walletOverview")),1),n("div",{class:"toggle-value",onClick:e[0]||(e[0]=(...t)=>c.setHideValue&&c.setHideValue(...t))},[(s(),a(M(c.toggleValueIcon),{class:"action-icon"}))])]),n("div",{class:"my-strategy--link",onClick:e[1]||(e[1]=(...t)=>c.goMyStrategy&&c.goMyStrategy(...t))},[S(y(t.$t("strategy.myStrategy"))+" ",1),b(d)])]),n("div",Ns,[n("div",_s,[n("span",{class:v(["strategy-info--pnl",{[c.checkLongOrShort("totalIncome")]:!0}])},y(c.isHideValue?"*****":l.totalIncome),3),e[2]||(e[2]=n("span",{class:"strategy-info--currency"},"USDT",-1)),b(g,{class:"strategy-info--description",content:t.$t("strategy.subTitle.1"),tooltip:t.$t("strategy.tooltip.totalEarnings")},null,8,["content","tooltip"])]),n("div",Rs,[n("span",{class:v(["strategy-info--pnl",{[c.checkLongOrShort("botProfit")]:!0}])},y(c.isHideValue?"*****":l.botProfit),3),e[3]||(e[3]=n("span",{class:"strategy-info--currency"},"USDT",-1)),b(g,{class:"strategy-info--description",content:t.$t("strategy.subTitle.2"),tooltip:t.$t("strategy.tooltip.botReturns")},null,8,["content","tooltip"])]),n("div",Ms,[n("span",{class:v(["strategy-info--pnl",{[c.checkLongOrShort("saleProfit")]:!0}])},y(c.isHideValue?"*****":l.saleProfit),3),e[4]||(e[4]=n("span",{class:"strategy-info--currency"},"USDT",-1)),b(g,{class:"strategy-info--description",content:t.$t("strategy.subTitle.3"),tooltip:t.$t("strategy.tooltip.saleEarnings")},null,8,["content","tooltip"])]),n("div",As,[n("span",Os,y(c.isHideValue?"*****":l.runningBotCount),1),n("p",Es,y(t.$t("strategy.subTitle.4")),1)])])])),[[m,l.isLoading,"streamingLight"]])}],["__scopeId","data-v-46bf8264"]]);const Fs=Ie({name:"IconLocalMall",components:{Icon:V},props:{width:{type:[Number,String],default:22},height:{type:[Number,String],default:22}}},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{width:o.width,height:o.height,"aria-label":"Trend Icon"},{default:r((()=>e[0]||(e[0]=[n("path",{d:"M4.75577 18.0829C4.38065 18.0829 4.06358 17.9534 3.80456 17.6944C3.54553 17.4354 3.41602 17.1183 3.41602 16.7432V7.25605C3.41602 6.88094 3.54553 6.56387 3.80456 6.30484C4.06358 6.04581 4.38065 5.9163 4.75577 5.9
1163H6.41602C6.41602 4.92183 6.76508 4.07599 7.4632 3.3788C8.16131 2.6816 9.00826 2.33301 10.004 2.33301C10.9998 2.33301 11.8452 2.6816 12.5402 3.3788C13.2352 4.07599 13.5826 4.92183 13.5826 5.9163H15.2429C15.618 5.9163 15.9351 6.04581 16.1941 6.30484C16.4531 6.56387 16.5826 6.88094 16.5826 7.25605V16.7432C16.5826 17.1183 16.4531 17.4354 16.1941 17.6944C15.9351 17.9534 15.618 18.0829 15.2429 18.0829H4.75577ZM4.75577 16.9996H15.2429C15.307 16.9996 15.3658 16.9729 15.4192 16.9195C15.4726 16.8661 15.4993 16.8073 15.4993 16.7432V7.25605C15.4993 7.19194 15.4726 7.13317 15.4192 7.07974C15.3658 7.02632 15.307 6.99961 15.2429 6.99961H4.75577C4.69165 6.99961 4.63288 7.02632 4.57945 7.07974C4.52604 7.13317 4.49933 7.19194 4.49933 7.25605V16.7432C4.49933 16.8073 4.52604 16.8661 4.57945 16.9195C4.63288 16.9729 4.69165 16.9996 4.75577 16.9996ZM10.004 12.0829C10.9998 12.0829 11.8452 11.7343 12.5402 11.0371C13.2352 10.3399 13.5826 9.49408 13.5826 8.49961H12.4993C12.4993 9.19406 12.2563 9.78433 11.7702 10.2704C11.2841 10.7566 10.6938 10.9996 9.99933 10.9996C9.30488 10.9996 8.71461 10.7566 8.22849 10.2704C7.74238 9.78433 7.49933 9.19406 7.49933 8.49961H6.41602C6.41602 9.49853 6.76508 10.3455 7.4632 11.0405C8.16131 11.7354 9.00826 12.0829 10.004 12.0829ZM7.49933 5.9163H12.4993C12.4993 5.22186 12.2563 4.63158 11.7702 4.14547C11.2841 3.65936 10.6938 3.4163 9.99933 3.4163C9.30488 3.4163 8.71461 3.65936 8.22849 4.14547C7.74238 4.63158 7.49933 5.22186 7.49933 5.9163Z"},null,-1)]))),_:1,__:[0]},8,["width","height"])}]]),{enableAccountAvatar:Hs}=It;$e([xe,Be,Le,Ne]);const zs={name:"Strategy",components:{Icon:ot,IconLocalMall:Fs,Avatar:Vt},props:{strategy:{type:Object,default:()=>({})}},emits:["onCopy"],data(){return this.chart=null,{DEFAULT_AVATAR_ID:Zt,enableAccountAvatar:Hs}},computed:{...d(["lang"]),...d("futures",{futuresMarketMap:"marketMap"}),isFutures(){return this.strategy.marketType===Pt.FUTURES},symbolText(){return this.isFutures?this.strategy.symbol:`${this.strategy.symbol}/${this.strategy.quoteCurrency}`},botTypeText(){const{botType:t}=this.strategy;return this.isFutures?this.toTitleCase(t):t},leverageText(){const{detail:t={}}=this.strategy;return Number(null==t?void 0:t.leverage)||0},baseCurrency(){var t;return this.isFutures?null==(t=this.futuresMarketMap[this.strategy.symbol])?void 0:t.baseCurrency:this.strategy.baseCurrency},roiHistory(){var t;const e=(null==(t=this.strategy.roiPoint)?void 0:t.map((([,t])=>+t)))||[];return e.length>0?e:[...Array(10)].fill(0)},roiText(){const t=this.strategy.roi||0;return this.$filters.formatNumber(t,{formatKey:2,signed:!0,postfix:"%",roundMode:l.ROUND_HALF_UP})},spotDirectionText(){const{direction:t,detail:e}=this.strategy;return`${this.toTitleCase(e.cycle.period)} ${"LONG"===t?this.$t("t.buy"):this.$t("t.sell")}`}},mounted(){this.initChart()},beforeUnmount(){this.chart&&(window.removeEventListener("resize",this.chart.resize),this.chart=null)},methods:{toTitleCase:t=>t?t.replace(/\w\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()})):"",goToMyStrategy(t){this.$router.push({name:Wt.MY_STRATEGY,params:{lang:this.lang,tab:t}})},countLinearGradient(){const t=this.roiHistory,e=Math.max(...t),i=Math.min(...t),a=e<0?0:i<0?(e/(e-i)).toFixed(2):1,s=[{offset:0,color:"rgba(0, 177, 93, 0.3)"},{offset:a,color:"transparent"}];return 1!==a&&s.push({offset:1,color:"rgba(255, 91, 90, 0.25)"}),s},initChart(){this.chart=Pe(this.$refs.chart,null,{renderer:"canvas",useDirtyRect:!1});const t={xAxis:{type:"category",show:!1,axisLine:{show:!1},xisTick:{show:!1}},yAxis:{type:"value",axisLine:{show:!1},splitLine:{show:!1,lineStyle:{type:"dashed",color:"#666"}}},grid:[{left:0,right:0,bottom:0,top:0}],series:[{data:this.roiHistory,type:"line",smooth:!0,showSymbol:!1,effect:{delay:1e3},lineStyle:{width:2},areaStyle:{color:new ke(0,0,0,1,this.countLinearGradient())},markLine:{silent:!0,symbol:"none",label:{show:!1},data:[{yAxis:0,lineStyle:{color:"#033D90",width:1,type:"dashed"}}]}}],visualMap:{show:!1,pieces:[{gte:0,lte:9999999,color:"#02CB6B"},{lt:0,color:"#FF5B5A"}]}};this.chart.setOption(t),window.addEventListener("resize",this.chart.resize)},getDirectionClass:pi,getDirectionText:mi,formatPrice(t){return this.$filters.formatNumber(t,"max2")}}},Gs={class:"color-border-box strategy"},Ws={class:"color-border-box__module"},Vs={class:"strategy-header"},Zs={class:"strategy-sub-header"},Ys={class:"flex-box flex-row items-center"},js={class:"flex-box flex-row items-center"},qs={class:"strategy-chart"},Ks={class:"strategy-duration"},Qs={class:"strategy-duration--time"},Xs={ref:"chart",class:"chart"},Js={class:"strategy-footer"},tr={class:"strategy-user"},er={class:"user-name"},ir={class:"multiline-ellipsis"};const ar=Ie(zs,[["render",function(t,e,o,l,c,d){const u=i("Icon"),p=i("IconLocalMall"),m=i("Avatar"),f=i("BaseButton");return s(),h("div",Gs,[n("div",Ws,[n("div",Vs,[b(u,{name:d.baseCurrency,showName:!1,size:"36"}
1,null,8,["name"]),n("p",null,y(d.symbolText),1)]),n("div",Zs,[n("div",Ys,[n("span",null,y(d.toTitleCase(o.strategy.marketType)),1),d.isFutures?(s(),h($,{key:0},[n("div",{class:v(["strategy-sub-header--tag",d.getDirectionClass(o.strategy.direction)])},y(d.getDirectionText(o.strategy.direction)),3),n("div",{class:v(["strategy-sub-header--tag",d.getDirectionClass(o.strategy.direction)])},y(d.leverageText)+"x ",3)],64)):(s(),h("div",{key:1,class:v(["strategy-sub-header--tag",d.getDirectionClass(o.strategy.direction)])},y(d.spotDirectionText),3))]),n("div",js,[b(p,{size:"20"}),n("span",null,y(o.strategy.saleCount),1)])]),n("div",qs,[n("p",{class:v(["strategy-chart--pnl",{long:o.strategy.roi>0,short:o.strategy.roi<0}])},y(d.roiText),3),n("p",null,y(t.$t("t.roi")),1)]),n("div",Ks,[n("div",null,[n("p",Qs,y(o.strategy.duration),1),n("p",null,y(t.$t("t.duration")),1)]),n("div",Xs,null,512)]),n("div",Js,[n("div",tr,[c.enableAccountAvatar?(s(),a(m,{key:0,class:"user-avatar",avatarId:o.strategy.avatarType||c.DEFAULT_AVATAR_ID},null,8,["avatarId"])):g("",!0),n("div",er,[n("p",ir,y(o.strategy.creatorNickname||o.strategy.creatorShareId),1)])]),o.strategy.isCreator||o.strategy.isPurchased?(s(),a(f,{key:0,class:"primary strategy-btn outline",size:"medium",onClick:e[0]||(e[0]=e=>o.strategy.isCreator?d.goToMyStrategy(2):t.$emit("onCopy"))},{default:r((()=>[S(y(o.strategy.isCreator?t.$t("t.view"):t.$t("t.purchased")),1)])),_:1})):(s(),a(f,{key:1,class:"primary strategy-btn",size:"medium",onClick:e[1]||(e[1]=e=>t.$emit("onCopy"))},{default:r((()=>[+o.strategy.salePrice?(s(),h($,{key:0},[S(y(t.$t("strategy.copyForPrice",{price:`${d.formatPrice(o.strategy.salePrice)} ${o.strategy.saleCurrency}`})),1)],64)):(s(),h($,{key:1},[S(y(t.$t("t.copyForFree")),1)],64))])),_:1}))])])])}],["__scopeId","data-v-f89c558d"]]),sr="botRoi:DESC",rr="saleCount:DESC",nr="createdAt:DESC",or="createdAt:ASC",lr={name:"StrategyFilters",components:{StrategyFilter:ws},props:{symbolOptions:{type:Array,default:()=>[]},filters:{type:Object,required:!0},isFutures:{type:Boolean,required:!0},resetFlag:{type:String,default:""}},emits:["update:filters","reset"],data:()=>({market:"",roi:"",leverage:"",duration:"",sort:sr}),computed:{marketOptions(){const t=this.symbolOptions.map((t=>({name:t,value:t})));return[{name:this.$t("t.all"),value:""}].concat(t)},roiOptions(){return[{name:this.$t("t.all"),value:""},{name:"0-50%",value:"1"},{name:"> 50%",value:"2"}]},leverageOptions(){return[{name:this.$t("t.all"),value:""},{name:"1-20x",value:"1"},{name:"> 20x",value:"2"}]},durationOptions(){return[{name:this.$t("t.all"),value:""},{name:`< ${this.$t("t.days",{day:7})}`,value:"1"},{name:`${this.$t("t.days",{day:"7~90"})}`,value:"2"},{name:`> ${this.$t("t.days",{day:90})}`,value:"3"}]},sortByOptions(){return[{name:`↓ ${this.$t("t.roi")}`,value:sr},{name:`↓ ${this.$t("strategy.filter.subscriptionCount")}`,value:rr},{name:`↓ ${this.$t("t.duration")}`,value:or},{name:`↑ ${this.$t("t.duration")}`,value:nr}]}},watch:{resetFlag(){this.resetFilter(!1)},market(t){this.updateFilters({symbols:t})},roi(t){let e={};switch(t){case"":e.minRoiPercentage="",e.maxRoiPercentage="";break;case"1":e.minRoiPercentage=0,e.maxRoiPercentage=50;break;case"2":e.minRoiPercentage=50,e.maxRoiPercentage=""}this.updateFilters(e)},leverage(t){let e={};switch(t){case"":e.minLeverage="",e.maxLeverage="";break;case"1":e.minLeverage=0,e.maxLeverage=20;break;case"2":e.minLeverage=20,e.maxLeverage=""}this.updateFilters(e)},duration(t){let e={};const i=Date.now(),a=6048e5,s=7776e6;switch(t){case"":e.durationEndTime="",e.durationStartTime="";break;case"1":e.durationEndTime=i,e.durationStartTime=i-a;break;case"2":e.durationEndTime=i-a,e.durationStartTime=i-s;break;case"3":e.durationEndTime=i-s,e.durationStartTime=""}this.updateFilters(e)},sort(t){this.updateFilters({sorting:t})}},methods:{resetFilter(t=!0){this.isReset=!0,this.market="",this.roi="",this.leverage="",this.duration="",this.sort=sr,t&&this.$emit("reset"),this.$nextTick((()=>{this.isReset=!1}))},updateFilters(t){if(!this.isReset){const e={...this.filters,...t};for(const t in e)""===e[t]&&delete e[t];this.$emit("update:filters",e)}}}},cr={class:"strategy-marketplace-filter-wrapper"},dr={class:"wrapper-left"},ur={class:"wrapper-right"};const hr=Ie(lr,[["render",function(t,e,r,o,l,c){const d=i("StrategyFilter");return s(),h("div",cr,[n("div",dr,[b(d,{sortBy:l.market,"onUpdate:sortBy":e[0]||(e[0]=t=>l.market=t),"placeholder-title":"Market",options:c.marketOptions,isFutures:r.isFutures,crypto:""}
1,null,8,["sortBy","options","isFutures"]),b(d,{sortBy:l.roi,"onUpdate:sortBy":e[1]||(e[1]=t=>l.roi=t),"placeholder-title":"ROI%",options:c.roiOptions},null,8,["sortBy","options"]),r.isFutures?(s(),a(d,{key:0,sortBy:l.leverage,"onUpdate:sortBy":e[2]||(e[2]=t=>l.leverage=t),"placeholder-title":"Leverage",options:c.leverageOptions},null,8,["sortBy","options"])):g("",!0),b(d,{sortBy:l.duration,"onUpdate:sortBy":e[3]||(e[3]=t=>l.duration=t),"placeholder-title":"Duration",options:c.durationOptions},null,8,["sortBy","options"]),n("div",{class:"marketplace-filter reset",onClick:e[4]||(e[4]=(...t)=>c.resetFilter&&c.resetFilter(...t))},y(t.$t("t.reset")),1)]),n("div",ur,[b(d,{sortBy:l.sort,"onUpdate:sortBy":e[5]||(e[5]=t=>l.sort=t),"placeholder-title":"Sort by",options:c.sortByOptions},null,8,["sortBy","options"])])])}],["__scopeId","data-v-73b1400a"]]),{enableAccountAvatar:gr}=It,pr={name:"StrategyDialog",components:{BrandDialog:Qt,Icon:ot,IconLocalMall:Fs,IconTransfer:Ee,IconDeposit:Kt,IconQuestionCircle2:li,IconSuccess:qt,IconFlashFail:jt,IconChevronRight:Yt,IconSetting2:ts,Avatar:Vt,Warning:Ps,TradingInput:oi,TradeSlider:us},props:{strategy:{type:Object,default:()=>({})},isPurchased:{type:Boolean,default:!1}},emits:["close","onPurchased"],setup(t){const e=le(),{loginState:i}=Bt(),a=c((()=>t.strategy.marketType===Pt.FUTURES)),s=c((()=>`${t.strategy.symbol}-${t.strategy.quoteCurrency}`));if(i){const{updateSymbol:e}=vs(a.value?gs:ps);e(a.value?t.strategy.symbol:s.value)}return{tradingBotInitDataStore:e,loginState:i,isFutures:a,symbol:s}},data(){return this.chart=null,{DEFAULT_AVATAR_ID:Zt,enableAccountAvatar:gr,isResult:!1,resultDialog:1,failedMessage:"",loading:!1,purchasingBot:{},isToggleInfo:!1,step:this.isPurchased?2:1,currentWallet:{},currentPosition:{},lastPrice:null,form:{iniMargin:null,percent:0,investmentPerPeriod:""},tmpCreatedData:{},isGoToTradePage:!1}},computed:{...d(["lang","currencyMap","isApp"]),...d("futures",{futuresMarketMap:"marketMap",futuresMarketDetailMap:"marketDetailMap",futuresLastDataMap:"futuresLastDataMap"}),...T(Oe,{showFuturesTransferPopup:"showTransferPopup"}),...T(Y,["getExchangeInfoBySymbol"]),...T(Ze,["orderBook","bestAskPrice","midPrice"]),...w(["isSubAccount","isUnifiedWallet"]),tradingBotInitData(){return this.tradingBotInitDataStore.tradingBotInitData},baseCurrency(){var t;return this.isFutures?null==(t=this.futuresMarketMap[this.strategy.symbol])?void 0:t.baseCurrency:this.strategy.baseCurrency},symbolText(){return this.isFutures?this.strategy.symbol:`${this.strategy.symbol}/${this.strategy.quoteCurrency}`},botTypeText(){const{botType:t}=this.strategy;return this.isFutures?this.toTitleCase(t):t},spotDirectionText(){const{direction:t,detail:e}=this.strategy;return`${this.toTitleCase(e.cycle.period)} ${"LONG"===t?this.$t("t.buy"):this.$t("t.sell")}`},roiHistory(){var t;const e=(null==(t=this.strategy.roiPoint)?void 0:t.map((([,t])=>+t)))||[];return e.length>0?e:[...Array(10)].fill(0)},roiText(){const t=this.strategy.roi||0;return this.$filters.formatNumber(t,{formatKey:2,signed:!0,postfix:"%",roundMode:l.ROUND_HALF_UP})},dateText(){return oe(this.strategy.createdAt,"yyyy-MM-dd")},usdtData(){return this.currencyMap.USDT||{}},spotBaseCurrencyData(){return this.currencyMap[this.strategy.baseCurrency]||{}},spotQuoteCurrency(){return this.currencyMap[this.strategy.quoteCurrency]||{}},spotBalanceData(){return this.isLong?this.spotQuoteCurrency:this.spotBaseCurrencyData},notEnoughUsdtBalance(){return this.usdtData.available<this.strategy.salePrice},availableBalance(){if(!this.isUnifiedWallet)return this.currentWallet.availableBalance;const{asset:t,assetInUse:e}=this.currentWallet,i=(null==t?void 0:t.USDT)||0,a=(null==e?void 0:e.USDT)||0;return l(i).minus(a).toNumber()},notEnoughInvestment(){return this.availableBalance<this.minInitialMargin},strategyConfig(){return this.strategy.config||this.purchasingBot.config||{}},isNeutral(){return this.strategy.direction===at.NEUTRAL.value},isLong(){return this.strategy.direction===at.LONG.value},isShort(){return this.strategy.direction===at.SHORT.value},currentWalletLeverage(){var t,e,i;return this.isUnifiedWallet?null==(i=null==(e=null==(t=this.currentWallet)?void 0:t.leverage)?void 0:e[0])?void 0:i.leverage:this.currentWallet.isCrossWallet?l(1).div(this.currentPosition.initialMarginPercentage||1).dp(2,l.ROUND_DOWN).toNumber():this.currentWallet.leverage},maxInvestment(){return l(this.availableBalance||0).dp(2,l.ROUND_DOWN).toNumber()},stepPrice(){return this.strategyConfig.upperPrice&&this.strategyConfig.lowerPrice&&this.strategyConfig.gridNumber?l(this.strategyConfig.upperPrice).minus(this.strategyConfig.lowerPrice).div(this.strategyConfig.gridNumber).toNumber():null},currentMarketDetail(){return this.futuresMarketDetailMap[this.strategy.symbol]||null},priceFilter(){var t;return(null==(t=this.currentMarketDetail)?void 0:t.priceFilter)??2},sumOfGridPrices(){return bi({stepPrice:this.stepPrice,midPrice:this.midPrice,gridNumber:this.strategyConfig.gridNumber,lowerPrice:this.strategyConfig.lowerPrice,priceFilter:this.priceFilter})},minInitialMargin(){return Si({sumOfGridPrices:this.sumOfGridPrices,leverage:this.currentWalletLeverage,marketDetail:this.currentMarketDetail,isNeutral:this.isNeutral,adjConf:this.getAdjConfig()})},errorIniMargin(){if(this.form.iniMargin){if(this.form.iniMargin>this.availableBalance)return"trading.bot.grid.errorIniMargin1";if(this.minInitialMargin&&this.form.iniMargin<this.minInitialMargin)return"trading.bot.grid.errorIniMargin2"}return null},currentWalletFullName(){return this.$filters.walletName(this.currentWallet.activeWalletName)},transferDialogConfig(){const t="Spot Wallet";return{tag:"both",both:{from:1===this.step?z:t,to:1===this.step?t:this.currentWallet.activeWalletName}}},cycleText(){const{detail:{cycle:{period:t,executeAt:e}}}=this.strategy,i=this.isLong?this.$t("t.buy"):this.$t("t.sell"),a=`0${e}`.slice(-2)+":00";return`${i} ${this.toTitleCase(t)} ${this.$t("otc.description.price.1")} ${a}`},leverageText(){const{detail:t={}}=this.strategy;return+(null==t?void 0:t.leverage)||0},investmentPerPeriodText(){return this.strategyConfig.investmentPerPeriod||0},slippageText(){return this.strategyConfig.slippage||""},numberOfInvestmentText(){const t=this.strategyConfig.numberOfInvestment;return t?this.$filters.formatNumber(t||"max8"):this.$t("wallet.topUp.noLimit")},flexibleEarnText(){return this.strategyConfig.flexibleEarn?this.$t("t.enable"):this.$t("t.disable")},spotExchangeInfo(){return this.getExchangeInfoBySymbol(this.symbol)},spotDisplayCurrency(){return this.isLong?this.strategy.quoteCurrency:this.strategy.baseCurrency}
1,spotDynamicDecimal(){const{priceDecimal:t,sizeDecimal:e}=this.spotExchangeInfo;return this.isLong?t:e},totalInvestmentText(){const t=this.strategyConfig.numberOfInvestment||0,e=this.strategyConfig.investmentPerPeriod||0;return t?`${l(+e).times(t).toFixed(this.spotDynamicDecimal)} ${this.spotDisplayCurrency}`:this.$t("wallet.topUp.noLimit")},userTotalInvestmentText(){const{numberOfInvestment:t=0}=this.strategyConfig,{investmentPerPeriod:e}=this.form;if(!t)return this.$t("wallet.topUp.noLimit");const i=l(t).times(e).toNumber();return this.$filters.formatNumber(i,this.spotDynamicDecimal)},spotMinInvestment(){const{minOrderSize:t,minPriceIncrement:e}=this.spotExchangeInfo,i=l(t).times(10);if(this.isLong){const t=this.bestAskPrice||0;return l.max(l(t).times(i),e).dp(this.spotDynamicDecimal,l.ROUND_UP).toNumber()}return i.dp(this.spotDynamicDecimal,l.ROUND_UP).toNumber()},notEnoughSpotMinInvestment(){return""!==this.form.investmentPerPeriod&&this.spotMinInvestment>this.form.investmentPerPeriod},notEnoughSpotBalance(){return this.spotBalanceData.available<this.spotMinInvestment||""!==this.form.investmentPerPeriod&&this.form.investmentPerPeriod>this.spotBalanceData.available},errorQuickCopySpot(){return""===this.form.investmentPerPeriod||this.notEnoughSpotMinInvestment||this.notEnoughSpotBalance},gains(){var t;return null==(t=this.futuresLastDataMap[this.strategy.symbol])?void 0:t.gains},initialMarginAdjConf(){var t,e;return null==(e=null==(t=this.tradingBotInitData.futures)?void 0:t.grid)?void 0:e.initialMarginAdjConf}},watch:{showFuturesTransferPopup(t){!t&&this.initAdditionalFuturesWs()}},mounted(){this.initChart(),this.loginState&&this.isFutures&&(this.initAdditionalFuturesWs(),this.getPositionData())},beforeUnmount(){this.chart&&(window.removeEventListener("resize",this.chart.resize),this.chart=null),this.unSubscribeTopics({topics:this.getFuturesTopics()})},methods:{...A(Oe,["toggleTransferPopup"]),...A(ne,["extraSubscribe","unSubscribeTopics"]),openFuturesTransferPopup(){if(this.isApp)ee({event:"TRANSFER",from:this.isFutures?"SPOT@":"CROSS@",to:this.isFutures?this.currentWallet.activeWalletName:"SPOT@"});else{const t=1===this.step,e=this.isUnifiedWallet?G:z,i=this.isUnifiedWallet?G:this.currentWallet.activeWalletName;this.toggleTransferPopup({from:t?e:re,to:t?re:i})}},getFuturesTopics(){return["margin","marginV2","tradeHistory"].map((t=>`${t}:${this.strategy.symbol}-${se}`))},initAdditionalFuturesWs(){const t=this.isUnifiedWallet?`marginV2:${this.strategy.symbol}-${se}`:"margin";this.extraSubscribe({topics:this.getFuturesTopics(),callbacks:{[t]:t=>{t.isCrossWallet=t.activeWalletName===z,this.currentWallet=t},tradeHistory:t=>{const e=t[0].price;this.lastPrice=e}}})},async getPositionData(){const t=await ae.getOpenPosition(this.strategy.symbol);this.currentPosition=t},toTitleCase:t=>t.replace(/\w\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()})),goToDeposit(){const t=this.$router.resolve({name:Wt.DEPOSIT,params:{lang:this.lang}});window.open(t.href,"_blank")},countLinearGradient(){const t=this.roiHistory,e=Math.max(...t),i=Math.min(...t),a=e<0?0:i<0?(e/(e-i)).toFixed(2):1,s=[{offset:0,color:"rgba(0, 177, 93, 0.3)"},{offset:a,color:"transparent"}];return 1!==a&&s.push({offset:1,color:"rgba(255, 91, 90, 0.25)"}),s},initChart(){this.chart=Pe(this.$refs.chart,null,{renderer:"canvas",useDirtyRect:!1});const t={xAxis:{type:"category",show:!1,axisLine:{show:!1},xisTick:{show:!1}},yAxis:{type:"value",axisLine:{show:!1},splitLine:{show:!1,lineStyle:{type:"dashed",color:"#666"}}},grid:[{left:0,right:0,bottom:0,top:0}],series:[{data:this.roiHistory,type:"line",smooth:!0,showSymbol:!1,effect:{delay:1e3},lineStyle:{width:2},areaStyle:{color:new ke(0,0,0,1,this.countLinearGradient())},markLine:{silent:!0,symbol:"none",label:{show:!1},data:[{yAxis:0,lineStyle:{color:"#033D90",width:1,type:"dashed"}}]}}],visualMap:{show:!1,pieces:[{gte:0,lte:9999999,color:"#02CB6B"},{lt:0,color:"#FF5B5A"}]}};this.chart.setOption(t),window.addEventListener("resize",this.chart.resize)},checkSubAccount(){this.isSubAccount?this.$emit("close",!0):this.buyStrategy()},async buyStrategy(){this.loading=!0;try{const{tradingBotId:t,salePrice:e,saleCurrency:i}=this.strategy,{data:a}=await Gt.postTradingBotBuy(t,{salePrice:e,saleCurrency:i});this.purchasingBot=a.tradingBot,this.$emit("onPurchased"),this.step=2}catch(t){this.resultDialog=1,this.isResult=!0}finally{this.loading=!1}},goToTradingBot(){const t=this.isFutures?this.strategy.symbol:`${this.strategy.symbol}-${this.strategy.quoteCurrency}`;if(this.isApp)return void ee({event:"CREATE_FUTURES_GRID_BOT",symbol
1:t,config:this.strategyConfig});const e=this.strategy.config?this.strategy:this.purchasingBot;this.isGoToTradePage=!0,this.$router.push({name:this.isFutures?"futuresId":"tradingId",params:{lang:this.lang,id:t,tradeType:this.isFutures?ie.GRID:bt.DCA,tradingBot:e,copyFromTradingBotId:this.strategy.tradingBotId,direction:this.strategy.direction}})},getDirectionClass:pi,getDirectionText:mi,handleInputFuturesInvestment(t){if(!this.availableBalance)return;const e=l(t||0).div(this.availableBalance).times(100).dp(0,l.ROUND_UP).toNumber();this.form.percent=Math.min(e,100)},handlePercentChange(t){if(0!==t)try{const e=l(this.availableBalance).times(t).div(100).dp(2,l.ROUND_DOWN).toNumber();this.form.iniMargin=e}catch(e){this.form.iniMargin=""}else this.form.iniMargin=null},async handleQuickCopy(){const{symbol:t,tradingBotId:e,direction:i}=this.strategy,a=this.isFutures?{tradingDirection:i,midPrice:String(this.midPrice),upperPrice:String(this.strategyConfig.upperPrice),lowerPrice:String(this.strategyConfig.lowerPrice),wallet:{mode:this.currentWallet.isCrossWallet?Xt.CROSS:Xt.ISOLATED,leverage:String(this.currentWalletLeverage)},gridNumber:Number(this.strategyConfig.gridNumber),initialMargin:String(this.form.iniMargin),botStopAction:{cancelAllOrders:!0,closeAllPositions:!0},feeType:this.strategyConfig.feeType}:{...this.strategyConfig,investmentPerPeriod:this.form.investmentPerPeriod},s={symbol:t,marketType:this.isFutures?Pt.FUTURES:Pt.SPOT,botType:this.isFutures?bt.GRID:bt.DCA,config:a,copyFromTradingBotId:e};this.isFutures||(s.config.cycle.timezoneOffsetInMin=-(new Date).getTimezoneOffset(),s.quoteCurrency=this.strategy.quoteCurrency);try{this.loading=!0;const{tradingBot:t}=await Gt.createBot(s);this.tmpCreatedData=t,this.trackCreateBot(s),this.resultDialog=3,this.isResult=!0}catch({code:r}){const t=`response-code.${r}`;let e=Jt(t)?this.$t(t):`${this.$t("defaultError")} [code: ${r}]`;r===te.MAX_BOTS_EXCEEDED&&(e=this.$t(t)),this.failedMessage=e,this.resultDialog=2,this.isResult=!0}finally{this.loading=!1}},trackCreateBot(t){const{symbol:e,config:i}=t,{tradingDirection:a}=i;ht(pt.TRADING_BOT_GRID_BOT_CREATED,{s1:a.toLowerCase(),s2:this.isFutures?"futures":"spot",s3:e,s4:"number",s5:"false",s6:"mark",s7:"mark",s8:"true",s9:"true"})},handleCancelResult(){this.isResult=!1,this.$emit("close")},goToBotDetail(){const{tradingBotId:t,symbol:e,botType:i,quoteCurrency:a}=this.tmpCreatedData;this.$router.push({name:i===bt.GRID?Wt.FUTURES_GRID_BOT_DETAIL:Wt.SPOT_DCA_BOT_DETAIL,params:{lang:this.lang,id:this.isFutures?e:`${e}-${a}`,botId:t}})},getAdjConfig(){return this.initialMarginAdjConf?this.isNeutral?this.initialMarginAdjConf.neutral:this.isLong?this.initialMarginAdjConf.long:this.initialMarginAdjConf.short:null}}},mr={class:"strategy"},yr={class:"strategy-header"},vr={class:"flex-box items-center flex-1 gap-8"},fr={class:"price"},br={class:"gains"},Cr={class:"flex-box gap-24"},Sr={class:"flex-box items-center gap-8"},Tr={class:"flex-box items-center"},wr={class:"strategy-body"},Dr={class:"mw-100"},Ir={class:"flex-box items-center gap-8 mb-16"},Pr={class:"font-14"},kr={class:"tag"},$r={class:"tag"},xr={key:1,class:"tag"},Br={class:"scroll-wrapper"},Lr={key:"a",class:"scroll-block"},Nr={class:"roi"},_r={ref:"chart",class:"chart"},Rr={key:"b",class:"info-wrapper scroll-block"},Mr={class:"info-block"},Ar={class:"info-label"},Or={class:"info-row"},Er={class:"row-label"},Ur={class:"row-value"},Fr={class:"info-row"},Hr={class:"row-label"},zr={class:"info-row"},Gr={class:"row-label"},Wr={class:"row-value"},Vr={class:"info-row"},Zr={class:"row-label"},Yr={class:"row-value"},jr={class:"info-row"},qr={class:"row-label"},Kr={class:"row-value"},Qr={class:"info-row"},Xr={class:"row-label"},Jr={class:"row-value"},tn={class:"info-row"},en={class:"row-label"},an={class:"row-value"},sn={class:"info-row"},rn={class:"row-label"},nn={class:"row-value"},on={class:"info-block"},ln={class:"info-label"},cn={class:"info-row"},dn={class:"row-label"},un={class:"info-row pl-12"},hn={class:"row-label"},gn={class:"info-row pl-12"},pn={class:"row-label"},mn={key:0,class:"info-row"},yn={class:"row-label"},vn={class:"row-value"},fn={key:1,class:"info-row"},bn={class:"row-label"},Cn={class:"row-value"},Sn={class:"info-row"},Tn={class:"row-label"},wn={class:"row-value"},Dn={class:"info-row"},In={class:"row-label"},Pn={class:"row-value"},kn={class:"mw-100 with-bg"},$n={class:"info-steps"},xn={class:"step-name"},Bn={class:"step-name"},Ln={class:"info"},Nn={class:"info-title"},_n={class:"info-text"},Rn={class:"info"},Mn={class:"info-title"},An={class:"flex-box justify-end mt-8 gap-24"},On={key:2,class:"invest-form"},En={class:"flex-box justify-between items-center"},Un={class:"form-label"},Fn={class:"form-note"},Hn={class:"label"},zn={class:"flex-box justify-between items-center"},Gn={class:"form-label"},Wn={class:"form-note font-14"},Vn={key:0,class:"label"},Zn={class:"value"},Yn={class:"flex-box justify-between items-center mt-8"},jn={class:"form-label"},qn={class:"form-note font-14"},Kn={class:"value"},Qn={key:0,class:"flex-box justify-between items-center mt-8 color-gray"},Xn={class:"form-label"},Jn={class:"form-note font-14"},to={class:"value"},eo={class:"strategy-footer"},io={key:0},ao={key:1},so={class:"result-wrapper"},ro={class:"result-title"},no={class:"result-text"},oo={class:"result-title"},lo={class:"result-text"},co={class:"result-title"},uo={class:"result-text"},ho={class:"result-text"};const go=Ie(pr,[["render",function(t,e,o,l,c,d){const u=i("Icon"),m=i("Avatar"),f=i("IconLocalMall"),T=i("IconChevronRight"),w=i("Warning"),D=i("IconTransfer"),I=i("IconDeposit"),P=i("IconQuestionCircle2"),k=i("Tooltip"),x=i("TradingInput"),B=i("TradeSlider"),L=i("IconSetting2"),N=i("BaseButton"),_=i("IconSuccess"),R=i("IconFlashFail"),M=i("BrandDialog");return s(),a(M,{width:t.isMobile?"90%":"800px",class:"strategy-dialog",idPrefix:"copy_strategy_dialog",isBrandNewStyle:"",showClose:!c.isResult,"onUpdate:visible":e[10]||(e[10]=e=>t.$emit("close"))},{header:r((()=>
1[S(y(t.$t("t.copyStrategy")),1)])),body:r((()=>[p(n("div",null,[n("div",mr,[n("div",yr,[n("div",vr,[b(u,{name:d.baseCurrency,showName:!1,size:"36"},null,8,["name"]),n("h3",null,y(d.symbolText),1),l.isFutures?(s(),h("div",{key:0,class:v(["last-price",{"brand-color-positive":d.gains>0,"brand-color-negative":d.gains<0}])},[n("div",fr,y(c.lastPrice),1),n("div",br," ("+y(t.$filters.formatNumber(d.gains,{signed:!0,postfix:"%"}))+") ",1)],2)):g("",!0)]),n("div",Cr,[n("div",Sr,[c.enableAccountAvatar?(s(),a(m,{key:0,class:"user-avatar",avatarId:o.strategy.avatarType||c.DEFAULT_AVATAR_ID},null,8,["avatarId"])):g("",!0),n("span",null,y(o.strategy.creatorNickname||o.strategy.creatorShareId),1)]),n("div",Tr,[b(f,{size:"20"}),n("span",null,y(t.$t("strategy.dialog.copiers"))+": "+y(o.strategy.saleCount),1)])])]),n("div",wr,[n("div",Dr,[n("div",Ir,[n("p",Pr,y(d.toTitleCase(o.strategy.marketType))+" "+y(d.botTypeText),1),n("div",{class:v(["flex-box gap-8",d.getDirectionClass(o.strategy.direction)])},[l.isFutures?(s(),h($,{key:0},[n("div",kr,y(d.getDirectionText(o.strategy.direction)),1),n("div",$r,y(d.leverageText)+"x",1)],64)):(s(),h("div",xr,y(d.spotDirectionText),1))],2)]),n("div",Br,[b(O,{name:"slide-left",tag:"div"},{default:r((()=>[p(n("div",Lr,[n("p",{class:v(["pnl",{long:o.strategy.roi>0,short:o.strategy.roi<0}])},y(d.roiText),3),n("p",Nr,y(t.$t("t.roi")),1),n("div",_r,null,512)],512),[[C,!c.isToggleInfo]]),p(n("div",Rr,[n("div",Mr,[n("div",Ar,y(t.$t("kyc.stepper.step3")),1),l.isFutures?(s(),h($,{key:0},[n("div",Or,[n("div",Er,y(t.$t("t.duration")),1),n("div",Ur,y((o.strategy.duration||"").replace(/-/g," ")),1)]),n("div",Fr,[n("div",Hr,y(t.$t("t.direction"))+" | "+y(t.$t("futuresMain.trade.leverage")),1),n("div",{class:v(["row-value",d.getDirectionClass(o.strategy.direction)])},[S(y(d.getDirectionText(o.strategy.direction))+" ",1),e[11]||(e[11]=n("span",{class:"divider"},"|",-1)),S(" "+y(d.leverageText)+"x ",1)],2)]),n("div",zr,[n("div",Gr,y(t.$t("strategy.priceRange")),1),n("div",Wr,y(t.$filters.formatNumber(d.strategyConfig.lowerPrice))+" - "+y(t.$filters.formatNumber(d.strategyConfig.upperPrice))+" USDT ",1)]),n("div",Vr,[n("div",Zr,y(t.$t("trading.bot.numberOfGrids")),1),n("div",Yr,y(d.strategyConfig.gridNumber),1)])],64)):(s(),h($,{key:1},[n("div",jr,[n("div",qr,y(t.$t("t.cycle")),1),n("div",Kr,y(d.cycleText),1)]),n("div",Qr,[n("div",Xr,y(t.$t("trading.spot.dca.investmentPerPeriod")),1),n("div",Jr,y(t.$filters.formatNumber(d.investmentPerPeriodText,d.spotDynamicDecimal))+" "+y(d.spotDisplayCurrency),1)]),n("div",tn,[n("div",en,y(t.$t("trading.spot.dca.noOfInvestment")),1),n("div",an,y(d.numberOfInvestmentText),1)]),n("div",sn,[n("div",rn,y(t.$t("t.totalInvestment")),1),n("div",nn,y(d.totalInvestmentText),1)])],64))]),n("div",on,[n("div",ln,y(t.$t("trading.bot.advancedSettings")),1),l.isFutures?(s(),h($,{key:0},[n("div",cn,[n("div",dn,y(t.$t("trading.bot.stopLossPrice")),1),e[12]||(e[12]=n("div",{class:"row-value"},null,-1))]),n("div",un,[n("div",hn,y(t.$t("trading.bot.topPrice")),1),e[13]||(e[13]=n("div",{class:"row-value"},"-",-1))]),n("div",gn,[n("div",pn,y(t.$t("trading.bot.bottomPrice")),1),e[14]||(e[14]=n("div",{class:"row-value"},"-",-1))]),t.isUnifiedWallet?g("",!0):(s(),h("div",mn,[n("div",yn,y(t.$t("trading.bot.cancelOrderOnStop")),1),n("div",vn,y(t.$t("t.enable")),1)])),t.isUnifiedWallet?g("",!0):(s(),h("div",fn,[n("div",bn,y(t.$t("trading.bot.cancelPositionOnStop")),1),n("div",Cn,y(t.$t("t.enable")),1)]))],64)):(s(),h($,{key:1},[n("div",Sn,[n("div",Tn,y(t.$t("t.slippage")),1),n("div",wn,y(d.slippageText),1)]),n("div",Dn,[n("div",In,y(t.$t("trading.spot.dca.dialog.depositAfterText")),1),n("div",Pn,y(d.flexibleEarnText),1)])],64))])],512),[[C,c.isToggleInfo]])])),_:1})]),o.isPurchased||2===c.step?(s(),h("div",{key:0,class:"switch-btn",onClick:e[0]||(e[0]=t=>c.isToggleInfo=!c.isToggleInfo)},[c.isToggleInfo?(s(),h($,{key:1},[b(T,{class:"revert-icon",width:"16",height:"16"}),n("span",null,y(t.$t("kyc.stepper.step3")),1)],64)):(s(),h($,{key:0},[n("span",null,y(t.$t("trading.bot.detail")),1),b(T,{width:"16",height:"16"})],64))])):g("",!0)]),n("div",kn,[o.isPurchased?g("",!0):(s(),h($,{key:0},[n("div",$n,[n("div",{class:v(["info-step",{activate:1===c.step}])},[e[15]||(e[15]=n("div",{class:"step-num"},"1",-1)),n("div",xn,y(t.$t("strategy.copyBot")),1)],2),e[17]||(e[17]=n("div",{class:"dotted-line"},null,-1)),n("div",{class:v(["info-step",{activate:2===c.step}])},[e[16]||(e[16]=n("div",{class:"step-num"},"2",-1)),n("div",Bn,y(t.$t("strategy.yourInvestment")),1)],2)]),e[18]||(e[18]=n("div",{class:"info-div
1ider"},null,-1))],64)),1===c.step?(s(),h($,{key:1},[n("div",Ln,[n("div",Nn,y(t.$t("strategy.costOfCopy")),1),n("div",_n,y(t.$filters.formatNumber(o.strategy.salePrice))+" "+y(o.strategy.saleCurrency),1)]),n("div",Rn,[n("div",Mn,y(t.$t("strategy.spotWalletBalance")),1),n("div",{class:v(["info-text",{"brand-color-negative":d.notEnoughUsdtBalance}])},y(t.$filters.formatNumber(d.usdtData.available,"max2"))+" "+y(d.usdtData.displayName),3)]),d.notEnoughUsdtBalance?(s(),h($,{key:0},[b(w,{class:"warning-block",text:t.$t("strategy.tooltip.insufficientSpot")},null,8,["text"]),n("div",An,[n("div",{class:"link",onClick:e[1]||(e[1]=(...t)=>d.openFuturesTransferPopup&&d.openFuturesTransferPopup(...t))},[b(D,{class:"link-icon"}),n("span",null,y(t.$t("t.transfer")),1)]),n("div",{class:"link",onClick:e[2]||(e[2]=(...t)=>d.goToDeposit&&d.goToDeposit(...t))},[b(I,{class:"link-icon"}),n("span",null,y(t.$t("t.deposit")),1)])])],64)):g("",!0)],64)):g("",!0),2===c.step?(s(),h("div",On,[n("div",En,[n("div",Un,[n("span",null,y(t.$t("trading.bot.investment")),1),b(k,{tooltip:l.isFutures?t.$t("strategy.tooltip.investment"):t.$t("strategy.tooltip.investment.spot")},{content:r((()=>[b(P)])),_:1},8,["tooltip"])]),n("div",Fn,[n("span",Hn,y(t.$t("trading.bot.avbl"))+":",1),l.isFutures?(s(),h("span",{key:0,class:v(["value",{"brand-color-negative":d.notEnoughInvestment}])},y(t.$filters.formatNumber(d.availableBalance))+" USDT ",3)):(s(),h("span",{key:1,class:v(["value",{"brand-color-negative":d.notEnoughSpotBalance}])},y(t.$filters.formatNumber(d.spotBalanceData.available,d.spotDynamicDecimal))+" "+y(d.spotDisplayCurrency),3)),b(D,{class:"transfer-icon",width:"16",height:"16",onClick:d.openFuturesTransferPopup},null,8,["onClick"])])]),l.isFutures?(s(),h($,{key:0},[b(x,{value:c.form.iniMargin,"onUpdate:value":e[3]||(e[3]=t=>c.form.iniMargin=t),label:t.$t("trading.bot.grid.totalInvestment"),placeholder:`≥ ${d.minInitialMargin}`,enableThousandSeparator:"",min:0,max:d.maxInvestment,step:.01,maxDecimalPlaces:2,errorShown:!!d.errorIniMargin,onInput:d.handleInputFuturesInvestment},{append:r((()=>e[19]||(e[19]=[S("USDT")]))),_:1},8,["value","label","placeholder","max","errorShown","onInput"]),b(B,{value:c.form.percent,"onUpdate:value":e[4]||(e[4]=t=>c.form.percent=t),onChange:d.handlePercentChange},null,8,["value","onChange"]),d.notEnoughInvestment?(s(),a(w,{key:0,class:"mb-20",text:t.$t("strategy.tooltip.pleaseFund",{wallet:d.currentWalletFullName})},null,8,["text"])):g("",!0),n("div",zn,[n("div",Gn,[n("span",null,y(t.$t("futuresMain.trade.leverage")),1),b(k,{tooltip:t.$t("strategy.tooltip.leverage")},{content:r((()=>[b(P)])),_:1},8,["tooltip"])]),n("div",Wn,[t.isUnifiedWallet?g("",!0):(s(),h("span",Vn,y(c.currentWallet.isCrossWallet?t.$t("futuresMain.trade.cross"):t.$t("t.isolated")),1)),n("span",Zn,y(d.currentWalletLeverage)+"x",1)])])],64)):(s(),h($,{key:1},[b(x,{value:c.form.investmentPerPeriod,"onUpdate:value":e[5]||(e[5]=t=>c.form.investmentPerPeriod=t),label:t.$t("trading.spot.dca.investmentPerPeriod"),placeholder:`≥${d.spotMinInvestment}`,enableThousandSeparator:"",min:0,step:d.isLong?Number(d.spotExchangeInfo.minPriceIncrement):Number(d.spotExchangeInfo.minSizeIncrement),errorShown:d.notEnoughSpotMinInvestment},{append:r((()=>[S(y(d.spotDisplayCurrency),1)])),errorMsg:r((()=>[S(y(d.notEnoughSpotMinInvestment?t.$t("trading.spot.dca.investmentWarning",{currency:d.spotDisplayCurrency,amount:d.spotMinInvestment}):""),1)])),_:1},8,["value","label","placeholder","step","errorShown"]),n("div",Yn,[n("div",jn,[n("span",null,y(t.$t("trading.spot.dca.noOfInvestment")),1),b(k,{tooltip:t.$t("trading.spot.dca.noOfInvestment.hint")},{content:r((()=>[b(P)])),_:1},8,["tooltip"])]),n("div",qn,[n("span",Kn,y(d.numberOfInvestmentText),1)])]),c.form.investmentPerPeriod?(s(),h("div",Qn,[n("div",Xn,[n("span",null,y(t.$t("t.totalInvestment")+" ≈"),1)]),n("div",Jn,[n("span",to,y(d.userTotalInvestmentText),1)])])):g("",!0)],64))])):g("",!0),2!==c.step||t.isApp&&!l.isFutures?g("",!0):(s(),h("div",{key:3,class:"customize-btn",onClick:e[6]||(e[6]=(...t)=>d.goToTradingBot&&d.goToTradingBot(...t))},[b(L),n("span",null,y(t.$t("t.customize")),1)]))])]),n("div",eo,[t.isUnifiedWallet?(s(),h("p",io,y(t.$t("trading.copystrategy.transferWalletText")),1)):(s(),h("p",ao,y(o.strategy.tradingBotId),1)),1===c.step?(s(),a(N,{key:2,class:"primary strategy-btn",size:"medium",isLoading:c.loading,disabled:d.notEnoughUsdtBalance,onClick:d.checkSubAccount},{default:r((()=>[S(y(d.notEnoughUsdtBalance?t.$t("debitCard.insufficientBalance"):t.$t("t.confirm")),1)])),_:1},8,["isLoading","disabled","onClick"])):(s(),h($,{key:3},[l.isFutures?(s(),a(N,{key:0,class:"primary strategy-btn",size:"medium",isLoading:c.loading,disabled:d.errorIniMargin||!c.form.iniMargin,onClick:d.handleQuickCopy},{default:r((()=>[S(y(t.$t("t.start")),1)])),_:1},8,["isLoading","disabled","onClick"])):(s(),a(N,{key:1,class:"primary strategy-btn",size:"medium",isLoading:c.loading,disabled:d.errorQuickCopySpot,onClick:d.handleQuickCopy},{default:r((()=>[S(y(t.$t("t.start")),1)])),_:1},8,["isLoading","disabled","onClick"]))],64))])])],512),[[C,!c.isResult]]),p(n("div",null,[n("div",so,[3===c.resultDialog?(s(),h($,{key:0},[b(_),n("h3",ro,y(t.$t("msg.success")),1),n("p",no,y(t.$t("strategy.dialog.subscription.created")),1),b(N,{class:"primary strategy-btn",size:"large",onClick:d.goToBotDetail},{default:r((()=>
1[S(y(t.$t("strategy.dialog.btn.viewBotDetails")),1)])),_:1},8,["onClick"]),n("div",{class:"cancel-btn",onClick:e[7]||(e[7]=(...t)=>d.handleCancelResult&&d.handleCancelResult(...t))},y(t.$t("strategy.dialog.btn.copyMore")),1)],64)):2===c.resultDialog?(s(),h($,{key:1},[b(R),n("h3",oo,y(t.$t("strategy.dialog.create.failed.title")),1),n("p",lo,y(l.isFutures?c.failedMessage:t.$t("trading.spot.dca.createBot.fail.message")),1),b(N,{class:"primary strategy-btn",size:"large",onClick:e[8]||(e[8]=t=>c.isResult=!1)},{default:r((()=>[S(y(t.$t("t.ok")),1)])),_:1})],64)):(s(),h($,{key:2},[b(R),n("h3",co,y(t.$t("t.unsuccessful")),1),n("p",uo,y(t.$t("strategy.dialog.subscription.failed.1")),1),n("p",ho,y(t.$t("strategy.dialog.subscription.failed.2")),1),b(N,{class:"primary strategy-btn",size:"large",onClick:e[9]||(e[9]=t=>c.isResult=!1)},{default:r((()=>[S(y(t.$t("t.ok")),1)])),_:1})],64))])],512),[[C,c.isResult]])])),_:1},8,["width","showClose"])}],["__scopeId","data-v-3b5359ed"]]),po={class:"strategy-body"};const mo=Ie({name:"SubAccountWarningDialog",components:{BrandDialog:Qt,IconAlertCircle:ce},emits:["close"]},[["render",function(t,e,o,l,c,d){const u=i("IconAlertCircle"),h=i("BaseButton"),g=i("BrandDialog");return s(),a(g,{width:t.isMobile?"90%":"333px",class:"strategy-dialog",idPrefix:"sub_account_warning_dialog",isBrandNewStyle:"",showHeaderBottomDivider:!1,"onUpdate:visible":e[1]||(e[1]=e=>t.$emit("close"))},{header:r((()=>e[2]||(e[2]=[n("p",{class:"empty"},null,-1)]))),body:r((()=>[n("div",po,[b(u,{class:"icon-alert"}),n("p",null,y(t.$t("strategy.dialog.subAccountAlert")),1),b(h,{class:"primary strategy-btn",size:"medium",onClick:e[0]||(e[0]=e=>t.$emit("close"))},{default:r((()=>[S(y(t.$t("t.ok")),1)])),_:1})])])),_:1},8,["width"])}],["__scopeId","data-v-c6a31c73"]]),{enableSpotDcaBot:yo,enableFuturesTradingBot:vo}=It,fo={class:"tabs"},bo=["onClick"];const Co=Ie({name:"StrategyTabs",props:{value:{type:[Number,String],required:!0}},emits:["update:value"],computed:{list(){const t=[];return vo&&t.push({id:Pt.FUTURES,text:this.$t("t.futuresGrid")}),yo&&t.push({id:Pt.SPOT,text:this.$t("t.spotDca")}),t}}},[["render",function(t,e,i,a,r,n){return s(),h("div",fo,[(s(!0),h($,null,x(n.list,(e=>(s(),h("div",{key:e.id,class:v(["tab",{active:i.value===e.id}]),onClick:i=>t.$emit("update:value",e.id)},y(e.text),11,bo)))),128))])}],["__scopeId","data-v-a88b7c4e"]]),{enableFuturesTradingBot:So}=It,To={sorting:sr},wo={total:0,currentPage:1,totalPages:0,pageSize:12},Do={name:"CopyStrategy",components:{MyStrategy:Us,Strategy:ar,StrategyFilters:hr,Pagination:de,StrategyDialog:go,SubAccountWarningDialog:mo,IconChevronRight:Yt,StrategyTabs:Co},data:()=>({strategies:[],showDialog:!1,dialogStrategyData:null,futuresSymbols:[],spotSymbols:[],filters:{...To},pageData:{...wo},isLoading:!0,showSubAccountWarning:!1,originTheme:"",botMarketType:So?Pt.FUTURES:Pt.SPOT}),computed:{...d({isLogin:"loginState",lang:"lang",accountInfo:"accountInfo",theme:"theme",isDefaultBrand:"isDefaultBrand"}),isFutures(){return this.botMarketType===Pt.FUTURES},symbols(){return this.isFutures?this.futuresSymbols:this.spotSymbols},heroBackgroundImg:()=>wt("copy-trading/copy-strategy-leaderboard-bg.png"),heroStyles(){return{"background-image":`url(${this.heroBackgroundImg})`}},myStrategyClasses(){return{"color-border-box-header mb-100":this.isLogin,"has-arrow-icon":this.isDefaultBrand}}},watch:{filters(){this.getTradingBots(this.botMarketType)},accountInfo(t,e){(null==e?void 0:e.uid)&&t.uid!==e.uid&&window.location.reload()},botMarketType(){this.strategies=[],this.handleFilterReset()}},created(){this.getTradingBotInit(),this.originTheme=this.theme,this.setTmpTheme("night")},beforeUnmount(){this.setTmpTheme(this.originTheme)},methods:{...E(["setTmpTheme"]),handlePageChange(t){this.pageData.currentPage=t,this.getTradingBots()},handleSizeChange(t){this.pageData.pageSize=t,this.pageData.currentPage=1,this.getTradingBots()},async handleCopy(t){if(!this.isLogin){const t=encodeURI(window.location.pathname);return void this.$router.push({path:`/${this.lang}/login?redirect=${t}`})}const{isPurchased:e,salePrice:i,saleCurrency:a,tradingBotId:s}=t;if(e){const{data:e}=await Gt.getPurchasedBotConfig(s);t.config=e.data.tradingBot.config}else if(0===Number(i))try{this.isLoading=!0;const{data:e}=await Gt.postTradingBotBuy(s,{salePrice:i,saleCurrency:a});this.getTradingBots(),t.saleCount++,t.config=e.tradingBot.config,t.isPurchased=!0}catch(r){}finally{this.isLoading=!1}this.dialogStrategyData=t,this.showDialog=!0},async getTradingBotInit(){try{const{data:t}=await Gt.getTradingBotInit();this.futuresSymbols=t.futures.symbols,this.spotSymbols=t.spot.symbols}finally{this.getTradingBots()}},async getTradingBots(t){this.isLoading=!0;const e={...this.filters,marketType:this.botMarketType,botType:this.isFutures?bt.GRID:bt.DCA,pageSize:this.pageData.pageSize,page:this.pageData.currentPage};try{const{data:i}=await Gt.getPublishedTradingBots(e);(t&&t===this.botMarketType||!t)&&(this.strategies=i.tradingBots),this.pageData.total=i.totalRows||0,this.pageData.totalPages=i.totalPages||0}finally{this.isLoading=!1}},handleFilterReset(){this.filters={...To},this.pageData={...wo}},handleClose(t=!1){this.showDialog=!1,this.$nextTick((()=>{this.showSubAccountWarning=t}))},handlePurchased(){this.getTradingBots()}}},Io={class:"dashboard-header"},Po={class:"dashboard-title"},ko={class:"dashboard-steps"},$o={class:"dashboard-step"},xo={class:"step-label"},Bo={class:"dashboard-step"},Lo={class:"step-label"},No={class:"dashboard-step"},_o={class:"step-label"},Ro={key:0,class:"color-border-box-header__module"},Mo={class:"section-card"},Ao={class:"strategy-marketplace-title"},Oo={class:"strategy-wrapper"},Eo={class:"strategy-page-content"};const Uo=Ie(Do,[["render",function(t,e,r,o,l,c){const d=i("IconChevronRight"),m=i("MyStrategy"),f=i("StrategyTabs"),C=i("StrategyFilters"),S=i("Strategy"),T=i("Pagination"),w=i("StrategyDialog"),D=i("SubAccountWarningDialog"),I=u("loading");return s(),h("div",{class:"copy-strategy-dashboard",style:k(c.heroStyles)},[n("div",Io,[n("h1",Po,y(t.$t("t.copyStrategy")),1),n("p",null,y(t.$t("strategy.slogan.2")),1),n("div",ko,[n("div",$o,[e[3]||(e[3]=n("div",{class:"step-num"},"1",-1)),n("div",xo,y(t.$t("strategy.step.1")),1)]),b(d),n("div",Bo,[e[4]||(e[4]=n("div",{class:"step-num"},"2",-1)),n("div",Lo,y(t.$t("strategy.step.2")),1)]),b(d),n("div",No,[e[5]||(e[5]=n("div",{class:"step-num"},"3",-1)),n("div",_o,y(t.$t("strategy.step.3")),1)])])]),n("div",{class:v(["section-card mb-100 my-strategy-wrapper",c.myStrategyClasses]),style:{position:"relative"}}
1,[t.isLogin?(s(),h("div",Ro,[b(m)])):g("",!0)],2),n("div",Mo,[n("h3",Ao,y(t.$t("strategy.marketPlace")),1),b(f,{value:l.botMarketType,"onUpdate:value":e[0]||(e[0]=t=>l.botMarketType=t)},null,8,["value"]),b(C,{ref:"strategyFilters",filters:l.filters,"onUpdate:filters":e[1]||(e[1]=t=>l.filters=t),symbolOptions:c.symbols,isFutures:c.isFutures,resetFlag:l.botMarketType,onReset:c.handleFilterReset},null,8,["filters","symbolOptions","isFutures","resetFlag","onReset"]),p((s(),h("div",Oo,[(s(!0),h($,null,x(l.strategies,((t,e)=>(s(),a(S,{key:`${e}_${t.tradingBotId}`,strategy:t,onOnCopy:()=>c.handleCopy(t)},null,8,["strategy","onOnCopy"])))),128))])),[[I,l.isLoading,"streamingLight"]]),n("div",Eo,[b(T,{class:"strategy-pagination",layout:t.isMobile?"prev, pager, next":"prev, pager, next, jumper, sizes",background:!1,total:l.pageData.total,currentPage:l.pageData.currentPage,totalPages:l.pageData.totalPages,pageSize:l.pageData.pageSize,pageSizes:[12,24,48],hideOnSinglePage:!1,onHandleCurrentChangeP:c.handlePageChange,onHandleSizeChangeP:c.handleSizeChange},null,8,["layout","total","currentPage","totalPages","pageSize","onHandleCurrentChangeP","onHandleSizeChangeP"])])]),l.showDialog?(s(),a(w,{key:0,strategy:l.dialogStrategyData,isPurchased:l.dialogStrategyData.isPurchased,onClose:c.handleClose,onOnPurchased:c.handlePurchased},null,8,["strategy","isPurchased","onClose","onOnPurchased"])):g("",!0),l.showSubAccountWarning?(s(),a(D,{key:1,onClose:e[2]||(e[2]=t=>l.showSubAccountWarning=!1)})):g("",!0)],4)}],["__scopeId","data-v-ebebe70e"]]),Fo=Object.freeze(Object.defineProperty({__proto__:null,default:Uo},Symbol.toStringTag,{value:"Module"})),{enableAccountAvatar:Ho}=It,zo={name:"MyStrategyInfo",components:{IconEdit:ue,Avatar:Vt,IconEyeClose:Ht,IconEye:Ft,Tooltip:Ut},data:()=>({DEFAULT_TRADING_BOT_AVATAR_ID:ge,enableAccountAvatar:Ho,totalIncome:"",botProfit:"",saleProfit:"",isLoading:!1}),computed:{...d(["lang","accountInfo","userConfig"]),summaryItemList(){return[{id:"totalIncome",value:this.totalIncome,label:this.$t("strategy.subTitle.1"),tooltip:this.$t("strategy.tooltip.totalEarnings")},{id:"botProfit",value:this.botProfit,label:this.$t("strategy.subTitle.2"),tooltip:this.$t("strategy.tooltip.botReturns")},{id:"saleProfit",value:this.saleProfit,label:this.$t("strategy.subTitle.3"),tooltip:this.$t("strategy.tooltip.saleEarnings")}]},toggleValueIcon(){return this.isHideValue?Ht:Ft},isHideValue(){return this.userConfig[W.COPY_STRATEGY_HIDE_VALUE]},heroBackgroundImg:()=>wt("copy-trading/my-strategy-bg.png"),heroStyles(){return{"background-image":`url(${this.heroBackgroundImg})`}}},created(){this.init()},methods:{...R(["updateUserConfigByKey"]),async init(){try{this.isLoading=!0;const{data:t}=await Gt.getTradingBotSummary();this.totalIncome=t.totalIncome,this.botProfit=t.botProfit,this.saleProfit=t.saleProfit}finally{this.isLoading=!1}},handleClickEdit(){this.$router.push({name:he.ACCOUNT,params:{lang:this.lang}})},getFormatValue(t){return t?this.$filters.formatNumber(t,{signed:!0,formatKey:"max2"}):""},setHideValue(){this.updateUserConfigByKey({key:W.COPY_STRATEGY_HIDE_VALUE,value:!this.isHideValue})},getValueClass(t){return this.isHideValue?"":t>0?"brand-color-positive":t<0?"brand-color-negative":""}}},Go={class:"title-row"},Wo={class:"nick-name-wrap"},Vo={class:"nick-name"},Zo={class:"summary-row-wrap flex-box flex-wrap"},Yo={class:"summary-item"},jo={class:"summary-value-wrap"},qo={class:"summary-label"};const Ko=Ie(zo,[["render",function(t,e,r,o,l,c){const d=i("Avatar"),m=i("IconEdit"),f=i("Tooltip"),C=u("loading");return s(),h("div",{class:"my-info-wrapper",style:k(c.heroStyles)},[n("div",Go,[l.enableAccountAvatar?(s(),a(d,{key:0,class:"account-avatar"})):g("",!0),n("div",Wo,[n("div",Vo,y(t.accountInfo.nickname||t.accountInfo.uid),1),b(m,{class:"icon-edit",onClick:c.handleClickEdit},null,8,["onClick"])])]),p((s(),h("div",Zo,[(s(!0),h($,null,x(c.summaryItemList,((t,i)=>(s(),h("div",{key:t.id,class:"summary-row flex-box flex-wrap"},[n("div",Yo,[n("div",jo,[n("div",{class:v(["summary-value",{[c.getValueClass(t.value)]:!0}])},y(c.isHideValue?"*****":c.getFormatValue(t.value)),3),e[1]||(e[1]=n("span",{class:"summary-unit"},"USDT",-1))]),n("div",qo,[b(f,{content:t.label,tooltip:t.tooltip},null,8,["content","tooltip"]),0===i?(s(),h("span",{key:0,class:"toggle-value",onClick:e[0]||(e[0]=(...t)=>c.setHideValue&&c.setHideValue(...t))}
1,[(s(),a(M(c.toggleValueIcon),{class:"action-icon"}))])):g("",!0)])]),i!==c.summaryItemList.length-1?(s(),h("div",{key:`divider-${t.id}`,class:"divider"})):g("",!0)])))),128))])),[[C,l.isLoading,"streamingLight"]])],4)}],["__scopeId","data-v-50abaa29"]]);const Qo=Ie({name:"IconDetail",components:{Icon:V},props:{width:{type:[Number,String],default:14},height:{type:[Number,String],default:14}},emits:["click"]},[["render",function(t,e,o,l,c,d){const u=i("Icon");return s(),a(u,{width:o.width,height:o.height,viewBox:"0 0 14 14","aria-label":"Detail Icon","fill-rule":"evenodd",onClick:e[0]||(e[0]=e=>t.$emit("click",e))},{default:r((()=>e[1]||(e[1]=[n("path",{d:"M10.125 2.66492H4.875C4.39175 2.66492 4 3.05667 4 3.53992V10.5399C4 11.0232 4.39175 11.4149 4.875 11.4149H6.625C6.86662 11.4149 7.0625 11.6108 7.0625 11.8524C7.0625 12.094 6.86662 12.2899 6.625 12.2899H4.875C3.9085 12.2899 3.125 11.5064 3.125 10.5399V3.53992C3.125 2.57342 3.9085 1.78992 4.875 1.78992H10.125C11.0915 1.78992 11.875 2.57342 11.875 3.53992V7.43747C11.875 7.67909 11.6791 7.87497 11.4375 7.87497C11.1959 7.87497 11 7.67909 11 7.43747V3.53992C11 3.05667 10.6082 2.66492 10.125 2.66492Z"},null,-1),n("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.59172 11.6209C9.95099 11.6209 10.2835 11.5064 10.5548 11.3119L11.3392 12.0963C11.5101 12.2672 11.7871 12.2672 11.9579 12.0963C12.1288 11.9254 12.1288 11.6484 11.9579 11.4776L11.1084 10.6281C11.1969 10.4255 11.2459 10.2018 11.2459 9.96669C11.2459 9.05309 10.5053 8.31247 9.59172 8.31247C8.67812 8.31247 7.9375 9.05309 7.9375 9.96669C7.9375 10.8803 8.67812 11.6209 9.59172 11.6209ZM9.59172 10.7459C10.0221 10.7459 10.3709 10.397 10.3709 9.96669C10.3709 9.53634 10.0221 9.18747 9.59172 9.18747C9.16137 9.18747 8.8125 9.53634 8.8125 9.96669C8.8125 10.397 9.16137 10.7459 9.59172 10.7459Z"},null,-1),n("path",{d:"M10.125 4.81247C10.125 5.05409 9.92912 5.24997 9.6875 5.24997H5.3125C5.07088 5.24997 4.875 5.05409 4.875 4.81247C4.875 4.57084 5.07088 4.37497 5.3125 4.37497H9.6875C9.92912 4.37497 10.125 4.57084 10.125 4.81247Z"},null,-1),n("path",{d:"M7.9375 7.87497C8.17912 7.87497 8.375 7.67909 8.375 7.43747C8.375 7.19584 8.17912 6.99997 7.9375 6.99997H5.3125C5.07088 6.99997 4.875 7.19584 4.875 7.43747C4.875 7.67909 5.07088 7.87497 5.3125 7.87497H7.9375Z"},null,-1)]))),_:1,__:[1]},8,["width","height"])}]]),{enableFuturesTrade:Xo}=It,Jo={name:"EmptyListContent",components:{NoDataAvailable:pe,IconChevronRight:Yt},data:()=>({ROUTE_NAME:Wt}),computed:{...d(["lang","isApp"]),tradingRoute(){return Xo?{name:"futuresId",params:{lang:this.lang,id:"BTC-PERP"},state:{tradeType:ie.GRID}}:{name:"tradingId",params:{id:"BTC-USDT",lang:this.lang},state:{tradeType:bt.DCA}}}}},tl={class:"empty-wrapper"},el={class:"navs"};const il=Ie(Jo,[["render",function(t,e,o,l,c,d){const u=i("NoDataAvailable"),p=i("IconChevronRight"),m=i("router-link");return s(),h("div",tl,[b(u,{emptyText:t.$t("t.noDataFound")},null,8,["emptyText"]),n("div",el,[b(m,{class:"link",to:{name:c.ROUTE_NAME.COPY_STRATEGY,params:{lang:t.lang}}},{default:r((()=>[n("span",null,y(t.$t("strategy.copyNow")),1),b(p,{class:"nav-arrow",width:"16",height:"16"})])),_:1},8,["to"]),t.isApp?g("",!0):(s(),a(m,{key:0,class:"link",to:d.tradingRoute},{default:r((()=>[n("span",null,y(t.$t("strategy.createNow")),1),b(p,{class:"nav-arrow",width:"16",height:"16"})])),_:1},8,["to"]))])])}],["__scopeId","data-v-cf2d5d16"]]),{enableAccountAvatar:al}=It,sl={name:"MobileListItem",components:{BrandIcon:ot,IconDetail:Qo,IconShare2:fs,Avatar:Vt},props:{item:{type:Object,required:!0},onPublish:{type:Function,default:()=>{}},onToDetail:{type:Function,default:()=>{}},onShare:{type:Function,default:()=>{}},onDelist:{type:Function,default:()=>{}},onOpenRecord:{type:Function,default:()=>{}},onCopy:{type:Function,default:()=>{}},isRunning:{type:Boolean,default:!1},isHistory:{type:Boolean,default:!1},isPublished:{type:Boolean,default:!1},isPurchased:{type:Boolean,default:!1},getReasonText:{type:Function,default:()=>{}},getStatusText:{type:Function,default:()=>{}},onGoPublished:{type:Function,default:()=>{}}},data:()=>({DEFAULT_AVATAR_ID:Zt,enableAccountAvatar:al}),computed:{isGrid(){return this.item.botType===bt.GRID},isDca(){return this.item.botType===bt.DCA}},methods:{getDirectionClass:pi,getDirectionText:mi}},rl={class:"item-wrapper"},nl={class:"header"},ol={class:"market-name"},ll={class:"name"},cl={class:"type"},dl={class:"type"},ul={key:1,class:"type"},hl={class:"body"},gl={key:0,class:"item-row"},pl={class:"title"},ml={class:"value"},yl={class:"bold"},vl={class:"item-row"},fl={class:"title"},bl={class:"value"},Cl={class:"bold"},Sl={class:"item-row"},Tl={class:"title"},wl={class:"value"},Dl={class:"creator"},Il={class:"creator-name bold"},Pl={key:2,class:"item-row"},kl={class:"title"},$l={class:"value"},xl={class:"num bold"},Bl={class:"currency"},Ll={class:"item-row"},Nl={class:"title"},_l={class:"value"},Rl={class:"num bold"},Ml={class:"item-row"},Al={class:"title"},Ol={class:"value"},El={class:"num bold"},Ul={key:0,class:"item-row"},Fl={class:"title"},Hl={class:"value"},zl={class:"num bold"},Gl={class:"currency"},Wl={key:1,class:"item-row"},Vl={class:"title"},Zl={class:"value"},Yl={class:"num bold"},jl={class:"currency"},ql={class:"item-row"},Kl={class:"title"},Ql={class:"bolder"},Xl={class:"percent"},Jl={class:"currency"},tc={key:5,class:"item-row"},ec={class:"title"},ic={class:"value"},ac={class:"num bold"},sc={class:"percent"},rc={class:"currency"},nc={key:6,class:"item-row"},oc={class:"title"},lc={class:"value"},cc={class:"num bold"},dc={class:"percent"},uc={class:"currency"},hc={key:7,class:"item-row"},gc={class:"title"},pc={class:"value"},mc={class:"bold"},yc={class:"currency"},vc={key:8,class:"item-row"},fc={class:"title"},bc={class:"value"},Cc={class:"bold"},Sc={class:"item-row"},Tc={class:"title"},wc={class:"value"},Dc={class:"bold"},Ic={key:9,class:"item-row"},Pc={class:"title"},kc={class:"value"},$c={class:"bold"},xc={class:"footer"};const Bc=Ie(sl,[["render",function(t,e,o,l,c,d){const u=i("BrandIcon"),p=i("Avatar"),m=i("BaseButton"),f=i("IconDetail"),C=i("IconShare2");return s(),h("div",rl,[n("div",nl,[n("div",ol,[b(u,{name:o.item.symbol.split("-")[0],size:"16",showName:!1}
1,null,8,["name"]),n("span",null,y(o.item.symbolText),1)]),n("div",{class:v(["market-type",d.getDirectionClass(o.item.direction)])},[n("div",ll,y(o.item.botTypeText),1),d.isGrid?(s(),h($,{key:0},[n("div",cl,y(d.getDirectionText(o.item.direction)),1),n("div",dl,y(o.item.detail.initialLeverage||Number(o.item.detail.leverage))+"x ",1)],64)):(s(),h("div",ul,y(o.item.directionText),1))],2)]),n("div",hl,[o.isPublished?(s(),h("div",gl,[n("div",pl,y(t.$t("t.publishDate")),1),n("div",ml,[n("div",yl,y(t.$filters.formatDate(o.item.publishedAt,"yyyy-MM-dd")),1)])])):g("",!0),o.isPurchased?(s(),h($,{key:1},[n("div",vl,[n("div",fl,y(t.$t("strategy.purchasedDate")),1),n("div",bl,[n("div",Cl,y(t.$filters.formatDate(o.item.purchasedAt,"yyyy-MM-dd")),1)])]),n("div",Sl,[n("div",Tl,y(t.$t("t.creator")),1),n("div",wl,[n("div",Dl,[c.enableAccountAvatar?(s(),a(p,{key:0,class:"creator-avatar",avatarId:o.item.creatorAvatarType||c.DEFAULT_AVATAR_ID},null,8,["avatarId"])):g("",!0),n("div",Il,y(o.item.creatorNickname||o.item.creatorShareId),1)])])])],64)):g("",!0),o.isPublished||o.isPurchased?(s(),h("div",Pl,[n("div",kl,y(t.$t("t.price")),1),n("div",$l,[n("div",xl,y(t.$filters.formatNumber(o.item.salePrice)),1),n("div",Bl,y(o.item.saleCurrency||"USDT"),1)])])):g("",!0),o.isPublished?(s(),h($,{key:3},[n("div",Ll,[n("div",Nl,y(t.$t("strategy.soldAmount")),1),n("div",_l,[n("div",Rl,y(t.$filters.formatNumber(o.item.saleCount,0)),1)])]),n("div",Ml,[n("div",Al,y(t.$t("strategy.totalRevenue")),1),n("div",Ol,[n("div",El,y(t.$filters.formatNumber(o.item.saleProfit)),1),e[6]||(e[6]=n("div",{class:"currency"},"USDT",-1))])])],64)):g("",!0),o.isRunning||o.isHistory?(s(),h($,{key:4},[d.isGrid?(s(),h("div",Ul,[n("div",Fl,y(t.$t("futuresMain.changeRiskLimit.initialMargin")),1),n("div",Hl,[n("div",zl,y(t.$filters.formatNumber(o.item.detail.initialMargin)),1),n("div",Gl,y(o.item.settleInCurrency),1)])])):g("",!0),d.isDca?(s(),h("div",Wl,[n("div",Vl,y(t.$t("t.totalInvestment")),1),n("div",Zl,[n("div",Yl,y(o.item.detail.totalInvestment),1),n("div",jl,y(o.item.tradeCurrency),1)])])):g("",!0),n("div",ql,[n("div",Kl,y(t.$t("trading.bot.grid.totalPnl")),1),n("div",{class:v(["value",{positive:Number(o.item.totalRoi)>0,negative:Number(o.item.totalRoi)<0}])},[n("div",Ql,y(t.$filters.formatNumber(o.item.totalProfit,{key:2,signed:!0})),1),n("div",Xl," ("+y(t.$filters.formatNumber(o.item.totalRoi,{key:2,signed:!0,postfix:"%"}))+") ",1),n("div",Jl,y(o.item.settleInCurrency),1)],2)])],64)):g("",!0),o.isRunning&&d.isGrid?(s(),h("div",tc,[n("div",ec,y(t.$t("trading.bot.grid.matchedProfits")),1),n("div",ic,[n("div",ac,y(t.$filters.formatNumber(o.item.realizedProfit)),1),n("div",sc," ("+y(t.$filters.formatNumber(o.item.realizedRoi,{key:2,signed:!0,postfix:"%"}))+") ",1),n("div",rc,y(o.item.settleInCurrency),1)])])):g("",!0),o.isRunning&&d.isGrid?(s(),h("div",nc,[n("div",oc,y(t.$t("trading.bot.grid.unmatchedProfits")),1),n("div",lc,[n("div",cc,y(t.$filters.formatNumber(o.item.unrealizedProfit)),1),n("div",dc," ("+y(t.$filters.formatNumber(o.item.unrealizedRoi,{key:2,signed:!0,postfix:"%"}))+") ",1),n("div",uc,y(o.item.settleInCurrency),1)])])):g("",!0),o.isRunning||o.isHistory?(s(),h("div",hc,[n("div",gc,y(t.$t("t.duration")),1),n("div",pc,[n("div",mc,y(o.item.duration.replace(/-/g," ")),1),n("div",yc," ("+y(t.$filters.formatDate(o.item.createdAt,"yyyy-MM-dd"))+") ",1)])])):g("",!0),o.isHistory?(s(),h("div",vc,[n("div",fc,y(t.$t("t.closedTime")),1),n("div",bc,[n("div",Cc,y(t.$filters.formatDate(o.item.closedAt,"yyyy-MM-dd")),1)])])):g("",!0),n("div",Sc,[n("div",Tc,y(t.$t("t.status")),1),n("div",wc,[n("div",Dc,y(o.getStatusText(o.isPublished?o.item:o.item.state)),1)])]),o.isHistory?(s(),h("div",Ic,[n("div",Pc,y(t.$t("t.reason")),1),n("div",kc,[n("div",$c,y(o.getReasonText(o.item.state,o.item.reason)),1)])])):g("",!0)]),n("div",xc,[o.isRunning?(s(),h($,{key:0},[o.item.isPublishing?(s(),a(m,{key:0,class:"published-btn",onClick:o.onGoPublished},{default:r((()=>[S(y(t.$t("t.published")),1)])),_:1},8,["onClick"])):(s(),a(m,{key:1,class:"primary",onClick:e[0]||(e[0]=t=>o.onPublish(o.item))},{default:r((()=>[S(y(t.$t("t.publish")),1)])),_:1}))],64)):g("",!0),o.isRunning||o.isHistory?(s(),h($,{key:1},[b(f,{width:"24",height:"24",onClick:e[1]||(e[1]=t=>o.onToDetail(o.item))}),b(C,{width:"24",height:"24",onClick:e[2]||(e[2]=t=>o.onShare(o.item))})],64)):g("",!0),o.isPublished?(s(),h($,{key:2},[b(m,{class:v(["primary",{hidden:!o.item.isPublishing}]),onClick:e[3]||(e[3]=t=>o.onDelist(o.item))},{default:r((()=>[S(y(t.$t("strategy.delist")),1)])),_:1},8,["class"]),b(f,{width:"24",height:"24",onClick:e[4]||(e[4]=t=>o.onOpenRecord(o.item))})],64)):g("",!0),o.isPurchased?(s(),a(m,{key:3,class:"primary",onClick:e[5]||(e[5]=t=>o.onCopy(o.item))},{default:r((()=>[S(y(t.$t("msg.copy")),1)])),_:1})):g("",!0)])])}],["__scopeId","data-v-f81896bf"]]),Lc={name:"PublishStrategyDialog",components:{BrandDialog:Qt,TradingInput:oi},props:{show:{type:Boolean,required:!0},isLoading:{type:Boolean,default:!1}},emits:["update:show","submit"],data:()=>({price:0}),methods:{handleClose(){this.$emit("update:show",!1)},handleSave(){this.$emit("submit",this.price)}}},Nc={class:"body-wrapper"},_c={class:"input-label"},Rc={class:"input-container"},Mc={class:"btns"};const Ac=Ie(Lc,[["render",function(t,e,o,l,c,d){const u=i("TradingInput"),h=i("BaseButton"),g=i("BrandDialog");return s(),a(g,{width:t.isMobile?"100%":"500px",isBrandNewStyle:"",onClosed:d.handleClose},{header:r((()=>
1[S(y(t.$t("strategy.dialog.publishHeader")),1)])),body:r((()=>[n("div",Nc,[n("div",_c,y(t.$t("strategy.decidePrice")),1),n("div",Rc,[b(u,{value:c.price,"onUpdate:value":e[0]||(e[0]=t=>c.price=t),label:"",min:0,max:1e6,step:1,enableThousandSeparator:"",maxDecimalPlaces:0},null,8,["value"]),e[2]||(e[2]=n("div",{class:"currency"},"USDT",-1))]),n("div",Mc,[b(h,{class:"primary w-100",size:"large",disabled:""===c.price,isLoading:o.isLoading,onClick:d.handleSave},{default:r((()=>[S(y(t.$t("t.save")),1)])),_:1},8,["disabled","isLoading","onClick"]),n("div",{class:"cancel-btn",onClick:e[1]||(e[1]=(...t)=>d.handleClose&&d.handleClose(...t))},y(t.$t("t.cancel")),1)])])])),_:1},8,["width","onClosed"])}],["__scopeId","data-v-793f3801"]]),{enableSpotTrade:Oc,enableFuturesTrade:Ec}=It,Uc={RUNNING:"RUNNING",HISTORY:"HISTORY"},Fc={name:"MyStrategyList",components:{SortableHeaderCell:be,BrandIcon:ot,IconDetail:Qo,IconShare2:fs,Pagination:de,EmptyListContent:il,MobileListItem:Bc,SharePnlDialog:Ja,PublishStrategyDialog:Ac,WarningConfirmDialog:fe,Switcher:ve,WalletDropdown:ye},data:()=>({FUTURES_BASE_CURRENCY:we,SWITCHER_TYPE:Te,theme:Se,STATE_TABS:Uc,stateTab:"",list:[],pagination:{currentPage:1,pageSize:10,totalRows:0,totalPages:0},isLoading:!1,isShowShareDialog:!1,isShowPublishDialog:!1,sharingBotData:{},publishingBotData:{},isPublishing:!1,isShowFailPublishDialog:!1,marketType:"",botType:"",botTypeCount:[],BigNumber:l}),computed:{...d(["lang"]),...T(Y,["getExchangeInfoBySymbol"]),isInRunningTab(){return this.stateTab===Uc.RUNNING},isGrid(){return this.botType===bt.GRID},tableTitles(){return[{id:"market",lang:this.$t("account.account.my-fees.market"),tab:[Uc.RUNNING,Uc.HISTORY]},this.isGrid?{id:"iniMargin",lang:this.$t("futuresMain.changeRiskLimit.initialMargin"),textAlign:"right",tab:[Uc.RUNNING,Uc.HISTORY]}:{id:"totalInvestment",lang:this.$t("t.totalInvestment"),textAlign:"right",tab:[Uc.RUNNING,Uc.HISTORY]},{id:"totalRoi",lang:this.$t("trading.bot.grid.totalPnl"),textAlign:"right",tab:[Uc.RUNNING,Uc.HISTORY]},this.isGrid&&{id:"matchedProfit",lang:this.$t("trading.bot.grid.matchedProfits"),textAlign:"right",tab:[Uc.RUNNING]},this.isGrid&&{id:"unmatchedPnl",lang:this.$t("trading.bot.grid.unmatchedProfits"),textAlign:"right",tab:[Uc.RUNNING]},{id:"duration",lang:this.$t("t.duration"),tab:[Uc.RUNNING,Uc.HISTORY]},{id:"closedTime",lang:this.$t("t.timeClosed"),tab:[Uc.HISTORY]},{id:"status",lang:this.$t("t.status"),tab:[Uc.RUNNING,Uc.HISTORY]},{id:"reason",lang:this.$t("t.reason"),tab:[Uc.HISTORY]},{id:"action",lang:this.$t("account.myApi.table.action"),tab:[Uc.RUNNING,Uc.HISTORY]}].filter((t=>t)).filter((t=>t.tab.includes(this.stateTab)))},subSwitchList(){return[{id:bt.GRID,title:this.$t("t.futuresGrid"),isDisabled:!Ec},{id:bt.DCA,title:this.$t("t.spotDca"),isDisabled:!Oc}].filter((t=>!(null==t?void 0:t.isDisabled)))},botsCount(){const t={[bt.GRID]:0,[bt.DCA]:0};return this.botTypeCount.forEach((e=>{t[e.botType]=e.count})),Object.values(t)},botTypeOptions(){return[{value:Uc.RUNNING,name:this.$t("order.active")},{value:Uc.HISTORY,name:this.$t("t.history")}]},formattedList(){return this.list.map((t=>{var e,i;if(t.symbolText=this.isGrid?t.symbol:`${t.symbol}/${t.quoteCurrency}`,t.botTypeText=this.isGrid?this.$t("t.futuresGrid"):this.$t("t.spotDca"),t.settleInCurrency=St(t.symbol),this.botType===bt.DCA){const a=this.getExchangeInfoBySymbol(t.symbol),s="LONG"===t.direction,r=s?null==a?void 0:a.priceDecimal:null==a?void 0:a.sizeDecimal;t.detail.totalInvestment=this.$filters.formatNumber(t.detail.totalInvestment,r||"max8"),t.directionText=`${this.capitalizeFirst(null==(i=null==(e=t.detail)?void 0:e.cycle)?void 0:i.period)} ${s?this.$t("t.buy"):this.$t("t.sell")}`,t.tradeCurrency=s?t.quoteCurrency:t.baseCurrency;try{const e=Number(t.detail.totalIncome),i=Number(t.detail.totalInvestment);t.averageEntryPrice=Ni({isLong:s,totalInvestment:i,totalIncome:e})}catch{t.averageEntryPrice=""}}return t}))}},watch:{stateTab(t){t===Uc.HISTORY?this.getHistoryBots():this.getRunningBots()}},created(){const t=new URLSearchParams(window.location.search),e=t.get("botType"),i=t.get("stateTab");this.botType=e||bt.GRID,this.stateTab=i||Uc.RUNNING,this.marketType=e===bt.DCA?Pt.SPOT:Pt.FUTURES},methods:{capitalizeFirst:me,async getRunningBots(t=1){this.isLoading=!0;try{const{data:e}=await Gt.getTradingBots({marketType:this.marketType,botType:this.botType,page:t,pageSize:this.pagination.pageSize,getAllBotC
1ount:!0});this.list=e.tradingBots||[],this.botTypeCount=e.botTypeCount||[],this.pagination.currentPage=e.currentPage,this.pagination.totalPages=e.totalPages,this.pagination.totalRows=e.totalRows}finally{this.isLoading=!1}},async getHistoryBots(t=1){this.isLoading=!0;try{const{data:e}=await Gt.getTradingBotHistory({marketType:this.marketType,botType:this.botType,page:t,pageSize:this.pagination.pageSize,getAllBotCount:!0});this.list=e.tradingBots||[],this.botTypeCount=e.botTypeCount||[],this.pagination.currentPage=e.currentPage,this.pagination.totalPages=e.totalPages,this.pagination.totalRows=e.totalRows}finally{this.isLoading=!1}},getReasonText(t,e){return t===it.CLOSED?"-":this.$t(Ce[e])},getBotStatusText:ki,handlePublish(t){this.publishingBotData=t,this.isShowPublishDialog=!0},handleGoPublished(){this.$router.push({name:Wt.MY_STRATEGY,params:{lang:this.lang,tab:2},query:{s:Date.now()}})},async handleSubmitPublish(t){const{tradingBotId:e}=this.publishingBotData;this.isPublishing=!0;try{await Gt.publishBot(e,{salePrice:String(t)}),this.isShowPublishDialog=!1,this.getRunningBots(this.pagination.currentPage)}catch(i){20000013===i&&(this.isShowFailPublishDialog=!0)}finally{this.isPublishing=!1}},handlePageChange(t){this.isInRunningTab?this.getRunningBots(t):this.getHistoryBots(t)},handleSizeChange(t){this.pagination.pageSize=t,this.handlePageChange(1)},goToDetail({symbol:t,tradingBotId:e,botType:i,quoteCurrency:a}){this.$router.push({name:i===bt.GRID?Wt.FUTURES_GRID_BOT_DETAIL:Wt.SPOT_DCA_BOT_DETAIL,params:{lang:this.lang,id:this.isGrid?t:`${t}-${a}`,botId:e}})},handleShare(t){const e={...t,leverage:t.detail.initialLeverage,percentage:Number(t.totalRoi)};this.sharingBotData=e,this.isShowShareDialog=!0},getDirectionClass:pi,getDirectionText:mi,onSubSwitcherSelect(t){this.botType=t,this.marketType=t===bt.GRID?Pt.FUTURES:Pt.SPOT,this.handlePageChange(1)},handleUpdateBotType(t){this.stateTab=t}}},Hc={class:"table-container"},zc={class:"switch-wrapper"},Gc={class:"table-wrapper"},Wc={class:"market-name"},Vc={class:"name"},Zc={class:"type"},Yc={class:"type"},jc={key:1,class:"type"},qc={class:"num"},Kc={class:"currency"},Qc={class:"currency"},Xc={class:"bold"},Jc={class:"percent"},td={class:"currency"},ed={class:"percent"},id={class:"currency"},ad={class:"percent"},sd={class:"currency"},rd={class:"num"},nd={class:"currency"},od={class:"action-wrapper"},ld={class:"pagi-wrapper"},cd={class:"dialog-text"};const dd=Ie(Fc,[["render",function(t,e,o,l,c,d){const m=i("Switcher"),f=i("WalletDropdown"),C=i("SortableHeaderCell"),T=i("HeaderRow"),w=i("BrandIcon"),D=i("Cell"),I=i("BaseButton"),P=i("IconDetail"),k=i("IconShare2"),B=i("Row"),L=i("DataTable"),N=i("MobileListItem"),_=i("EmptyListContent"),R=i("Pagination"),M=i("SharePnlDialog"),A=i("PublishStrategyDialog"),O=i("WarningConfirmDialog"),E=u("loading");return p((s(),h("div",Hc,[n("div",zc,[b(m,{class:"sub-switcher",barHeight:4,type:c.SWITCHER_TYPE.BOTTOM_BAR_NARROW,theme:c.theme.compact,itemList:d.subSwitchList,selected:c.botType,isDefaultSelectedKey:!1,count:d.botsCount,onSelect:d.onSubSwitcherSelect},null,8,["type","theme","itemList","selected","count","onSelect"]),b(f,{ref:"botTypeDropdown",class:"dropdown",list:d.botTypeOptions,defaultValue:c.stateTab,handleUpdate:d.handleUpdateBotType},null,8,["list","defaultValue","handleUpdate"])]),n("div",Gc,[t.isMobile?(s(!0),h($,{key:1},x(d.formattedList,((t,e)=>(s(),a(N,{key:e,item:t,onPublish:d.handlePublish,onGoPublished:d.handleGoPublished,onToDetail:d.goToDetail,onShare:d.handleShare,isRunning:d.isInRunningTab,isHistory:!d.isInRunningTab,getReasonText:d.getReasonText,getStatusText:d.getBotStatusText},null,8,["item","onPublish","onGoPublished","onToDetail","onShare","isRunning","isHistory","getReasonText","getStatusText"])))),128)):(s(),a(L,{key:0},{header:r((()=>[b(T,{textAlign:"left"},{default:r((()=>[(s(!0),h($,null,x(d.tableTitles,(t=>(s(),a(C,{key:t.id,title:t,textAlign:t.textAlign},{content:r((()=>[S(y(t.lang),1)])),_:2},1032,["title","textAlign"])))),128))])),_:1})])),body:r((()=>[(s(!0),h($,null,x(d.formattedList,((e,i)=>
1(s(),a(B,{key:i,index:i,disableBackground:""},{default:r((()=>[b(D,{textAlign:"left"},{default:r((()=>[n("div",Wc,[b(w,{name:e.symbol.split("-")[0],size:"16",showName:!1},null,8,["name"]),n("span",null,y(e.symbolText),1)]),n("div",{class:v(["market-type",d.getDirectionClass(e.direction)])},[n("div",Vc,y(e.botTypeText),1),d.isGrid?(s(),h($,{key:0},[n("div",Zc,y(d.getDirectionText(e.direction)),1),n("div",Yc,y(e.detail.initialLeverage)+"x",1)],64)):(s(),h("div",jc,y(e.directionText),1))],2)])),_:2},1024),d.isGrid?(s(),a(D,{key:0},{default:r((()=>[n("div",qc,y(t.$filters.formatNumber(e.detail.initialMargin)),1),n("div",Kc,y(e.settleInCurrency),1)])),_:2},1024)):(s(),a(D,{key:1},{default:r((()=>[S(y(e.detail.totalInvestment)+" ",1),n("div",Qc,y(e.tradeCurrency),1)])),_:2},1024)),b(D,{class:v(["roi",{positive:Number(e.totalRoi)>0,negative:Number(e.totalRoi)<0}])},{default:r((()=>[n("div",Xc,y(t.$filters.formatNumber(d.isGrid?e.totalProfit:e.totalProfitInUsdt,{formatKey:2,signed:!0})),1),n("div",Jc," ("+y(t.$filters.formatNumber(e.totalRoi,{formatKey:2,signed:!0,postfix:"%",roundMode:c.BigNumber.ROUND_HALF_UP}))+") ",1),n("div",td,y(d.isGrid?e.settleInCurrency:c.FUTURES_BASE_CURRENCY),1)])),_:2},1032,["class"]),d.isGrid&&d.isInRunningTab?(s(),h($,{key:2},[b(D,{class:"roi"},{default:r((()=>[n("div",null,y(t.$filters.formatNumber(e.realizedProfit)),1),n("div",ed," ("+y(t.$filters.formatNumber(e.realizedRoi,{formatKey:2,signed:!0,postfix:"%",roundMode:c.BigNumber.ROUND_HALF_UP}))+") ",1),n("div",id,y(e.settleInCurrency),1)])),_:2},1024),b(D,{class:"roi"},{default:r((()=>[n("div",null,y(t.$filters.formatNumber(e.unrealizedProfit)),1),n("div",ad," ("+y(t.$filters.formatNumber(e.unrealizedRoi,{formatKey:2,signed:!0,postfix:"%",roundMode:c.BigNumber.ROUND_HALF_UP}))+") ",1),n("div",sd,y(e.settleInCurrency),1)])),_:2},1024)],64)):g("",!0),b(D,{textAlign:"left"},{default:r((()=>[n("div",rd,y(e.duration.replace(/-/g," ")),1),n("div",nd," ("+y(t.$filters.formatDate(e.createdAt,"yyyy-MM-dd"))+") ",1)])),_:2},1024),d.isInRunningTab?g("",!0):(s(),a(D,{key:3,textAlign:"left"},{default:r((()=>[S(y(t.$filters.formatDate(e.closedAt,"yyyy-MM-dd")),1)])),_:2},1024)),b(D,{textAlign:"left"},{default:r((()=>[S(y(d.getBotStatusText(e.state)),1)])),_:2},1024),d.isInRunningTab?g("",!0):(s(),a(D,{key:4,textAlign:"left"},{default:r((()=>[S(y(d.getReasonText(e.state,e.reason)),1)])),_:2},1024)),b(D,{textAlign:"left"},{default:r((()=>[n("div",od,[d.isInRunningTab?(s(),h($,{key:0},[e.isPublishing?(s(),a(I,{key:0,class:"published-btn",onClick:d.handleGoPublished},{default:r((()=>[S(y(t.$t("t.published")),1)])),_:1},8,["onClick"])):(s(),a(I,{key:1,class:"primary",onClick:t=>d.handlePublish(e)},{default:r((()=>[S(y(t.$t("t.publish")),1)])),_:2},1032,["onClick"]))],64)):g("",!0),b(P,{width:"24",height:"24",onClick:t=>d.goToDetail(e)},null,8,["onClick"]),b(k,{width:"24",height:"24",onClick:t=>d.handleShare(e)},null,8,["onClick"])])])),_:2},1024)])),_:2},1032,["index"])))),128))])),_:1})),d.formattedList.length?g("",!0):(s(),a(_,{key:2}))]),n("div",ld,[c.isLoading?g("",!0):(s(),a(R,{key:0,class:"pagination",layout:"prev, pager, next, jumper, sizes",total:c.pagination.totalRows,pageSize:c.pagination.pageSize,totalPages:c.pagination.totalPages,currentPage:c.pagination.currentPage,background:!1,onHandleCurrentChangeP:d.handlePageChange,onHandleSizeChangeP:d.handleSizeChange},null,8,["total","pageSize","totalPages","currentPage","onHandleCurrentChangeP","onHandleSizeChangeP"]))]),c.isShowShareDialog?(s(),a(M,{key:0,show:c.isShowShareDialog,"onUpdate:show":e[0]||(e[0]=t=>c.isShowShareDialog=t),position:c.sharingBotData,isBotSharing:"",forceDayTheme:""},null,8,["show","position"])):g("",!0),c.isShowPublishDialog?(s(),a(A,{key:1,show:c.isShowPublishDialog,"onUpdate:show":e[1]||(e[1]=t=>c.isShowPublishDialog=t),isLoading:c.isPublishing,onSubmit:d.handleSubmitPublish},null,8,["show","isLoading","onSubmit"])):g("",!0),b(O,{visible:c.isShowFailPublishDialog,"onUpdate:visible":e[3]||(e[3]=t=>c.isShowFailPublishDialog=t)},{buttons:r((()=>[b(I,{class:"primary w-100",size:"large",onClick:e[2]||(e[2]=t=>
1c.isShowFailPublishDialog=!1)},{default:r((()=>[S(y(t.$t("t.ok")),1)])),_:1})])),default:r((()=>[n("p",cd,y(t.$t("strategy.dialog.publish.failed.1")),1)])),_:1},8,["visible"])])),[[E,c.isLoading,"streamingLight"]])}],["__scopeId","data-v-9899e29a"]]),ud={class:"body-wrapper"},hd={ref:"listArea",class:"list-area"},gd=["index"],pd={class:"date"},md={class:"info"},yd={class:"nickname"},vd={class:"price"},fd={class:"num"},bd={class:"currency"},Cd={ref:"loadMore"},Sd={class:"price"},Td={class:"num"},wd={class:"currency"},Dd={ref:"loadMore"},Id={class:"btns"};const Pd={name:"PublishedStrategyList",components:{SortableHeaderCell:be,BrandIcon:ot,IconDetail:Qo,Pagination:de,EmptyListContent:il,MobileListItem:Bc,WarningConfirmDialog:fe,PurchasedUsersDialog:Ie({name:"PurchasedUsersDialog",components:{BrandDialog:Qt},props:{tradingBotId:{type:String,default:""}},emits:["update:visible"],data:()=>({list:[],currentPage:0,totalPages:1,isLoading:!1}),computed:{visible:{get(){return this.$attrs.visible},set(t){return this.$emit("update:visible",t)}}},watch:{visible(t){t&&this.tradingBotId&&(this.initComponent(),this.$nextTick((()=>{this.initObserver()})))}},methods:{handleClose(){this.$emit("update:visible",!1)},initComponent(){this.list=[],this.currentPage=0,this.totalPages=1},async getList(t=1){this.isLoading=!0;try{const{data:e}=await Gt.getTradingBotBuyers(this.tradingBotId,{page:t,pageSize:20,sorting:"createdAt:DESC"});this.totalPages=e.totalPages,this.list=this.list.concat(e.tradingBotBuyers)}catch(e){}finally{this.isLoading=!1}},initObserver(){const{listArea:t,loadMore:e}=this.$refs,i={root:t,rootMargin:"0px",threshold:0};this.observer=new IntersectionObserver((()=>{this.isLoading||this.currentPage>=this.totalPages||(this.currentPage++,this.getList(this.currentPage))}),i),this.observer.observe(e)}}},[["render",function(t,e,o,l,c,d){const g=i("Cell"),m=i("HeaderRow"),v=i("Row"),f=i("DataTable"),C=i("BaseButton"),T=i("BrandDialog"),w=u("loading");return s(),a(T,{visible:d.visible,"onUpdate:visible":e[0]||(e[0]=t=>d.visible=t),width:t.isMobile?"100%":"500px",isBrandNewStyle:""},{header:r((()=>[S(y(t.$t("t.records")),1)])),body:r((()=>[n("div",ud,[p((s(),h("div",hd,[t.isMobile?(s(),h($,{key:0},[(s(!0),h($,null,x(c.list,((e,i)=>(s(),h("div",{key:i,class:"mobile-record-item",index:i},[n("div",pd,y(t.$filters.formatDate(e.createdAt,"yyyy-MM-dd")),1),n("div",md,[n("div",yd,y(e.buyerNickname||e.buyerShareId),1),n("div",vd,[n("div",fd,y(t.$filters.formatNumber(e.salePrice)),1),n("div",bd,y(e.saleCurrency),1)])])],8,gd)))),128)),n("div",Cd,null,512)],64)):(s(),a(f,{key:1},{header:r((()=>[b(m,null,{default:r((()=>[b(g,{textAlign:"left"},{default:r((()=>[S(y(t.$t("t.date")),1)])),_:1}),b(g,{textAlign:"left"},{default:r((()=>[S(y(t.$t("t.nickname")),1)])),_:1}),b(g,null,{default:r((()=>[S(y(t.$t("t.price")),1)])),_:1})])),_:1})])),body:r((()=>[(s(!0),h($,null,x(c.list,((e,i)=>(s(),a(v,{key:i,index:i},{default:r((()=>[b(g,{textAlign:"left"},{default:r((()=>[S(y(t.$filters.formatDate(e.createdAt,"yyyy-MM-dd")),1)])),_:2},1024),b(g,{textAlign:"left"},{default:r((()=>[S(y(e.buyerNickname||e.buyerShareId),1)])),_:2},1024),b(g,null,{default:r((()=>[n("div",Sd,[n("div",Td,y(t.$filters.formatNumber(e.salePrice)),1),n("div",wd,y(e.saleCurrency),1)])])),_:2},1024)])),_:2},1032,["index"])))),128)),n("div",Dd,null,512)])),_:1}))])),[[w,c.isLoading,"streamingLight"]]),n("div",Id,[b(C,{class:"primary w-100",size:"large",onClick:d.handleClose},{default:r((()=>[S(y(t.$t("t.ok")),1)])),_:1},8,["onClick"])])])])),_:1},8,["visible","width"])}],["__scopeId","data-v-1ab6754e"]])},data:()=>({BOT_TYPE:bt,list:[],pagination:{currentPage:1,pageSize:10,totalRows:0,totalPages:0},isLoading:!1,isShowDelistDialog:!1,isShowRecordsDialog:!1,delistingBotData:{},isDelisting:!1,fetchingId:"",isShowFailDelistDialog:!1}),computed:{...d(["lang"]),tableTitles(){return[{id:"publishDate",lang:this.$t("t.publishDate")},{id:"market",lang:this.$t("account.account.my-fees.market")},{id:"strategyPrice",lang:this.$t("t.price"),textAlign:"right"},{id:"soldAmount",lang:this.$t("strategy.soldAmount"),textAlign:"right"},{id:"totalIncome",lang:this.$t("strategy.totalRevenue"),textAlign:"right"},{id:"status",lang:this.$t("t.status")},{id:"action",lang:this.$t("account.myApi.table.action")}]},formattedList(){return this.list.map((t=>{var e,i;const a=t.botType===bt.GRID,s="LONG"===t.direction;
1return t.symbolText=a?t.symbol:`${t.symbol}/${t.quoteCurrency}`,t.botTypeText=a?this.$t("t.futuresGrid"):this.$t("t.spotDca"),t.directionText=`${this.capitalizeFirst(null==(i=null==(e=t.detail)?void 0:e.cycle)?void 0:i.period)} ${s?this.$t("t.buy"):this.$t("t.sell")}`,t}))}},created(){this.getList()},methods:{async getList(t=1){this.isLoading=!0;try{const{data:e}=await Gt.getMyPublishedBots({page:t,pageSize:this.pagination.pageSize});this.list=e.tradingBotSales||[],this.pagination.currentPage=e.currentPage,this.pagination.totalPages=e.totalPages,this.pagination.totalRows=e.totalRows}finally{this.isLoading=!1}},getStatusText(t){return t.isPublishing?this.$t("t.published"):this.$t("t.delisted")},handleDelist(t){this.delistingBotData=t,this.isShowDelistDialog=!0},async handleSubmitDelist(){const{tradingBotId:t}=this.delistingBotData;this.isDelisting=!0;try{await Gt.delistBot(t),this.getList(this.pagination.currentPage)}catch(e){20000013===e&&(this.isShowFailDelistDialog=!0)}finally{this.isDelisting=!1}this.closeDelistDialog()},closeDelistDialog(){this.isShowDelistDialog=!1},async handleOpenRecord(t){const{tradingBotId:e}=t;this.fetchingId=e,this.isShowRecordsDialog=!0},handlePageChange(t){this.getList(t)},handleSizeChange(t){this.pagination.pageSize=t,this.handlePageChange(1)},getDirectionClass:pi,getDirectionText:mi,capitalizeFirst:me}},kd={class:"table-container"},$d={class:"table-wrapper"},xd={class:"market-name"},Bd={class:"name"},Ld={class:"type"},Nd={class:"type"},_d={key:1,class:"type"},Rd={class:"num"},Md={class:"num"},Ad={class:"action-wrapper"},Od={class:"pagi-wrapper"},Ed={class:"confirm-text"},Ud={class:"dialog-text"};const Fd=Ie(Pd,[["render",function(t,e,o,l,c,d){const m=i("SortableHeaderCell"),f=i("HeaderRow"),C=i("Cell"),T=i("BrandIcon"),w=i("BaseButton"),D=i("IconDetail"),I=i("Row"),P=i("DataTable"),k=i("MobileListItem"),B=i("EmptyListContent"),L=i("Pagination"),N=i("WarningConfirmDialog"),_=i("PurchasedUsersDialog"),R=u("loading");return p((s(),h("div",kd,[n("div",$d,[t.isMobile?(s(!0),h($,{key:1},x(d.formattedList,((t,e)=>(s(),a(k,{key:e,item:t,onDelist:d.handleDelist,onOpenRecord:d.handleOpenRecord,isPublished:"",getStatusText:d.getStatusText},null,8,["item","onDelist","onOpenRecord","getStatusText"])))),128)):(s(),a(P,{key:0},{header:r((()=>[b(f,{textAlign:"left"},{default:r((()=>[(s(!0),h($,null,x(d.tableTitles,(t=>(s(),a(m,{key:t.id,title:t,textAlign:t.textAlign},{content:r((()=>[S(y(t.lang),1)])),_:2},1032,["title","textAlign"])))),128))])),_:1})])),body:r((()=>[(s(!0),h($,null,x(d.formattedList,((i,o)=>(s(),a(I,{key:o,index:o,disableBackground:""},{default:r((()=>[b(C,{textAlign:"left"},{default:r((()=>[S(y(t.$filters.formatDate(i.publishedAt,"yyyy-MM-dd")),1)])),_:2},1024),b(C,{textAlign:"left"},{default:r((()=>[n("div",xd,[b(T,{name:i.symbol.split("-")[0],size:"16",showName:!1},null,8,["name"]),n("span",null,y(i.symbolText),1)]),n("div",{class:v(["market-type",d.getDirectionClass(i.direction)])},[n("div",Bd,y(i.botTypeText),1),i.botType===c.BOT_TYPE.GRID?(s(),h($,{key:0},[n("div",Ld,y(d.getDirectionText(i.direction)),1),n("div",Nd,y(Number(i.detail.leverage))+"x",1)],64)):(s(),h("div",_d,y(i.directionText),1))],2)])),_:2},1024),b(C,null,{default:r((()=>[n("div",Rd,y(t.$filters.formatNumber(i.salePrice)),1),e[5]||(e[5]=n("div",{class:"currency"},"USDT",-1))])),_:2,__:[5]},1024),b(C,null,{default:r((()=>[S(y(t.$filters.formatNumber(i.saleCount,0)),1)])),_:2},1024),b(C,null,{default:r((()=>[n("div",Md,y(t.$filters.formatNumber(i.saleProfit)),1),e[6]||(e[6]=n("div",{class:"currency"},"USDT",-1))])),_:2,__:[6]},1024),b(C,{textAlign:"left"},{default:r((()=>[S(y(d.getStatusText(i)),1)])),_:2},1024),b(C,{textAlign:"left"},{default:r((()=>[n("div",Ad,[b(w,{class:v(["primary",{hidden:!i.isPublishing}]),onClick:t=>d.handleDelist(i)},{default:r((()=>[S(y(t.$t("strategy.delist")),1)])),_:2},1032,["class","onClick"]),b(D,{width:"24",height:"24",onClick:t=>d.handleOpenRecord(i)},null,8,["onClick"])])])),_:2},1024)])),_:2},1032,["index"])))),128))])),_:1})),d.formattedList.length?g("",!0):(s(),a(B,{key:2}))]),n("div",Od,[c.isLoading?g("",!0):(s(),a(L,{key:0,class:"pagination",layout:"prev, pager, next, jumper, sizes",total:c.pagination.totalRows,pageSize:c.pagination.pageSize,totalPages:c.pagination.totalPages,currentPage:c.pagination.currentPage,background:!1,onHandleCurrentChangeP:d.handlePageChange,onHandleSizeChangeP:d.handleSizeChange},null,8,["total","pageSize","totalPages","currentPage","onHandleCurrentChangeP","onHandleSizeChangeP"]))]),b(N,{visible:c.isS
1howDelistDialog,"onUpdate:visible":e[1]||(e[1]=t=>c.isShowDelistDialog=t)},{buttons:r((()=>[b(w,{class:"primary w-100",size:"large",isLoading:c.isDelisting,onClick:d.handleSubmitDelist},{default:r((()=>[S(y(t.$t("strategy.dialog.delistYes")),1)])),_:1},8,["isLoading","onClick"]),n("div",{class:"cancel-btn",onClick:e[0]||(e[0]=(...t)=>d.closeDelistDialog&&d.closeDelistDialog(...t))},y(t.$t("t.cancel")),1)])),default:r((()=>[n("p",Ed,y(t.$t("strategy.dialog.delistConfirm")),1)])),_:1},8,["visible"]),b(_,{visible:c.isShowRecordsDialog,"onUpdate:visible":e[2]||(e[2]=t=>c.isShowRecordsDialog=t),tradingBotId:c.fetchingId},null,8,["visible","tradingBotId"]),b(N,{visible:c.isShowFailDelistDialog,"onUpdate:visible":e[4]||(e[4]=t=>c.isShowFailDelistDialog=t)},{buttons:r((()=>[b(w,{class:"primary w-100",size:"large",onClick:e[3]||(e[3]=t=>c.isShowFailDelistDialog=!1)},{default:r((()=>[S(y(t.$t("t.ok")),1)])),_:1})])),default:r((()=>[n("p",Ud,y(t.$t("strategy.dialog.delist.failed.1")),1)])),_:1},8,["visible"])])),[[R,c.isLoading,"streamingLight"]])}],["__scopeId","data-v-491c040e"]]),{enableAccountAvatar:Hd}=It,zd={name:"PurchasedStrategyList",components:{SortableHeaderCell:be,BrandIcon:ot,Pagination:de,EmptyListContent:il,MobileListItem:Bc,Avatar:Vt,StrategyDialog:go},data:()=>({BOT_TYPE:bt,DEFAULT_AVATAR_ID:Zt,enableAccountAvatar:Hd,list:[],pagination:{currentPage:1,pageSize:10,totalRows:0,totalPages:0},isLoading:!1,showCopyDialog:!1}),computed:{...d(["lang"]),tableTitles(){return[{id:"purchaseDate",lang:this.$t("strategy.purchasedDate")},{id:"market",lang:this.$t("account.account.my-fees.market")},{id:"creatot",lang:this.$t("t.creator")},{id:"strategyPrice",lang:this.$t("t.price"),textAlign:"right"},{id:"status",lang:this.$t("t.status")},{id:"action",lang:this.$t("account.myApi.table.action")}]},formattedList(){return this.list.map((t=>{var e,i;const a=t.botType===bt.GRID,s="LONG"===t.direction;return t.symbolText=a?t.symbol:`${t.symbol}/${t.quoteCurrency}`,t.botTypeText=a?this.$t("t.futuresGrid"):this.$t("t.spotDca"),t.directionText=`${this.toTitleCase(null==(i=null==(e=t.detail)?void 0:e.cycle)?void 0:i.period)} ${s?this.$t("t.buy"):this.$t("t.sell")}`,t}))}},created(){this.getList()},methods:{async getList(t=1){this.isLoading=!0;try{const{data:e}=await Gt.getMyPurchasedBots({page:t,pageSize:this.pagination.pageSize});this.list=e.purchasedTradingBots||[],this.pagination.currentPage=e.currentPage,this.pagination.totalPages=e.totalPages,this.pagination.totalRows=e.totalRows}finally{this.isLoading=!1}},getBotStatusText:ki,async handleCopy(t){let e=t;try{const{data:t}=await Gt.getPurchasedBotConfig(e.tradingBotId);e={...e,...t.data.tradingBot},this.dialogStrategyData=e,this.showCopyDialog=!0}catch(i){}},handlePageChange(t){this.getList(t)},handleSizeChange(t){this.pagination.pageSize=t,this.handlePageChange(1)},getDirectionClass:pi,getDirectionText:mi,toTitleCase:t=>t?t.replace(/\w\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()})):""}},Gd={class:"table-container"},Wd={class:"table-wrapper"},Vd={class:"market-name"},Zd={class:"name"},Yd={class:"type"},jd={class:"type"},qd={key:1,class:"type"},Kd={class:"creator"},Qd={class:"creator-name"},Xd={class:"num"},Jd={class:"currency"},tu={class:"action-wrapper"},eu={class:"pagi-wrapper"};const iu=Ie(zd,[["render",function(t,e,o,l,c,d){const m=i("SortableHeaderCell"),f=i("HeaderRow"),C=i("Cell"),T=i("BrandIcon"),w=i("Avatar"),D=i("BaseButton"),I=i("Row"),P=i("DataTable"),k=i("MobileListItem"),B=i("EmptyListContent"),L=i("Pagination"),N=i("StrategyDialog"),_=u("loading");return p((s(),h("div",Gd,[n("div",Wd,[t.isMobile?(s(!0),h($,{key:1},x(d.formattedList,((t,e)=>(s(),a(k,{key:e,item:t,onCopy:d.handleCopy,isPurchased:"",getStatusText:d.getBotStatusText},null,8,["item","onCopy","getStatusText"])))),128)):(s(),a(P,{key:0},{header:r((()=>[b(f,{textAlign:"left"},{default:r((()=>[(s(!0),h($,null,x(d.tableTitles,(t=>(s(),a(m,{key:t.id,title:t,textAlign:t.textAlign},{content:r((()=>[S(y(t.lang),1)])),_:2},1032,["title","textAlign"])))),128))])),_:1})])),body:r((()=>[(s(!0),h($,null,x(d.formattedList,((e,i)=>
1(s(),a(I,{key:i,index:i,disableBackground:""},{default:r((()=>[b(C,{textAlign:"left"},{default:r((()=>[S(y(t.$filters.formatDate(e.purchasedAt,"yyyy-MM-dd")),1)])),_:2},1024),b(C,{textAlign:"left"},{default:r((()=>[n("div",Vd,[b(T,{name:e.symbol.split("-")[0],size:"16",showName:!1},null,8,["name"]),n("span",null,y(e.symbolText),1)]),n("div",{class:v(["market-type",d.getDirectionClass(e.direction)])},[n("div",Zd,y(e.botTypeText),1),e.botType===c.BOT_TYPE.GRID?(s(),h($,{key:0},[n("div",Yd,y(d.getDirectionText(e.direction)),1),n("div",jd,y(Number(e.detail.leverage))+"x",1)],64)):(s(),h("div",qd,y(e.directionText),1))],2)])),_:2},1024),b(C,{textAlign:"left"},{default:r((()=>[n("div",Kd,[c.enableAccountAvatar?(s(),a(w,{key:0,class:"creator-avatar",avatarId:e.creatorAvatarType||c.DEFAULT_AVATAR_ID},null,8,["avatarId"])):g("",!0),n("div",Qd,y(e.creatorNickname||e.creatorShareId),1)])])),_:2},1024),b(C,null,{default:r((()=>[n("div",Xd,y(t.$filters.formatNumber(e.salePrice)),1),n("div",Jd,y(e.saleCurrency),1)])),_:2},1024),b(C,{textAlign:"left"},{default:r((()=>[S(y(d.getBotStatusText(e.state)),1)])),_:2},1024),b(C,{textAlign:"left"},{default:r((()=>[n("div",tu,[b(D,{class:"primary",onClick:t=>d.handleCopy(e)},{default:r((()=>[S(y(t.$t("msg.copy")),1)])),_:2},1032,["onClick"])])])),_:2},1024)])),_:2},1032,["index"])))),128))])),_:1})),d.formattedList.length?g("",!0):(s(),a(B,{key:2}))]),n("div",eu,[c.isLoading?g("",!0):(s(),a(L,{key:0,class:"pagination",layout:"prev, pager, next, jumper, sizes",total:c.pagination.totalRows,pageSize:c.pagination.pageSize,totalPages:c.pagination.totalPages,currentPage:c.pagination.currentPage,background:!1,onHandleCurrentChangeP:d.handlePageChange,onHandleSizeChangeP:d.handleSizeChange},null,8,["total","pageSize","totalPages","currentPage","onHandleCurrentChangeP","onHandleSizeChangeP"]))]),c.showCopyDialog?(s(),a(N,{key:0,strategy:t.dialogStrategyData,isPurchased:"",onClose:e[0]||(e[0]=t=>c.showCopyDialog=!1)},null,8,["strategy"])):g("",!0)])),[[_,c.isLoading,"streamingLight"]])}],["__scopeId","data-v-61e1a4df"]]),{enableSpotTrade:au,enableFuturesTrade:su}=It,ru={name:"CreateBotDialog",components:{BrandDialog:Qt},props:{show:{type:Boolean,required:!0}},emits:["update:show"],computed:{...d(["lang"]),botList(){const t=[];return su&&t.push({icon:"/static/img/bkjndS1d.svg",title:this.$t("t.futuresGrid"),description:this.$t("trading.bot.createBot.grid.description")}),au&&t.push({icon:"/static/img/Bj-ZhJAr.svg",title:this.$t("t.spotDca"),description:this.$t("trading.bot.createBot.dca.description")}),t}},methods:{handleClose(){this.$emit("update:show",!1)},handleClickBot(t){0!==t?this.$router.push({name:"tradingId",params:{id:"BTC-USDT",lang:this.lang},state:{tradeType:bt.DCA}}):this.$router.push({name:"futuresId",params:{id:"BTC-PERP",lang:this.lang},state:{tradeType:ie.GRID}})}}},nu={class:"content"},ou=["onClick"],lu={class:"bot-header"},cu=["src"],du={class:"bot-description"};const uu=Ie(ru,[["render",function(t,e,o,l,c,d){const u=i("BrandDialog");return s(),a(u,{width:t.isMobile?"100%":"888px",isBrandNewStyle:"",onClosed:d.handleClose},{header:r((()=>[S(y(t.$t("strategy.createNow")),1)])),body:r((()=>[n("div",nu,[(s(!0),h($,null,x(d.botList,((t,e)=>(s(),h("div",{key:t.title,class:"bot",onClick:t=>d.handleClickBot(e)},[n("div",lu,[n("img",{src:t.icon,width:"48px"},null,8,cu),n("p",null,y(t.title),1)]),n("div",du,y(t.description),1)],8,ou)))),128))])])),_:1},8,["width","onClosed"])}],["__scopeId","data-v-fcc25619"]]);$e([xe,Be,Le,Ne]);const hu={name:"MyStrategy",components:{MyStrategyInfo:Ko,IconChevronRight:Yt,MyStrategyList:dd,PublishedStrategyList:Fd,PurchasedStrategyList:iu,IconPlus:De,Tooltip:Ut,CreateBotDialog:uu},data:()=>({ROUTE_NAME:Wt,currentTab:1,showCreateBotDialog:!1}),computed:{...d(["lang","accountInfo","isApp"]),tabList(){return[{id:1,label:this.$t("strategy.myStrategy"),tooltip:this.$t("strategy.tooltip.myBots")},{id:3,label:this.$t("strategy.purchasedStrategy"),tooltip:this.$t("strategy.tooltip.purchasedBots")},{id:2,label:this.$t("strategy.publishedStrategy"),tooltip:this.$t("strategy.tooltip.publishedBots")}]}},watch:{accountInfo(t,e){(null==e?void 0:e.uid)&&t.uid!==e.uid&&window.location.reload()},"$route.params"({tab:t}){t&&(this.currentTab=Number(t))}},created(){const t=this.$route.params.tab;t&&(this.currentTab=Number(t))}},gu={class:"my-strategy-container"},pu={class:"my-strategy-wrapper"},mu={class:"bread-nav"},yu=["onClick"],vu={class:"nav-item active"},fu={class:"tab-row"},bu={class:"tabs"},Cu=["onClick"],Su={class:"table-content"};const Tu=Ie(hu,[["render",function(t,e,o,l,c,d){const u=i("router-link"),p=i("IconChevronRight"),m=i("MyStrategyInfo"),f=i("Tooltip"),C=i("IconPlus"),T=i("BaseButton"),w=i("MyStrategyList"),D=i("PublishedStrategyList"),I=i("PurchasedStrategyList"),P=i("CreateBotDialog");return s(),h("div",gu,[n("div",pu,[n("div",mu,[b(u,{to:{name:c.ROUTE_NAME.COPY_STRATEGY,params:{lang:t.lang}},custom:""},{default:r((({navigate:e})=>[n("div",{class:"nav-item",role:"link",onClick:e},y(t.$t("t.copyStrategy")),9,yu)])),_:1},8,["to"]),b(p,{class:"nav-arrow",width:"16",height:"16"}),n("div",vu,y(t.$t("strategy.myStrategy")),1)]),b(m),n("div",fu,[n("div",bu,[(s(!0),h($,null,x(d.tabList,(t=>(s(),h("div",{key:t.id,class:v(["tab",{active:c.currentTab===t.id}]),onClick:e=>c.currentTab=t.id},[b(f,{content:t.label,tooltip:t.tooltip},null,8,["content","tooltip"])],10,Cu)))),128))]),t.isApp?g("",!0):(s(),a(T,{key:0,class:"primary create-btn",size:"large",onClick:e[0]||(e[0]=t=>c.showCreateBotDialog=!0)},{default:r((()=>[b(C,{class:"icon-plus"}),S(" "+y(t.$t("strategy.createNow")),1)])),_:1}))]),n("div",Su,[1===c.currentTab?(s(),a(w,{key:0})):2===c.currentTab?(s(),a(D,{key:1})):3===c.currentTab?(s(),a(I,{key:2})):g("",!0)])]),c.showCreateBotDialog?(s(),a(P,{key:0,show:c.showCreateBotDialog,"onUpdate:show":e[1]||(e[1]=t=>c.showCreateBotDialog=t)},null,8,["show"])):g("",!0)])}],["__scopeId","data-v-50453522"]]),wu=Object.freeze(Object.defineProperty({__proto__:null,default:Tu},Symbol.toStringTag,{value:"Module"}));
1export{Ni as A,ps as B,Bi as C,fs as D,ws as E,gs as F,ci as G,di as H,Ee as I,ui as J,hi as K,gi as L,Qo as M,qe as N,Ke as O,Qe as P,Fo as Q,ys as R,Ja as S,oi as T,wu as U,Ps as W,Fe as _,Ue as a,Ze as b,Ye as c,li as d,ts as e,ls as f,mi as g,He as h,Ve as i,yi as j,vi as k,fi as l,_i as m,bi as n,Ci as o,Si as p,Ti as q,Di as r,ki as s,wi as t,Oe as u,Ii as v,Pi as w,us as x,vs as y,Li as z}; 2//# sourceMappingURL=cvxruSMo.js.map
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.