1import{q as U,b4 as j,b3 as V,u as G,r as w,b as I,z as R,b5 as Q,b6 as l,b7 as n,b8 as o,ba as r,bb as d,bI as h,b9 as s,a6 as p,ac as P,bx as _,bw as f,bc as i,bd as x,bC as C,bE as Y,aZ as H}from"./index-CqTW0gwL.js";import{Q as J}from"./QSpinnerDots-De-IVVYn.js";import{Q as O}from"./QBanner-DaqGlO9v.js";import{Q as A}from"./QBadge-CKyhOArA.js";import{Q as Z}from"./QPage-D-M_E9XA.js";import{Q as K,a as W}from"./QLayout-CcFHfjkw.js";import{T as X}from"./TradeChartViewer-CwaEjnSP.js";import{u as ee}from"./useTimeFormat-qkTSNmJ1.js";import{_ as se}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./QResizeObserver-BSaGMVXC.js";import"./QChip-Bt5HE8Pr.js";import"./QBtnToggle-ByNOzY0E.js";import"./QBtnGroup-CXBnNi4J.js";import"./QTooltip-Bz8A02FK.js";import"./position-engine-DctTkrBz.js";import"./selection-B-35Dxh9.js";import"./lightweight-charts.production-B4TW5rUF.js";import"./use-quasar-CzXAgSgL.js";import"./index-D2sxJ5CD.js";import"./symbolNormalization-CbmFdDY9.js";import"./symbols-Cm7bt_1O.js";import"./sessionPlans-BmoW8wRW.js";import"./network-CJVvY9Rp.js";import"./trades-BeyEDV2n.js";import"./plans-CS4aYuWG.js";import"./settings-BlDI1tHw.js";import"./relationships-DTc1iCEU.js";const te={key:0,class:"top-banner"},ae={class:"banner-content"},oe={class:"banner-text text-on-primary"},le={key:1,class:"flex flex-center",style:{"min-height":"80vh"}},ie={key:2,class:"q-pa-lg"},re={class:"text-body1 te-text-secondary q-mb-lg"},ne={key:3,class:"q-pa-md"},de={key:0,class:"q-mb-lg"},ce={class:"row items-center justify-between"},ue={class:"col-auto q-pl-md"},ve={class:"row q-col-gutter-md"},me={class:"col-12 col-md-6"},pe={class:"row items-center q-mb-md"},_e={class:"text-h3"},fe={key:0,class:"text-body1 te-text-secondary q-mb-xs"},ye={class:"row q-col-gutter-sm q-mt-md"},xe={class:"col-6"},be={class:"text-h6 metric-value"},he={class:"text-caption te-text-secondary"},ge={class:"col-6"},ke={key:0,class:"text-h6 metric-value"},Te={key:1,class:"text-h6 te-text-secondary"},qe={key:2,class:"text-caption te-text-secondary"},we={key:0,class:"col-12 col-md-6"},Pe={class:"text-right"},Le={class:"row q-col-gutter-sm q-mt-md justify-end"},De={class:"col-auto text-center"},Ce={class:"metric-card"},Fe={class:"text-h5 metric-value"},Se={key:0,class:"col-auto text-center"},$e={class:"metric-card"},Qe={class:"text-h6 metric-value"},Ae={key:1,class:"col-auto text-center"},Ee={class:"metric-card"},ze={class:"text-h6"},Me={class:"row q-col-gutter-md"},Be={class:"col-12 col-md-6"},Ne={class:"text-h6 q-mb-md"},Ue={class:"detail-row"},je={class:"detail-value"},Ve={class:"detail-row"},Ge={class:"detail-value"},Ie={key:0,class:"detail-row"},Re={class:"detail-value"},Ye={class:"detail-row"},He={class:"detail-value"},Je={key:1,class:"detail-row"},Oe={class:"detail-value"},Ze={key:2,class:"detail-row"},Ke={class:"detail-value"},We={class:"col-12 col-md-6"},Xe={class:"text-h6 q-mb-md"},es={key:0,class:"detail-row"},ss={class:"detail-value"},ts={key:1,class:"detail-row"},as={key:2,class:"detail-row"},os={class:"detail-value"},ls={key:3,class:"detail-row"},is={class:"detail-value"},rs={class:"detail-row"},ns={key:4,class:"detail-row"},ds={class:"detail-value"},cs={key:5,class:"detail-row"},us={key:0,class:"col-12"},vs={class:"text-h6 q-mb-md"},ms={class:"trade-notes"},ps={key:1,class:"col-12"},_s={class:"text-h6 q-mb-md"},fs=["src"],ys={key:2,class:"col-12"},xs={class:"text-h6 q-mb-md"},bs={key:0,class:"analysis-section"},hs={class:"analysis-content"},gs={key:1,class:"analysis-section"},ks={class:"analysis-content"},Ts={key:2,class:"analysis-section"},qs={class:"analysis-content"},ws={key:1,class:"q-mt-md"},Ps={class:"row q-col-gutter-md justify-center"},Ls={class:"col-auto"},Ds=U({__name:"PublicTradePage",setup(Cs){const E=j(),z=V(),L=G(),{formatTime:F}=ee(),t=w(null),g=w([]),k=w(!0),b=w(null),u=I(()=>{if(!t.value)return null;if(g.value.length<=1)return t.value;const a=g.value;return{...t.value,quantity:a.reduce((e,c)=>e+c.quantity,0),profitLoss:a.reduce((e,c)=>e+c.profitLoss,0),netProfitLoss:a.reduce((e,c)=>e+(c.netProfitLoss??c.profitLoss),0),fees:a.reduce((e,c)=>e+(c.fees??0),0)||void 0}}),T=a=>{if(!a)return"â";let e;if(typeof a=="object"&&"toDate"in a&&typeof a.toDate=="function")e=a.toDate();else if(typeof a=="object"&&"_seconds"in a)e=new Date(a._seconds*1e3);else if(a instanceof Date)e=a;
1else if(typeof a=="string")e=new Date(a);else return"â";return e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},M=a=>{if(a<60)return`${a}m`;if(a<1440){const e=Math.floor(a/60),c=a%60;return c>0?`${e}h ${c}m`:`${e}h`}else{const e=Math.floor(a/1440),c=Math.floor(a%1440/60);return c>0?`${e}d ${c}h`:`${e}d`}},q=a=>{if(a){if(typeof a=="object"&&"_seconds"in a)return new Date(a._seconds*1e3);if(a instanceof Date)return a;if(typeof a=="string")return new Date(a)}},B=async a=>{try{k.value=!0,b.value=null;const e=Y(),m=(await H(e,"getPublicTrade")({shareToken:a})).data;if(console.log("[PublicTradePage] Received data from backend:",{success:m.success,hasGroupedTrades:!!m.groupedTrades,groupedTradesLength:m.groupedTrades?.length??0,groupedTrades:m.groupedTrades}),m.success&&m.trade){const S=v=>{const $=q(v.entryDate);if($&&(v.entryDate=$),v.exitDate){const y=q(v.exitDate);y&&(v.exitDate=y)}if(v.createdAt){const y=q(v.createdAt);y&&(v.createdAt=y)}if(v.updatedAt){const y=q(v.updatedAt);y&&(v.updatedAt=y)}return v};t.value=S(m.trade),m.groupedTrades&&m.groupedTrades.length>0&&(g.value=m.groupedTrades.map(S))}else b.value=m.error??"Trade not found or not publicly accessible"}catch(e){console.error("Error fetching public trade:",e);const c=e instanceof Error?e.message:"This trade is not publicly accessible or does not exist.";b.value=c}finally{k.value=!1}},D=()=>{window.open("https://tradersedge.io","_blank")},N=()=>{z.push("/")};return R(async()=>{const a=E.params.token;if(!a){b.value="Invalid share link",k.value=!1;return}await B(a)}),(a,e)=>(l(),Q(W,{view:"hHh lpR fFf"},{default:n(()=>[o(K,null,{default:n(()=>[o(Z,{class:"public-trade-page"},{default:n(()=>[h(L).user?(l(),r("div",te,[s("div",ae,[s("div",oe,[o(p,{name:"insights",size:"24px",class:"q-mr-sm"}),e[0]||(e[0]=s("span",{class:"banner-message"},"View your trades and analytics in your dashboard",-1))]),o(P,{unelevated:"",color:"grey-10","text-color":"primary",label:"Go to Dashboard","icon-right":"arrow_forward",onClick:N,"no-caps":"",class:"banner-cta"})])])):d("",!0),k.value?(l(),r("div",le,[o(J,{color:"primary",size:"50px"})])):b.value?(l(),r("div",ie,[o(_,{class:"te-card error-card q-mx-auto",style:{"max-width":"600px"}},{default:n(()=>[o(f,{class:"text-center"},{default:n(()=>[o(p,{name:"error_outline",size:"64px",color:"negative",class:"q-mb-md"}),e[1]||(e[1]=s("div",{class:"text-h5 q-mb-md"},"Trade Not Found",-1)),s("div",re,i(b.value),1),o(P,{unelevated:"",color:"primary",label:"Create Your Free Account",icon:"person_add",onClick:D,size:"lg"})]),_:1})]),_:1})])):t.value?(l(),r("div",ne,[h(L).user?d("",!0):(l(),r("div",de,[o(O,{rounded:"",class:"bg-gradient-primary text-on-primary"},{avatar:n(()=>[o(p,{name:"trending_up",size:"lg"})]),default:n(()=>[s("div",ce,[e[2]||(e[2]=s("div",{class:"col"},[s("div",{class:"text-h6 text-weight-bold"},"Find Your Edge in Trading"),s("div",{class:"text-body2 q-mt-xs"}," Track, analyze, and improve your trading performance with TradersEdge ")],-1)),s("div",ue,[o(P,{unelevated:"",color:"grey-10","text-color":"primary",label:"Start Free Trial","icon-right":"arrow_forward",onClick:D,"no-caps":""})])])]),_:1})])),o(_,{class:"te-card q-mb-lg"},{default:n(()=>[o(f,{class:"page-header"},{default:n(()=>[s("div",ve,[s("div",me,[s("div",pe,[s("span",_e,[x(i(t.value.symbol)+" ",1),o(A,{color:t.value.direction==="long"?"positive":"negative",label:t.value.direction.toUpperCase(),class:"q-ml-sm"},null,8,["color","label"]),t.value.outcome?(l(),Q(A,{key:0,color:t.value.outcome==="win"?"positive":t.value.outcome==="loss"?"negative":"grey",label:t.value.outcome.toUpperCase(),class:"q-ml-sm"},null,8,["color","label"])):d("",!0)])]),t.value.assetClass?(l(),r("div",fe,[o(p,{name:"category",size:"sm",class:"q-mr-xs"}),x(" "+i(t.value.assetClass.charAt(0).toUpperCase()+t.value.assetClass.slice(1)),1)])):d("",!0),s("div",ye,[s("div",xe,[e[3]||(e[3]=s("div",{class:"text-caption te-text-secondary"},"Entry",-1)),s("div",be,"$"+i(t.value.entryPrice.toFixed(2)),1),s("div",he,i(T(t.value.entryDate)),1)]),s("div",ge,[e[4]||(e[4]=s("div",{class:"text-caption te-text-secondary"}
1,"Exit",-1)),t.value.exitPrice?(l(),r("div",ke," $"+i(t.value.exitPrice.toFixed(2)),1)):(l(),r("div",Te,"â")),t.value.exitDate?(l(),r("div",qe,i(T(t.value.exitDate)),1)):d("",!0)])])]),u.value?(l(),r("div",we,[s("div",Pe,[e[8]||(e[8]=s("div",{class:"text-caption te-text-secondary q-mb-xs"},"Profit & Loss",-1)),s("div",{class:C(["text-h2 metric-value",{"text-positive":(u.value.netProfitLoss||u.value.profitLoss)>0,"text-negative":(u.value.netProfitLoss||u.value.profitLoss)<0}])},i((u.value.netProfitLoss||u.value.profitLoss)>=0?"+":"")+"$"+i((u.value.netProfitLoss||u.value.profitLoss).toFixed(2)),3),s("div",Le,[s("div",De,[s("div",Ce,[e[5]||(e[5]=s("div",{class:"text-caption te-text-secondary"},"Quantity",-1)),s("div",Fe,i(u.value.quantity),1)])]),u.value.fees?(l(),r("div",Se,[s("div",$e,[e[6]||(e[6]=s("div",{class:"text-caption te-text-secondary"},"Fees",-1)),s("div",Qe," $"+i(u.value.fees.toFixed(2)),1)])])):d("",!0),u.value.duration?(l(),r("div",Ae,[s("div",Ee,[e[7]||(e[7]=s("div",{class:"text-caption te-text-secondary"},"Duration",-1)),s("div",ze,i(M(u.value.duration)),1)])])):d("",!0)])])])):d("",!0)])]),_:1})]),_:1}),o(_,{class:"te-card q-mb-lg"},{default:n(()=>[o(f,null,{default:n(()=>[o(X,{trade:t.value,"grouped-trades":g.value},null,8,["trade","grouped-trades"])]),_:1})]),_:1}),s("div",Me,[s("div",Be,[o(_,{class:"te-card"},{default:n(()=>[o(f,null,{default:n(()=>[s("div",Ne,[o(p,{name:"login",class:"q-mr-sm"}),e[9]||(e[9]=x(" Entry Details ",-1))]),s("div",Ue,[e[10]||(e[10]=s("span",{class:"detail-label"},"Price:",-1)),s("span",je,"$"+i(t.value.entryPrice.toFixed(2)),1)]),s("div",Ve,[e[11]||(e[11]=s("span",{class:"detail-label"},"Date:",-1)),s("span",Ge,i(T(t.value.entryDate)),1)]),t.value.entryTime?(l(),r("div",Ie,[e[12]||(e[12]=s("span",{class:"detail-label"},"Time:",-1)),s("span",Re,i(h(F)(t.value.entryTime)),1)])):d("",!0),s("div",Ye,[e[13]||(e[13]=s("span",{class:"detail-label"},"Quantity:",-1)),s("span",He,i(t.value.quantity),1)]),t.value.stopLoss?(l(),r("div",Je,[e[14]||(e[14]=s("span",{class:"detail-label"},"Stop Loss:",-1)),s("span",Oe,"$"+i(t.value.stopLoss.toFixed(2)),1)])):d("",!0),t.value.takeProfit?(l(),r("div",Ze,[e[15]||(e[15]=s("span",{class:"detail-label"},"Take Profit:",-1)),s("span",Ke,"$"+i(t.value.takeProfit.toFixed(2)),1)])):d("",!0)]),_:1})]),_:1})]),s("div",We,[o(_,{class:"te-card"},{default:n(()=>[o(f,null,{default:n(()=>[s("div",Xe,[o(p,{name:"logout",class:"q-mr-sm"}),e[16]||(e[16]=x(" Exit Details ",-1))]),t.value.exitPrice?(l(),r("div",es,[e[17]||(e[17]=s("span",{class:"detail-label"},"Price:",-1)),s("span",ss,"$"+i(t.value.exitPrice.toFixed(2)),1)])):(l(),r("div",ts,[...e[18]||(e[18]=[s("span",{class:"detail-label"},"Status:",-1),s("span",{class:"detail-value text-info"},"Open Position",-1)])])),t.value.exitDate?(l(),r("div",as,[e[19]||(e[19]=s("span",{class:"detail-label"},"Date:",-1)),s("span",os,i(T(t.value.exitDate)),1)])):d("",!0),t.value.exitTime?(l(),r("div",ls,[e[20]||(e[20]=s("span",{class:"detail-label"},"Time:",-1)),s("span",is,i(h(F)(t.value.exitTime)),1)])):d("",!0),s("div",rs,[e[21]||(e[21]=s("span",{class:"detail-label"},"P&L:",-1)),s("span",{class:C(["detail-value",{"text-positive":t.value.profitLoss>0,"text-negative":t.value.profitLoss<0}])},i(t.value.profitLoss>=0?"+":"")+"$"+i(t.value.profitLoss.toFixed(2)),3)]),t.value.fees?(l(),r("div",ns,[e[22]||(e[22]=s("span",{class:"detail-label"},"Fees:",-1)),s("span",ds,"$"+i(t.value.fees.toFixed(2)),1)])):d("",!0),t.value.netProfitLoss?(l(),r("div",cs,[e[23]||(e[23]=s("span",{class:"detail-label"},"Net P&L:",-1)),s("span",{class:C(["detail-value",{"text-positive":t.value.netProfitLoss>0,"text-negative":t.value.netProfitLoss<0}])},i(t.value.netProfitLoss>=0?"+":"")+"$"+i(t.value.netProfitLoss.toFixed(2)),3)])):d("",!0)]),_:1})]),_:1})]),t.value.notes?(l(),r("div",us,[o(_,{class:"te-card"},{default:n(()=>[o(f,null,{default:n(()=>[s("div",vs,[o(p,{name:"notes",class:"q-mr-sm"}),e[24]||(e[24]=x(" Trade Notes ",-1))]),s("div",ms,i(t.value.notes),1)]),_:1})]),_:1})])):d("",!0),t.value.screenshotUrl?(l(),r("div",ps,[o(_,{class:"te-card"},{default:n(()=>[o(f,null,{default:n(()=>[s("div",_s,[o(p,{name:"image",class:"q-mr-sm"}),e[25]||(e[25]=x(" Trade Screenshot ",-1))]),s("img",{src:t.value.screenshotUrl,alt:"Trade Screenshot",class:"screenshot-image"},null,8,fs)]),_:1})]),_:1})])):d("",!0),t.value.emotionalState||t.value.mistakesMade||t.value.lessonsLearned?(l(),r("div",ys,[o(_,{class:"te-card"},{default:n(()=>[o(f,null,{default:n(()=>
1[s("div",xs,[o(p,{name:"psychology",class:"q-mr-sm"}),e[26]||(e[26]=x(" Trade Analysis ",-1))]),t.value.emotionalState?(l(),r("div",bs,[e[27]||(e[27]=s("div",{class:"analysis-label"},"Emotional State:",-1)),s("div",hs,i(t.value.emotionalState),1)])):d("",!0),t.value.mistakesMade?(l(),r("div",gs,[e[28]||(e[28]=s("div",{class:"analysis-label"},"Mistakes Made:",-1)),s("div",ks,i(t.value.mistakesMade),1)])):d("",!0),t.value.lessonsLearned?(l(),r("div",Ts,[e[29]||(e[29]=s("div",{class:"analysis-label"},"Lessons Learned:",-1)),s("div",qs,i(t.value.lessonsLearned),1)])):d("",!0)]),_:1})]),_:1})])):d("",!0)]),h(L).user?d("",!0):(l(),r("div",ws,[o(_,{class:"te-card cta-card"},{default:n(()=>[o(f,{class:"text-center q-pa-xl"},{default:n(()=>[e[30]||(e[30]=s("div",{class:"text-h4 text-weight-bold q-mb-md"},"Start Tracking Your Trades",-1)),e[31]||(e[31]=s("div",{class:"text-h6 te-text-secondary q-mb-lg"}," Join thousands of traders improving their performance with TradersEdge ",-1)),s("div",Ps,[s("div",Ls,[o(P,{unelevated:"",color:"primary",label:"Create Free Account",icon:"person_add",onClick:D,size:"lg","no-caps":""})])])]),_:1})]),_:1})]))])):d("",!0)]),_:1})]),_:1})]),_:1}))}}),ot=se(Ds,[["__scopeId","data-v-547cd14a"]]);export{ot as default};
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.