PageSourceSearch

https://www.vogaz.com/chunk-YV24QEBL.js

js vogaz.com collected 2026-10-07 19:00:43 UTC 698,370 bytes, 33 lines download raw bytes

1import{a as zr,b as lo}from"./chunk-COFZENZN.js";import{$ as us,A as me,B as ft,C as rt,D as Ee,E as Wt,F as rs,G as ss,H as bi,I as zn,J as as,K as ls,L as Vt,M as Bt,N as _n,O as $e,P as ut,Q as cs,R as ee,S as mt,T as It,U as Q,V as fn,W as fe,X as ds,Y as ps,Z as yi,_ as Y,a as ge,aa as ms,b as _e,ba as hs,c as je,ca as Fe,d as es,da as _s,e as Ke,ea as fs,f as Ot,fa as xs,g as Mt,ga as bs,h as ts,ha as ys,i as _t,ia as Cs,j as po,k as ns,l as Et,m as Tt,n as j,o as ue,p as ie,q as Xt,r as xi,s as In,t as ot,u as gn,v as Pe,w as is,x as pt,y as kn,z as os}from"./chunk-PWQKLZIJ.js";import{a as Zr,b as se}from"./chunk-ZU5T4S3M.js";import{a as Tn}from"./chunk-DJAHR5YI.js";import{a as gs}from"./chunk-N4XUM3IG.js";import"./chunk-D4JPTZPE.js";import{Ha as Yr,Ma as Xr,Oa as Wr,R as Kr,X as co,fa as $r,ga as Qr,s as jr}from"./chunk-UJPX3TB7.js";import{a as Jr}from"./chunk-YBGODZKT.js";import{i as te,w as ye,y as ne}from"./chunk-22PG4C6G.js";import"./chunk-K64CTUVM.js";import{D as qr,E as dt,F as fi,b as gi,c as vt,e as wt,g as ct,h as Rr,k as Dr,l as Yt,m as Nr,n as _i,p as Fr,q as Lr,r as Ar,t as Ur,u as Hr,v as Vr,w as Br}from"./chunk-Y5V43S4P.js";import{g as En}from"./chunk-QGI2N47H.js";import"./chunk-UF7BX22N.js";import{a as Gn,b as Gr}from"./chunk-7GYQYITI.js";import"./chunk-M7JCRRPW.js";import{d as kr}from"./chunk-MM7N2KJB.js";import"./chunk-V4X73WZR.js";import"./chunk-QUJFQN2Y.js";import"./chunk-FPQYVCR7.js";import"./chunk-PBAOHQWW.js";import"./chunk-T7UGIX2C.js";import"./chunk-J65STJXU.js";import"./chunk-R7PRHIS3.js";import"./chunk-E4BAR5R2.js";import{e as Mr,n as Er,o as Tr,p as Ir}from"./chunk-QLIHVSOV.js";import{f as Ge,h as ze,i as st,l as hi,m as wr,p as Or,q as Mn,s as St}from"./chunk-TLLYEBPA.js";import{a as we}from"./chunk-BU6NSJCR.js";import{i as at,l as lt,m as Ne}from"./chunk-HAPKHYWR.js";import{$ as gr,$b as G,Aa as fr,Ab as L,Ac as hn,Cb as yr,Cc as ke,D as dr,Da as vn,Dc as Re,Ec as De,F as pr,Fb as P,Fc as vr,G as cn,Ga as ce,Ha as qe,Ic as Ct,J as ur,Ja as X,Jc as ao,Ka as E,Kc as gt,La as di,Lc as Ve,M as dn,Ma as O,Nc as z,Oc as Pt,Pc as W,Qb as H,Qc as Ht,R as ci,Rb as b,S as mr,Sb as Se,Sc as it,Tb as w,Ub as J,V as hr,Xb as C,Xc as mi,Yb as He,Zb as et,_b as q,a as be,aa as _r,ac as a,ba as Je,bc as l,ca as Ut,cc as y,cd as Qt,dc as tt,dd as M,ec as nt,ed as re,f as pe,fc as Cr,g as lr,gc as R,ia as U,ib as xr,jc as _,k as ln,kc as u,lb as un,lc as pi,mb as c,mc as ui,na as V,oa as D,qc as jt,r as At,rb as br,rc as Kt,s as Ae,sb as Z,sc as $t,tc as On,uc as Pr,v as cr,va as ve,vb as wn,vc as mn,wa as S,wc as d,xa as v,xc as T,y as Ue,ya as pn,yc as g,zc as Sr}from"./chunk-M42JVFCA.js";import"./chunk-PTM2QU7L.js";import"./chunk-Z7QLWI7J.js";import"./chunk-DNXVUVY2.js";import"./chunk-TFGWRAC6.js";import"./chunk-THB3M52Y.js";import"./chunk-5LCCWDBB.js";import"./chunk-7GKJZC2Y.js";import"./chunk-JIWQYZVS.js";import"./chunk-ARFGPUPD.js";import"./chunk-MTHZ7MWU.js";import"./chunk-WI5MSH4N.js";import"./chunk-7WJGOJPZ.js";import"./chunk-CKP3SGE2.js";import"./chunk-AHZIVFQW.js";import{a as f,b as F,e as so,i as k}from"./chunk-FBFWB55K.js";var Ps=i=>{let o=Xl(i.data);return{title:i.title||i.message||"-",value:o.map(([r,e])=>({spot_info:F(f({},e.spot_info),{instrument_token:Number(e.spot_info.instrument_token||r)}),direction:e.direction??{priceDirection:"none",changeDirection:e.spot_info.change>0?"positive_change":e.spot_info.change<0?"negative_change":"none"},spread_values:{spot_futures:0,spot_synthetic_futures:0,futures_synthetic_futures:0},futures_spread:{},futures_matrix:{},mispricing:Wl(tc(e)),spread_prices:{},mispricingDirection:{}}))}};function Xl(i){return Array.isArray(i)?i.map((o,r)=>[String(r),o]):ec(i)?[[String(i.spot_info.instrument_token),i]]:Object.entries(i??{})}function Wl(i){let o={};for(let[r,e]of Object.entries(i??{}))Jl(r)&&(o[r]=Zl(e));return o}function Zl(i){return typeof i=="number"?{value:i,token:0}:{value:Number(i?.value??0),token:Number(i?.token??0)}}function Jl(i){return i==="f_1"||i==="f_2"||i==="f_3"}function ec(i){return!!i&&typeof i=="object"&&"spot_info"in i&&("flow_chart"in i||"mispricing"in i)}function tc(i){let o=i;return o.flow_chart??o.mispricing??{}}function Ci(i,o){return F(f({},i),{queue_event:{event_id:o.event_id,sequence:o.sequence,received_at_utc:o.received_at_utc,secondary_id:o.secondary_id,selection_key:o.selection_key}})}function Pi(i){let o=new Map;for(let e of i){let t=e.spot_info.instrument_token,n=o.get(t)??[];n.includes(e.price_matrix.expiry)||(n.push(e.price_matrix.expiry),n.sort((s,p)=>s.localeCompare(p)),o.set(t,n))}let r=nc(o);return i.map(e=>F(f({},e),{price_matrix:F(f({}
1,e.price_matrix),{expiry_index:r.get(`${e.spot_info.instrument_token}:${e.price_matrix.expiry}`)??1})}))}function nc(i){let o=new Map;for(let[r,e]of i.entries())e.forEach((t,n)=>{o.set(`${r}:${t}`,n+1)});return o}function Ss(i){let o=new Set;return i.map(r=>{let e=`${r.spot_info.symbol}:${r.price_matrix.expiry}`,t=!o.has(e);return o.add(e),F(f({},r),{isLatestForSymbolExpiry:t})})}function jn(i){return i.map(o=>F(f({},o),{spot_info:F(f({},o.spot_info),{changeDirection:o.spot_info.change>0?"#001cf2":"#c90076"})}))}function Rn(i){return jn(Pi(i.map(ic)))}function Kn(i){return jn(Pi(i.map(rc)))}function Si(i){return i.map(sc)}function ic(i){return F(f({},i),{spot_info:i.spot_info,price_matrix:oc(i),trade_tokens:i.trade_tokens??null})}function oc(i){let o=i.price_matrix,r=o?.value,e=Number(r);return{expiry:o?.expiry??"",value:r===null?null:Number.isFinite(e)?e:0,expiry_index:Number(o?.expiry_index??1),max_profit_is_unlimited:o?.max_profit_is_unlimited===!0}}function rc(i){let o=Number(i.percent_change??0),r=xt(i.instrument_token),e=uo(i.option_leg?.instrument_token);return{scanner_kind:"protective_put_breakeven",protective_put:{sno:Number(i.sno??0),instrument_token:r,symbol:i.symbol??"",last_price:Number(i.last_price??0),percent_change:o,last_update:i.last_update??"",expiry:i.expiry??"",matrix_2:i.matrix_2??0,breakeven_diff_percent:Number(i.breakeven_diff_percent??0),target_date_pop:uo(i.target_date_pop),option_leg:{instrument_token:e??0,trading_symbol:i.option_leg?.trading_symbol??""}},protective_put_selection:{instrument_token:r,option_instrument_token:e},spot_info:{instrument_token:r,symbol:i.symbol??"",price:Number(i.last_price??0),change:o,update:i.last_update,exchange:"",priceDirection:"none",changeDirection:o>0?"#001cf2":"#c90076"},price_matrix:{expiry:i.expiry??"",value:Number(i.breakeven_diff_percent??0),expiry_index:1},trade_tokens:null}}function sc(i){let o=xt(i.instrument_token),r=xt(i.percent_change),e=xt(i.option_leg?.instrument_token),t={sno:xt(i.sno),instrument_token:o,symbol:i.symbol??"",last_price:xt(i.last_price),percent_change:r,last_update:uo(i.last_update),expiry:i.expiry??"",max_loss:xt(i.max_loss),max_loss_is_unlimited:i.max_loss_is_unlimited===!0,option_leg:{instrument_token:e,trading_symbol:i.option_leg?.trading_symbol??"",strike:xt(i.option_leg?.strike),delta:xt(i.option_leg?.delta),put_lot:xt(i.option_leg?.put_lot),last_price:xt(i.option_leg?.last_price)}};return{scanner_kind:"protective_put_max_loss",max_loss_row:t,spot_info:{instrument_token:o,symbol:t.symbol,price:t.last_price,change:r,update:t.last_update??0,exchange:"",priceDirection:"none",changeDirection:r>0?"#001cf2":"#c90076"},price_matrix:{expiry:t.expiry,value:t.max_loss,expiry_index:1},trade_tokens:null}}function xt(i){let o=Number(i);return Number.isFinite(o)?o:0}function uo(i){let o=Number(i);return Number.isFinite(o)?o:null}var bt="Lots must be a positive whole number.";function Dn(i){if(typeof i=="string"&&!i.trim())return null;let o=Number(i);return Number.isSafeInteger(o)&&o>0?o:null}function Nn(i){if(typeof i!="object"||i===null||!("error"in i))return!1;let o=i.error;return typeof o=="object"&&o!==null&&"code"in o&&o.code==="invalid_put_lot"}function vi(i){let o=(i.instrument_token??[]).filter(Number.isFinite),r=i.expiry?.trim(),e=typeof i.spot_token=="number"&&Number.isFinite(i.spot_token)?i.spot_token:null,t=(gn(i.secondary_id)||fe(i.secondary_id))&&o.length===0&&e!==null,n=i.secondary_id===Q.id;return f(f(f(f({segment:i.segment,secondary_id:i.secondary_id},o.length?{instrument_token:[...o]}:t?{instrument_token:[]}:{}),r?{expiry:r}:n?{expiry:null}:{}),e!==null?{spot_token:e}:n?{spot_token:null}:{}),typeof i.put_lot=="number"&&Number.isFinite(i.put_lot)?{put_lot:i.put_lot}:{})}function xn(i){let o=vi(i);return JSON.stringify({segment:o.segment.toLowerCase(),secondary_id:o.secondary_id,instrument_token:o.instrument_token??[],expiry:o.expiry??null,spot_token:o.spot_token??null,put_lot:o.put_lot??null})}var Fn=class{};var Zt=class{};var kt=class{};var Ln=class{};var Rt=class{};var An=class{};var Oi=(()=>{let o=class o{constructor(e,t){this.marketWatchRepository=e,this.scannerRepository=t,this.thresholds={basis_dev:{entry:[.6,.9,1.2],exit:.2},pop_percent:{entry:[50,65,80],exit:.2},spread_dev:{entry:[400,700,1e3],exit:.2},stress_dev:{entry:[-80,-150,-200],exit:.2},convexity_mis:{entry:[200,400,600],exit:.2}}}
1GetSpotQuotes(e,t,n){return this.marketWatchRepository.getSpotQuotes({primary_id:e,segment:t,secondary_id:n})}GetScanner(e,t="single",n,s,p){let m=e===j.id,h=m?Dn(p??1):null;if(m&&h===null)return Ae(()=>new Error(bt));let x=e===j.id||e===ee.id||e===ie.id||e===Q.id,I=x?"multi":t,N=e===je.id,B=N||e===ue.id&&I==="multi";return this.scannerRepository.getScanner(f(f(f(f({origin:e},B?{}:{type:I}),!N&&!x&&I==="single"&&n!=null?{spot_token:n}:{}),!N&&!x&&s?{target_date:s}:{}),m?{put_lot:h}:{}))}};o.\u0275fac=function(t){return new(t||o)(V(Ln),V(An))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Mi=class{constructor(){this.items=O({}),this.asList=M(()=>Object.values(this.items()))}clear(){this.items.set({})}};var Un=(()=>{let o=class o extends Mi{constructor(){super(...arguments),this.sortedItems=O([]),this.pendingSpotUpdates=new Map,this.pendingMispricingUpdates=new Map,this.frameHandle=null,this.asList=M(()=>this.sortedItems())}setAll(e){let t={},n=e.map(s=>{s.mispricingDirection??={},s.direction??={priceDirection:"none",changeDirection:"none"};for(let h=1;h<4;h++)s.mispricingDirection[`f_${h}`]="none";let m=s.spot_info.change>0?"positive_change":"negative_change";return s.direction=F(f({},s.direction),{changeDirection:m}),t[s.spot_info.instrument_token]=s,s}).sort((s,p)=>s.spot_info.symbol.localeCompare(p.spot_info.symbol));this.sortedItems.set(n),this.items.set(t)}update(e){this.pendingSpotUpdates.set(e.key,e),this.scheduleFlush()}upsert(e){let t=f({},e);this.items.update(m=>F(f({},m),{[e.spot_info.instrument_token]:t}));let n=this.sortedItems(),s=n.findIndex(({spot_info:m})=>m.instrument_token===e.spot_info.instrument_token);if(s>=0){let m=n.slice();m[s]=t,this.sortedItems.set(m);return}let p=[...n,t].sort((m,h)=>m.spot_info.symbol.localeCompare(h.spot_info.symbol));this.sortedItems.set(p)}getDirection(e,t,n){return t<0?"negative":e<0&&t>0||t>e?"up":t<e?"down":n}updateMispricing(e,t,n,s){this.pendingMispricingUpdates.set(`${e}:${t}`,{spotInstrument:e,futureKey:t,value:n,token:s}),this.scheduleFlush()}clear(){this.cancelScheduledFlush(),this.pendingSpotUpdates.clear(),this.pendingMispricingUpdates.clear(),super.clear(),this.sortedItems.set([])}scheduleFlush(){this.frameHandle===null&&(this.frameHandle=requestAnimationFrame(()=>{this.frameHandle=null,this.flushPendingUpdates()}))}cancelScheduledFlush(){this.frameHandle!==null&&(cancelAnimationFrame(this.frameHandle),this.frameHandle=null)}flushPendingUpdates(){if(this.pendingSpotUpdates.size===0&&this.pendingMispricingUpdates.size===0)return;let e=this.items(),t=f({},e),n=this.sortedItems(),s=n.slice(),p=new Map(n.map(({spot_info:m},h)=>[m.instrument_token,h]));for(let m of this.pendingSpotUpdates.values()){let h=t[m.key];if(!h)continue;let x=h.spot_info.price,I=m.price,N=m.change,B=I>x?"positive":"negative",$=N>0?"positive_change":"negative_change",K=F(f({},h),{direction:{priceDirection:B,changeDirection:$},spot_info:F(f({},h.spot_info),{price:I,change:N,update:m.update})});t[m.key]=K;let oe=p.get(m.key);oe!==void 0&&(s[oe]=K)}for(let m of this.pendingMispricingUpdates.values()){let h=t[m.spotInstrument];if(!h)continue;let x=this.getMispricingValue(h.mispricing[m.futureKey]),I=h.mispricingDirection[m.futureKey],N=F(f({},h),{mispricing:F(f({},h.mispricing),{[m.futureKey]:{value:m.value,token:m.token}}),mispricingDirection:F(f({},h.mispricingDirection),{[m.futureKey]:this.getDirection(x,m.value,I)})});t[m.spotInstrument]=N;let B=p.get(m.spotInstrument);B!==void 0&&(s[B]=N)}this.pendingSpotUpdates.clear(),this.pendingMispricingUpdates.clear(),this.items.set(t),this.sortedItems.set(s)}getMispricingValue(e){return typeof e=="number"?e:e?.value??0}};o.\u0275fac=(()=>{let e;return function(n){return(e||(e=fr(o)))(n||o)}})(),o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var vs=[{key:"market",label:"Market"},{key:"scanner",label:"Scanner"}],lc=["F - 1","F - 2","F - 3"],cc=["M-1","M-2","M-3"],dc=["75dbdc05-0409-41d2-92e4-c4f50b3ba850","499ce19d-b211-4212-b3da-adf9437cd088",je.id,po.id],Qn=["Symbol","Last Price","%Change","Last Update"],ws=[...Qn,"Expiry","Max Profit"],Os=[...Qn,"Expiry","Max Profit"],Ms=[...Qn,"Expiry","Max Profit"],Es=["Symbol","Exchange","Last Price","%Change","Last Update"],Ts=["Symbol","Mispricing","Exchange","Last Price","%Change","Last Update","Expiry"],Is=["Symbol","Mispricing","Last Price","%Change","Last Update","Expiry"],ks=[...Es,"Expiry","Mispricing"],Rs=[...Qn,"Expiry","Mispricing"],Ds=["Symbol","Trading Symbol","Last Price","%Change","Last Update","Expiry","MATRIX-1","MATRIX-2","Target POP"],Ns=["Symbol","Trading Symbol","Spot LTP","%Change","Last Update","Expiry","Strike","Delta","Put Lot","Put LTP","Max Loss"];function pc(i,o=null){return me(Qe(o))?Ns:Us(o)?Ds:(i==="equity-options"||i==="index-options")&&Vs(Qe(o))?Ms:i==="equity-options"&&(ot(Qe(o))||Hs(o))?ws:i==="index-options"&&fe(Qe(o))?Os:As(o)?i==="etf"||i==="commodity"?Ts:Is:i==="etf"||i==="commodity"?ks:Rs}function Fs(i,o,r,e=null){return o==="scanner"?pc(i,e):r}function Ls(i,o,r){let e=i==="etf"||i==="commodity"?Es:Qn;return o==="market"?i==="equity-futures"||i==="index-futures"||i==="index-options"||ho(r)?[...e,...uc(r)]:e:o==="scanner"&&me(Qe(r))?Ns:o==="scanner"&&Us(r)?Ds:o==="scanner"&&(i==="equity-options"||i==="index-options")&&Vs(Qe(r))?Ms:o==="scanner"&&i==="equity-options"&&(ot(Qe(r))||Hs(r))?ws:o==="scanner"&&i==="index-options"&&fe(Qe(r))?Os:As(r)?i==="etf"||i==="commodity"?Ts:Is:i==="etf"||i==="commodity"?ks:Rs}function ho(i){return dc.includes(Qe(i))}function uc(i){return Qe(i)===po.id?cc:lc}function As(i){return yi.has(Qe(i))}function Qe(i){return Y(i??"")??i??""}function Us(i){return Ee(Qe(i))}function Hs(i){return Qe(i)===ue.id}function Vs(i){let o=Qe(i);return o===j.id||o===ee.id||o===ie.id||o===Q.id}function Ye(i,o=""){if(i.queue_event?.event_id)return i.queue_event.event_id;if(Jt(i))return[o,i.max_loss_row.instrument_token].join(":");if(Hn(i))return[o,i.protective_put_selection.instrument_token,i.protective_put_selection.option_instrument_token].join(":");if(go(i)){let e=Ti(i),t=_o(i);return[o,i.spot_info.instrument_token,i.spot_info.symbol,i.price_matrix.expiry,e?.lower_strike??"",e?.upper_strike??"",...t.map(n=>n.instrument_token)].join(":")}let r=i.trade_tokens;return[i.spot_info.instrument_token,i.spot_info.symbol,i.price_matrix.expiry,r?.strategy??"",r?.spot??"",r?.pe??"",r?.ce??"",i.spot_info.update,i.price_matrix.value].join(":")}function Jt(i){return i.scanner_kind==="protective_put_max_loss"}function Hn(i){return i.scanner_kind==="protective_put_breakeven"}function go(i){return!!i.box_spread||!!i.spread&&Array.isArray(i.trade_legs)&&i.trade_legs.length===4}function Ti(i){return i.box_spread?{lower_strike:i.box_spread.lower_strike,upper_strike:i.box_spread.upper_strike,width:i.box_spread.width,net_debit:i.box_spread.net_debit,net_credit:Ei(i.box_spread.net_credit),edge_points:i.box_spread.edge_points,edge_rupees:i.box_spread.edge_rupees,return:i.box_spread.return,lot_size:i.box_spread.lot_size,is_profitable:i.box_spread.is_profitable,opportunity_available:i.box_spread.opportunity_available,profit_per_lot:i.box_spread.profit_per_lot,lot_count:i.box_spread.lot_count,total_profit:i.box_spread.total_profit,minimum_profit_per_lot:i.box_spread.minimum_profit_per_lot,threshold_matched:i.box_spread.threshold_matched,threshold:i.box_spread.threshold,side:i.box_spread.side??null}:i.spread?{lower_strike:i.spread.negative_strike,upper_strike:i.spread.positive_strike,width:i.spread.positive_strike-i.spread.negative_strike,net_debit:Ei(i.spread.net_debit),net_credit:null,edge_points:Ei(i.spread.edge_points),edge_rupees:i.spread.mispricing,return:Ei(i.spread.return),lot_size:null,is_profitable:null,opportunity_available:null,profit_per_lot:i.spread.profit_per_lot,lot_count:i.spread.lot_count,total_profit:i.spread.total_profit,minimum_profit_per_lot:i.spread.minimum_profit_per_lot,threshold_matched:i.spread.threshold_matched,threshold:i.spread.threshold,side:null}:null}function _o(i){if(Array.isArray(i.processed_legs)&&i.processed_legs.length===4)return i.processed_legs.slice().sort((t,n)=>t.order-n.order);let o=Ti(i),r=i.trade_legs??[];return!o||r.length!==4?[]:[{strike:o.lower_strike,instrument_type:"CE",position:"Long"},{strike:o.upper_strike,instrument_type:"CE",position:"Short"},{strike:o.upper_strike,instrument_type:"PE",position:"Long"},{strike:o.lower_strike,instrument_type:"PE",position:"Short"}].reduce((t,n)=>{let s=r.find(p=>p.strike===n.strike&&p.instrument_type===n.instrument_type&&p.position===n.position);
1return s&&t.push(s),t},[])}function Ei(i){if(i==null)return null;let o=Number(i);return Number.isFinite(o)?o:null}var fo=[{id:"bd4f8065-e009-41ff-9926-5bcb902b37b5",event:"equity-protection-analysis"},{id:"c0820cf0-4f94-4c06-bf8b-59e74951aaf6",event:"equity-futures-protection-analysis"},{id:"a288245a-c8b7-45a8-a4b4-fd0c9595eb97",event:"etf-protection-analysis"},{id:"09496eb1-5f71-4230-bef9-03d7c1be869d",event:"index-futures-protection-analysis"},{id:"fa914656-9a63-4a41-8e2b-fe15679ee668",event:"commodity-futures-protection-analysis"},{id:"12d754c7-63de-4181-b0cf-cc0a3ae23c91",event:"equity-options-protection-analysis"},{id:"2854f5a3-2961-4e9d-929d-42005d308216",event:"index-options-protection-analysis"},{id:"abea221e-bec7-4864-8f86-9a2c49f8daed",event:"commodity-options-protection-analysis"},{id:"305c8fc3-e278-4005-93f4-40a1f26d7c91",event:"multi-instrument-grid-analysis"}],Ii="bd4f8065-e009-41ff-9926-5bcb902b37b5",Yn="c0820cf0-4f94-4c06-bf8b-59e74951aaf6",ki="a288245a-c8b7-45a8-a4b4-fd0c9595eb97",qt="09496eb1-5f71-4230-bef9-03d7c1be869d",ht="12d754c7-63de-4181-b0cf-cc0a3ae23c91",Gt="2854f5a3-2961-4e9d-929d-42005d308216",mc=new Set(fo.map(i=>i.id)),hc={[Ii]:"equity",[Yn]:"equity-futures",[ht]:"equity-options",[ki]:"etf",[qt]:"index-futures",[Gt]:"index-options"},Bs={[Ii]:new Set(is.map(i=>i.id)),[Yn]:new Set(es.map(i=>i.id)),[ht]:new Set(ns.map(i=>i.id)),[ki]:new Set(rs.map(i=>i.id)),[qt]:new Set(ls.map(i=>i.id)),[Gt]:new Set(cs.map(i=>i.id))},qs=i=>mc.has(i),Gs=(i,o)=>Bs[i]?.has(o)??!1,zs=i=>Object.entries(Bs).find(([,o])=>o.has(i))?.[0],js=i=>hc[i]??"";var Ks={"":"AXISBANK",commodity:"AXISBANK",etf:"NIFTYBEES",equity:"AXISBANK","equity-futures":"AXISBANK","equity-options":"AXISBANK","index-futures":"NIFTY 50","index-options":"NIFTY 50",default:"AXISBANK"},$s={"":1510401,commodity:1510401,etf:2707457,equity:1510401,"equity-futures":1510401,"equity-options":1510401,"index-futures":256265,"index-options":256265,default:1510401},Ri=50,gc=150,_c=Ri*4,fc=2e3,ae=(()=>{let o=class o{constructor(e){this.tickStore=e,this.views=vs,this.title=O(""),this.marketWatchTitle=O(""),this.currentView=O("market"),this.hedgeActiveAssets=O(""),this.selectedIndexName=O(this.getDefaultIndexName("equity")),this.selectedInstrumentToken=O(this.getDefaultInstrumentToken("equity")),this.selectedOptionInstrumentToken=O(null),this.selectedOptionInstrumentTokens=O([]),this.selectedScannerPayoffInstrumentTokens=O([]),this.selectedOptionPutLot=O(null),this.equityLongBoxPutLotInput=O(String(1)),this.equityLongBoxPutLot=M(()=>Dn(this.equityLongBoxPutLotInput())),this.equityLongBoxPutLotError=M(()=>this.equityLongBoxPutLot()===null?bt:""),this.payoffPutLot=M(()=>this.originId()===j.id?this.equityLongBoxPutLot()??Number.NaN:this.selectedOptionPutLot()),this.selectedScannerTradeTokens=O(null),this.selectedScannerExpiry=O(null),this.selectedExpiryIndex=O(1),this.selectedRowIndex=O(-1),this.selectedRowKey=O(null),this.selectedRowSource=O(null),this.priceMatr
1ixSelectionRevision=O(0),this.isTableSwitching=O(!1),this.selectedMarketSymbols=O([]),this.selectedScannerSymbols=O([]),this.theads=M(()=>Ls(this.hedgeActiveAssets(),this.currentView(),this.originId())),this.allEquityRows=M(()=>this.tickStore.asList()),this.equityRows=M(()=>this.allEquityRows()),this.marketRows=M(()=>{let t=this.equityRows().map(n=>this.toSpotMarketRow(n));return this.filterBySelectedSymbols(t,this.selectedMarketSymbols())}),this.scannerQueueRows=M(()=>this.scannerQueueRowsState()),this.scannerRows=M(()=>this.filterBySelectedSymbols(this.scannerQueueRows(),this.selectedScannerSymbols())),this.primaryId=O(""),this.originId=O(""),this.scannerQueueLoaded=O(!1),this.scannerQueueLoading=O(!1),this.scannerQueueError=O(null),this.scannerQueueEmptyMessage=O(null),this.scannerQueueRowsState=O([]),this.switchAnimationTimer=null,this.pendingScannerRows=[],this.seenScannerEventIds=new Set,this.longBoxEventIds=new Set,this.longBoxRowKeys=new Set,this.scannerQueueFlushTimer=null,this.legacyScannerEventSequence=0}destroy(){this.switchAnimationTimer&&clearTimeout(this.switchAnimationTimer),this.scannerQueueFlushTimer&&(clearTimeout(this.scannerQueueFlushTimer),this.scannerQueueFlushTimer=null),this.pendingScannerRows=[],this.seenScannerEventIds.clear(),this.longBoxEventIds.clear(),this.longBoxRowKeys.clear()}setTitle(e){this.title.set(e)}setMarketWatchTitle(e){this.marketWatchTitle.set(e)}setPrimaryId(e){this.primaryId()!==e&&(this.primaryId.set(e),this.setDefaultSelectedIndex(this.hedgeActiveAssets()),this.selectedOptionInstrumentToken.set(null),this.selectedOptionInstrumentTokens.set([]),this.selectedScannerPayoffInstrumentTokens.set([]),this.selectedOptionPutLot.set(null),this.selectedScannerTradeTokens.set(null),this.selectedScannerExpiry.set(null),this.selectedExpiryIndex.set(1),this.clearSymbolFilters(),this.clearActiveRowSelection())}setOriginId(e){this.originId()!==e&&this.selectedScannerPayoffInstrumentTokens.set([]),this.originId.set(e),this.shouldStartWithoutDefaultMarketSelection()&&this.clearSelectedIndex()}setPrimarySection(e){this.hedgeActiveAssets()!==e&&(this.hedgeActiveAssets.set(e),this.setDefaultSelectedIndex(e),this.selectedOptionInstrumentToken.set(null),this.selectedOptionInstrumentTokens.set([]),this.selectedScannerPayoffInstrumentTokens.set([]),this.selectedOptionPutLot.set(null),this.selectedScannerTradeTokens.set(null),this.selectedScannerExpiry.set(null),this.selectedExpiryIndex.set(1),this.clearSymbolFilters(),this.clearActiveRowSelection())}setCurrentView(e){this.currentView.set(e)}setScannerQueueLoaded(e){this.scannerQueueLoaded.set(e)}setScannerQueueLoading(e){this.scannerQueueLoading.set(e)}setScannerQueueError(e){this.scannerQueueError.set(e)}setScannerQueueEmptyMessage(e){this.scannerQueueEmptyMessage.set(e)}resetForOriginChange(){this.pendingScannerRows=[],this.scannerQueueFlushTimer&&(clearTimeout(this.scannerQueueFlushTimer),this.scannerQueueFlushTimer=null),this.title.set(""),this.marketWatchTitle.set(""),this.scannerQueueLoaded.set(!1),this.scannerQueueLoading.set(!1),this.scannerQueueError.set(null),this.scannerQueueEmptyMessage.set(null),this.scannerQueueRowsState.set([]),this.seenScannerEventIds.clear(),this.longBoxEventIds.clear(),this.longBoxRowKeys.clear(),this.legacyScannerEventSequence=0,this.setDefaultSelectedIndex(this.hedgeActiveAssets()),this.selectedOptionInstrumentToken.set(null),this.selectedOptionInstrumentTokens.set([]),this.selectedScannerPayoffInstrumentTokens.set([]),this.selectedOptionPutLot.set(null),this.equityLongBoxPutLotInput.set(String(1)),this.selectedScannerTradeTokens.set(null),this.selectedScannerExpiry.set(null),this.selectedExpiryIndex.set(1),this.clearSymbolFilters(),this.clearActiveRowSelection()}setSelectedIndexName(e,t){this.selectedIndexName()===e&&this.selectedInstrumentToken()===t||(this.selectedIndexName.set(e),this.selectedInstrumentToken.set(t),this.selectedOptionInstrumentToken.set(null),this.selectedOptionInstrumentTokens.set([]),this.selectedScannerPayoffInstrumentTokens.set([]),this.selectedOptionPutLot.set(null),this.selectedScannerTradeTokens.set(null),this.selectedScannerExpiry.set(null),this.selectedExpiryIndex.set(1))}setDefaultSelectedIndex(e){if(this.shouldStartWithoutDefaultMarketSelection()){this.clearSelectedIndex();return}this.selectedIndexName.set(this.getDefaultIndexName(e)),this.selectedInstrumentToken.set(this.getDefaultInstrumentToken(e))}clearSelectedIndex(){this.selectedIndexName.set(""),this.selectedInstrumentToken.set(null)}shouldStartWithoutDefaultMarketSelection(){return this.primaryId()===ht||this.isEquitySpotOptionParityOrigin()}isEquitySpotOptionParityOrigin(){return ot(this.originId())&&this.hedgeActiveAssets()==="equity-options"}
1setSelectedIndexAndExpiry(e,t,n){this.selectedIndexName()===e&&this.selectedInstrumentToken()===t&&this.selectedExpiryIndex()===n||(this.selectedIndexName.set(e),this.selectedInstrumentToken.set(t),this.selectedOptionInstrumentToken.set(null),this.selectedOptionInstrumentTokens.set([]),this.selectedScannerPayoffInstrumentTokens.set([]),this.selectedOptionPutLot.set(null),this.selectedScannerTradeTokens.set(null),this.selectedScannerExpiry.set(null),this.selectedExpiryIndex.set(n))}setSelectedOptionInstrumentToken(e){this.selectedOptionInstrumentToken()!==e&&(this.selectedOptionInstrumentToken.set(e),this.selectedOptionInstrumentTokens.set(e===null?[]:[e]),this.selectedScannerPayoffInstrumentTokens.set([]),this.selectedOptionPutLot.set(null),this.selectedScannerTradeTokens.set(null),this.selectedScannerExpiry.set(null))}setSelectedOptionInstrumentTokens(e,t=null){let n=[...e],s=n.length&&Number.isFinite(t)?t:null;this.areSameNumbers(this.selectedOptionInstrumentTokens(),n)&&this.selectedOptionPutLot()===s||(this.selectedOptionInstrumentTokens.set(n),this.selectedOptionInstrumentToken.set(n[0]??null),this.selectedScannerPayoffInstrumentTokens.set([]),this.selectedOptionPutLot.set(s),this.selectedScannerTradeTokens.set(null),this.selectedScannerExpiry.set(null))}setSelectedMarketSymbols(e){this.setUniqueSymbols(this.selectedMarketSymbols,e)}setSelectedScannerSymbols(e){this.setUniqueSymbols(this.selectedScannerSymbols,e)}syncSelectedInstrumentTokenFromRows(e){let t=e.findIndex(s=>s.spot_info.symbol===this.selectedIndexName());if(t<0)return;let n=e[t];this.selectedInstrumentToken.set(n.spot_info.instrument_token),this.setActiveRowSelection("hedging",t)}setActiveRowSelection(e,t){this.selectedRowSource()===e&&this.selectedRowIndex()===t||(this.selectedRowSource.set(e),this.selectedRowIndex.set(t),e!=="scanner"&&(this.selectedRowKey.set(null),this.selectedScannerPayoffInstrumentTokens.set([])))}
1markPriceMatrixSelection(){this.priceMatrixSelectionRevision.update(e=>e+1)}syncScannerActiveRowForInstrument(e,t){let n=Number(t);if(!Number.isFinite(n)||n<=0)return;let s=e.trim().toUpperCase(),p=this.scannerRows(),m=p.findIndex(x=>{let I=Number(x.spot_info.instrument_token),N=x.spot_info.symbol.trim().toUpperCase();return I===n||!!s&&N===s});if(m<0)return;let h=Ye(p[m],this.originId());this.selectedRowSource()==="scanner"&&this.selectedRowIndex()===m&&this.selectedRowKey()===h||(this.selectedRowSource.set("scanner"),this.selectedRowIndex.set(m),this.selectedRowKey.set(h))}clearActiveRowSelection(){this.selectedRowSource.set(null),this.selectedRowIndex.set(-1),this.selectedRowKey.set(null)}setSelectedScannerRow(e){let t=this.toFinitePositiveNumbers(e.optionInstrumentTokens??[]),n=[...e.payoffInstrumentTokens??[]],s=this.toPositiveNumberOrNull(e.putLot),p=t.length>0,m=this.originId()===ue.id,h=m&&e.tradeTokens?e.tradeTokens.spot:e.instrumentToken,x=e.expiry?.trim()||null;if(!(this.selectedIndexName()===e.indexName&&this.selectedInstrumentToken()===h&&this.selectedExpiryIndex()===e.expiryIndex&&this.selectedScannerExpiry()===x&&this.selectedRowKey()===(e.rowKey??null)&&this.areSameTradeTokens(this.selectedScannerTradeTokens(),e.tradeTokens??null)&&this.areSameNumbers(n,this.selectedScannerPayoffInstrumentTokens())&&(!p||this.areSameNumbers(t,this.selectedOptionInstrumentTokens())&&this.selectedOptionPutLot()===s))){if(this.selectedIndexName.set(e.indexName),this.selectedInstrumentToken.set(h),this.selectedScannerTradeTokens.set(e.tradeTokens??null),this.selectedScannerPayoffInstrumentTokens.set(n),this.selectedScannerExpiry.set(x),p)this.selectedOptionInstrumentToken.set(t[0]??null),this.selectedOptionInstrumentTokens.set(t),this.selectedOptionPutLot.set(s),this.selectedScannerTradeTokens.set(null);else if(e.tradeTokens){let I=e.tradeTokens.strategy==="conversion"||m?[e.tradeTokens.pe,e.tradeTokens.ce]:[e.tradeTokens.ce,e.tradeTokens.pe];this.selectedOptionInstrumentToken.set(I[0]??null),this.selectedOptionInstrumentTokens.set(I),this.selectedOptionPutLot.set(null)}else this.selectedOptionInstrumentToken.set(null),this.selectedOptionInstrumentTokens.set([]),this.selectedOptionPutLot.set(null);this.selectedExpiryIndex.set(e.expiryIndex),e.rowKey?this.selectedRowKey.set(e.rowKey):this.selectedRowKey.set(null)}}replaceScannerQueueRows(e,t=!1){this.pendingScannerRows=[],this.scannerQueueFlushTimer&&(clearTimeout(this.scannerQueueFlushTimer),this.scannerQueueFlushTimer=null);let n=this.ensureScannerQueueEventMetadata(e);t||this.seenScannerEventIds.clear(),this.rememberScannerEventIds(n),this.setScannerQueueRows(this.prepareScannerQueueRows(n))}replaceLongBoxScannerSnapshot(e){this.pendingScannerRows=[],this.scannerQueueFlushTimer&&(clearTimeout(this.scannerQueueFlushTimer),this.scannerQueueFlushTimer=null),this.longBoxEventIds.clear(),this.longBoxRowKeys.clear(),this.setLongBoxScannerRows(e.slice())}appendLongBoxScannerRow(e){let t=e.data,n=this.getLongBoxScannerRowKey(t);return!n||e.secondary_id!==ie.id&&this.getLongBoxScannerMaxProfit(t)<fc||this.longBoxEventIds.has(e.event_id)||this.longBoxRowKeys.has(n)?!1:(this.longBoxEventIds.add(e.event_id),this.setLongBoxScannerRows([F(f({},t),{queue_event:{event_id:e.event_id,sequence:e.sequence,received_at_utc:e.received_at_utc,secondary_id:e.secondary_id,selection_key:e.selection_key}}),...this.scannerQueueRowsState()]),!0)}setEquityLongBoxPutLotInput(e){this.equityLongBoxPutLotInput.set(e==null?"":String(e))}setLongBoxScannerRows(e){let t=this.sortScannerRowsNewestFirst(jn(e)),n=fn(this.originId())?t.slice(0,Ri):t;this.longBoxRowKeys.clear();for(let s of n){let p=this.getLongBoxScannerRowKey(s);p&&this.longBoxRowKeys.add(p)}this.setScannerQueueRows(n)}enqueueScannerQueueRow(e){this.enqueueScannerQueueRows([e])}enqueueScannerQueueRows(e){let t=this.ensureScannerQueueEventMetadata(e),n=new Set(this.seenScannerEventIds);for(let s of t){let p=Ye(s,this.originId());n.has(p)||(n.add(p),this.rememberScannerEventId(p),this.pendingScannerRows.push(s))}this.pendingScannerRows.length&&(this.scannerQueueFlushTimer||(this.scannerQueueFlushTimer=setTimeout(()=>{if(this.scannerQueueFlushTimer=null,!this.pendingScannerRows.length)return;let s=this.takePendingScannerRows(),p=this.sortScannerRowsNewestFirst(this.uniqueScannerEvents([...s,...this.scannerQueueRowsState()]));this.setScannerQueueRows(this.prepareScannerQueueRows(p))},gc)))}triggerTableAnimation(){this.isTableSwitching.set(!1),this.switchAnimationTimer&&clearTimeout(this.switchAnimationTimer),setTimeout(()=>this.isTableSwitching.set(!0),0),this.switchAnimationTimer=setTimeout(()=>this.isTableSwitching.set(!1),280)}getDefaultIndexName(e){return Ks[e]??Ks.default}getDefaultInstrumentToken(e){return $s[e]??$s.default}toSpotMarketRow(e){return{spot_info:e.spot_info,mispricing:e.mispricing,mispricingDirection:e.mispricingDirection,direction:e.direction}}filterBySelectedSymbols(e,t){if(!t.length)return e;let n=new Set(t);return e.filter(s=>n.has(s.spot_info.symbol))}setUniqueSymbols(e,t){let n=[...new Set(t)];this.areSameSymbols(n,e())||e.set(n)}clearSymbolFilters(){this.selectedMarketSymbols.set([]),this.selectedScannerSymbols.set([])}areSameSymbols(e,t){return e.length===t.length&&e.every((n,s)=>t[s]===n)}areSameNumbers(e,t){return e.length===t.length&&e.every((n,s)=>t[s]===n)}toFinitePositiveNumbers(e){return e.map(t=>Number(t)).filter(t=>Number.isFinite(t)&&t>0)}toPositiveNumberOrNull(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:null}areSameTradeTokens(e,t){return e?.spot===t?.spot&&e?.ce===t?.ce&&e?.pe===t?.pe&&e?.strategy===t?.strategy}takePendingScannerRows(){this.scannerQueueFlushTimer&&(clearTimeout(this.scannerQueueFlushTimer),this.scannerQueueFlushTimer=null);let e=this.pendingScannerRows;return this.pendingScannerRows=[],e}ensureScannerQueueEventMetadata(e){return e.map(t=>{if(t.queue_event?.event_id)return t;this.legacyScannerEventSequence+=1;let n=this.legacyScannerEventSequence;return F(f({},t),{queue_event:{event_id:`legacy:${this.originId()}:${n}`,sequence:n,received_at_utc:new Date().toISOString(),secondary_id:this.originId(),selection_key:`legacy:${this.originId()}`}})})}uniqueScannerEvents(e){let t=new Set;return e.filter(n=>{let s=Ye(n,this.originId());return t.has(s)?!1:(t.add(s),!0)})}rememberScannerEventIds(e){for(let t of e)this.rememberScannerEventId(Ye(t,this.originId()))}rememberScannerEventId(e){for(this.seenScannerEventIds.add(e);this.seenScannerEventIds.size>_c;){let t=this.seenScannerEventIds.values().next().value;if(typeof t!="string")return;this.seenScannerEventIds.delete(t)}}sortScannerRowsNewestFirst(e){return e.slice().sort((t,n)=>{let s=t.queue_event,p=n.queue_event;if(me(this.originId())&&s&&p){let x=s.selection_key.startsWith("legacy:"),I=p.selection_key.startsWith("legacy:");if(x!==I)return x?1:-1}if(s&&p&&s.selection_key===p.selection_key&&s.sequence!==p.sequence)return p.sequence-s.sequence;let m=this.getScannerRowTimestamp(t),h=this.getScannerRowTimestamp(n);return m!==null&&h!==null?h-m:m!==null?-1:h!==null?1:0})}getScannerRowTimestamp(e){for(let n of[e.queue_event?.received_at_utc,e.generation_timestamp]){let s=typeof n=="string"&&/^\d{4}-\d{2}-\d{2}T/.test(n)?Date.parse(n):Number.NaN;if(Number.isFinite(s))return s}let t=Number(e.spot_info.update);return Number.isFinite(t)?t:null}getLongBoxScannerRowKey(e){let t=e.processed_instrument_tokens,n=e.generation_timestamp?.trim(),s=e.box_spread?.edge_rupees;return!Array.isArray(t)||t.length===0||!t.every(p=>Number.isFinite(Number(p)))||!Number.isFinite(Number(s))||!n?null:[t.map(p=>Number(p)).join(","),Number(s),n].join("|")}getLongBoxScannerMaxProfit(e){let t=e.box_spread?.edge_rupees??e.price_matrix.value??0,n=Number(t);return Number.isFinite(n)?n:0}setScannerQueueRows(e){this.scannerQueueRowsState.set(e),this.clearDiscardedScannerSelection(e),this.syncSelectedMaxLossScannerRow(e)}clearDiscardedScannerSelection(e){let t=this.selectedRowKey();!t||e.some(s=>Ye(s,this.originId())===t)||this.clearActiveRowSelection()}prepareScannerQueueRows(e){return e.length&&e.every(Jt)?this.prepareMaxLossScannerRows(e):Ss(jn(Pi(e.slice(0,Ri))
1))}prepareMaxLossScannerRows(e){return e.slice(0,Ri)}syncSelectedMaxLossScannerRow(e){let t=this.selectedRowKey();if(this.selectedRowSource()!=="scanner"||!t)return;let n=e.findIndex(m=>Jt(m)&&Ye(m,this.originId())===t);if(n<0)return;let s=e[n],p=s.max_loss_row.option_leg.instrument_token;this.selectedIndexName.set(s.max_loss_row.symbol),this.selectedInstrumentToken.set(s.max_loss_row.instrument_token),this.selectedOptionInstrumentToken.set(p),this.selectedOptionInstrumentTokens.set([p]),this.selectedOptionPutLot.set(null),this.selectedExpiryIndex.set(1),this.selectedRowIndex.set(n+1)}};o.\u0275fac=function(t){return new(t||o)(V(Un))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Xn=(()=>{let o=class o{constructor(e,t,n){this.deviation=e,this.tickStore=t,this.store=n,this.scannerRequest=be.EMPTY,this.activeScannerRequestKey=""}loadPriceDeviations(e,t,n){this.tickStore.clear(),this.deviation.GetSpotQuotes(e,t,n).subscribe({next:s=>{let p=Ps(s);this.store.setTitle(p.title),this.store.setMarketWatchTitle(p.title),this.tickStore.setAll(p.value),this.store.syncSelectedInstrumentTokenFromRows(this.store.marketRows())},error:console.error})}loadScannerQueue(e,t="single",n,s,p,m){let h=JSON.stringify(["futures-scanner",e,n??null,t,s??null,m??null]);if(this.activeScannerRequestKey=h,this.scannerRequest.unsubscribe(),this.store.setScannerQueueLoaded(!1),this.store.setScannerQueueLoading(!0),this.store.setScannerQueueError(null),this.store.setScannerQueueEmptyMessage(null),me(e)){this.loadMaxLossScannerQueue(e,t,n,h,p);return}if(Ee(e)){this.loadProtectivePutBreakevenScannerQueue(e,t,n,s,h);return}let x=m==null?this.deviation.GetScanner(e,t,n,s):this.deviation.GetScanner(e,t,n,s,m);this.scannerRequest=x.subscribe({next:I=>{if(h!==this.activeScannerRequestKey)return;this.store.setTitle(I.title||"-");let N=I.data??[],B=e===j.id||e===ee.id||e===ie.id||e===Q.id,$=e===ue.id||B,K=B?N.slice():Rn(N),oe=$?K:K.slice().reverse();this.store.setScannerQueueEmptyMessage(B&&N.length===0&&I.message.trim()||null),B?this.store.replaceLongBoxScannerSnapshot(oe):this.store.replaceScannerQueueRows(oe,$),this.store.setScannerQueueLoaded(!0),this.store.setScannerQueueLoading(!1),p?.(!0)},error:I=>{h===this.activeScannerRequestKey&&(this.store.setScannerQueueLoading(!1),this.store.setScannerQueueLoaded(!0),this.store.setScannerQueueError(this.resolveScannerError(I)),p?.(!1),console.error(I))}})}loadProtectivePutBreakevenScannerQueue(e,t,n,s,p=""){this.scannerRequest=this.deviation.GetScanner(e,t,n,s).subscribe({next:m=>{if(p!==this.activeScannerRequestKey)return;this.store.setTitle(m.title||"-");let h=Kn(m.data??[]);this.store.replaceScannerQueueRows(h),this.store.setScannerQueueLoaded(!0),this.store.setScannerQueueLoading(!1)},error:m=>{p===this.activeScannerRequestKey&&(this.store.setScannerQueueLoading(!1),this.store.setScannerQueueLoaded(!0),this.store.setScannerQueueError(this.resolveScannerError(m)),console.error(m))}})}loadMaxLossScannerQueue(e,t,n,s="",p){this.scannerRequest=this.deviation.GetScanner(e,t,n).subscribe({next:m=>{if(s!==this.activeScannerRequestKey)return;this.store.setTitle(m.title||"-");let h=Si(m.data??[]);this.store.replaceScannerQueueRows(h),this.store.setScannerQueueLoaded(!0),this.store.setScannerQueueLoading(!1),p?.(!0)},error:m=>{s===this.activeScannerRequestKey&&(this.store.setScannerQueueLoading(!1),this.store.setScannerQueueLoaded(!0),this.store.setScannerQueueError(this.resolveScannerError(m)),p?.(!1),console.error(m))}})}resolveScannerError(e){if(Nn(e))return bt;if(typeof e=="object"&&e!==null&&"error"in e){let t=e.error;if(typeof t?.message=="string"&&t.message.trim())return t.message}return"Unable to load scanner rows."}cancelScannerRequest(){this.activeScannerRequestKey="",this.scannerRequest.unsubscribe(),this.scannerRequest=be.EMPTY,this.store.setScannerQueueLoading(!1)}};o.\u0275fac=function(t){return new(t||o)(V(Oi),V(Un),V(ae))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Be=(function(i){return i[i.Alert=1]="Alert",i[i.BeepDefault=2]="BeepDefault",i[i.ItemCollect=3]="ItemCollect",i[i.GlassBreak=4]="GlassBreak",i[i.BeepDouble=5]="BeepDouble",i[i.BeepBasic=6]="BeepBasic",i[i.RadioWave=7]="RadioWave",i[i.BeepShort=8]="BeepShort",i})(Be||{}
1),en=(function(i){return i[i.HighestToLowest=1]="HighestToLowest",i[i.LowestToHighest=2]="LowestToHighest",i})(en||{}),tn=(function(i){return i[i.IgnoreSign=1]="IgnoreSign",i[i.RespectSign=2]="RespectSign",i})(tn||{});var Oe=(()=>{let o=class o{constructor(e){this.auth=e,this.state=this.createDefaultState(),this.stateSubject=new lr(this.state),this.state$=this.stateSubject.asObservable(),this.state=this.normalizeState({user_id:this.auth.getUserId()})}getState(){return this.state}setState(e){let t=this.syncLegacyPatchToNestedSettings(e);this.state=this.normalizeState(f(f({},this.state),t)),this.stateSubject.next(this.state)}loadCurrentUserState(){return At(this.state)}updateStateAndSave(e){let t=this.auth.getUserId();this.setState(F(f({},e),{user_id:t||this.state.user_id}))}createDefaultState(){return{id:"",user_id:"",hide_market_panel:!1,compact_market_view:!0,expand_market_panel:!1,hide_scanner_panel:!1,compact_scanner_view:!1,expand_scanner_panel:!1,hide_delta_panel:!1,expand_delta_panel:!1,hide_detail_panel:!1,expand_detail_panel:!1,is_enable_protection_opened:!1,is_settings_opened:!1,is_how_to_use_opened:!1,is_fullscreen:!1,zoom_out:0,reset_zoom:!1,zoom_in:0,market_watch_settings:{favorite_symbols:[],compact_view:!0,hidden:!1,expanded:!1},scanner_settings:{favorite_symbols:[],compact_view:!1,hidden:!1,expanded:!1,sound_alert:Be.Alert,sort_direction:en.HighestToLowest,sign_handling:tn.IgnoreSign,month_selection:{near_month:!0,next_month:!0,far_month:!0},mispricing_range:{near_month:5e3,next_month:1e4,far_month:2e4},pop_settings:{near_month:70,next_month:70,far_month:70},mispricing_change_step:null},hedge_table_settings:{visible_columns:[],column_order:[],compact_view:null},details_settings:{hidden:!1,expanded:!1,fullscreen:!1,zoom_out:0,reset_zoom:!1,zoom_in:0,visible_sections:[]}}}normalizeState(e){let t=this.createDefaultState(),n=f(f({},t),e),s=f(f({},t.market_watch_settings),e.market_watch_settings),p=F(f(f({},t.scanner_settings),e.scanner_settings),{month_selection:f(f({},t.scanner_settings.month_selection),e.scanner_settings?.month_selection),mispricing_range:f(f({},t.scanner_settings.mispricing_range),e.scanner_settings?.mispricing_range),pop_settings:f(f({},t.scanner_settings.pop_settings),e.scanner_settings?.pop_settings)}),m=f(f({},t.hedge_table_settings),e.hedge_table_settings),h=f(f({},t.details_settings),e.details_settings);return s.compact_view=e.market_watch_settings?.compact_view??n.compact_market_view,s.hidden=e.market_watch_settings?.hidden??n.hide_market_panel,s.expanded=e.market_watch_settings?.expanded??n.expand_market_panel,p.compact_view=e.scanner_settings?.compact_view??n.compact_scanner_view,p.hidden=e.scanner_settings?.hidden??n.hide_scanner_panel,p.expanded=e.scanner_settings?.expanded??n.expand_scanner_panel,p.sound_alert=this.normalizeScannerSoundAlert(p.sound_alert),p.sort_direction=this.normalizeScannerSortDirection(p.sort_direction),p.sign_handling=this.normalizeScannerSignHandling(p.sign_handling),h.hidden=e.details_settings?.hidden??n.hide_detail_panel,h.expanded=e.details_settings?.expanded??n.expand_detail_panel,h.fullscreen=e.details_settings?.fullscreen??n.is_fullscreen,h.zoom_out=e.details_settings?.zoom_out??n.zoom_out,h.reset_zoom=e.details_settings?.reset_zoom??n.reset_zoom,h.zoom_in=e.details_settings?.zoom_in??n.zoom_in,F(f({},n),{hide_market_panel:s.hidden,compact_market_view:s.compact_view,expand_market_panel:s.expanded,hide_scanner_panel:p.hidden,compact_scanner_view:p.compact_view,expand_scanner_panel:p.expanded,hide_detail_panel:h.hidden,expand_detail_panel:h.expanded,is_fullscreen:h.fullscreen,zoom_out:h.zoom_out,reset_zoom:h.reset_zoom,zoom_in:h.zoom_in,market_watch_settings:s,scanner_settings:p,hedge_table_settings:m,details_settings:h})}syncLegacyPatchToNestedSettings(e){let t=f({},e);return(e.hide_market_panel!==void 0||e.compact_market_view!==void 0||e.expand_market_panel!==void 0)&&(t.market_watch_settings=F(f(f({},this.state.market_watch_settings),e.market_watch_settings),{hidden:e.hide_market_panel??e.market_watch_settings?.hidden??this.state.hide_market_panel,compact_view:e.compact_market_view??e.market_watch_settings?.compact_view??this.state.compact_market_view,expanded:e.expand_market_panel??e.market_watch_settings?.expanded??this.state.expand_market_panel})),(e.hide_scanner_panel!==void 0||e.compact_scanner_view!==void 0||e.expand_scanner_panel!==void 0)&&(t.scanner_settings=F(f(f({},this.state.scanner_settings),e.scanner_settings),{hidden:e.hide_scanner_panel??e.scanner_settings?.hidden??this.state.hide_scanner_panel,compact_view:e.compact_scanner_view??e.scanner_settings?.compact_view??this.state.compact_scanner_view,expanded:e.expand_scanner_panel??e.scanner_settings?.expanded??this.state.expand_scanner_panel})),(e.hide_detail_panel!==void 0||e.expand_detail_panel!==void 0||e.is_fullscreen!==void 0||e.zoom_out!==void 0||e.reset_zoom!==void 0||e.zoom_in!==void 0)&&(t.details_settings=F(f(f({},this.state.details_settings),e.details_settings),{hidden:e.hide_detail_panel??e.details_settings?.hidden??this.state.hide_detail_panel,expanded:e.expand_detail_panel??e.details_settings?.expanded??this.state.expand_detail_panel,fullscreen:e.is_fullscreen??e.details_settings?.fullscreen??this.state.is_fullscreen,zoom_out:e.zoom_out??e.details_settings?.zoom_out??this.state.zoom_out,reset_zoom:e.reset_zoom??e.details_settings?.reset_zoom??this.state.reset_zoom,zoom_in:e.zoom_in??e.details_settings?.zoom_in??this.state.zoom_in})),t}normalizeScannerSoundAlert(e){if(typeof e=="number"&&e>=1&&e<=8)return e;let t=this.normalizeEnumText(e);return{alert:Be.Alert,beep_default:Be.BeepDefault,item_collect:Be.ItemCollect,glass_break:Be.GlassBreak,beep_double:Be.BeepDouble,beep_basic:Be.BeepBasic,radio_wave:Be.RadioWave,beep_short:Be.BeepShort}[t]??null}normalizeScannerSortDirection(e){if(typeof e=="number"&&e>=1&&e<=2)return e;let t=this.normalizeEnumText(e);return{highest_to_lowest:en.HighestToLowest,lowest_to_highest:en.LowestToHighest}[t]??null}normalizeScannerSignHandling(e){if(typeof e=="number"&&e>=1&&e<=2)return e;let t=this.normalizeEnumText(e);return{ignore_sign:tn.IgnoreSign,respect_sign:tn.RespectSign}[t]??null}normalizeEnumText(e){return String(e??"").replace(/([a-z])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}};o.\u0275fac=function(t){return new(t||o)(V(En))},o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Dt=(()=>{let o=class o{constructor(e){this.userStateService=e,this.isAllowed=O(!0),this.showInternetDisconnectPopup=O(!1),this.isMuted=O(!0),this.isFullscreen=O(!1),this.isDocumentVisible=O(typeof document>"u"||document.visibilityState==="visible"),this.resumeFrameHandle=null,this.beepAudio=typeof Audio<"u"?new Audio("assets/sound/beep.mp3"):null,this.onOffline=()=>{this.isAllowed.set(!1),this.enableVolumeAndPlayBeep()},this.onOnline=()=>{this.isAllowed.set(!0),this.muteBeep()},this.onFullscreenChange=()=>{this.isFullscreen.set(this.checkFullscreen())},this.onVisibilityChange=()=>{if(document.visibilityState!=="visible"){this.cancelScheduledResume(),this.isDocumentVisible.set(!1);return}this.isDocumentVisible()||this.scheduleResumeAfterPaint()}}init(){this.beepAudio&&(this.beepAudio.preload="auto"),typeof window<"u"&&(window.addEventListener("offline",this.onOffline),window.addEventListener("online",this.onOnline)),typeof document<"u"&&(document.addEventListener("fullscreenchange",this.onFullscreenChange),document.addEventListener("visibilitychange",this.onVisibilityChange),this.isFullscreen.set(this.checkFullscreen()),this.onVisibilityChange()),typeof navigator<"u"&&(this.isAllowed.set(navigator.onLine),navigator.onLine||this.enableVolumeAndPlayBeep())}destroy(){this.cancelScheduledResume(),typeof window<"u"&&(window.removeEventListener("offline",this.onOffline),window.removeEventListener("online",this.onOnline)),typeof document<"u"&&(document.removeEventListener("fullscreenchange",this.onFullscreenChange),document.removeEventListener("visibilitychange",this.onVisibilityChange)),this.beepAudio&&(this.beepAudio.pause(),this.beepAudio.currentTime=0)}scheduleResumeAfterPaint(){if(this.cancelScheduledResume(),typeof requestAnimationFrame!="function"){this.isDocumentVisible.set(!0);return}this.resumeFrameHandle=requestAnimationFrame(()=>{this.resumeFrameHandle=requestAnimationFrame(()=>{this.resumeFrameHandle=null,document.visibilityState==="visible"&&this.isDocumentVisible.set(!0)})})}cancelScheduledResume(){this.resumeFrameHandle===null||typeof cancelAnimationFrame!="function"||(cancelAnimationFrame(this.resumeFrameHandle),this.resumeFrameHandle=null)}toggleVolume(){this.isMuted()||this.muteBeep()}toggleFullscreen(){return k(this,null,function*(){if(!(typeof document>"u"))try{this.checkFullscreen()?(yield document.exitFullscreen(),this.updateFullscreenState(!1)):(yield document.documentElement.requestFullscreen(),this.updateFullscreenState(!0))}catch{}})}toggleBeepSound(){if(this.isMuted()){this.enableVolumeAndPlayBeep();return}this.muteBeep()}closeDisconnectPopup(){this.showInternetDisconnectPopup.set(!1)}enableVolumeAndPlayBeep(){this.isMuted.set(!1),this.showInternetDisconnectPopup.set(!0),this.beepAudio&&(this.beepAudio.currentTime=0,this.beepAudio.play().catch(()=>{}))}muteBeep(){this.isMuted.set(!0),this.beepAudio&&(this.beepAudio.pause(),this.beepAudio.currentTime=0)}checkFullscreen(){return typeof document<"u"&&!!document.fullscreenElement}updateFullscreenState(e){this.userStateService.updateStateAndSave({is_fullscreen:e})}};o.\u0275fac=function(t){return new(t||o)(V(Oe))}
1,o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var yc=[{matches:({secondaryId:i})=>i===ge.id||i===_e.id,defaults:{market:{compact:!1}}},{matches:({secondaryId:i})=>Ee(i)||me(i),defaults:{scanner:{multiMode:!0}}}],Cc={market:{compact:!0},scanner:{compact:!1}};function Xs(i){return yc.reduce((o,r)=>r.matches(i)?F(f({},o),{market:f(f({},o.market),r.defaults.market),scanner:f(f({},o.scanner),r.defaults.scanner)}):o,Cc)}var he=(()=>{let o=class o{constructor(e){this.userStateService=e,this.showMarketPanel=O(!0),this.showScannerPanel=O(!0),this.showDeltaPanel=O(!0),this.showMatrixPanel=O(!0),this.showDetailPanel=O(!0),this.isMarketFullView=O(!1),this.isScannerFullView=O(!1),this.isDeltaFullView=O(!1),this.isMatrixFullView=O(!1),this.isDetailFullView=O(!1),this.isDeltaPanelAvailable=O(!1),this.isMatrixPanelAvailable=O(!1),this.hideColumns=O(!0),this.hideScannerColumns=O(!1),this.isProtected=O(!1),this.isFlowChart=O(!1),this.isDeltaFlowChart=O(!1),this.isMultiMode=O(!0),this.isScannerSplitView=O(!1),this.screenZoom=O(100),this.marketPanelZoom=O(100),this.scannerPanelZoom=O(100),this.marketPopupRequest=O(0),this.scannerPopupRequest=O(0),this.deltaPopupRequest=O(0),this.matrixPopupRequest=O(0),this.detailPopupRequest=O(0),this.minScreenZoom=70,this.maxScreenZoom=130,this.screenZoomStep=5,this.controlDefaultsKey=""}applyControlDefaults(e){let t=`${e.primaryId}:${e.secondaryId}`;if(this.controlDefaultsKey===t)return;this.controlDefaultsKey=t;let n=Xs(e);n.market?.compact!==void 0&&(this.hideColumns.set(n.market.compact),this.userStateService.setState({compact_market_view:n.market.compact})),n.scanner?.compact!==void 0&&(this.hideScannerColumns.set(n.scanner.compact),this.userStateService.setState({compact_scanner_view:n.scanner.compact})),n.scanner?.multiMode!==void 0&&this.isMultiMode.set(n.scanner.multiMode)}onCompactToggle(e){this.hideColumns.set(e)}onScannerCompactToggle(e){this.hideScannerColumns.set(e)}toggleMarketPanel(){this.showMarketPanel()&&!this.canHidePanel()||(this.showMarketPanel.update(e=>!e),this.isMarketFullView.set(!1),this.isScannerFullView.set(!1),this.isDeltaFullView.set(!1),this.isMatrixFullView.set(!1),this.isScannerSplitView.set(!1))}toggleMarketFullView(){this.isScannerFullView.set(!1),this.isDeltaFullView.set(!1),this.isMatrixFullView.set(!1),this.isDetailFullView.set(!1),this.isScannerSplitView.set(!1),this.isMarketFullView.update(e=>{let t=!e;return t?(this.showMarketPanel.set(!0),this.showScannerPanel.set(!1),this.showDeltaPanel.set(!1),this.showMatrixPanel.set(!1),this.showDetailPanel.set(!1)):(this.showMarketPanel.set(!0),this.showScannerPanel.set(!0),this.showDeltaPanel.set(!0),this.showMatrixPanel.set(!0),this.showDetailPanel.set(!0)),t})}toggleScannerPanel(){this.showScannerPanel()&&!this.canHidePanel()||(this.showScannerPanel.update(e=>!e),this.isMarketFullView.set(!1),this.isScannerFullView.set(!1),this.isDeltaFullView.set(!1),this.isMatrixFullView.set(!1),this.isDetailFullView.set(!1),this.isScannerSplitView.set(!1))}toggleScannerFullView(){this.isMarketFullView.set(!1),this.isDeltaFullView.set(!1),this.isMatrixFullView.set(!1),this.isDetailFullView.set(!1),this.isScannerFullView.update(e=>{let t=!e;return t?(this.showMarketPanel.set(!1),this.showScannerPanel.set(!0),this.showDeltaPanel.set(!1),this.showMatrixPanel.set(!1),this.showDetailPanel.set(!1)):(this.showMarketPanel.set(!0),this.showScannerPanel.set(!0),this.showDeltaPanel.set(!0),this.showMatrixPanel.set(!0),this.showDetailPanel.set(!0),this.isScannerSplitView.set(!1)),t})}toggleCenterPanel(){this.toggleScannerPanel()}toggleCenterFullView(){this.toggleScannerFullView()}setDeltaPanelAvailable(e){this.isDeltaPanelAvailable.set(e),e||(this.showDeltaPanel.set(!0),this.isDeltaFullView.set(!1))}setMatrixPanelAvailable(e){this.isMatrixPanelAvailable.set(e),e||(this.showMatrixPanel.set(!0),this.isMatrixFullView.set(!1))}toggleDeltaPanel(){this.showDeltaPanel()&&!this.canHidePanel()||(this.showDeltaPanel.update(e=>!e),this.isMarketFullView.set(!1),this.isScannerFullView.set(!1),this.isDeltaFullView.set(!1),this.isMatrixFullView.set(!1),this.isDetailFullView.set(!1),this.isScannerSplitView.set(!1))}toggleDeltaFullView(){this.isMarketFullView.set(!1),this.isScannerFullView.set(!1),this.isMatrixFullView.set(!1),this.isDetailFullView.set(!1),this.isScannerSplitView.set(!1),this.isDeltaFullView.update(e=>{let t=!e;return t?(this.showMarketPanel.set(!1),this.showScannerPanel.set(!1),this.showDeltaPanel.set(!0),this.showMatrixPanel.set(!1),this.showDetailPanel.set(!1)):(this.showMarketPanel.set(!0),this.showScannerPanel.set(!0),this.showDeltaPanel.set(!0),this.showMatrixPanel.set(!0),this.showDetailPanel.set(!0)),t})}
1toggleMatrixPanel(){this.showMatrixPanel()&&!this.canHidePanel()||(this.showMatrixPanel.update(e=>!e),this.isMarketFullView.set(!1),this.isScannerFullView.set(!1),this.isDeltaFullView.set(!1),this.isMatrixFullView.set(!1),this.isDetailFullView.set(!1),this.isScannerSplitView.set(!1))}toggleMatrixFullView(){this.isMarketFullView.set(!1),this.isScannerFullView.set(!1),this.isDeltaFullView.set(!1),this.isDetailFullView.set(!1),this.isScannerSplitView.set(!1),this.isMatrixFullView.update(e=>{let t=!e;return t?(this.showMarketPanel.set(!1),this.showScannerPanel.set(!1),this.showDeltaPanel.set(!1),this.showMatrixPanel.set(!0),this.showDetailPanel.set(!1)):(this.showMarketPanel.set(!0),this.showScannerPanel.set(!0),this.showDeltaPanel.set(!0),this.showMatrixPanel.set(!0),this.showDetailPanel.set(!0)),t})}toggleDetailPanel(){this.showDetailPanel()&&!this.canHidePanel()||(this.showDetailPanel.update(e=>!e),this.isMarketFullView.set(!1),this.isScannerFullView.set(!1),this.isDeltaFullView.set(!1),this.isMatrixFullView.set(!1),this.isDetailFullView.set(!1),this.isScannerSplitView.set(!1))}toggleDetailFullView(){this.isMarketFullView.set(!1),this.isScannerFullView.set(!1),this.isDeltaFullView.set(!1),this.isMatrixFullView.set(!1),this.isScannerSplitView.set(!1),this.isDetailFullView.update(e=>{let t=!e;return t?(this.showMarketPanel.set(!1),this.showScannerPanel.set(!1),this.showDeltaPanel.set(!1),this.showMatrixPanel.set(!1),this.showDetailPanel.set(!0)):(this.showMarketPanel.set(!0),this.showScannerPanel.set(!0),this.showDeltaPanel.set(!0),this.showMatrixPanel.set(!0),this.showDetailPanel.set(!0)),t})}toggleShield(){let e=this.userStateService.getState().is_enable_protection_opened;this.userStateService.updateStateAndSave({is_enable_protection_opened:!e}),this.isProtected.update(t=>!t)}toggleFlowChart(){this.isFlowChart.update(e=>!e)}toggleDeltaFlowChart(){this.isDeltaFlowChart.update(e=>!e)}toggleMultiMode(){this.isMultiMode.update(e=>!e)}toggleScannerSplitView(){this.isScannerFullView()&&this.isScannerSplitView.update(e=>!e)}toggleCenterSplitView(){this.toggleScannerSplitView()}requestMarketPopup(){this.marketPopupRequest.update(e=>e+1)}resetMarketPopupRequest(){this.marketPopupRequest.set(0)}requestScannerPopup(){this.scannerPopupRequest.update(e=>e+1)}resetScannerPopupRequest(){this.scannerPopupRequest.set(0)}requestDeltaPopup(){this.deltaPopupRequest.update(e=>e+1)}resetDeltaPopupRequest(){this.deltaPopupRequest.set(0)}requestMatrixPopup(){this.matrixPopupRequest.update(e=>e+1)}resetMatrixPopupRequest(){this.matrixPopupRequest.set(0)}requestDetailPopup(){this.detailPopupRequest.update(e=>e+1)}resetDetailPopupRequest(){this.detailPopupRequest.set(0)}decreaseScreenZoom(){let t=this.userStateService.getState().zoom_out+this.screenZoomStep;this.userStateService.updateStateAndSave({zoom_out:t}),this.screenZoom.update(n=>Math.max(this.minScreenZoom,n-this.screenZoomStep))}increaseScreenZoom(){let t=this.userStateService.getState().zoom_in+this.screenZoomStep;this.userStateService.updateStateAndSave({zoom_in:t}),this.screenZoom.update(n=>Math.min(this.maxScreenZoom,n+this.screenZoomStep))}resetScreenZoom(){let e=this.userStateService.getState().reset_zoom;this.userStateService.updateStateAndSave({reset_zoom:!e}),this.screenZoom.set(100)}canHidePanel(){return Number(this.showMarketPanel())+Number(this.showScannerPanel())+Number(this.isDeltaPanelAvailable()&&this.showDeltaPanel())+Number(this.isMatrixPanelAvailable()&&this.showMatrixPanel())+Number(this.showDetailPanel())>1}};o.\u0275fac=function(t){return new(t||o)(V(Oe))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var vc={[kn]:{scannerEvent:os},[ge.id]:{spotUpdates:!0,mispricingUpdates:!0,scannerEvent:"equity-futures-carry-arbitrage-scanner"},[_e.id]:{spotUpdates:!0,mispricingUpdates:!0,scannerEvent:"equity-futures-reverse-carry-arbitrage-scanner"},[je.id]:{spotUpdates:!0,mispricingUpdates:!0,scannerEvent:"etf-futures-carry-arbitrage-scanner"},[ft.id]:{scannerEvent:"equity-protective-put-breakeven-scanner"},[rt.id]:{scannerEvent:"equity-protective-put-breakeven-scanner"},[Xt.id]:{scannerEvent:"equity-options-parity-arbitrage-scanner"},[xi.id]:{scannerEvent:"equity-options-parity-arbitrage-scanner"},[Et.id]:{scannerEvent:"equity-options-parity-arbitrage-scanner"},[Tt.id]:{scannerEvent:"equity-options-parity-arbitrage-scanner"},[ue.id]:{scannerEvent:"equity-options-parity-arbitrage-scanner"}
1,[j.id]:{scannerEvent:"equity-spread-long-box-scanner-row-added"},[ie.id]:{scannerEvent:"equity-spread-short-box-scanner-row-added"},[Q.id]:{scannerEvent:"index-spread-short-box-scanner-row-added"},[ee.id]:{scannerEvent:"index-spread-long-box-scanner-row-added"},[mt.id]:{scannerEvent:"equity-options-parity-arbitrage-scanner"},[It.id]:{scannerEvent:"equity-options-parity-arbitrage-scanner"}},Ws=i=>vc[i]??{};var wc=5e3,yn=(()=>{let o=class o{constructor(e){this.signalR=e,this.connectionState=O("disconnected"),this.lastScannerMessageAt=O(null),this.boundLiveConfig={},this.activeSelections=new Map,this.subscribedSelections=new Set,this.subscriptionAttempts=new Map,this.subscriptionRetryTimer=null,this.disposed=!1,this.handleScannerUpdate=t=>{this.lastScannerMessageAt.set(Date.now()),this.onScannerUpdate?.(t)},this.hubConnection=this.signalR.connection,this.syncConnectionState(),this.hubConnection.onreconnecting(()=>{this.connectionState.set("reconnecting"),this.subscribedSelections.clear()}),this.hubConnection.onreconnected(()=>{this.connectionState.set("connected"),this.subscribedSelections.clear(),this.handleReconnected()}),this.hubConnection.onclose(()=>{this.connectionState.set("disconnected"),this.subscribedSelections.clear(),this.refreshSubscriptionRetry()})}configureHandlers(e){this.onEquitySpotUpdate=e.onEquitySpotUpdate,this.onMispricingUpdate=e.onMispricingUpdate,this.onScannerUpdate=e.onScannerUpdate,this.onBeforeScannerReconnect=e.onBeforeScannerReconnect,this.onScannerReconnected=e.onScannerReconnected}dispose(){this.disposed=!0,this.activeSelections.clear(),this.subscribedSelections.clear(),this.clearSubscriptionRetry(),this.unbindLiveUpdates()}bindLiveUpdates(e,t=!1,n=!1){let s=Ws(e),p=F(f({},s),{spotUpdates:s.spotUpdates||t,mispricingUpdates:s.mispricingUpdates||n});this.isSameLiveConfig(p)||(this.unbindLiveUpdates(),!(!this.hasLiveConfig(p)||!this.onEquitySpotUpdate||!this.onMispricingUpdate||!this.onScannerUpdate)&&(p.spotUpdates&&this.hubConnection.on("update-equity-spots",this.onEquitySpotUpdate),p.mispricingUpdates&&this.hubConnection.on("update-mispricing-list",this.onMispricingUpdate),p.scannerEvent&&this.hubConnection.on(p.scannerEvent,this.handleScannerUpdate),this.boundLiveConfig=p))}unbindLiveUpdates(){!this.hasLiveConfig(this.boundLiveConfig)||!this.onEquitySpotUpdate||!this.onMispricingUpdate||!this.onScannerUpdate||(this.boundLiveConfig.spotUpdates&&this.hubConnection.off("update-equity-spots",this.onEquitySpotUpdate),this.boundLiveConfig.mispricingUpdates&&this.hubConnection.off("update-mispricing-list",this.onMispricingUpdate),this.boundLiveConfig.scannerEvent&&this.hubConnection.off(this.boundLiveConfig.scannerEvent,this.handleScannerUpdate),this.boundLiveConfig={})}subscribeSelection(e){return k(this,null,function*(){if(this.disposed)return;let t=this.normalizeSelection(e),n=this.getSelectionKey(t);this.activeSelections.set(n,t),yield this.ensureSelectionSubscribed(n)})}unsubscribeSelection(e){return k(this,null,function*(){let t=this.normalizeSelection(e),n=this.getSelectionKey(t);this.activeSelections.delete(n),this.refreshSubscriptionRetry();let s=this.subscriptionAttempts.get(n);s&&(yield s),yield this.unsubscribeConfirmedSelection(n,t)})}ensureSelectionSubscribed(e){if(this.disposed||!this.activeSelections.has(e)||this.subscribedSelections.has(e))return Promise.resolve();let t=this.subscriptionAttempts.get(e);if(t)return t;let n=this.subscribeSelectionCore(e).finally(()=>{this.subscriptionAttempts.get(e)===n&&this.subscriptionAttempts.delete(e),this.refreshSubscriptionRetry()});return this.subscriptionAttempts.set(e,n),n}subscribeSelectionCore(e){return k(this,null,function*(){this.hubConnection.state!==se.Connected&&this.connectionState.set("connecting");try{yield this.signalR.Init()}catch(s){console.error("Unable to initialize SignalR selection subscription:",s),this.syncConnectionState();return}this.syncConnectionState();let t=this.activeSelections.get(e);this.disposed||!t||this.hubConnection.state!==se.Connected||!(yield this.invokeSelection("subscribe",t))||(this.subscribedSelections.add(e),(this.disposed||!this.activeSelections.has(e))&&(yield this.unsubscribeConfirmedSelection(e,t)))})}resubscribeActiveSelections(){return k(this,null,function*(){this.disposed||this.hubConnection.state===se.Connected&&(yield Promise.all(Array.from(this.activeSelections.keys()).map(e=>this.ensureSelectionSubscribed(e))))})}handleReconnected(){return k(this,null,function*(){this.onBeforeScannerReconnect?.(),yield this.resubscribeActiveSelections(),this.disposed||this.onScannerReconnected?.()})}syncConnectionState(){switch(this.hubConnection.state){case se.Connected:this.connectionState.set("connected");break;case se.Connecting:this.connectionState.set("connecting");break;case se.Reconnecting:this.connectionState.set("reconnecting");break;default:this.connectionState.set("disconnected")}}invokeSelection(e,t){return k(this,null,function*(){let s=typeof t!="string"?e==="subscribe"?"SubscribeScanner":"UnsubscribeScanner":e==="subscribe"?"SubscribeSelection":"UnsubscribeSelection";try{return yield this.hubConnection.invoke(s,t),!0}catch(p){return e==="unsubscribe"&&this.isConnectionClosedInvocationError(p)?!0:(console.error(`${s} failed:`,p),!1)}})}unsubscribeConfirmedSelection(e,t){return k(this,null,function*(){if(this.subscribedSelections.has(e)){
1if(this.hubConnection.state!==se.Connected){this.subscribedSelections.delete(e);return}(yield this.invokeSelection("unsubscribe",t))&&this.subscribedSelections.delete(e)}})}refreshSubscriptionRetry(){if(this.disposed||!this.hasMissingSubscriptions()){this.clearSubscriptionRetry();return}this.subscriptionRetryTimer||(this.subscriptionRetryTimer=setTimeout(()=>{this.subscriptionRetryTimer=null,this.retryMissingSubscriptions()},wc))}retryMissingSubscriptions(){return k(this,null,function*(){this.disposed||(yield Promise.all(Array.from(this.activeSelections.keys()).filter(e=>!this.subscribedSelections.has(e)).map(e=>this.ensureSelectionSubscribed(e))),this.refreshSubscriptionRetry())})}hasMissingSubscriptions(){return Array.from(this.activeSelections.keys()).some(e=>!this.subscribedSelections.has(e))}normalizeSelection(e){return typeof e=="string"?e:{secondary_id:e.secondary_id.trim(),put_lot:Number(e.put_lot)}}getSelectionKey(e){return typeof e=="string"?`selection:${e}`:`scanner:${e.secondary_id}:put_lot:${e.put_lot}`}clearSubscriptionRetry(){this.subscriptionRetryTimer&&(clearTimeout(this.subscriptionRetryTimer),this.subscriptionRetryTimer=null)}isConnectionClosedInvocationError(e){let t=e instanceof Error?e.message:typeof e=="string"?e:String(e?.message??"");return t.includes("Invocation canceled")&&t.includes("underlying connection being closed")}hasLiveConfig(e){return!!(e.spotUpdates||e.mispricingUpdates||e.scannerEvent)}isSameLiveConfig(e){return this.boundLiveConfig.spotUpdates===e.spotUpdates&&this.boundLiveConfig.mispricingUpdates===e.mispricingUpdates&&this.boundLiveConfig.scannerEvent===e.scannerEvent}};o.\u0275fac=function(t){return new(t||o)(V(Fe))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Di=[{id:"near",label:"Near",date:"Near",mispricingKey:"f_1",threshold:0,enabled:!0},{id:"next",label:"Next",date:"Next",mispricingKey:"f_2",threshold:0,enabled:!0},{id:"far",label:"Far",date:"Far",mispricingKey:"f_3",threshold:0,enabled:!0}];var Nt=(()=>{let o=class o{constructor(){this.presetPrices=[2e4,3e4],this.flowMeta=O(Di),this.monthThresholds=O({near:5e3,next:1e4,far:2e4}),this.selectedDate=O(Di[0].date),this.selectedDates=O(Di.map(e=>e.date)),this.selectedPrice=O(this.presetPrices[0]),this.sortDirection=O("desc"),this.sortValueMode=O("absolute"),this.hasSortValueModeSelection=O(!1),this.dates=M(()=>this.flowMeta().map(e=>e.date)),this.dialogMispricingRanges=M(()=>{let e=this.monthThresholds();return[{month:"Near Month",amount:e.near},{month:"Next Month",amount:e.next},{month:"Far Month",amount:e.far}]})}getSortValueMode(e){return!this.hasSortValueModeSelection()&&e===ge.id?"signed":this.sortValueMode()}applySettings(e){if(e.selectedDates?.length?(this.selectedDates.set(e.selectedDates),this.selectedDate.set(e.selectedDate??e.selectedDates[0])):e.selectedDate&&(this.selectedDates.set([e.selectedDate]),this.selectedDate.set(e.selectedDate)),typeof e.selectedPrice=="number"&&this.selectedPrice.set(e.selectedPrice),e.sortDirection&&this.sortDirection.set(e.sortDirection),e.sortValueMode&&(this.hasSortValueModeSelection.set(!0),this.sortValueMode.set(e.sortValueMode)),!e.mispricingRanges?.length)return;let t=f({},this.monthThresholds());for(let n of e.mispricingRanges)n.month==="Near Month"?t.near=n.amount:n.month==="Next Month"?t.next=n.amount:n.month==="Far Month"&&(t.far=n.amount);this.monthThresholds.set(t)}};o.\u0275fac=function(t){return new(t||o)}
1,o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Zs=/^\d{4}-\d{2}-\d{2}$/,Xe=(()=>{let o=class o{constructor(e,t,n,s,p,m,h){this.store=e,this.ui=t,this.tickStore=n,this.dataLoader=s,this.signalRManager=p,this.mispricingSettings=m,this.browser=h,this.currentPageSelection=null,this.currentPrimarySelection=null,this.primaryId="",this.scannerActive=!1,this.destroyed=!1,this.scannerSnapshotOriginId="",this.longBoxSnapshotReadyOriginId="",this.pendingLongBoxScannerEvents=[],this.maxLossSelectionRequestKey="",this.maxLossSnapshotReadyRequestKey="",this.pendingMaxLossScannerEvents=[],this.maxLossFinancialStateByInstrument=new Map,this.pageSelectionTransition=Promise.resolve(),this.updateHandler=x=>{if(this.store.currentView()!=="market"||!this.isActiveSpotPayload(x))return;let I=x.data;this.tickStore.update({key:I.key,price:I.data.last_price,change:I.data.change,update:I.data.update})},this.updateMispricings=x=>{if(!this.isActiveOriginPayload(x))return;let I=x.data,N=I.equityKey??I.equity_key,B=I.futuresKey??I.futures_key;if(!Number.isFinite(N)||!B||!Number.isFinite(I.token)){console.warn("Invalid mispricing update payload:",x);return}this.tickStore.updateMispricing(N,B,I.value,I.token)},this.updateFuturesCarryArbitrage=x=>{if(this.isLongBoxScanner()){this.appendLongBoxScannerEvent(x);return}if(this.isScannerQueueEvent(x)){this.enqueueImmutableScannerEvent(x);return}let I=this.resolveProtectivePutScannerLiveRows(x);if(I){I.title&&this.store.setTitle(I.title),this.store.enqueueScannerQueueRows(Kn(I.rows)),this.store.setScannerQueueLoaded(!0);return}let N=this.resolveScannerLiveData(x);if(N){if(this.isScannerResponseDto(N)){let B=this.filterScannerRowsForCurrentMode(N.data),$=Rn(B);this.store.setTitle(N.title||"-"),this.isEquityCarryScanner()?this.store.replaceScannerQueueRows($.slice().reverse()):$.length&&this.store.enqueueScannerQueueRows($),this.store.setScannerQueueLoaded(!0);return}this.isActiveScannerRowForCurrentMode(N)&&this.store.enqueueScannerQueueRows(Rn([N]))}},this.scannerActive=this.ui.showScannerPanel()&&this.browser.isDocumentVisible(),this.signalRManager.configureHandlers({onEquitySpotUpdate:this.updateHandler,onMispricingUpdate:this.updateMispricings,onScannerUpdate:this.updateFuturesCarryArbitrage}),re(()=>{let x=this.ui.showScannerPanel()&&this.browser.isDocumentVisible();this.setScannerActivity(x)}),re(()=>{let x=Y(this.store.originId())??"",I=this.storeScannerMode(),N=I==="single"?this.store.selectedInstrumentToken():null,B=this.buildMaxLossSelectionRequestKey(x,I,N);this.handleMaxLossSelectionChanged(B)})}init(){return k(this,null,function*(){yield this.syncPrimarySelection(),yield this.queuePageSelectionSync()})}destroy(){return k(this,null,function*(){this.destroyed=!0,this.scannerActive=!1,this.resetMaxLossSnapshotHandoff(),this.dataLoader.cancelScannerRequest(),yield this.queuePageSelectionSync(),yield this.unsubscribeCurrentPrimarySelection(),this.signalRManager.dispose()})}setPrimaryId(e){this.primaryId!==e&&(this.primaryId=e,this.store.setPrimaryId(e),this.bindLiveUpdates(),this.syncPrimarySelection())}setOriginId(e){this.store.originId()!==e&&(this.store.setOriginId(e),this.store.resetForOriginChange(),this.scannerSnapshotOriginId="",this.longBoxSnapshotReadyOriginId="",this.pendingLongBoxScannerEvents=[],this.resetMaxLossSnapshotHandoff(),this.dataLoader.cancelScannerRequest(),this.loadPriceDeviations(),this.bindLiveUpdates(),this.activateScannerOrigin(e))}switchView(e){this.store.currentView()!==e&&(this.store.setCurrentView(e),this.store.triggerTableAnimation())}ensureScannerQueueLoaded(){this.scannerActive&&this.store.originId()&&(this.store.scannerQueueLoaded()||this.loadScannerQueue())}loadPriceDeviations(){let e=Y(this.store.originId());e&&this.dataLoader.loadPriceDeviations(this.primaryId,this.store.hedgeActiveAssets(),e)}loadScannerQueue(){if(!this.scannerActive||this.destroyed)return;let e=Y(this.store.originId())??"",t=e===j.id,n=t?this.store.equityLongBoxPutLot():null,s=this.isLongBoxScanner(e)?"multi":this.storeScannerMode(),p=s==="single"&&this.shouldUseSelectedSpotForScanner()?this.store.selectedInstrumentToken():null,m=this.buildMaxLossSelectionRequestKe
1y(e,s,p),h=t?`${e}:${n??"invalid"}`:me(e)?m:e;if(!e||me(e)&&!m||this.scannerSnapshotOriginId===h)return;if(t&&n===null){this.dataLoader.cancelScannerRequest(),this.store.replaceLongBoxScannerSnapshot([]),this.store.setScannerQueueLoaded(!0),this.store.setScannerQueueLoading(!1),this.store.setScannerQueueError(this.store.equityLongBoxPutLotError());return}this.scannerSnapshotOriginId=h;let x=this.resolveScannerTargetDate(e);if(this.isLongBoxScanner(e)){let I=N=>this.handleLongBoxSnapshotLoaded(e,N);t?this.dataLoader.loadScannerQueue(e,s,p,void 0,I,n):this.dataLoader.loadScannerQueue(e,s,p,void 0,I);return}if(me(e)){this.beginMaxLossSnapshotHandoff(m),this.dataLoader.loadScannerQueue(e,s,p,void 0,I=>this.handleMaxLossSnapshotSettled(e,m,I));return}if(x){this.dataLoader.loadScannerQueue(e,s,p,x);return}if(this.isProtectivePutBreakevenScanner(e)){this.dataLoader.loadScannerQueue(e,s,p,null);return}this.dataLoader.loadScannerQueue(e,s,p)}refreshEquityLongBoxLot(){(Y(this.store.originId())??"")===j.id&&(this.scannerSnapshotOriginId="",this.longBoxSnapshotReadyOriginId="",this.pendingLongBoxScannerEvents=[],this.dataLoader.cancelScannerRequest(),this.store.replaceLongBoxScannerSnapshot([]),this.queuePageSelectionSync().then(()=>this.loadScannerQueue()).catch(()=>{}))}bindLiveUpdates(){this.signalRManager.bindLiveUpdates(Y(this.store.originId())??"",this.shouldSubscribePrimarySpotUpdates(),this.shouldSubscribePrimaryMispricingUpdates())}unbindLiveUpdates(){this.signalRManager.unbindLiveUpdates()}selectDetailsTarget(e){let t=e.expiryIndex??1,n=e.instrumentToken??null,s=this.store.selectedIndexName()===e.indexName,p=this.store.selectedInstrumentToken()===n,m=this.store.selectedExpiryIndex()===t,h=this.store.selectedScannerExpiry()===(e.expiry?.trim()||null),x=e.rowIndex===void 0||this.store.selectedRowSource()===e.source&&this.store.selectedRowIndex()===e.rowIndex;s&&p&&m&&h&&e.source!=="scanner"&&x||(e.source==="scanner"?this.store.setSelectedScannerRow({indexName:e.indexName,instrumentToken:n,expiryIndex:t,rowKey:e.rowKey,tradeTokens:e.tradeTokens,optionInstrumentTokens:e.optionInstrumentTokens,payoffInstrumentTokens:e.payoffInstrumentTokens,expiry:e.expiry,putLot:e.putLot}):e.expiryIndex!==void 0?this.store.setSelectedIndexAndExpiry(e.indexName,n,t):this.store.setSelectedIndexName(e.indexName,n),e.rowIndex!==void 0&&this.store.setActiveRowSelection(e.source,e.rowIndex))}resolvePageSelection(){if(!this.scannerActive||this.destroyed)return null;let e=Y(this.store.originId());if(!e)return null;if(e===j.id){let t=this.store.equityLongBoxPutLot();return t===null?null:{secondary_id:e,put_lot:t}}switch(e){case ge.id:return e;case _e.id:return e;case je.id:return e;case ft.id:return e;case rt.id:return e;case kn:return e;default:return this.isLongBoxScanner(e)||this.isSpotOptionParityScanner(e)||this.isShortBoxScanner(e)?e:null}}syncPageSelection(){return k(this,null,function*(){let e=this.resolvePageSelection(),t=this.currentPageSelection;this.isSamePageSelection(t,e)||(t&&(yield this.signalRManager.unsubscribeSelection(t)),this.currentPageSelection=e,e&&(yield this.signalRManager.subscribeSelection(e)))})}queuePageSelectionSync(){let e=this.pageSelectionTransition.then(()=>this.syncPageSelection());return this.pageSelectionTransition=e.catch(t=>{console.error("Unable to synchronize scanner selection:",t)}),e}isSamePageSelection(e,t){return e===t?!0:!e||!t||typeof e=="string"||typeof t=="string"?!1:e.secondary_id===t.secondary_id&&e.put_lot===t.put_lot}setScannerActivity(e){return k(this,null,function*(){this.destroyed||this.scannerActive===e||(this.scannerActive=e,this.dataLoader.cancelScannerRequest(),e||(this.scannerSnapshotOriginId="",this.longBoxSnapshotReadyOriginId="",this.pendingLongBoxScannerEvents=[],this.resetMaxLossSnapshotHandoff()),yield this.queuePageSelectionSync(),e&&(this.isLongBoxScanner()||me(Y(this.store.originId())))&&this.loadScannerQueue())})}activateScannerOrigin(e){return k(this,null,function*(){yield this.queuePageSelectionSync(),!(this.destroyed||!this.scannerActive||this.store.originId()!==e)&&this.loadScannerQueue()})}resolvePrimarySelection(){return this.shouldSubscribePrimarySpotUpdates()?this.primaryId:null}syncPrimarySelection(){return k(this,null,function*(){let e=this.resolvePrimarySelection(),t=this.currentPrimarySelection;t!==e&&(t&&(yield this.signalRManager.unsubscribeSelection(t)),this.currentPrimarySelection=e,e&&(yield this.signalRManager.subscribeSelection(e)))})}enqueueImmutableScannerEvent(e){let t=Y(this.store.originId())??"";if(!t||e.secondary_id.toLowerCase()!==t.toLowerCase())return;if(me(t)){this.appendMaxLossScannerEvent(e,t);return}if(Ee(t)){if(!this.isProtectivePutScannerRow(e.data))return;let p=this.filterProtectivePutRowsForCurrentMode([e.data]),[m]=Kn(p);m&&(this.store.enqueueScannerQueueRow(Ci(m,e)),this.store.setScannerQueueLoaded(!0));return}let n=this.isShortBoxScanner(t)?this.resolveShortBoxScannerEventRow(e.data):this.isFuturesScannerDto(e.data)?e.data:null;if(!n||!this.isActiveScannerRowForCurrentMode(n))return;let[s]=Rn([n]);this.store.enqueueScannerQueueRow(Ci(s,e)),this.store.setScannerQueueLoaded(!0)}appendLongBoxScannerEvent(e){let t=Y(this.store.originId())??"";if(!t||!this.isScannerQueueEvent(e)||e.secondary_id.toLowerCase()!==t.toLowerCase()||!this.isFuturesScannerDto(e.data)||!this.matchesActiveEquityLongBoxLot(t,e.data))return;let n=F(f({},e),{data:e.data});
1if(this.longBoxSnapshotReadyOriginId!==t){this.pendingLongBoxScannerEvents.some(s=>s.event_id===n.event_id)||this.pendingLongBoxScannerEvents.push(n);return}this.store.appendLongBoxScannerRow(n)&&this.store.setScannerQueueLoaded(!0)}appendMaxLossScannerEvent(e,t){let n=this.storeScannerMode(),s=n==="single"?this.store.selectedInstrumentToken():null;if(!this.isMaxLossScannerRow(e.data)||!this.isMaxLossRowForCurrentMode(e.data))return;let p=this.buildMaxLossSelectionRequestKey(t,n,s);if(!p)return;let m=F(f({},e),{data:e.data});if(this.maxLossSelectionRequestKey!==p&&(this.maxLossSelectionRequestKey=p,this.maxLossSnapshotReadyRequestKey="",this.pendingMaxLossScannerEvents=[],this.maxLossFinancialStateByInstrument.clear()),this.maxLossSnapshotReadyRequestKey!==p){this.pendingMaxLossScannerEvents.some(h=>h.event_id===m.event_id)||this.pendingMaxLossScannerEvents.push(m);return}this.isNewMaxLossFinancialState(m.data)&&this.enqueueMaxLossScannerEvents([m])}handleMaxLossSnapshotSettled(e,t,n){let s=Y(this.store.originId())??"",p=this.resolveCurrentMaxLossSelectionRequestKey();if(this.destroyed||!this.scannerActive||s!==e||p!==t||this.maxLossSelectionRequestKey!==t)return;n||(this.scannerSnapshotOriginId=""),this.maxLossSnapshotReadyRequestKey=t;let m=this.collectMaxLossSnapshotFinancialStates();this.maxLossFinancialStateByInstrument.clear();for(let[x,I]of m)this.maxLossFinancialStateByInstrument.set(x,I);let h=this.pendingMaxLossScannerEvents.filter(x=>x.secondary_id.toLowerCase()===e.toLowerCase()&&this.isMaxLossRowForCurrentMode(x.data)).sort((x,I)=>x.sequence-I.sequence).filter(x=>this.isNewMaxLossFinancialState(x.data));this.pendingMaxLossScannerEvents=[],h.length&&this.enqueueMaxLossScannerEvents(h),this.store.setScannerQueueLoaded(!0)}enqueueMaxLossScannerEvents(e){let t=e.map(n=>{let[s]=Si([n.data]);return Ci(s,n)});this.store.enqueueScannerQueueRows(t),this.store.setScannerQueueError(null),this.store.setScannerQueueLoaded(!0)}handleLongBoxSnapshotLoaded(e,t=!0){if(this.destroyed||!this.scannerActive||this.store.originId()!==e)return;t||(this.scannerSnapshotOriginId=""),this.longBoxSnapshotReadyOriginId=e;let n=this.pendingLongBoxScannerEvents;this.pendingLongBoxScannerEvents=[];for(let s of n)s.secondary_id.toLowerCase()===e.toLowerCase()&&this.store.appendLongBoxScannerRow(s);this.queuePageSelectionSync()}matchesActiveEquityLongBoxLot(e,t){if(e!==j.id)return!0;let n=t.lot_count??t.box_spread?.lot_count??t.spread?.lot_count,s=this.store.equityLongBoxPutLot();return s!==null&&(n==null||Number(n)===s)}resolveShortBoxScannerEventRow(e){if(this.isFuturesScannerDto(e))return e;if(!this.isRecord(e)||!this.isRecord(e.price_matrix)||!this.isRecord(e.trade_tokens))return null;let t=e.price_matrix,n=e.trade_tokens,s=Number(n.spot),p=Number(n.ce),m=Number(n.pe),h=Number(n.max_profit),x=n.strategy,I=t.expiry;if(!Number.isFinite(s)||!Number.isFinite(p)||!Number.isFinite(m)||!Number.isFinite(h)||typeof x!="string"||typeof I!="string")return null;let N=this.store.scannerQueueRows().find(xe=>xe.spot_info.instrument_token===s),B=this.store.marketRows().find(xe=>xe.spot_info.instrument_token===s),$=this.store.selectedInstrumentToken()===s?this.store.selectedIndexName():`Spot ${s}`,K=N?.spot_info??(B?F(f({},B.spot_info),{priceDirection:B.direction.priceDirection,changeDirection:B.direction.changeDirection}):{instrument_token:s,symbol:$,price:0,change:0,update:0,exchange:"NSE",priceDirection:"none",changeDirection:"none"}),oe=t.value,le=Number(oe),Ce=Number(t.expiry_index);return{spot_info:K,price_matrix:{expiry:I,value:oe===null?null:Number.isFinite(le)?le:null,expiry_index:Number.isFinite(Ce)?Ce:1},trade_tokens:{spot:s,ce:p,pe:m,strategy:x,max_profit:h}}}isMaxLossRowForCurrentMode(e){if(this.storeScannerMode()!=="single")return!0;let t=this.store.selectedInstrumentToken();return Number.isFinite(t)&&e.instrument_token===t}resolveCurrentMaxLossSelectionRequestKey(){let e=Y(this.store.originId())??"",t=this.storeScannerMode(),n=t==="single"?this.store.selectedInstrumentToken():null;return this.buildMaxLossSelectionRequestKey(e,t,n)}
1buildMaxLossSelectionRequestKey(e,t,n){return!me(e)||t==="single"&&!Number.isFinite(n)?"":JSON.stringify(["max-loss-scanner",e,t,t==="single"?n:null])}beginMaxLossSnapshotHandoff(e){this.maxLossSelectionRequestKey!==e?(this.maxLossSelectionRequestKey=e,this.pendingMaxLossScannerEvents=[]):this.maxLossSnapshotReadyRequestKey===e&&(this.pendingMaxLossScannerEvents=[]),this.maxLossSnapshotReadyRequestKey="",this.maxLossFinancialStateByInstrument.clear()}handleMaxLossSelectionChanged(e){if(this.maxLossSelectionRequestKey===e)return;let t=this.maxLossSelectionRequestKey;this.maxLossSelectionRequestKey=e,this.maxLossSnapshotReadyRequestKey="",this.pendingMaxLossScannerEvents=[],this.maxLossFinancialStateByInstrument.clear(),!(!t&&!e)&&(this.scannerSnapshotOriginId="",this.dataLoader.cancelScannerRequest(),t&&(this.store.replaceScannerQueueRows([]),this.store.setScannerQueueLoaded(!1)),!(!e||!this.scannerActive||this.destroyed)&&this.queuePageSelectionSync().then(()=>{!this.destroyed&&this.scannerActive&&this.resolveCurrentMaxLossSelectionRequestKey()===e&&this.loadScannerQueue()}).catch(()=>{}))}resetMaxLossSnapshotHandoff(){this.maxLossSelectionRequestKey="",this.maxLossSnapshotReadyRequestKey="",this.pendingMaxLossScannerEvents=[],this.maxLossFinancialStateByInstrument.clear()}collectMaxLossSnapshotFinancialStates(){let e=new Map;for(let t of this.store.scannerQueueRows())Jt(t)&&e.set(this.getMaxLossInstrumentKey(t.max_loss_row),this.getMaxLossFinancialFingerprint(t.max_loss_row));return e}isNewMaxLossFinancialState(e){let t=this.getMaxLossInstrumentKey(e),n=this.getMaxLossFinancialFingerprint(e);return this.maxLossFinancialStateByInstrument.get(t)===n?!1:(this.maxLossFinancialStateByInstrument.set(t,n),!0)}getMaxLossInstrumentKey(e){let t=String(e.option_leg.trading_symbol??"").trim().toUpperCase();return t?`trading-symbol:${t}`:`tokens:${Number(e.instrument_token)}:${Number(e.option_leg.instrument_token)}`}getMaxLossFinancialFingerprint(e){return JSON.stringify([Number(e.instrument_token),String(e.symbol??"").trim().toUpperCase(),Number(e.last_price),Number(e.percent_change),String(e.expiry??""),Number(e.max_loss),e.max_loss_is_unlimited===!0,Number(e.option_leg.instrument_token),String(e.option_leg.trading_symbol??"").trim().toUpperCase(),Number(e.option_leg.strike),Number(e.option_leg.delta),Number(e.option_leg.put_lot),Number(e.option_leg.last_price)])}isMaxLossScannerRow(e){if(!this.isRecord(e)||!this.isRecord(e.option_leg))return!1;let t=Number(e.instrument_token),n=Number(e.option_leg.instrument_token);return Number.isFinite(t)&&t>0&&typeof e.symbol=="string"&&Number.isFinite(n)&&n>0}resolveScannerLiveData(e){if(this.isScannerLiveUpdatePayload(e)){let t=Y(this.store.originId())??"",n=e.selectionKey??e.origin_id??e.originId;return n&&n!==t?null:e.data}return this.isFuturesScannerDto(e)?e:null}resolveProtectivePutScannerLiveRows(e){let t=Y(this.store.originId())??"";if(!Ee(t)||this.getPayloadOriginId(e)!==t)return null;let s=this.hasDataProperty(e)?e.data:e,p=this.toProtectivePutScannerLiveRows(s);if(!p)return null;let m=this.filterProtectivePutRowsForCurrentMode(p.rows);return F(f({},p),{rows:this.preserveCustomTargetDatePop(t,m)})}toProtectivePutScannerLiveRows(e){return Array.isArray(e)?{rows:e.filter(n=>this.isProtectivePutScannerRow(n))}:this.isProtectivePutScannerRow(e)?{rows:[e]}:this.isProtectivePutScannerResponse(e)?{rows:e.data,title:typeof e.title=="string"?e.title:void 0}:null}isProtectivePutScannerResponse(e){return this.isRecord(e)&&Array.isArray(e.data)&&e.data.every(t=>this.isProtectivePutScannerRow(t))}isProtectivePutScannerRow(e){return this.isRecord(e)&&typeof e.symbol=="string"&&typeof e.expiry=="string"&&"breakeven_diff_percent"in e&&"last_price"in e}isActiveOriginPayload(e){let t=Y(this.store.originId())??"",n=e.origin_id??e.originId;return!n||n===t||n===this.primaryId}isActiveSpotPayload(e){return e.primary_id?e.primary_id===this.primaryId:this.isActiveOriginPayload(e)}shouldSubscribePrimarySpotUpdates(){return this.primaryId===Ii||this.primaryId===Yn||this.primaryId===ht||this.primaryId===ki||this.isIndexQuotePrimary()}shouldSubscribePrimaryMispricingUpdates(){return this.primaryId===Yn||this.primaryId===qt||this.primaryId===Gt}isIndexQuotePrimary(){return this.primaryId===qt||this.primaryId===Gt}isSpotOptionParityScanner(e=this.store.originId()){let t=Y(e)??"";return In(t)||fe(t)}isShortBoxScanner(e=this.store.originId()){return Y(e)===ue.id}isLongBoxScanner(e=this.store.originId()){let t=Y(e);return t===j.id||t===ee.id||t===ie.id||t===Q.id}isProtectivePutBreakevenScanner(e=this.store.originId()){return Ee(Y(e))}shouldUseSelectedSpotForScanner(){return this.isSpotOptionParityScanner()||this.isShortBoxScanner()||this.isProtectivePutBreakevenScanner()||me(Y(this.store.originId()))}resolveScannerTargetDate(e){if(!Ee(e))return null;
1let t=this.mispricingSettings.selectedDate();return Zs.test(t)?t:this.mispricingSettings.selectedDates().find(n=>Zs.test(n))??null}storeScannerMode(){return this.ui.isMultiMode()?"multi":"single"}isEquityCarryScanner(){let e=Y(this.store.originId())??"";return e===ge.id||e===_e.id}filterScannerRowsForCurrentMode(e){if(!this.shouldFilterScannerRowsBySelectedSpot())return e;let t=this.store.selectedInstrumentToken();return e.filter(n=>this.getScannerSpotInstrumentToken(n)===t)}isActiveScannerRowForCurrentMode(e){return!this.shouldFilterScannerRowsBySelectedSpot()||this.getScannerSpotInstrumentToken(e)===this.store.selectedInstrumentToken()}shouldFilterScannerRowsBySelectedSpot(){return this.storeScannerMode()==="single"&&(this.isSpotOptionParityScanner()||this.isLongBoxScanner()||this.isShortBoxScanner())&&Number.isFinite(this.store.selectedInstrumentToken())}isScannerLiveUpdatePayload(e){if(!this.hasDataProperty(e))return!1;let t=e.data;return this.isFuturesScannerDto(t)||this.isFuturesScannerResponseDto(t)}filterProtectivePutRowsForCurrentMode(e){let t=this.store.selectedInstrumentToken();return this.storeScannerMode()!=="single"||!Number.isFinite(t)?e:e.filter(n=>n.instrument_token===t)}preserveCustomTargetDatePop(e,t){if(!this.resolveScannerTargetDate(e))return t;let n=this.store.scannerQueueRows();return t.map(s=>{let p=n.find(m=>Hn(m)&&m.protective_put.instrument_token===s.instrument_token&&m.protective_put.option_leg.instrument_token===s.option_leg.instrument_token);return!p||!Hn(p)?s:F(f({},s),{target_date_pop:p.protective_put.target_date_pop})})}isScannerResponseDto(e){return Array.isArray(e.data)}isFuturesScannerResponseDto(e){return this.isRecord(e)&&Array.isArray(e.data)&&e.data.every(t=>this.isFuturesScannerDto(t))}isFuturesScannerDto(e){return this.isRecord(e)?!!e.spot_info&&!!e.price_matrix:!1}isScannerQueueEvent(e){return this.isRecord(e)&&typeof e.event_id=="string"&&!!e.event_id&&typeof e.sequence=="number"&&Number.isFinite(e.sequence)&&typeof e.received_at_utc=="string"&&typeof e.secondary_id=="string"&&typeof e.selection_key=="string"&&"data"in e}hasDataProperty(e){return this.isRecord(e)&&"data"in e}getPayloadOriginId(e){if(!this.isRecord(e))return null;let t=e.selectionKey??e.origin_id??e.originId;return typeof t=="string"?t:null}isRecord(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}unsubscribeCurrentPageSelection(){return k(this,null,function*(){if(!this.currentPageSelection)return;let e=this.currentPageSelection;this.currentPageSelection=null,yield this.signalRManager.unsubscribeSelection(e)})}unsubscribeCurrentPrimarySelection(){return k(this,null,function*(){if(!this.currentPrimarySelection)return;let e=this.currentPrimarySelection;this.currentPrimarySelection=null,yield this.signalRManager.unsubscribeSelection(e)})}getScannerSpotInstrumentToken(e){return e.spot_info?.instrument_token??NaN}};o.\u0275fac=function(t){return new(t||o)(V(ae),V(he),V(Un),V(Xn),V(yn),V(Nt),V(Dt))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var de=(()=>{let o=class o{constructor(e,t,n,s,p){this.route=e,this.store=t,this.ui=n,this.sync=s,this.resources=p,this.activeAnalysis=O(null),this.activeAnalysisTitle=O(""),this.activeStrategyName=O(""),this.primaryId=O(""),this.primarySection=O(""),this.strategyLookupKey="",this.originId=Gr(this.route.paramMap.pipe(Ue(m=>{let h=m.get("primary")||"";this.primaryId.set(h);let x=js(h);this.primarySection.set(x);let I=m.get("secondary")||"",N=Y(I)??null;return this.activeAnalysis.set(N),I})),{initialValue:""}),re(()=>{this.ui.applyControlDefaults({primaryId:this.primaryId(),secondaryId:this.originId()});let m=this.primarySection();this.store.hedgeActiveAssets()!==m&&this.store.setPrimarySection(m),this.sync.setPrimaryId(this.primaryId()),this.sync.setOriginId(this.originId())}),re(()=>{let m=this.primaryId(),h=this.originId();this.activeAnalysisTitle.set(this.resolvePrimaryAnalysisTitle(m)),this.resolveActiveStrategyName(m,h)}),re(()=>{let m=this.primarySection();this.store.hedgeActiveAssets()!==m&&this.store.setPrimarySection(m)})}resolveActiveStrategyName(e,t){if(!e||!t){this.activeStrategyName.set(""),this.strategyLookupKey="";return}let n=history.state;if(n?.strategyName&&n.strategyId===t&&n.productId===e){this.activeStrategyName.set(n.strategyName),this.strategyLookupKey=`${e}:${t}`;return}let s=`${e}:${t}`;if(this.strategyLookupKey===s)return;this.strategyLookupKey=s,this.activeStrategyName.set("");let p=this.resolvePrimaryProductUrl(e);if(!p)return;let m={type:lo.Hedging,user_id:"",product_url:p,dashboard_type:lo.Hedging};this.resources.getHedgingDashboard(m).subscribe({next:h=>{this.activeStrategyName.set(this.findStrategyName(h.data,t))},error:h=>{console.error("Unable to resolve active hedging strategy name",h)}})}findStrategyName(e,t){let n=e?.items??{};for(let s of Object.values(n))for(let p of Object.values(s??{})){let m=p.product?.find(h=>h.strategy_id===t);if(m)return m.strategy_name||m.short_strategy_name||""}return""}resolvePrimaryAnalysisTitle(e){let t=this.resolvePrimaryProductUrl(e);return kr.find(s=>
1s.url===t)?.name??""}resolvePrimaryProductUrl(e){return fo.find(t=>t.id===e)?.event??""}};o.\u0275fac=function(t){return new(t||o)(V(Er),V(ae),V(he),V(Xe),V(zr))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Tc=new Set(["8c761a7f-b49c-4b92-8dfa-600a0331bf7d","09679757-905f-422c-a601-3230243f6fc3","7c064701-8343-4425-adc5-adb56ae7931c",Ot.id,Mt.id,_t,ss.id,Vt.id,Bt.id,$e,ut]),Ic=new Set(["09679757-905f-422c-a601-3230243f6fc3","7c064701-8343-4425-adc5-adb56ae7931c",Ot.id,_t,Bt.id,ut]),kc=new Set([ge.id,_e.id,je.id]),Rc=new Set([Ke.id,pt.id,rt.id,Wt.id,bi.id,zn.id]);function xo(i){return Tc.has(i)}function bo(i){return Rc.has(i)}function yo(i){return Ic.has(i)}function Ni(i){return i.matched_last_price>0}function nn(i){return(xo(i)||bo(i))&&!kc.has(i)}function Bn(i,o){return i===ht||i===Gt&&(fe(o)||o===ee.id||o===Q.id)}function Js(i,o,r){if(o===Bt.id||o===Ot.id||o===_t){let e=r.instrument_token,t=r.future_token??r.source_token??null,n=r.matched_instrument_token;return e!==null&&t!==null&&n>0&&Ni(r)?[e,t,n]:[]}
1if(o===_n.id){let e=r.instrument_token,t=r.future_token??r.source_token??null,n=r.matched_instrument_token;return e!==null&&t!==null&&n>0&&Ni(r)?[t,e,n]:[]}if(i===qt||o===Ot.id||o===Mt.id||o===_t||o===Vt.id){let e=r.instrument_token,t=r.future_token??null;return e!==null&&t!==null?[e,t]:[]}return yo(o)?r.instrument_token&&r.matched_instrument_token>0?[r.instrument_token,r.matched_instrument_token]:[]:r.instrument_token===null?[]:[r.instrument_token]}var Fi=(()=>{let o=class o{constructor(){this.greeksHub=new ms({hubUrl:`${we.base_url}${hs.greeks}`,logLevel:Zr.Warning})}Init(){return k(this,null,function*(){yield this.greeksHub.init()})}disconnect(){return k(this,null,function*(){yield this.greeksHub.stop()})}invoke(e,...t){return k(this,null,function*(){yield this.greeksHub.invoke(e,...t)})}get connection(){return this.greeksHub.connection}get activeConnection(){return this.greeksHub.activeConnection}};o.\u0275fac=function(t){return new(t||o)},o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Li=(()=>{let o=class o{constructor(e,t){this.zone=e,this.greeksHub=t,this.groupsUpdatedSubject=ne
1w pe,this.rowChangesSubject=new pe,this.rowUpdatedSubject=new pe,this.rowUpdatesSubject=new pe,this.rowRemovedSubject=new pe,this.rowRemovalsSubject=new pe,this.stateResetSubject=new pe,this.reconnectedSubject=new pe,this.groupsUpdated$=this.groupsUpdatedSubject.asObservable(),this.rowChanges$=this.rowChangesSubject.asObservable(),this.rowUpdated$=this.rowUpdatedSubject.asObservable(),this.rowUpdates$=this.rowUpdatesSubject.asObservable(),this.rowRemoved$=this.rowRemovedSubject.asObservable(),this.rowRemovals$=this.rowRemovalsSubject.asObservable(),this.stateReset$=this.stateResetSubject.asObservable(),this.reconnected$=this.reconnectedSubject.asObservable(),this.handlersRegisteredFor=null,this.currentSubscription=null,this.currentSubscriptionLease=null,this.nextSubscriptionLease=0,this.subscriptionTransition=Promise.resolve(),this.pendingRowChanges=new Map,this.pendingGroupsSnapshot=null,this.pendingFrame=0}Init(){return k(this,null,function*(){yield this.ensureConnected()})}subscribeDeltaRange(e){return k(this,null,function*(){let t=this.normalizeRequest(e),n=++this.nextSubscriptionLease;return yield this.queueSubscriptionTransition(()=>k(this,null,function*(){if(this.currentSubscription&&this.isSameRequest(this.currentSubscription,t)){this.currentSubscriptionLease=n;return}yield this.ensureConnected(),this.currentSubscription&&(yield this.invokeUnsubscribe(this.currentSubscription)),yield this.invokeSubscribe(t),this.currentSubscription=t,this.currentSubscriptionLease=n})),n})}unsubscribeDeltaRange(e,t){return k(this,null,function*(){yield this.queueSubscriptionTransition(()=>k(this,null,function*(){if(t!==void 0&&t!==this.currentSubscriptionLease)return;let n=e??this.currentSubscription;n&&(yield this.invokeUnsubscribe(n),this.currentSubscription&&this.isSameRequest(this.currentSubscription,n)&&(this.cancelPendingFlush(),this.currentSubscription=null,this.currentSubscriptionLease=null))}))})}disconnect(){return k(this,null,function*(){let e=this.greeksHub.activeConnection;if(e){try{yield this.unsubscribeDeltaRange()}catch(t){console.error("UnsubscribeGreekDeltaRange failed:",t)}e.off("GreekDeltaRangeRowUpdated"),e.off("GreekDeltaRangeRowRemoved"),e.off("GreekDeltaRangeRowsUpdated"),this.cancelPendingFlush(),yield this.greeksHub.disconnect(),this.handlersRegisteredFor=null}})}ensureConnected(){return k(this,null,function*(){this.getConnection(),yield this.greeksHub.Init()})}getConnection(){let e=this.greeksHub.connection;return this.handlersRegisteredFor===e||(this.zone.runOutsideAngular(()=>{e.on("GreekDeltaRangeRowUpdated",t=>{this.enqueueRowUpdate(this.normalizeRowUpdate(t))}),e.on("GreekDeltaRangeRowRemoved",t=>{this.enqueueRowRemoval(this.normalizeRowRemoval(t))}),e.on("GreekDeltaRangeRowsUpdated",t=>{this.enqueueGroupsUpdated(this.normalizeRowsUpdated(t))})}),e.onreconnected(()=>{this.queueSubscriptionTransition(()=>k(this,null,function*(){let t=this.currentSubscription;t&&(yield this.invokeSubscribe(t)),this.zone.run(()=>this.reconnectedSubject.next())}))}),e.onreconnecting(()=>{this.cancelPendingFlush(),this.zone.run(()=>this.stateResetSubject.next())}),this.handlersRegisteredFor=e),e}enqueueRowRemoval(e){this.enqueueRowChange({kind:"removal",removal:e})}enqueueRowUpdate(e){this.enqueueRowChange({kind:"update",row:e})}enqueueRowChange(e){let t=this.getRowChangeKey(e),n=this.pendingRowChanges.get(t);n&&this.getRowChangeSequence(e)<this.getRowChangeSequence(n)||(this.pendingRowChanges.set(t,e),this.scheduleFlush())}enqueueGroupsUpdated(e){this.pendingGroupsSnapshot=e,this.pendingRowChanges.clear(),this.scheduleFlush()}scheduleFlush(){this.pendingFrame||(this.pendingFrame=requestAnimationFrame(()=>{this.pendingFrame=0,this.flushPendingUpdates()}))}flushPendingUpdates(){let e=this.pendingGroupsSnapshot,t=Array.from(this.pendingRowChanges.values());!e&&t.length===0||(this.pendingGroupsSnapshot=null,this.pendingRowChanges.clear(),this.zone.run(()=>{if(e&&this.groupsUpdatedSubject.next(e),t.length===0)return;this.rowChangesSubject.next(t);let n=t.filter(p=>p.kind==="update").map(p=>p.row),s=t.filter(p=>p.kind==="removal").map(p=>p.removal);if(n.length>0){this.rowUpdatesSubject.next(n);for(let p of n)this.rowUpdatedSubject.next(p)}if(s.length>0){this.rowRemovalsSubject.next(s);for(let p of s)this.rowRemovedSubject.next(p)}}))}cancelPendingFlush(){this.pendingFrame&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=0),this.pendingRowChanges.clear(),this.pendingGroupsSnapshot=null}getRowChangeKey(e){let t=e.kind==="update"?e.row:e.removal;return`${t.expiry}:${t.instrument_token}`}getRowChangeSequence(e){let t=e.kind==="update"?e.row:e.removal,n=Number(t.update_sequence);return Number.isFinite(n)?n:0}invokeSubscribe(e){return k(this,null,function*(){yield this.greeksHub.invoke("SubscribeGreekDeltaRange",e.name,e.side,e.min_delta,e.max_delta,e.secondary_id??null,e.source??"spot",e.source_token??null)})}invokeUnsubscribe(e){return k(this,null,function*(){this.greeksHub.activeConnection?.state===se.Connected&&(yield this.greeksHub.invoke("UnsubscribeGreekDeltaRange",e.name,e.side,e.min_delta,e.max_delta,e.secondary_id??null,e.source??"spot",e.source_token??null))})}queueSubscriptionTransition(e){let t=this.subscriptionTransition.then(e,e);return this.subscriptionTransition=t.catch(()=>{}),t}normalizeRowsUpdated(e){let t=Array.isArray(e)?e:e?.data;return Array.isArray(t)?[{expiry:"All Expiries",rows:t.map(n=>this.normalizeDataRow(n))}]:Object.entries(t??{}).map(([n,s])=>({expiry:n,rows:(s??[]).map(p=>this.normalizeDataRow(p))}))}normalizeDataRow(e){return e}normalizeRowUpdate(e){return e}normalizeRowRemoval(e){return e}normalizeRequest(e){return F(f({name:e.name.trim(),side:e.side,min_delta:e.min_delta,max_delta:e.max_delta},e.secondary_id?{secondary_id:e.secondary_id}:{}),{source:e.source||"spot",source_token:e.source_token??null})}isSameRequest(e,t){return e.name===t.name&&e.side===t.side&&e.min_delta===t.min_delta&&e.max_delta===t.max_delta&&e.secondary_id===t.secondary_id&&
1(e.source??"spot")===(t.source??"spot")&&(e.source_token??null)===(t.source_token??null)}};o.\u0275fac=function(t){return new(t||o)(V(qe),V(Fi))},o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ai=(()=>{let o=class o{constructor(e,t){this.zone=e,this.greeksHub=t,this.groupUpdatedSubject=new pe,this.groupUpdatesSubject=new pe,this.groupUpdated$=this.groupUpdatedSubject.asObservable(),this.groupUpdates$=this.groupUpdatesSubject.asObservable(),this.handlersRegisteredFor=null,this.currentSubscription=null,this.pendingGroupUpdates=new Map,this.pendingFrame=0}Init(){return k(this,null,function*(){yield this.ensureConnected()})}subscribeNearestDeltas(e){return k(this,null,function*(){let t=this.normalizeRequest(e);this.currentSubscription&&this.isSameRequest(this.currentSubscription,t)||(yield this.ensureConnected(),this.currentSubscription&&(yield this.unsubscribeNearestDeltas(this.currentSubscription)),yield this.invokeSubscribe(t),this.currentSubscription=t)})}unsubscribeNearestDeltas(e){return k(this,null,function*(){let t=e??this.currentSubscription;if(!t)return;this.greeksHub.activeConnection?.state===se.Connected&&(yield this.greeksHub.invoke("UnsubscribeNearestGreekDeltas",t.name,t.side,t.secondary_id??null,this.resolveSource(t),t.source_token??null)),this.currentSubscription&&this.isSameRequest(this.currentSubscription,t)&&(this.currentSubscription=null)})}disconnect(){return k(this,null,function*(){let e=this.greeksHub.activeConnection;if(e){try{yield this.unsubscribeNearestDeltas()}catch(t){console.error("UnsubscribeNearestGreekDeltas failed:",t)}e.off("NearestGreekDeltasUpdated"),this.cancelPendingFlush(),yield this.greeksHub.disconnect(),this.handlersRegisteredFor=null}})}ensureConnected(){return k(this,null,function*(){this.getConnection(),yield this.greeksHub.Init()})}getConnection(){let e=this.greeksHub.connection;return this.handlersRegisteredFor===e||(this.zone.runOutsideAngular(()=>{e.on("NearestGreekDeltasUpdated",t=>{this.enqueueGroupUpdate(t)})}),e.onreconnected(()=>{let t=this.currentSubscription;t&&this.invokeSubscribe(t)}),this.handlersRegisteredFor=e),e}enqueueGroupUpdate(e){this.pendingGroupUpdates.set(this.getGroupKey(e),e),!this.pendingFrame&&(this.pendingFrame=requestAnimationFrame(()=>{this.pendingFrame=0,this.flushGroupUpdates()}))}flushGroupUpdates(){if(this.pendingGroupUpdates.size===0)return;let e=Array.from(this.pendingGroupUpdates.values());this.pendingGroupUpdates.clear(),this.zone.run(()=>{this.groupUpdatesSubject.next(e);for(let t of e)this.groupUpdatedSubject.next(t)})}cancelPendingFlush(){this.pendingFrame&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=0),this.pendingGroupUpdates.clear()}getGroupKey(e){return`${e.name}:${e.expiry}:${e.side}`}invokeSubscribe(e){return k(this,null,function*(){let t=this.resolveSource(e);yield this.greeksHub.invoke("SubscribeNearestGreekDeltas",e.name,this.resolveSide(e),e.secondary_id??null,t,e.source_token??null)})}normalizeRequest(e){return{name:e.name.trim(),side:this.resolveSide(e),secondary_id:e.secondary_id||null,source:this.resolveSource(e),source_token:e.source_token??null}}resolveSource(e){return e.secondary_id===$e||e.secondary_id===ut?null:e.source||"spot"}resolveSide(e){return e.secondary_id===ut||e.secondary_id===$e?"call":e.side}isSameRequest(e,t){return e.name===t.name&&e.side===t.side&&(e.secondary_id??null)===(t.secondary_id??null)&&(e.source??"spot")===(t.source??"spot")&&(e.source_token??null)===(t.source_token??null)}};o.\u0275fac=function(t){return new(t||o)(V(qe),V(Fi))},o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();function Lc(i,o){if(i&1){let r=R();a(0,"button",44),_("click",function(t){let n=S(r).$implicit,s=u(2);return v(s.selectDropdownOption("experienceLevel",n,t))}),d(1),l()}if(i&2){let r,e=o.$implicit,t=u(2);w("is-selected",((r=t.requestForm.get("experienceLevel"))==null?null:r.value)===e.value),c(),g(" ",e.label," ")}}function Ac(i,o){if(i&1&&(a(0,"span",42),P(1,Lc,2,3,"button",43),l()),i&2){let r=u();c(),b("ngForOf",r.dropdownOptions.experienceLevel)}}function Uc(i,o){if(i&1){let r=R();a(0,"button",44),_("click",function(t){let n=S(r).$implicit,s=u(2);return v(s.selectDropdownOption("foExperience",n,t))}),d(1),l()}if(i&2){let r,e=o.$implicit,t=u(2);w("is-selected",((r=t.requestForm.get("foExperience"))==null?null:r.value)===e.value),c(),g(" ",e.label," ")}}function Hc(i,o){if(i&1&&(a(0,"span",42),P(1,Uc,2,3,"button",43),l()),i&2){let r=u();c(),b("ngForOf",r.dropdownOptions.foExperience)}}function Vc(i,o){if(i&1){let r=R();a(0,"button",44),_("click",function(t){let n=S(r).$implicit,s=u(2);return v(s.selectDropdownOption("primaryActivity",n,t))}),d(1),l()}if(i&2){let r,e=o.$implicit,t=u(2);w("is-selected",((r=t.requestForm.get("primaryActivity"))==null?null:r.value)===e.value),c(),g(" ",e.label," ")}}function Bc(i,o){if(i&1&&(a(0,"span",42),P(1,Vc,2,3,"button",43),l()),i&2){let r=u();c(),b("ngForOf",r.dropdownOptions.primaryActivity)}}function qc(i,o){if(i&1){let r=R();a(0,"button",44),_("click",function(t){let n=S(r).$implicit,s=u(2);return v(s.selectDropdownOption("preferredMarket",n,t))}),d(1),l()}if(i&2){let r,e=o.$implicit,t=u(2);w("is-selected",((r=t.requestForm.get("preferredMarket"))==null?null:r.value)===e.value),c(),g(" ",e.label," ")}}function Gc(i,o){if(i&1&&(a(0,"span",42),P(1,qc,2,3,"button",43),l()),i&2){let r=u();c(),b("ngForOf",r.dropdownOptions.preferredMarket)}}var na=(()=>{let o=class o{set strategyNamePropInput(e){this.strategyNameProp=e??""}constructor(e,t,n,s,p){this.modalCtrl=e,this.fb=t,this.authService=n,this.http=s,this.alertService=p,this.submitUrl=`${we.auth_url}/api/trading-automation/request`,this.strategyNameInput="",this.routeParam
1s=null,this.currentAnalysisTitle="",this.strategyNameProp="",this.strategyDescription="Request access to our semi-automated or fully automated execution infrastructure. Subject to eligibility and risk assessment.",this.isSubmitting=!1,this.activeDropdown=null,this.dropdownOptions={experienceLevel:[{label:"Beginner",value:"Beginner"},{label:"Intermediate",value:"Intermediate"},{label:"Advanced",value:"Advanced"}],foExperience:[{label:"Less than 1 year",value:"LessThan1Year"},{label:"1-3 years",value:"OneToThreeYears"},{label:"3-5 years",value:"ThreeToFiveYears"},{label:"5+ years",value:"MoreThanFiveYears"}],primaryActivity:[{label:"Option Buying",value:"OptionBuying"},{label:"Option Selling",value:"OptionSelling"},{label:"Spreads",value:"Spreads"},{label:"Futures",value:"Futures"},{label:"Mixed",value:"Mixed"}],preferredMarket:[{label:"Equity",value:"Equity"},{label:"Index",value:"Index"},{label:"F&O",value:"FuturesAndOptions"},{label:"Options",value:"Options"}]}}ngOnInit(){this.requestForm=this.fb.group({tradingType:this.fb.group({semi:[!1],auto:[!1]}),fullName:["",wt.required],email:["",[wt.required,wt.email]],phone:["",wt.required],experienceLevel:["Beginner",wt.required],foExperience:["LessThan1Year",wt.required],primaryActivity:["OptionBuying",wt.required],preferredMarket:["Equity",wt.required],consent:[!1,wt.requiredTrue]}),this.prefillCurrentUser()}submitRequest(){if(this.requestForm.invalid||!this.strategyDisplayName||!this.currentAnalysisTitle){this.requestForm.markAllAsTouched(),this.alertService.ErrorAlert("Please complete all required fields.");return}this.isSubmitting=!0,this.http.post(this.submitUrl,this.buildRequestPayload(),{withCredentials:!0}).pipe(hr(()=>this.isSubmitting=!1)).subscribe({next:()=>{this.alertService.SuccesAlert("Your trading automation request has been submitted successfully. Our team will c
1ontact you shortly."),this.resetForm(),this.modalCtrl.dismiss({submitted:!0})},error:e=>{this.alertService.ErrorAlert(e?.error?.message||e?.message||"Unable to submit trading automation request.")}})}close(){return k(this,null,function*(){yield this.modalCtrl.dismiss({action:"cancel"})})}closeDropdown(){this.activeDropdown=null}toggleDropdown(e,t){t.stopPropagation(),this.activeDropdown=this.activeDropdown===e?null:e}selectDropdownOption(e,t,n){n.stopPropagation(),this.requestForm.get(e)?.setValue(t.value),this.requestForm.get(e)?.markAsTouched(),this.activeDropdown=null}getDropdownLabel(e){let t=this.requestForm.get(e)?.value;return this.dropdownOptions[e].find(n=>n.value===t)?.label||""}strategyName(){return this.resolveStrategyName()}get strategyDisplayName(){return this.resolveInputValue(this.strategyNameSource)||this.resolveInputValue(this.strategyNameInput)||this.resolveInputValue(this.strategyNameProp)||""}resolveStrategyName(){return this.strategyDisplayName}resolveInputValue(e){return typeof e=="function"?e():e||""}buildRequestPayload(){let e=this.requestForm.getRawValue();return{fullName:e.fullName,email:e.email,phone:e.phone,analysisTitle:this.currentAnalysisTitle,strategyName:this.strategyDisplayName,semiAutomaticTrading:!!e.tradingType?.semi,fullyAutomaticTrading:!!e.tradingType?.auto,experienceLevel:e.experienceLevel,foExperience:e.foExperience,primaryActivity:e.primaryActivity,preferredMarket:e.preferredMarket,consent:!!e.consent}}resetForm(){this.requestForm.reset({tradingType:{semi:!1,auto:!1},fullName:"",email:"",phone:"",experienceLevel:"Beginner",foExperience:"LessThan1Year",primaryActivity:"OptionBuying",preferredMarket:"Equity",consent:!1})}prefillCurrentUser(){let e=this.authService.getCurrentUser();this.patchCurrentUserFields({fullName:this.cleanValue(e.user_name||this.authService.getUserName()),email:this.cleanValue(e.email||this.authService.getGmail())}),this.authService.getCurrentUserDetails().subscribe({next:t=>this.patchCurrentUserFields({fullName:this.getDisplayName(t),email:this.cleanValue(t.email),phone:this.getPhoneNumber(t)}),error:t=>{console.error("[TradingAutomationRequestComponent] Failed to load current user details",t)}})}patchCurrentUserFields(e){let t={};for(let[n,s]of Object.entries(e)){let p=this.requestForm.get(n),m=this.cleanValue(s);p&&m&&!this.cleanValue(p.value)&&(t[n]=m)}Object.keys(t).length&&this.requestForm.patchValue(t)}getDisplayName(e){return this.cleanValue(e.display_username||e.user_name||this.authService.getUserName())}getPhoneNumber(e){let t=this.cleanValue(e.phone_number),n=this.cleanValue(e.country_code);return!t||!n||t.startsWith(n)?t:`${n} ${t}`}cleanValue(e){if(typeof e!="string")return"";let t=e.trim();return t==="-"?"":t}};o.\u0275fac=function(t){return new(t||o)(Z(ye),Z(qr),Z(En),Z(Ne),Z(Tn))},o.\u0275cmp=L({type:o,selectors:[["app-trading-automation-request"]],hostBindings:function(t,n){t&1&&_("click",function(){return n.closeDropdown()},!1,un)},inputs:{strategyNameInput:"strategyNameInput",strategyNameSource:"strategyNameSource",routeParams:"routeParams",currentAnalysisTitle:"currentAnalysisTitle",strategyNamePropInput:[0,"strategyName","strategyNamePropInput"],strategyDescription:"strategyDescription"},decls:113,vars:25,consts:[[1,"strategy-page"],["type","button","aria-label","Close",1,"automation-request__close",3,"click"],["aria-hidden","true",1,"icon-close"],[1,"strategy-card"],[1,"request-header"],[1,"How-to"],[3,"ngSubmit","formGroup"],[1,"summary-grid"],[1,"summary-card"],[1,"summary-icon","summary-icon-shield"],[1,"summary-card","summary-card-active"],[1,"summary-icon","summary-icon-strategy"],[1,"automation-heading"],[1,"section-title"],["formGroupName","tradingType",1,"automation-grid"],[1,"automation-option"],["type","checkbox","formControlName","semi"],[1,"option-check"],[1,"option-heading"],[1,"option-icon","option-icon-semi"],[1,"option-title"],[1,"option-copy"],["type","checkbox","formControlName","auto"],[1,"option-icon","option-icon-auto"],[1,"details-panel"],[1,"form-grid"],[1,"form-field"],["type","text","formControlName","fullName","autocomplete","name","readonly",""],["type","email","formControlName","email","autocomplete","email","readonly",""],["type","tel","formControlName","phone","autocomplete","tel","readonly",""],[1,"select-control",3,"click"],["type","button",1,"select-trigger",3,"click"],["name","chevron-down-outline","aria-hidden","true"],["class","select-menu",4,"ngIf"],[1,"risk-panel"],[1,"risk-title"],[1,"risk-icon"],[1,"consent-row"],["type","checkbox","formControlName","consent"],[1,"submit-row"],["type","submit",1,"submit-btn",3,"disabled"],["aria-hidden","true"],[1,"select-menu"],["type","button","class","select-option",3,"is-selected","click",4,"ngFor","ngForOf"],["type","button",1,"select-option",3,"click"]],template:function(t,n){t&1&&(a(0,"section",0)(1,"button",1),_("click",function(){return n.close()}),y(2,"i",2),l(),a(3,"div",3)(4,"header",4)(5,"h1",5),d(6,"Request Trading Automation"),l(),a(7,"p"),d(8,"Configure your institutional-grade execution environment."),l()(),a(9,"form",6),_("ngSubmit",function(){return n.submitRequest()}),a(10,"div",7)(11,"article",8),y(12,"span",9),a(13,"div")(14,"h3"),d(15,"Product Name"),l(),a(16,"p"),d(17
vendor: 1,092 bytes, line 1
1),l()()(),a(18,"article",10),y(19,"span",11),a(20,"div")(21,"h3"),d(22,"Strategy Name"),l(),a(23,"p"),d(24),l()()()(),a(25,"div",12)(26,"h2",13),d(27,"Apply for Algorithmic Trading Access"),l()(),a(28,"div",14)(29,"label",15),y(30,"input",16)(31,"span",17),a(32,"span",18),y(33,"span",19),a(34,"span",20),d(35,"Semi-Automatic Trading"),l()(),a(36,"span",21),d(37," Human-assisted execution with automated entry signals and safety rails. Perfect for discretionary traders seeking algorithmic precision. "),l()(),a(38,"label",15),y(39,"input",22)(40,"span",17),a(41,"span",18),y(42,"span",23),a(43,"span",20),d(44,"Fully Automatic Trading"),l()(),a(45,"span",21),d(46," System-driven execution with zero human intervention. High-frequency capable with integrated risk management and API connectivity. "),l()()(),a(47,"div",24)(48,"div",25)(49,"label",26)(50,"span"),d(51,"Full Name"),l(),y(52,"input",27),l(),a(53,"label",26)(54,"span"),d(55,"Email Address"),l(),y(56,"input",28),l(),a(57,"label",26)(58,"span"),d(59,"Phone / WhatsApp"),l(),y(60,"input",29),l(),a(61,"div",26)(62,"span"),d(63,"
1Experience Level"),l(),a(64,"span",30),_("click",function(p){return p.stopPropagation()}),a(65,"button",31),_("click",function(p){return n.toggleDropdown("experienceLevel",p)}),a(66,"span"),d(67),l(),y(68,"ion-icon",32),l(),P(69,Ac,2,1,"span",33),l()(),a(70,"div",26)(71,"span"),d(72,"F&O Experience"),l(),a(73,"span",30),_("click",function(p){return p.stopPropagation()}),a(74,"button",31),_("click",function(p){return n.toggleDropdown("foExperience",p)}),a(75,"span"),d(76),l(),y(77,"ion-icon",32),l(),P(78,Hc,2,1,"span",33),l()(),a(79,"div",26)(80,"span"),d(81,"Primary F&O Activity"),l(),a(82,"span",30),_("click",function(p){return p.stopPropagation()}),a(83,"button",31),_("click",function(p){return n.toggleDropdown("primaryActivity",p)}),a(84,"span"),d(85),l(),y(86,"ion-icon",32),l(),P(87,Bc,2,1,"span",33),l()(),a(88,"div",26)(89,"span"),d(90,"Preferred Market"),l(),a(91,"span",30),_("click",function(p){return p.stopPropagation()}),a(92,"button",31),_("click",function(p){return n.toggleDropdown("preferredMarket",p)}),a(93,"span"),d(94),l(),y(95,"ion-icon",32),l(),P(96,Gc,2,1,"span",33),l()()(),a(97,"div",34)(98,"div",35),y(99,"span",36),a(100,"strong"),d(101,"Risk Disclosure & Disclaimer"),l()(),a(102,"p"),d(103," Automated trading does not eliminate risk. Past performance does not guarantee future results. "),l(),a(104,"label",37),y(105,"input",38),a(106,"span"),d(107," I understand that trading involves risk and results are not guaranteed. "),l()()(),a(108,"div",39)(109,"button",40),d(110),a(111,"span",41),d(112,">
1"),l()()()()()()()),t&2&&(c(9),b("formGroup",n.requestForm),c(8),T(n.currentAnalysisTitle),c(7),T(n.strategyDisplayName),c(41),w("is-open",n.activeDropdown==="experienceLevel"),H("aria-expanded",n.activeDropdown==="experienceLevel"),c(2),T(n.getDropdownLabel("experienceLevel")),c(2),b("ngIf",n.activeDropdown==="experienceLevel"),c(5),w("is-open",n.activeDropdown==="foExperience"),H("aria-expanded",n.activeDropdown==="foExperience"),c(2),T(n.getDropdownLabel("foExperience")),c(2),b("ngIf",n.activeDropdown==="foExperience"),c(5),w("is-open",n.activeDropdown==="primaryActivity"),H("aria-expanded",n.activeDropdown==="primaryActivity"),c(2),T(n.getDropdownLabel("primaryActivity")),c(2),b("ngIf",n.activeDropdown==="primaryActivity"),c(5),w("is-open",n.activeDropdown==="preferredMarket"),H("aria-expanded",n.activeDropdown==="preferredMarket"),c(2),T(n.getDropdownLabel("preferredMarket")),c(2),b("ngIf",n.activeDropdown==="preferredMarket"),c(13),b("disabled",n.isSubmitting),c(),g(" ",n.isSubmitting?"Submitting...":"Submit Request"," "))},dependencies:[dt,Nr,vt,gi,ct,Rr,fi,Lr,Ur,Ar,ne,te,st,ze],styles:['.strategy-page[_ngcontent-%COMP%]{position:relative;height:100%;padding:32px;overflow:hidden;color:#e5e7eb;font-family:Inter,system-ui,sans-serif;letter-spacing:0}.strategy-card[_ngcontent-%COMP%]{height:100%;box-sizing:border-box;overflow:auto;max-width:860px;margin:auto;padding:32px;background:#0c1016;border:1px solid rgba(148,163,184,.15);border-radius:16px;box-shadow:0 30px 60px #0009,inset 0 1px #ffffff08}.automation-request__close[_ngcontent-%COMP%]{position:absolute;top:20px;right:20px;z-index:10;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;background:#dc2626;border:1px solid #dc2626;border-radius:2px;color:#fff;cursor:pointer;transition:background .3s ease,transform .3s ease}.automation-request__close[_ngcontent-%COMP%]:hover, .automation-request__close[_ngcontent-%COMP%]:focus-visible{background:#dc2626d9;transform:scale(1.1)}.automation-request__close[_ngcontent-%COMP%]:focus-visible{outline:2px solid rgba(141,176,255,.65);outline-offset:2px}.icon-close[_ngcontent-%COMP%]{position:relative;display:block;width:14px;height:14px;color:currentColor}.icon-close[_ngcontent-%COMP%]:before, .icon-close[_ngcontent-%COMP%]:after{content:"";position:absolute;top:50%;left:50%;width:15px;height:2px;background:currentColor;border-radius:999px;transform:translate(-50%,-50%) rotate(45deg)}.icon-close[_ngcontent-%COMP%]:after{transform:translate(-50%,-50%) rotate(-45deg)}.request-header[_ngcontent-%COMP%]{padding-right:48px;margin-bottom:28px}.request-header[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:10px 0 0;color:#d8e6ff;font-size:13px;line-height:1.5}.How-to[_ngcontent-%COMP%]{margin:0;color:#f7fbff;font-size:13px;font-weight:800;line-height:1.2}.summary-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-bottom:28px}.summary-card[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;gap:14px;min-height:70px;padding:16px 18px;overflow:hidden;border:1px solid rgba(70,89,122,.35);border-radius:4px}.summary-card[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0 0 5px;color:#9ba8c1;font-size:11px;font-weight:800;line-height:1.2;text-transform:uppercase}.summary-card[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:0;color:#e6f0ff;font-size:13px;font-weight:700;line-height:1.3}.summary-card-active[_ngcontent-%COMP%]{border-left:4px solid #c7d8ff}.summary-icon[_ngcontent-%COMP%], .option-icon[_ngcontent-%COMP%], .risk-icon[_ngcontent-%COMP%]{position:relative;display:inline-flex;flex:0 0 auto;align-items:center;justify-content:center}.summary-icon[_ngcontent-%COMP%]{width:32px;height:32px;background:#2f6cff24;border:1px solid rgba(94,145,255,.24);border-radius:50%}.summary-icon[_ngcontent-%COMP%]:before, .summary-icon[_ngcontent-%COMP%]:after, .option-icon[_ngcontent-%COMP%]:before, .option-icon[_ngcontent-%COMP%]:after, .risk-icon[_ngcontent-%COMP%]:before, .risk-icon[_ngcontent-%COMP%]:after{content:"";position:absolute}.summary-icon-shield[_ngcontent-%COMP%]:before{width:13px;height:15px;background:#6e9cff;clip-path:polygon(50% 0,92% 18%,82% 76%,50% 100%,18% 76%,8% 18%);opacity:.85}.summary-icon-strategy[_ngcontent-%COMP%]:before{width:15px;height:15px;border:3px solid #8cadff;border-radius:50%}.summary-icon-strategy[_ngcontent-%COMP%]:after{width:5px;height:5px;background:#8cadff;border-radius:50%;box-shadow:-8px 0 #8cadff,0 -8px #8cadff}.automation-heading[_ngcontent-%COMP%]{margin-bottom:18px}.section-title[_ngcontent-%COMP%]{margin:0;color:#f7fbff;font-size:13px;font-weight:800;line-height:1.3}.automation-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr;gap:14px;margin-bottom:30px}.automation-option[_ngcontent-%COMP%]{position:relative;display:grid;grid-template-columns:1fr;min-height:78px;padding:18px 22px 18px 46px;background:transparent;border:1px solid rgba(118,138,174,.65);border-radius:0;cursor:pointer;transition:background .2s ease,border-color .2s ease,box-shadow .2s ease}.automation-option[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}.automation-option[_ngcontent-%COMP%]:hover{border-color:#b0c6fff2;box-shadow:0 0 0 1px #2d69ff2e}.automation-option[_ngcontent-%COMP%]:has(input:checked){background:transparent;border-color:#9cb7ff;border-left:3px solid #9cb7ff;box-shadow:0 0 0 1px #759bff59,0 12px 34px #275fff1f;padding-left:44px}.option-check[_ngcontent-%COMP%]{position:absolute;top:20px;left:18px;width:13px;height:13px;background:transparent;border:1px solid #7e8fae;border-radius:1px;transition:background .2s ease,border-color .2s ease,box-shadow .2s ease}.automation-option[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]:checked + .option-check[_ngcontent-%COMP%]{background:#326dff;border-color:#b9ccff;box-shadow:0 0 0 2px #326dff2e}.automation-option[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]:checked + .option-check[_ngcontent-%COMP%]:after{content:"";position:absolute;top:1px;left:4px;width:4px;height:7px;border-right:2px solid #ffffff;border-bottom:2px solid #ffffff;transform:rotate(45deg)}.option-heading[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;min-width:0;min-height:20px}.option-icon[_ngcontent-%COMP%]{flex:0 0 auto;width:17px;height:17px;margin-bottom:0}.option-icon-semi[_ngcontent-%COMP%]:before{width:12px;height:12px;border:2px solid #8db0ff;border-top-color:transparent;border-radius:50%}.option-icon-semi[_ngcontent-%COMP%]:after{width:5px;height:5px;right:0;top:1px;border-top:2px solid #8db0ff;border-right:2px solid #8db0ff;transform:rotate(45deg)}.option-icon-auto[_ngcontent-%COMP%]:before{width:13px;height:13px;border:2px solid #8db0ff;border-radius:4px}.option-icon-auto[_ngcontent-%COMP%]:after{width:4px;height:4px;background:#8db0ff;border-radius:50%;
1box-shadow:-6px 0 #8db0ff,6px 0 #8db0ff,0 -6px #8db0ff,0 6px #8db0ff}.option-title[_ngcontent-%COMP%]{display:block;color:#f6faff;font-size:13px;font-weight:800;line-height:1.3}.option-copy[_ngcontent-%COMP%]{display:block;max-width:620px;margin-top:8px;color:#e2ecff;font-size:11px;font-weight:700;line-height:1.55}.automation-option[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]:checked ~ .option-heading[_ngcontent-%COMP%]   .option-title[_ngcontent-%COMP%]{color:#f6faff}.details-panel[_ngcontent-%COMP%]{padding:28px 30px 30px;border-radius:4px}.form-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:24px;row-gap:22px}.form-field[_ngcontent-%COMP%]{display:grid;gap:8px}.form-field[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{color:#aab5ca;font-size:12px;font-weight:800;line-height:1.2}input[_ngcontent-%COMP%], .select-trigger[_ngcontent-%COMP%]{width:100%;min-height:48px;padding:0 14px;background:#0f131a;border:1px solid rgba(62,77,106,.7);border-radius:5px;color:#eaf2ff;font-size:13px;font-weight:700;outline:none;transition:border-color .2s ease,box-shadow .2s ease}.select-control[_ngcontent-%COMP%]{position:relative;display:block}.select-trigger[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left;cursor:pointer}.select-trigger[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{flex:0 0 auto;width:18px;height:18px;color:#8db0ff;transition:color .2s ease,transform .2s ease}.select-trigger[_ngcontent-%COMP%]:hover{border-color:#8db0fff2;box-shadow:0 0 0 1px #4578ff1f}.select-trigger[_ngcontent-%COMP%]:focus-visible, .select-trigger.is-open[_ngcontent-%COMP%]{border-color:#8db0ff;box-shadow:0 0 0 3px #4578ff3d,0 0 18px #4578ff2e}.select-trigger[_ngcontent-%COMP%]:hover   ion-icon[_ngcontent-%COMP%], .select-trigger[_ngcontent-%COMP%]:focus-visible   ion-icon[_ngcontent-%COMP%], .select-trigger.is-open[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{color:#c7d8ff}.select-trigger.is-open[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{transform:rotate(180deg)}.select-menu[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 6px);right:0;left:0;z-index:30;display:grid;overflow:hidden;background:#0f131a;border:1px solid rgba(141,176,255,.42);border-radius:6px;box-shadow:0 18px 38px #0000006b}.select-option[_ngcontent-%COMP%]{min-height:40px;padding:0 14px;background:transparent;border:0;color:#d8e6ff;font-size:13px;font-weight:700;text-align:left;cursor:pointer}.select-option[_ngcontent-%COMP%]:hover, .select-option[_ngcontent-%COMP%]:focus-visible, .select-option.is-selected[_ngcontent-%COMP%]{background:#4578ff2e;color:#fff;outline:none}input[_ngcontent-%COMP%]:focus{border-color:#5f8dff;box-shadow:0 0 0 3px #4578ff29}input[readonly][_ngcontent-%COMP%]{color:#cfd9ee;cursor:default}.risk-panel[_ngcontent-%COMP%]{margin-top:30px;padding:22px 24px;border-radius:8px}.risk-panel[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:8px 0 20px 34px;color:#c8d2e5;font-size:12px;font-weight:700;line-height:1.75}.risk-title[_ngcontent-%COMP%]{display:flex;align-items:center;gap:14px;color:#cfd8ea;font-size:12px;line-height:1.3}.risk-icon[_ngcontent-%COMP%]{width:20px;height:20px}.risk-icon[_ngcontent-%COMP%]:before{width:0;height:0;border-right:9px solid transparent;border-bottom:16px solid #ef9e9e;border-left:9px solid transparent}.risk-icon[_ngcontent-%COMP%]:after{width:3px;height:8px;top:6px;background:#192234;border-radius:2px;box-shadow:0 10px #192234}.consent-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:10px;color:#cdd8ec;font-size:12px;font-weight:700;line-height:1.4}.consent-row[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]{width:17px;min-width:17px;height:17px;min-height:17px;padding:0;accent-color:#316cff;cursor:pointer}.submit-row[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;margin-top:44px}.submit-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;gap:9px;min-width:216px;min-height:56px;padding:0 24px;background:#2f6dff;border:1px solid rgba(139,171,255,.55);border-radius:6px;color:#fff;font-size:12px;font-weight:800;line-height:1;cursor:pointer;box-shadow:0 0 22px #2f6dff5c;transition:background .2s ease,box-shadow .2s ease,transform .2s ease,opacity .2s ease}.submit-btn[_ngcontent-%COMP%]:hover{background:#3b7cff;box-shadow:0 0 30px #2f6dff75;transform:translateY(-1px)}.submit-btn[_ngcontent-%COMP%]:disabled{cursor:not-allowed;opacity:.6;transform:none}@media(max-width:760px){.strategy-page[_ngcontent-%COMP%]{padding:20px 14px}.automation-request__close[_ngcontent-%COMP%]{top:14px;right:14px}.request-header[_ngcontent-%COMP%]{padding-right:42px}.summary-grid[_ngcontent-%COMP%], .automation-grid[_ngcontent-%COMP%], .form-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}.details-panel[_ngcontent-%COMP%]{padding:22px 18px}.risk-panel[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin-left:0}.submit-row[_ngcontent-%COMP%]{margin-top:30px}.submit-btn[_ngcontent-%COMP%]{width:100%}}']});let i=o;return i})();var ia=(i,o)=>({active_market:i,disabled_action:o}),zc=i=>({active_market:i});function jc(i,o){i&1&&y(0,"ion-icon",4)}function Kc(i,o){i&1&&y(0,"ion-icon",5)}var oa=(()=>{let o=class o{constructor(e){this.userStateService=e,this.visible=E(!0),this.compact=E(!1),this.expandDisabled=E(!1),this.contractDisabled=E(!1),this.action=X()}toggleVisibility(){if(this.expandDisabled())return;let e=this.userStateService.getState().hide_market_panel;this.userStateService.updateStateAndSave({hide_market_panel:!e}),this.action.emit("toggle-visibility")}toggleCompactMode(){let e=this.userStateService.getState().compact_market_view;this.userStateService.updateStateAndSave({compact_market_view:!e}),this.action.emit("toggle-compact")}togglePanelMode(){if(!this.visible())return;let e=this.userStateService.getState().expand_market_panel;if(this.userStateService.updateStateAndSave({expand_market_panel:!e}
1),this.expandDisabled()){if(this.contractDisabled())return;this.action.emit("contract");return}this.action.emit("expand")}onDuplicateClick(){this.action.emit("duplicate")}hideTooltip(){return this.expandDisabled()?"Contract Market Panel before hiding":this.visible()?"Hide Market Panel":"Show Market Panel"}expandTooltip(){return this.visible()?this.expandDisabled()?"Contract Market Panel":"Expand Market Panel":"Show Market Panel first to expand"}};o.\u0275fac=function(t){return new(t||o)(Z(Oe))},o.\u0275cmp=L({type:o,selectors:[["app-market-controls"]],inputs:{visible:[1,"visible"],compact:[1,"compact"],expandDisabled:[1,"expandDisabled"],contractDisabled:[1,"contractDisabled"]},outputs:{action:"action"},decls:12,vars:16,consts:[[1,"icon-group","group-market"],[1,"group-tab"],[1,"market","ion-icon","instant-tooltip",3,"click","ngClass"],["name","list-outline"],["name","exit-outline",2,"rotate","360deg"],["name","exit-outline",2,"rotate","180deg"],[3,"name"],["data-tooltip","Duplicate Scanner Panel",1,"market","ion-icon","instant-tooltip",3,"click"],["name","duplicate-outline"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"p",1),d(2,"Market"),l(),a(3,"p",2),_("click",function(){return n.toggleVisibility()}),y(4,"ion-icon",3),l(),a(5,"p",2),_("click",function(){return n.toggleCompactMode()}),P(6,jc,1,0,"ion-icon",4)(7,Kc,1,0,"ion-icon",5),l(),a(8,"p",2),_("click",function(){return n.togglePanelMode()}),y(9,"ion-icon",6),l(),a(10,"p",7),_("click",function(){return n.onDuplicateClick()}),y(11,"ion-icon",8),l()()),t&2&&(c(3),b("ngClass",Ve(8,ia,n.visible(),n.expandDisabled())),H("data-tooltip",n.hideTooltip()),c(2),b("ngClass",gt(11,zc,n.compact())),H("data-tooltip",n.compact()?"Extend Market View":"Compact Market View"),c(),C(n.compact()?6:7),c(2),b("ngClass",Ve(13,ia,n.expandDisabled(),!n.visible())),H("data-tooltip",n.expandTooltip()),c(),b("name",n.expandDisabled()?"contract-outline":"expand-outline"))},dependencies:[Ge,ne,te],styles:["[_nghost-%COMP%]{display:contents}p[_ngcontent-%COMP%]{margin:0}.group-tab[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;min-width:92px;height:var(--toolbar-height, 36px);margin:0;padding:0 14px;color:#fff;font-size:12px;font-weight:600;letter-spacing:.02em;border-right:1px solid #2a2f3a;transition:color .18s ease,background .18s ease}.group-tab[_ngcontent-%COMP%]:hover{color:#e6edf3;background:#1f2630}.icon-group[_ngcontent-%COMP%]{display:flex;align-items:center;width:auto;min-height:var(--toolbar-height, 36px);overflow:visible;padding:0 4px;border:1px solid #2a2f3a;border-radius:var(--toolbar-radius, 10px);background:#14181f;box-shadow:inset 0 1px #ffffff08}.group-market[_ngcontent-%COMP%]{width:fit-content;flex:0 0 auto}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:var(--toolbar-height, 36px);height:var(--toolbar-height, 36px);margin:0;padding:0;cursor:pointer;border-radius:8px;transition:background .18s ease,color .18s ease,transform .18s ease}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:hover{background:#1f2630}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:not(:last-child){border-right:1px solid #2a2f3a}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{width:var(--nav-icon-size, 18px);height:var(--nav-icon-size, 18px);padding:0;color:#fff;font-size:var(--nav-icon-size, 18px)}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]{cursor:not-allowed;opacity:.45}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]:hover{background:transparent}.icon-group[_ngcontent-%COMP%]   .active_market[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{color:#fff;background:#00f;padding:5px;border-radius:5px}.instant-tooltip[_ngcontent-%COMP%]{position:relative}.instant-tooltip[_ngcontent-%COMP%]:after{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;z-index:50;padding:4px 8px;border:1px solid #2a2f3a;border-radius:6px;background:#0b1220;color:#fff;font-size:11px;line-height:1.2;white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transform:translate(-50%);transition:opacity 0ms linear,visibility 0ms linear}.instant-tooltip[_ngcontent-%COMP%]:hover:after, .instant-tooltip[_ngcontent-%COMP%]:focus-visible:after{opacity:1;visibility:visible}"],changeDetection:0});let i=o;return i})();var ra=(i,o)=>({active_scanner:i,disabled_action:o}),sa=i=>({active_scanner:i}),$c=i=>({active:i});function Qc(i,o){i&1&&y(0,"ion-icon",5)}function Yc(i,o){i&1&&(a(0,"span",6),y(1,"ion-icon",11),l())}function Xc(i,o){if(i&1){let r=R();a(0,"p",4),_("click",function(){S(r);let t=u();return v(t.toggleSplitView())}),y(1,"ion-icon",12),l()}if(i&2){let r=u();b("ngClass",gt(3,sa,r.splitViewVisible())),H("data-tooltip",r.splitViewVisible()?"Hide Scanner And Mispricing Split View":"Show Scanner And Mispricing Split View"),c(),b("ngClass",gt(5,$c,r.splitViewVisible()))}}var aa=(()=>{let o=class o{constructor(e){this.userStateService=e,this.visible=E(!0),this.compact=E(!1),this.splitViewVisible=E(!1),this.expandDisabled=E(!1),this.contractDisabled=E(!1),this.action=X()}toggleVisibility(){if(this.expandDisabled())return;let e=this.userStateService.getState().hide_scanner_panel;this.userStateService.updateStateAndSave({hide_scanner_panel:!e}),this.action.emit("toggle-visibility")}toggleCompactMode(){let e=this.userStateService.getState().compact_scanner_view;this.userStateService.updateStateAndSave({compact_scanner_view:!e}),this.action.emit("toggle-compact")}togglePanelMode(){if(!this.visible())return;let e=this.userStateService.getState().expand_scanner_panel;if(this.userStateService.updateStateAndSave({expand_scanner_panel:!e}
1),this.expandDisabled()){if(this.contractDisabled())return;this.action.emit("contract");return}this.action.emit("expand")}toggleSplitView(){this.action.emit("toggle-split-view")}onDuplicateClick(){this.action.emit("duplicate")}hideTooltip(){return this.expandDisabled()?"Contract Scanner Panel before hiding":this.visible()?"Hide Scanner Panel":"Show Scanner Panel"}expandTooltip(){return this.visible()?this.expandDisabled()?"Contract Scanner Panel":"Expand Scanner Panel":"Show Scanner Panel first to expand"}};o.\u0275fac=function(t){return new(t||o)(Z(Oe))},o.\u0275cmp=L({type:o,selectors:[["app-scanner-controls"]],inputs:{visible:[1,"visible"],compact:[1,"compact"],splitViewVisible:[1,"splitViewVisible"],expandDisabled:[1,"expandDisabled"],contractDisabled:[1,"contractDisabled"]},outputs:{action:"action"},decls:13,vars:17,consts:[[1,"icon-group","group-scanner"],[1,"group-tab"],[1,"scanner","ion-icon","instant-tooltip",3,"click","ngClass"],["name","filter-outline"],[1,"market","ion-icon","instant-tooltip",3,"click","ngClass"],["name","enter-outline"],[2,"rotate","180deg"],[3,"name"],[1,"market","ion-icon","instant-tooltip",3,"ngClass"],["data-tooltip","Duplicate Scanner Panel",1,"market","ion-icon","instant-tooltip",3,"click"],["name","duplicate-outline"],["name","exit-outline"],["name","git-network-outline",3,"ngClass"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"p",1),d(2,"Scanner"),l(),a(3,"p",2),_("click",function(){return n.toggleVisibility()}),y(4,"ion-icon",3),l(),a(5,"p",4),_("click",function(){return n.toggleCompactMode()}),P(6,Qc,1,0,"ion-icon",5)(7,Yc,2,0,"span",6),l(),a(8,"p",4),_("click",function(){return n.togglePanelMode()}),y(9,"ion-icon",7),l(),P(10,Xc,2,7,"p",8),a(11,"p",9),_("click",function(){return n.onDuplicateClick()}),y(12,"ion-icon",10),l()()),t&2&&(c(3),b("ngClass",Ve(9,ra,n.visible(),n.expandDisabled())),H("data-tooltip",n.hideTooltip()),c(2),b("ngClass",gt(12,sa,n.compact())),H("data-tooltip",n.compact()?"Extend Scanner View":"Compact Scanner View"),c(),C(n.compact()?6:7),c(2),b("ngClass",Ve(14,ra,n.expandDisabled(),!n.visible())),H("data-tooltip",n.expandTooltip()),c(),b("name",n.expandDisabled()?"contract-outline":"expand-outline"),c(),C(n.expandDisabled()?10:-1))},dependencies:[Ge,ne,te],styles:["[_nghost-%COMP%]{display:contents}p[_ngcontent-%COMP%]{margin:0}.group-tab[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;min-width:92px;height:var(--toolbar-height, 36px);margin:0;padding:0 14px;color:#fff;font-size:12px;font-weight:600;letter-spacing:.02em;border-right:1px solid #2a2f3a;transition:color .18s ease,background .18s ease}.group-tab[_ngcontent-%COMP%]:hover{color:#e6edf3;background:#1f2630}.icon-group[_ngcontent-%COMP%]{display:flex;align-items:center;width:auto;min-height:var(--toolbar-height, 36px);overflow:visible;padding:0 4px;border:1px solid #2a2f3a;border-radius:var(--toolbar-radius, 10px);background:#14181f;box-shadow:inset 0 1px #ffffff08}.group-scanner[_ngcontent-%COMP%]{width:fit-content;flex:0 0 auto}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:var(--toolbar-height, 36px);height:var(--toolbar-height, 36px);margin:0;padding:0;cursor:pointer;border-radius:8px;transition:background .18s ease,color .18s ease,transform .18s ease}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:hover{background:#1f2630}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:not(:last-child){border-right:1px solid #2a2f3a}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{width:var(--nav-icon-size, 18px);height:var(--nav-icon-size, 18px);padding:0;color:#fff;font-size:var(--nav-icon-size, 18px)}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]{cursor:not-allowed;opacity:.45}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]:hover{background:transparent}.icon-group[_ngcontent-%COMP%]   .active_scanner[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{color:#fff;background:#00f;padding:5px;border-radius:5px}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}.instant-tooltip[_ngcontent-%COMP%]{position:relative}.instant-tooltip[_ngcontent-%COMP%]:after{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;z-index:50;padding:4px 8px;border:1px solid #2a2f3a;border-radius:6px;background:#0b1220;color:#fff;font-size:11px;line-height:1.2;white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transform:translate(-50%);transition:opacity 0ms linear,visibility 0ms linear}.instant-tooltip[_ngcontent-%COMP%]:hover:after, .instant-tooltip[_ngcontent-%COMP%]:focus-visible:after{opacity:1;visibility:visible}"],changeDetection:0});let i=o;return i})();var la=(i,o)=>({active_delta:i,disabled_action:o}),ca=(()=>{let o=class o{constructor(e){this.userStateService=e,this.visible=E(!0),this.expandDisabled=E(!1),this.contractDisabled=E(!1),this.action=X()}toggleVisibility(){if(this.expandDisabled())return;let e=this.userStateService.getState().hide_delta_panel;this.userStateService.updateStateAndSave({hide_delta_panel:!e}),this.action.emit("toggle-visibility")}togglePanelMode(){if(!this.visible())return;let e=this.userStateService.getState().expand_delta_panel;if(this.userStateService.updateStateAndSave({expand_delta_panel:!e}
1),this.expandDisabled()){if(this.contractDisabled())return;this.action.emit("contract");return}this.action.emit("expand")}onDuplicateClick(){this.action.emit("duplicate")}hideTooltip(){return this.expandDisabled()?"Contract Delta Metrics Panel before hiding":this.visible()?"Hide Delta Metrics Panel":"Show Delta Metrics Panel"}expandTooltip(){return this.visible()?this.expandDisabled()?"Contract Delta Metrics Panel":"Expand Delta Metrics Panel":"Show Delta Metrics Panel first to expand"}};o.\u0275fac=function(t){return new(t||o)(Z(Oe))},o.\u0275cmp=L({type:o,selectors:[["app-delta-controls"]],inputs:{visible:[1,"visible"],expandDisabled:[1,"expandDisabled"],contractDisabled:[1,"contractDisabled"]},outputs:{action:"action"},decls:9,vars:11,consts:[[1,"icon-group","group-delta"],["data-tooltip","Delta Metrics Panel",1,"group-tab","instant-tooltip"],[1,"market","ion-icon","instant-tooltip",3,"click","ngClass"],["name","analytics-outline"],[3,"name"],["data-tooltip","Duplicate Delta Metrics Panel",1,"market","ion-icon","instant-tooltip",3,"click"],["name","duplicate-outline"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"p",1),d(2," Delta "),l(),a(3,"p",2),_("click",function(){return n.toggleVisibility()}),y(4,"ion-icon",3),l(),a(5,"p",2),_("click",function(){return n.togglePanelMode()}),y(6,"ion-icon",4),l(),a(7,"p",5),_("click",function(){return n.onDuplicateClick()}),y(8,"ion-icon",6),l()()),t&2&&(c(3),b("ngClass",Ve(5,la,n.visible(),n.expandDisabled())),H("data-tooltip",n.hideTooltip()),c(2),b("ngClass",Ve(8,la,n.expandDisabled(),!n.visible())),H("data-tooltip",n.expandTooltip()),c(),b("name",n.expandDisabled()?"contract-outline":"expand-outline"))},dependencies:[Ge,ne,te],styles:["[_nghost-%COMP%]{display:contents}p[_ngcontent-%COMP%]{margin:0}.group-tab[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;min-width:92px;height:var(--toolbar-height, 36px);margin:0;padding:0 14px;color:#fff;font-size:12px;font-weight:600;letter-spacing:.02em;border-right:1px solid #2a2f3a;transition:color .18s ease,background .18s ease}.group-tab[_ngcontent-%COMP%]:hover{color:#e6edf3;background:#1f2630}.icon-group[_ngcontent-%COMP%]{display:flex;align-items:center;width:auto;min-height:var(--toolbar-height, 36px);overflow:visible;padding:0 4px;border:1px solid #2a2f3a;border-radius:var(--toolbar-radius, 10px);background:#14181f;box-shadow:inset 0 1px #ffffff08}.group-delta[_ngcontent-%COMP%]{width:fit-content;flex:0 0 auto}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:var(--toolbar-height, 36px);height:var(--toolbar-height, 36px);margin:0;padding:0;cursor:pointer;border-radius:8px;transition:background .18s ease,color .18s ease,transform .18s ease}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:hover{background:#1f2630}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:not(:last-child){border-right:1px solid #2a2f3a}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{width:var(--nav-icon-size, 18px);height:var(--nav-icon-size, 18px);padding:0;color:#fff;font-size:var(--nav-icon-size, 18px)}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]{cursor:not-allowed;opacity:.45}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]:hover{background:transparent}.icon-group[_ngcontent-%COMP%]   .active_delta[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{color:#fff;background:#00f;padding:5px;border-radius:5px}.instant-tooltip[_ngcontent-%COMP%]{position:relative}.instant-tooltip[_ngcontent-%COMP%]:after{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;z-index:50;padding:4px 8px;border:1px solid #2a2f3a;border-radius:6px;background:#0b1220;color:#fff;font-size:11px;line-height:1.2;white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transform:translate(-50%);transition:opacity 0ms linear,visibility 0ms linear}.instant-tooltip[_ngcontent-%COMP%]:hover:after, .instant-tooltip[_ngcontent-%COMP%]:focus-visible:after{opacity:1;visibility:visible}"],changeDetection:0});let i=o;return i})();var da=(i,o)=>({active_matrix:i,disabled_action:o}),pa=(()=>{let o=class o{constructor(){this.visible=E(!0),this.expandDisabled=E(!1),this.contractDisabled=E(!1),this.action=X()}toggleVisibility(){this.expandDisabled()||this.action.emit("toggle-visibility")}togglePanelMode(){if(this.visible()){if(this.expandDisabled()){if
1(this.contractDisabled())return;this.action.emit("contract");return}this.action.emit("expand")}}onDuplicateClick(){this.action.emit("duplicate")}hideTooltip(){return this.expandDisabled()?"Contract Price Matrix Panel before hiding":this.visible()?"Hide Price Matrix Panel":"Show Price Matrix Panel"}expandTooltip(){return this.visible()?this.expandDisabled()?"Contract Price Matrix Panel":"Expand Price Matrix Panel":"Show Price Matrix Panel first to expand"}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-matrix-controls"]],inputs:{visible:[1,"visible"],expandDisabled:[1,"expandDisabled"],contractDisabled:[1,"contractDisabled"]},outputs:{action:"action"},decls:9,vars:11,consts:[[1,"icon-group","group-matrix"],["data-tooltip","Price Matrix Panel",1,"group-tab","instant-tooltip"],[1,"market","ion-icon","instant-tooltip",3,"click","ngClass"],["name","apps-outline"],[3,"name"],["data-tooltip","Duplicate Price Matrix Panel",1,"market","ion-icon","instant-tooltip",3,"click"],["name","duplicate-outline"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"p",1),d(2," Matrix "),l(),a(3,"p",2),_("click",function(){return n.toggleVisibility()}),y(4,"ion-icon",3),l(),a(5,"p",2),_("click",function(){return n.togglePanelMode()}),y(6,"ion-icon",4),l(),a(7,"p",5),_("click",function(){return n.onDuplicateClick()}),y(8,"ion-icon",6),l()()),t&2&&(c(3),b("ngClass",Ve(5,da,n.visible(),n.expandDisabled())),H("data-tooltip",n.hideTooltip()),c(2),b("ngClass",Ve(8,da,n.expandDisabled(),!n.visible())),H("data-tooltip",n.expandTooltip()),c(),b("name",n.expandDisabled()?"contract-outline":"expand-outline"))},dependencies:[Ge,ne,te],styles:["[_nghost-%COMP%]{display:contents}p[_ngcontent-%COMP%]{margin:0}.group-tab[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;min-width:92px;height:var(--toolbar-height, 36px);margin:0;padding:0 14px;color:#fff;font-size:12px;font-weight:600;letter-spacing:.02em;border-right:1px solid #2a2f3a;transition:color .18s ease,background .18s ease}.group-tab[_ngcontent-%COMP%]:hover{color:#e6edf3;background:#1f2630}.icon-group[_ngcontent-%COMP%]{display:flex;align-items:center;width:auto;min-height:var(--toolbar-height, 36px);overflow:visible;padding:0 4px;border:1px solid #2a2f3a;border-radius:var(--toolbar-radius, 10px);background:#14181f;box-shadow:inset 0 1px #ffffff08}.group-matrix[_ngcontent-%COMP%]{width:fit-content;flex:0 0 auto}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:var(--toolbar-height, 36px);height:var(--toolbar-height, 36px);margin:0;padding:0;cursor:pointer;border-radius:8px;transition:background .18s ease,color .18s ease,transform .18s ease}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:hover{background:#1f2630}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:not(:last-child){border-right:1px solid #2a2f3a}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{width:var(--nav-icon-size, 18px);height:var(--nav-icon-size, 18px);padding:0;color:#fff;font-size:var(--nav-icon-size, 18px)}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]{cursor:not-allowed;opacity:.45}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]:hover{background:transparent}.icon-group[_ngcontent-%COMP%]   .active_matrix[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{color:#fff;background:#00f;padding:5px;border-radius:5px}.instant-tooltip[_ngcontent-%COMP%]{position:relative}.instant-tooltip[_ngcontent-%COMP%]:after{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;z-index:50;padding:4px 8px;border:1px solid #2a2f3a;border-radius:6px;background:#0b1220;color:#fff;font-size:11px;line-height:1.2;white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transform:translate(-50%);transition:opacity 0ms linear,visibility 0ms linear}.instant-tooltip[_ngcontent-%COMP%]:hover:after, .instant-tooltip[_ngcontent-%COMP%]:focus-visible:after{opacity:1;visibility:visible}"],changeDetection:0});let i=o;return i})();var ua=(i,o)=>({active_detail:i,disabled_action:o}),ma=(()=>{let o=class o{constructor(e){this.userStateService=e,this.visible=E(!0),this.expandDisabled=E(!1),this.contractDisabled=E(!1),this.action=X()}toggleVisibility(){if(this.expandDisabled())return;let e=this.userStateService.getState().hide_detail_panel;this.userStateService.updateStateAndSave({hide_detail_panel:!e}),this.action.emit("toggle-visibility")}togglePanelMode(){if(!this.visible())return;let e=this.userStateService.getState().expand_detail_panel;if(this.userStateService.updateStateAndSave({expand_detail_panel:!e}
1),this.expandDisabled()){if(this.contractDisabled())return;this.action.emit("contract");return}this.action.emit("expand")}onDuplicateClick(){this.action.emit("duplicate")}hideTooltip(){return this.expandDisabled()?"Contract Detail Panel before hiding":this.visible()?"Hide Detail Panel":"Show Detail Panel"}expandTooltip(){return this.visible()?this.expandDisabled()?"Contract Detail Panel":"Expand Detail Panel":"Show Detail Panel first to expand"}};o.\u0275fac=function(t){return new(t||o)(Z(Oe))},o.\u0275cmp=L({type:o,selectors:[["app-detail-controls"]],inputs:{visible:[1,"visible"],expandDisabled:[1,"expandDisabled"],contractDisabled:[1,"contractDisabled"]},outputs:{action:"action"},decls:9,vars:11,consts:[[1,"icon-group","group-layout"],["data-tooltip","Detail Panel",1,"group-tab","instant-tooltip"],[1,"market","ion-icon","instant-tooltip",3,"click","ngClass"],["name","grid-outline"],[3,"name"],["data-tooltip","Duplicate Scanner Panel",1,"market","ion-icon","instant-tooltip",3,"click"],["name","duplicate-outline"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"p",1),d(2,"Detail"),l(),a(3,"p",2),_("click",function(){return n.toggleVisibility()}),y(4,"ion-icon",3),l(),a(5,"p",2),_("click",function(){return n.togglePanelMode()}),y(6,"ion-icon",4),l(),a(7,"p",5),_("click",function(){return n.onDuplicateClick()}),y(8,"ion-icon",6),l()()),t&2&&(c(3),b("ngClass",Ve(5,ua,n.visible(),n.expandDisabled())),H("data-tooltip",n.hideTooltip()),c(2),b("ngClass",Ve(8,ua,n.expandDisabled(),!n.visible())),H("data-tooltip",n.expandTooltip()),c(),b("name",n.expandDisabled()?"contract-outline":"expand-outline"))},dependencies:[Ge,ne,te],styles:["[_nghost-%COMP%]{display:contents}p[_ngcontent-%COMP%]{margin:0}.group-tab[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;min-width:92px;height:var(--toolbar-height, 36px);margin:0;padding:0 14px;color:#fff;font-size:12px;font-weight:600;letter-spacing:.02em;border-right:1px solid #2a2f3a;transition:color .18s ease,background .18s ease}.group-tab[_ngcontent-%COMP%]:hover{color:#e6edf3;background:#1f2630}.icon-group[_ngcontent-%COMP%]{display:flex;align-items:center;width:auto;min-height:var(--toolbar-height, 36px);overflow:visible;padding:0 4px;border:1px solid #2a2f3a;border-radius:var(--toolbar-radius, 10px);background:#14181f;box-shadow:inset 0 1px #ffffff08}.group-layout[_ngcontent-%COMP%]{width:fit-content;flex:0 0 auto}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:var(--toolbar-height, 36px);height:var(--toolbar-height, 36px);margin:0;padding:0;cursor:pointer;border-radius:8px;transition:background .18s ease,color .18s ease,transform .18s ease}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:hover{background:#1f2630}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]:not(:last-child){border-right:1px solid #2a2f3a}.icon-group[_ngcontent-%COMP%]   .ion-icon[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{width:var(--nav-icon-size, 18px);height:var(--nav-icon-size, 18px);padding:0;color:#fff;font-size:var(--nav-icon-size, 18px)}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]{cursor:not-allowed;opacity:.45}.icon-group[_ngcontent-%COMP%]   .disabled_action[_ngcontent-%COMP%]:hover{background:transparent}.icon-group[_ngcontent-%COMP%]   .active_detail[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%], .icon-group[_ngcontent-%COMP%]   .active_chart[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{color:#fff;background:#00f;padding:5px;border-radius:5px}.instant-tooltip[_ngcontent-%COMP%]{position:relative}.instant-tooltip[_ngcontent-%COMP%]:after{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;z-index:50;padding:4px 8px;border:1px solid #2a2f3a;border-radius:6px;background:#0b1220;color:#fff;font-size:11px;line-height:1.2;white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transform:translate(-50%);transition:opacity 0ms linear,visibility 0ms linear}.instant-tooltip[_ngcontent-%COMP%]:hover:after, .instant-tooltip[_ngcontent-%COMP%]:focus-visible:after{opacity:1;visibility:visible}"],changeDetection:0});let i=o;return i})();function Wc(i,o){if(i&1){let r=R();a(0,"app-delta-controls",4),_("action",function(t){S(r);let n=u();return v(n.emitAction("delta",t))}),l()}if(i&2){let r=u();b("visible",r.state().delta.visible)("expandDisabled",r.state().delta.expandDisabled)("contractDisabled",r.state().delta.
1contractDisabled)}}function Zc(i,o){if(i&1){let r=R();a(0,"app-matrix-controls",4),_("action",function(t){S(r);let n=u();return v(n.emitAction("matrix",t))}),l()}if(i&2){let r=u();b("visible",r.state().matrix.visible)("expandDisabled",r.state().matrix.expandDisabled)("contractDisabled",r.state().matrix.contractDisabled)}}var ha=(()=>{let o=class o{constructor(){this.state=E.required(),this.viewSelected=X(),this.action=X()}onSelect(e){this.viewSelected.emit(e)}emitAction(e,t){this.action.emit({section:e,action:t})}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-view-switcher"]],inputs:{state:[1,"state"]},outputs:{viewSelected:"viewSelected",action:"action"},decls:6,vars:14,consts:[[1,"list-options"],[3,"action","visible","compact","expandDisabled","contractDisabled"],[3,"action","visible","compact","splitViewVisible","expandDisabled","contractDisabled"],[3,"visible","expandDisabled","contractDisabled"],[3,"action","visible","expandDisabled","contractDisabled"]],template:function(t,n){if(t&1&&(a(0,"div",0)(1,"app-market-control
1s",1),_("action",function(p){return n.emitAction("market",p)}),l(),a(2,"app-scanner-controls",2),_("action",function(p){return n.emitAction("scanner",p)}),l(),P(3,Wc,1,3,"app-delta-controls",3)(4,Zc,1,3,"app-matrix-controls",3),a(5,"app-detail-controls",4),_("action",function(p){return n.emitAction("detail",p)}),l()()),t&2){let s;c(),b("visible",n.state().market.visible)("compact",n.state().market.compact)("expandDisabled",n.state().market.expandDisabled)("contractDisabled",n.state().market.contractDisabled),c(),b("visible",n.state().scanner.visible)("compact",n.state().scanner.compact)("splitViewVisible",(s=n.state().scanner.splitViewVisible)!==null&&s!==void 0?s:!1)("expandDisabled",n.state().scanner.expandDisabled)("contractDisabled",n.state().scanner.contractDisabled),c(),C(n.state().delta.available?3:-1),c(),C(n.state().matrix.available?4:-1),c(),b("visible",n.state().detail.visible)("expandDisabled",n.state().detail.expandDisabled)("contractDisabled",n.state().detail.contractDisabled)}},dependencies:[oa,aa,ca,pa,ma],styles:[".list-options[_ngcontent-%COMP%]{display:flex;align-items:center;flex-wrap:wrap;gap:8px}@media(max-width:992px){.list-options[_ngcontent-%COMP%]{gap:6px}}"],changeDetection:0});let i=o;return i})();function Jc(i,o){if(i&1&&(pn(),a(0,"svg",0),y(1,"path",4)(2,"line",5)(3,"line",6),l()),i&2){let r=u();H("width",r.resolvedSize())("height",r.resolvedSize())}}function ed(i,o){if(i&1&&(pn(),a(0,"svg",0),y(1,"path",4)(2,"polyline",7),l()),i&2){let r=u();H("width",r.resolvedSize())("height",r.resolvedSize())}}function td(i,o){if(i&1&&(pn(),a(0,"svg",1),y(1,"path",8)(2,"path",9)(3,"path",10)(4,"path",11)(5,"path",12),l()),i&2){let r=u();H("width",r.resolvedSize())("height",r.resolvedSize())}}function nd(i,o){if(i&1&&(pn(),a(0,"svg",2),y(1,"path",13)(2,"path",14)(3,"line",15)(4,"line",16),l()),i&2){let r=u();H("width",r.resolvedSize())("height",r.resolvedSize())}}function id(i,o){if(i&1&&(pn(),a(0,"svg",2),y(1,"path",17)(2,"path",18)(3,"polyline",19),l()),i&2){let r=u();H("width",r.resolvedSize())("height",r.resolvedSize())}}function od(i,o){if(i&1&&(pn(),a(0,"svg",3)(1,"g"),y(2,"path",20),l()()),i&2){let r=u();H("width",r.resolvedSize())("height",r.resolvedSize())}}var Ui=(()=>{let o=class o{constructor(){this.name=E.required(),this.size=E(null)}resolvedSize(){let e=this.size();return e===null?null:String(e)}};o.\u0275fac=function(t){return new(t||o)}
1,o.\u0275cmp=L({type:o,selectors:[["app-icon"]],inputs:{name:[1,"name"],size:[1,"size"]},decls:6,vars:1,consts:[["viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","aria-hidden","true"],["viewBox","0 0 100 100","fill","currentColor","xmlns","http://www.w3.org/2000/svg","aria-hidden","true"],["viewBox","0 0 403 359","xmlns","http://www.w3.org/2000/svg","aria-hidden","true"],["viewBox","0 0 104.31 122.88","xmlns","http://www.w3.org/2000/svg","fill","#ffffff","stroke","#ffffff","stroke-width","4","aria-hidden","true"],["d","M12 2L5 5v6c0 5 3.5 9 7 10 3.5-1 7-5 7-10V5l-7-3z"],["x1","9","y1","9","x2","15","y2","15"],["x1","15","y1","9","x2","9","y2","15"],["points","9 12 11 14 15 10"],["d",`M77.4,78.1H40.5c-1.2,0-2.3-1-2.3-2.2c0,0,0-0.1,0-0.1v-4.6c0-1.2,1-2.3,2.2-2.3c0,0,0.1,0,0.1,0h36.9
2      c1.2,0,2.3,1,2.3,2.2c0,0,0,0.1,0,0.1v4.6C79.8,77,78.8,78.1,77.4,78.1C77.5,78.1,77.5,78.1,77.4,78.1z`],["d",`M26.6,78.1H22c-1.2,0-2.3-1-2.3-2.2c0,0,0-0.1,0-0.1v-4.6c0-1.2,1-2.3,2.2-2.3c0,0,0.1,0,0.1,0h4.6
3      c1.2,0,2.3,1,2.3,2.2c0,0,0,0.1,0,0.1v4.6C29,77,28,78,26.8,78.1C26.7,78.1,26.7,78.1,26.6,78.1z`],["d",`M53.8,57.6c-1.2,0-2.3-1-2.3-2.2c0,0,0-0.1,0-0.1v-4.6c0-1.2,1-2.3,2.2-2.3c0,0,0.1,0,0.1,0h23.6
4      c1.2,0,2.3,1,2.3,2.2c0,0,0,0.1,0,0.1v4.6c0,1.2-1,2.3-2.2,2.3c0,0-0.1,0-0.1,0H53.8z`],["d",`M62.6,37.1c-1.2,0-2.3-1-2.3-2.2c0,0,0-0.1,0-0.1v-4.6c0-1.2,1-2.3,2.2-2.3c0,0,0.1,0,0.1,0h14.8
5      c1.2,0,2.3,1,2.3,2.2c0,0,0,0.1,0,0.1v4.6c0,1.2-1,2.3-2.2,2.3c0,0-0.1,0-0.1,0H62.6z`],["d",`M20.8,58.2C19.6,47.5,28,36.4,38,34.5l2.7-0.6c0.5-0.1,0.9-0.6,0.8-1.2c0-0.3-0.2-0.5-0.4-0.6l-6.7-4.5
6      c-0.7-0.5-0.8-1.4-0.3-2c0,0,0,0,0-0.1l1.7-2.5c0.4-0.7,1.4-0.9,2-0.4c0,0,0,0,0.1,0L54,33.5c0.7,0.4,0.9,1.4,0.4,2c0,0,0,0,0,0.1
7      l-11,16.2c-0.4,0.7-1.4,0.9-2,0.4c0,0,0,0-0.1,0l-2.5-1.7c-0.7-0.4-0.9-1.4-0.4-2c0,0,0,0,0-0.1l4.4-6.7c0.3-0.4,0.3-1.1-0.2-1.4
8      c-0.2-0.2-0.5-0.3-0.8-0.2l-1.6,0.3c-7.8,1.5-14.4,10.3-13.7,17.9c0,0.7-1.1,1.7-1.9,1.9h-1.9C21.8,60.3,20.8,59.1,20.8,58.2z`],["d",`M0,0 L120,0 L120,144 L72,144 L72,264 L48,264 L48,144 L0,144 Z
9        M24,24 L24,48 L96,48 L96,24 Z
10        M24,72 L24,120 L96,120 L96,72 L72,72 L72,96 L48,96 L48,72 Z`,"fill","#ff0000","transform","translate(34,48)"],["d",`M0,0 L192,0 L192,216 L60,216 L60,240 L120,240 L120,264
11        L-24,264 L-24,240 L36,240 L36,216 L-48,216 L-48,192
12        L168,192 L168,24 L0,24 Z`,"fill","#ff0000","transform","translate(178,48)"],["x1","210","y1","104","x2","314","y2","208","stroke","#ff0000","stroke-width","28","stroke-linecap","round"],["x1","314","y1","104","x2","210","y2","208","stroke","#ff0000","stroke-width","28","stroke-linecap","round"],["d",`M0,0 L120,0 L120,144 L72,144 L72,264 L48,264 L48,144 L0,144 Z
13        M24,24 L24,48 L96,48 L96,24 Z
14        M24,72 L24,120 L96,120 L96,72 L72,72 L72,96 L48,96 L48,72 Z`,"fill","#00ff00","transform","translate(34,48)"],["d",`M0,0 L192,0 L192,216 L60,216 L60,240 L120,240 L120,264
15        L-24,264 L-24,240 L36,240 L36,216 L-48,216 L-48,192
16        L168,192 L168,24 L0,24 Z`,"fill","#00ff00","transform","translate(178,48)"],["points","220,170 260,210 320,130","fill","none","stroke","#00ff00","stroke-width","28","stroke-linecap","round","stroke-linejoin","round"],["d","M25.85,63.15c-0.04-0.12-0.08-0.28-0.1-0.42c-0.22-1.89-0.43-3.98-0.62-5.78c-0.26-2.64-0.55-5.69-0.76-7.83 c-0.14-1.45-0.6-2.83-1.27-3.86c-0.45-0.66-0.95-1.15-1.51-1.39c-0.45-0.18-1-0.2-1.57,0.02c-0.78,0.3-1.65,0.93-2.62,2.03 c-0.86,0.98-1.53,2.29-2.09,3.68c-0.79,2.03-1.26,4.19-1.45,5.67c-0.02,0.1-0.02,0.18-0.06,0.26L8.42,86.07 c-0.08,0.4-0.24,0.76-0.48,1.04c-1.81,2.33-2.95,4.33-3.28,5.95c-0.24,1.19,0,2.15,0.79,2.9l19.8,19.8 c1.26,1.21,2.72,1.97,4.47,2.29c1.91,0.36,4.14,0.16,6.7-0.54c0.04,0,0.1-0.02,0.14-0.02c0.97-0.26,2.24-0.57,3.46-0.88 c5.31-1.29,9.94-2.43,14.23-6.33l5.52-5.76c0.05-0.1,0.14-0.18,0.22-0.26s0.62-0.62,1.35-1.31c3.78-3.69,8.45-8.25,5.61-12.24 l-2.21-2.21c-1.07,1.04-2.21,2.05-3.3,3.02c-1,0.88-1.93,1.69-2.78,2.55c-0.91,0.91-2.38,0.91-3.3,0c-0.91-0.92-0.91-2.38,0-3.3 c0.86-0.86,1.91-1.79,3-2.76c3.74-3.3,8.03-7.07,5.73-10.38l-2.19-2.19c-0.12-0.12-0.22-0.26-0.31-0.4c-1.26,1.29-2.64,2.52-4,3.72 c-1,0.88-1.93,1.69-2.78,2.55c-0.91,0.91-2.38,0.91-3.3,0s-0.91-2.38,0-3.3c0.86-0.86,1.91-1.79,3-2.76 c3.74-3.3,8.03-7.07,5.73-10.38l-2.19-2.19c-0.16-0.16-0.28-0.31-0.38-0.5l-6.42,6.42c-0.91,0.91-2.38,0.91-3.3,0s-0.91-2.38,0-3.3 l17.22-17.25c2.88-2.88,3.54-5.88,2.78-8.15c-0.28-0.83-0.74-1.57-1.31-2.14s-1.31-1.03-2.14-1.31c-2.24-0.74-5.23-0.06-8.19,2.9 l-30.2,30.2c-0.91,0.91-2.38,0.91-3.3,0s-0.91-2.38,0-3.3l3.07-3.07L25.85,63.15L25.85,63.15L25.85,63.15z M83.23,24.31 c-1.22,1.3-3.24,1.34-4.52,0.14c-1.3-1.22-1.34-3.24-0.14-4.52l8.82-9.39c1.22-1.3,3.25-1.34,4.52-0.14 c1.3,1.22,1.34,3.24,0.14,4.52L83.23,24.31L83.23,24.31L83.23,24.31L83.23,24.31z M43.96,23.65c1.3,1.22,1.34,3.25,0.14,4.52 c-1.22,1.3-3.25,1.34-4.52,0.14l-9.4-8.82c-1.29-1.23-1.33-3.25-0.14-4.52c1.22-1.3,3.25-1.34,4.52-0.14L43.96,23.65L43.96,23.65 L43.96,23.65z M63.69,15.96c0.05,1.76-1.34,3.24-3.09,3.3s-3.24-1.34-3.3-3.09L56.91,3.3c-0.06-1.75,1.34-3.24,3.09-3.3 c1.76-0.05,3.24,1.34,3.29,3.09L63.69,15.96L63.69,15.96L63.69,15.96z M76.88,63.31c-1.3-1.22-1.34-3.25-0.14-4.52 c1.22-1.3,3.24-1.34,4.52-0.14l9.39,8.82c1.3,1.22,1.34,3.24,0.14,4.52c-1.22,1.3-3.24,1.34-4.52,0.14L76.88,63.31L76.88,63.31 L76.88,63.31z M88.36,44.35c-1.75,0.06-3.24-1.34-3.3-3.09c-0.05-1.75,1.34-3.24,3.09-3.3l12.86-0.43c1.75-0.06,3.24,1.34,3.3,3.09 s-1.34,3.24-3.09,3.3L88.36,44.35L88.36,44.35L88.36,44.35z M60.88,58.97c0.17,0.1,0.34,0.22,0.5,0.38l2.29,2.29 c0.12,0.12,0.24,0.28,0.34,0.42c2.57,3.52,2.17,6.66,0.42,9.52c0.31,0.12,0.62,0.29,0.86,0.54l2.29,2.29 c0.12,0.12,0.24,0.28,0.34,0.42c2.76,3.8,2.07,7.12,0,10.14c0.1,0.05,0.17,0.14,0.28,0.24l2.29,2.29c0.12,0.12,0.24,0.28,0.34,0.42 c5.31,7.26-1.02,13.42-6.1,18.39l-1.31,1.31l-5.67,5.95l-0.18,0.17c-5.19,4.71-10.33,5.97-16.28,7.42c-1,0.24-2,0.5-3.4,0.86 c-0.04,0-0.06,0.02-0.1,0.02c-3.22,0.88-6.14,1.09-8.76,0.62c-2.66-0.48-4.97-1.67-6.9-3.56L2.31,99.29 c-2-1.93-2.69-4.31-2.12-7.14c0.43-2.26,1.75-4.77,3.81-7.47L9.3,54.74v-0.12c0.24-1.71,0.78-4.24,1.71-6.68 c0.71-1.83,1.67-3.62,2.92
16-5.07c1.51-1.71,3-2.76,4.47-3.32c1.81-0.69,3.54-0.6,5.07,0.06c1.43,0.6,2.64,1.69,3.56,3.08 c1.12,1.67,1.85,3.8,2.05,6.02c0.16,1.83,0.48,4.85,0.78,7.81l0.24,2.47L53,36.07c4.4-4.4,9.16-5.27,12.97-4.02 c1.53,0.5,2.88,1.33,4,2.45s1.95,2.47,2.45,4c1.26,3.8,0.4,8.63-3.92,12.95l-7.59,7.59L60.88,58.97L60.88,58.97L60.88,58.97z"]],template:function(t,n){if(t&1&&P(0,Jc,4,2,":svg:svg",0)(1,ed,3,2,":svg:svg",0)(2,td,6,2,":svg:svg",1)(3,nd,5,2,":svg:svg",2)(4,id,4,2,":svg:svg",2)(5,od,3,2,":svg:svg",3),t&2){let s;C((s=n.name())==="shield-off"?0:s==="shield-on"?1:s==="trading-request"?2:s==="monitor-off"?3:s==="monitor-on"?4:s==="how-to-use"?5:-1)}},styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center;justify-content:center;line-height:0}svg[_ngcontent-%COMP%]{display:block}"],changeDetection:0});let i=o;return i})();function rd(i,o){i&1&&(a(0,"span",8),d(1,"Select"),l())}function sd(i,o){if(i&1&&(a(0,"span"),d(1),l()),i&2){let r=u();c(),T(r.triggerLabel)}}function ad(i,o){if(i&1){let r=R();a(0,"button",16),_("click",function(t){S(r);let n=u(2);return v(n.clearSearch(t))}),d(1," x "),l()}}function ld(i,o){if(i&1){let r=R();a(0,"button",19),_("click",function(){let t=S(r).$implicit,n=u(3);return v(n.selectOption(t))}),y(1,"span",14),a(2,"span"),d(3),l()()}if(i&2){let r=o.$implicit,e=u(3);w("selected",e.selected.includes(r)),c(),w("checked",e.selected.includes(r)),c(2),T(r)}}function cd(i,o){if(i&1&&(a(0,"div",17),P(1,ld,4,5,"button",18),l()),i&2){let r=u(2);c(),b("ngForOf",r.filtered)("ngForTrackBy",r.trackByOption)}}function dd(i,o){i&1&&(a(0,"div",20),d(1,"No results found."),l())}function pd(i,o){if(i&1){let r=R();a(0,"div",9),_("click",function(t){S(r);let n=u();return v(n.onPanelClick(t))}),a(1,"div",10),y(2,"input",11),P(3,ad,2,0,"button",12),l(),a(4,"button",13),_("click",function(){S(r);let t=u();return v(t.toggleSelectAll())}),y(5,"span",14),a(6,"span"),d(7,"Select All"),l()(),P(8,cd,2,2,"div",15)(9,dd,2,0,"ng-template",null,0,it),l()}if(i&2){let r=mn(10),e=u();c(2),b("formControl",e.searchControl),c(),b("ngIf",e.searchControl.value),c(2),w("checked",e.allFilteredSelected),c(3),b("ngIf",e.filtered.length>0)("ngIfElse",r)}}var on=(()=>{let o=class o{constructor(){this.isOpen=!1,this.options=null,this.selectedOptions=null,this.defaultSelectAllOnly=!1,this.defaultOptions=["Apple","Mango","Banana","Orange","Pineapple","Grapes","Pear","Watermelon","Kiwi"],this.allOptions=[...this.defaultOptions],this.selected=[],this.searchControl=new Dr(""),this.filtered=[],this.implicitAllSelected=!1}ngOnInit(){this.syncOptions(),this.searchControl.valueChanges.subscribe(e=>{let t=e?.toLowerCase()??"";this.applyFilter(t)})}ngOnChanges(e){e.selectedOptions&&(this.selected=(this.selectedOptions??[]).filter((t,n,s)=>s.indexOf(t)===n)),(e.options||e.selectedOptions)&&this.syncOptions()}get triggerLabel(){return this.implicitAllSelected?"All selected":this.selected.length?this.selected.length===1?this.selected[0]:`${this.selected[0]} +${this.selected.length-1}`:"Select"}get allFilteredSelected(){return this.implicitAllSelected&&this.filtered.length>0?!0:this.filtered.length>0&&this.filtered.every(e=>this.selected.includes(e))}get selectionCount(){return this.implicitAllSelected?this.allOptions.length:this.selected.length}get hasSelection(){return this.selectionCount>0}get isImplicitAllSelected(){return this.implicitAllSelected}toggleDropdown(){this.isOpen=!this.isOpen}selectOption(e){this.implicitAllSelected=!1,this.selected.includes(e)?this.selected=this.selected.filter(t=>t!==e):this.selected.push(e)}toggleSelectAll(){if(this.implicitAllSelected){this.implicitAllSelected=!1,this.selected=[];return}if(this.allFilteredSelected){this.selected=this.selected.filter(e=>!this.filtered.includes(e));return}this.selected=[...new Set([...this.selected,...this.filtered])]}clearSearch(e){e?.stopPropagation(),this.searchControl.setValue("")}clearSelection(e){e?.stopPropagation(),this.implicitAllSelected=!1,this.selected=[]}onPanelClick(e){e.stopPropagation()}clickOutside(e){e.target?.closest(".dropdown-container")||(this.isOpen=!1)}trackByOption(e,t){return t}onOptionCheckboxClick(e){e.stopPropagation()}onSelectAllCheckboxClick(e){e.stopPropagation()}syncOptions(){let e=this.options?.length?this.options:this.defaultOptions;this.allOptions=[...new Set(e)],this.selected=this.selected.filter(t=>
16this.allOptions.includes(t)),this.implicitAllSelected=this.defaultSelectAllOnly&&this.selected.length===0&&this.allOptions.length>0,this.applyFilter((this.searchControl.value??"").toLowerCase())}applyFilter(e){this.filtered=this.allOptions.filter(t=>t.toLowerCase().includes(e))}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-multiple-select"]],hostBindings:function(t,n){t&1&&_("click",function(p){return n.clickOutside(p)},!1,un)},inputs:{options:"options",selectedOptions:"selectedOptions",defaultSelectAllOnly:"defaultSelectAllOnly"},features:[ve],decls:7,vars:5,consts:[["noResults",""],[1,"dropdown-container"],["type","button",1,"select-box",3,"click"],[1,"text"],["class","placeholder",4,"ngIf"],[4,"ngIf"],["aria-hidden","true",1,"arrow"],["class","dropdown-panel",3,"click",4,"ngIf"],[1,"placeholder"],[1,"dropdown-panel",3,"click"],[1,"search-box"],["type","text","placeholder","Search...",3,"formControl"],["class","clear-btn","type","button",3,"click",4,"ngIf"],["type","button",1,"option","select-all",3,"click"],["aria-hidden","true",1,"option-check"],["class","options-list",4,"ngIf","ngIfElse"],["type","button",1,"clear-btn",3,"click"],[1,"options-list"],["type","button","class","option",3,"selected","click",4,"ngFor","ngForOf","ngForTrackBy"],["type","button",1,"option",3,"click"],[1,"no-results"]],template:function(t,n){t&1&&(a(0,"div",1)(1,"button",2),_("click",function(){return n.toggleDropdown()}),a(2,"div",3),P(3,rd,2,0,"span",4)(4,sd,2,1,"span",5),l(),y(5,"span",6),l(),P(6,pd,11,6,"div",7),l()),t&2&&(c(3),b("ngIf",n.selected.length===0),c(),b("ngIf",n.selected.length>0),c(),w("open",n.isOpen),c(),b("ngIf",n.isOpen))},dependencies:[st,dt,vt,ct,fi,Fr,ze],styles:['.dropdown-container[_ngcontent-%COMP%]{position:relative;width:188px;max-width:100%;font-family:inherit}.select-box[_ngcontent-%COMP%]{width:100%;min-height:40px;padding:0 14px;border:1px solid #42536e;border-radius:10px;background:linear-gradient(180deg,#182230,#121a25);color:#f8fafc;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:10px;box-sizing:border-box;transition:background-color .2s ease,border-color .2s ease,box-shadow .2s ease,transform .2s ease}.select-box[_ngcontent-%COMP%]:hover{border-color:#6981a8;background:linear-gradient(180deg,#1a2636,#141d2a)}.select-box[_ngcontent-%COMP%]:focus-visible{outline:none;border-color:#0c56de;box-shadow:0 0 0 3px #0c56de2e}.text[_ngcontent-%COMP%]{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:13px;font-weight:600}.placeholder[_ngcontent-%COMP%]{color:#d7e0ec}.arrow[_ngcontent-%COMP%]{width:9px;height:9px;border-right:1.5px solid #c2cede;border-bottom:1.5px solid #c2cede;transform:rotate(45deg);transition:transform .2s ease;flex:0 0 auto;margin-top:-3px}.arrow.open[_ngcontent-%COMP%]{transform:rotate(-135deg);margin-top:3px}.dropdown-panel[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 8px);left:0;width:100%;min-width:188px;background:linear-gradient(180deg,#171f2c,#131a25);border:1px solid #33445d;border-radius:12px;box-shadow:0 18px 40px #00000073;z-index:50;overflow:hidden;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}.search-box[_ngcontent-%COMP%]{position:relative;padding:10px;border-bottom:1px solid rgba(143,155,179,.12)}.search-box[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]{width:100%;height:34px;padding:0 32px 0 12px;background:#111823;border:1px solid #314156;border-radius:8px;color:#dbe6f4;font-size:12px;box-sizing:border-box}.search-box[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]::placeholder{color:#8ea0bb}.search-box[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]:focus{outline:none;border-color:#0c56de;box-shadow:0 0 0 3px #0c56de24}.clear-btn[_ngcontent-%COMP%]{position:absolute;right:20px;top:50%;transform:translateY(-50%);border:0;background:transparent;color:#91a0b7;font-size:14px;cursor:pointer;line-height:1}.options-list[_ngcontent-%COMP%]{max-height:240px;overflow-y:auto}.option[_ngcontent-%COMP%]{width:100%;padding:0 14px;min-height:38px;border:0;background:transparent;color:#d7e0ec;display:flex;align-items:center;gap:10px;cursor:pointer;font-size:13px;font-weight:600;text-align:left;transition:background-color .16s ease,color .16s ease}.option[_ngcontent-%COMP%]:hover{background:#31415661}.option.selected[_ngcontent-%COMP%]{background:#0c56de2e;color:#fff}.option-check[_ngcontent-%COMP%]{width:14px;
16height:14px;flex:0 0 14px;border:1px solid #6d809d;border-radius:4px;background:#101722;box-shadow:inset 0 1px #ffffff0a;position:relative}.option-check.checked[_ngcontent-%COMP%]{border-color:#0c56de;background:#0c56de}.option-check.checked[_ngcontent-%COMP%]:after{content:"";position:absolute;left:4px;top:1px;width:4px;height:8px;border-right:2px solid #ffffff;border-bottom:2px solid #ffffff;transform:rotate(45deg)}.select-all[_ngcontent-%COMP%]{border-bottom:1px solid rgba(143,155,179,.12)}.no-results[_ngcontent-%COMP%]{padding:14px 12px;color:#91a0b7;font-size:12px;text-align:center}.options-list[_ngcontent-%COMP%]::-webkit-scrollbar{width:8px}.options-list[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.options-list[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#33465f;border-radius:999px}@media(max-width:768px){.dropdown-container[_ngcontent-%COMP%]{width:100%}.dropdown-panel[_ngcontent-%COMP%]{min-width:0;width:100%}}@media(min-width:768px)and (max-width:1024px){.dropdown-panel[_ngcontent-%COMP%]{max-width:calc(100vw - 2rem);max-height:calc(100dvh - 2rem)}.options-list[_ngcontent-%COMP%]{max-height:min(240px,100dvh - 8rem)}}@media(max-width:767px){.dropdown-panel[_ngcontent-%COMP%]{max-width:calc(100vw - 1rem);max-height:calc(100dvh - 1rem)}.options-list[_ngcontent-%COMP%]{max-height:min(220px,100dvh - 8rem)}}']});let i=o;return i})();function ud(i,o){if(i&1){let r=R();a(0,"div",9)(1,"span",15),d(2),l(),a(3,"button",16),_("click",function(t){S(r);let n=u();return v(n.multipleSelect==null?null:n.multipleSelect.clearSelection(t))}),d(4," Clear "),l()()}if(i&2){let r=u();c(2),g(" ",r.multipleSelect!=null&&r.multipleSelect.isImplicitAllSelected?"All symbols":(r.multipleSelect==null?null:r.multipleSelect.selectionCount)+" selected"," "),c(),b("disabled",r.multipleSelect==null?null:r.multipleSelect.isImplicitAllSelected)}}function md(i,o){if(i&1){let r=R();a(0,"div",11)(1,"div",17)(2,"h3"),d(3,"Protection Structure"),l(),a(4,"span"),d(5,"Choose the structure for market watch filters."),l()(),a(6,"div",18)(7,"button",19),_("click",function(){S(r);let t=u();return v(t.selectedProtectionStructure="fixed-equity-variable-put")}),d(8," Fixed Equity / Variable PUT "),l(),a(9,"button",19),_("click",function(){S(r);let t=u();return v(t.selectedProtectionStructure="fixed-put-variable-equity")}),d(10," Fixed PUT / Variable Equity "),l()()()}if(i&2){let r=u();c(7),w("active",r.selectedProtectionStructure==="fixed-equity-variable-put"),H("aria-pressed",r.selectedProtectionStructure==="fixed-equity-variable-put"),c(2),w("active",r.selectedProtectionStructure==="fixed-put-variable-equity"),H("aria-pressed",r.selectedProtectionStructure==="fixed-put-variable-equity")}}var ga=(()=>{let o=class o{constructor(){this.modalCtrl=D(ye),this.title="Market Watch Settings",this.description="Add the settings content for this section here.",this.originId="",this.symbolOptions=[],this.selectedSymbols=[],this.metrics=[{key:"expiry",label:"Show Available Trades Before Expiry",defaultPositive:7},{key:"firstFuture",label:"Show only First Futures Trades",defaultPositive:0,isString:!0},{key:"secondFuture",label:"Show only Second Futures Trades",defaultPositive:0,isString:!0},{key:"thirdFuture",label:"Show only Third Futures Trades",defaultPositive:0,isString:!0},{key:"lot",label:"Set the lot size based on your analysis",defaultPositive:300},{key:"srape",label:"Show SRAPE more than 3000",defaultPositive:3e3},{key:"pop",label:"Show PoP % Greater than 50%",defaultPositive:50},{key:"spreadDeviation",label:"Spread Deviation",defaultPositive:300,isVisible:!0},{key:"stressDeviation",label:"Stress Deviation",defaultPositive:300,isVisible:!0},{key:"forcedHedgerPressure",label:"Forced Hedger Pressure",defaultPositive:300,isVisible:!0},{key:"convexityMispricing",label:"Convexity Mispricing",defaultPositive:300,isVisible:!0},{key:"gammaConfidence",label:"Gamma Confidence",defaultPositive:300,isVisible:!0},{key:"dealerGammaRegime",label:"Dealer Gamma Regime",defaultPositive:300,isVisible:!0},{key:"liquidity",label:"Liquidity",defaultPositive:300,isVisible:!0},{key:"syntheticDominanceRatio",label:"Synthetic Dominance Ratio",defaultPositive:300,isVisible:!0}],this.values=this.metrics.reduce((e,t)=>
16(e[t.key]={positive:t.defaultPositive,negative:300,enabled:t.enabled??!0,isVisible:t.isVisible??!1,isString:t.isString??!1},e),{}),this.selectedProtectionStructure="fixed-equity-variable-put"}get defaultSelectAllOnly(){return this.selectedSymbols.length===0&&this.symbolOptions.length>0}close(){return k(this,null,function*(){yield this.modalCtrl.dismiss({action:"cancel"})})}save(){return k(this,null,function*(){yield this.modalCtrl.dismiss({action:"save",marketSettings:f(f({selectedSymbols:this.multipleSelect?.selected?.length?this.multipleSelect.selected:this.selectedSymbols},this.values),this.shouldShowProtectionStructure?{protectionStructure:this.selectedProtectionStructure}:{})})})}get shouldShowProtectionStructure(){return this.originId==="equity-protection-analysis-protective-put"}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-market-watch-settings-dialog"]],viewQuery:function(t,n){if(t&1&&jt(on,5),t&2){let s;Kt(s=$t())&&(n.multipleSelect=s.first)}},inputs:{title:"title",description:"description",originId:"originId",symbolOptions:"symbolOptions",selectedSymbols:"selectedSymbols"},decls:23,vars:7,consts:[[1,"settings-dialog"],[1,"dialog-header"],["type","button","aria-label","Close settings",1,"icon-button",3,"click"],["name","close-outline"],[1,"dialog-body"],[1,"settings-group"],[1,"settings-row"],[1,"settings-row__label"],[1,"settings-row__control"],[1,"selection-tools"],[3,"options","selectedOptions","defaultSelectAllOnly"],[1,"market-settings-card"],[1,"dialog-footer"],["type","button",1,"footer-button","secondary",3,"click"],["type","button",1,"footer-button","primary",3,"click"],[1,"selection-chip"],["type","button",1,"selection-clear",3,"click","disabled"],[1,"group-heading"],[1,"toggle-chip-group"],["type","button",1,"toggle-chip",3,"click"]],template:function(t,n){t&1&&(a(0,"section",0)(1,"header",1)(2,"div")(3,"h2"),d(4),l(),a(5,"p"),d(6),l()(),a(7,"button",2),_("click",function(){return n.close()}),y(8,"ion-icon",3),l()(),a(9,"div",4)(10,"div",5)(11,"div",6)(12,"label",7),d(13,"Select Your Favourite Symbol"),l(),a(14,"div",8),P(15,ud,5,2,"div",9),y(16,"app-multiple-select",10),l()(),P(17,md,11,6,"div",11),l()(),a(18,"footer",12)(19,"button",13),_("click",function(){return n.close()}),d(20," Cancel "),l(),a(21,"button",14),_("click",function(){return n.save()}),d(22," Save "),l()()()),t&2&&(c(4),T(n.title),c(2),T(n.description),c(9),C(n.multipleSelect!=null&&n.multipleSelect.hasSelection?15:-1),c(),b("options",n.symbolOptions)("selectedOptions",n.selectedSymbols)("defaultSelectAllOnly",n.defaultSelectAllOnly),c(),C(n.shouldShowProtectionStructure?17:-1))},dependencies:[ne,te,on],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.settings-dialog[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;background:#131820;color:#f8fafc;border:1px solid #243144;border-radius:16px;overflow:hidden;box-shadow:0 18px 40px #0006}.dialog-header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 24px 16px;border-bottom:1px solid rgba(143,155,179,.18);background:#131820}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{margin:0;font-size:22px;font-weight:700}.dialog-header[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:6px 0 0;color:#9aa6b2;font-size:13px;line-height:1.4}.icon-button[_ngcontent-%COMP%]{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #314156;border-radius:10px;background:#1b2230;color:#f8fafc;cursor:pointer}.icon-button[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:18px}.dialog-body[_ngcontent-%COMP%]{flex:1;padding:20px 24px;overflow-y:auto;background:#131820}.settings-group[_ngcontent-%COMP%]{padding:18px;background:#171f2b;border:1px solid #273244;border-radius:14px}.settings-group[_ngcontent-%COMP%] + .settings-group[_ngcontent-%COMP%]{margin-top:16px}.group-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;font-size:15px;font-weight:700}.group-heading[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;margin-top:6px;color:#9aa6b2;font-size:12px}.dialog-footer[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;
16gap:10px;padding:16px 24px 20px;border-top:1px solid rgba(143,155,179,.18);background:#131820}.footer-button[_ngcontent-%COMP%]{min-width:94px;height:40px;padding:0 18px;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer}.footer-button.secondary[_ngcontent-%COMP%]{border:1px solid #314156;background:transparent;color:#c8d3df}.footer-button.primary[_ngcontent-%COMP%]{border:1px solid #0043ba;background:#0043ba;color:#fff}.custom-input[_ngcontent-%COMP%]{width:100%;height:42px;padding:0 14px;border:1px solid #314156;border-radius:10px;background:#101722;color:#f8fafc;font-size:14px;box-sizing:border-box}.input-label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;color:#9aa6b2;font-size:12px;font-weight:600}.detail-empty-state[_ngcontent-%COMP%]{margin-top:14px;padding:18px;border:1px dashed #314156;border-radius:12px;color:#9aa6b2;background:#101722}@media(max-width:768px){.dialog-header[_ngcontent-%COMP%], .dialog-body[_ngcontent-%COMP%], .dialog-footer[_ngcontent-%COMP%]{padding-left:16px;padding-right:16px}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{font-size:18px}.dialog-footer[_ngcontent-%COMP%]{justify-content:stretch}.footer-button[_ngcontent-%COMP%]{flex:1}}.dialog-header[_ngcontent-%COMP%]{padding-bottom:18px}.dialog-body[_ngcontent-%COMP%]{padding-top:16px;padding-bottom:0}.settings-group[_ngcontent-%COMP%]{min-height:292px;padding:16px 18px;background:#141b25;border-color:#2a3950}.settings-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;padding:10px 14px;border:1px solid #2f3f58;border-radius:14px;background:linear-gradient(180deg,#1d2735,#1a2331)}.settings-row__label[_ngcontent-%COMP%]{flex:1;max-width:220px;color:#fff;font-size:14px;font-weight:700;line-height:1.35}.settings-row__control[_ngcontent-%COMP%]{flex:0 0 auto}.selection-tools[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-bottom:10px;flex-wrap:wrap}.selection-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;min-height:28px;padding:0 10px;border:1px solid rgba(12,86,222,.35);border-radius:999px;background:#0c56de24;color:#dbe8ff;font-size:12px;font-weight:700;white-space:nowrap}.selection-clear[_ngcontent-%COMP%]{min-height:28px;padding:0 10px;border:1px solid #2f3f58;border-radius:999px;background:#14181f;color:#9aa4b2;font-size:12px;font-weight:600;white-space:nowrap;cursor:pointer;transition:background-color .22s ease,border-color .22s ease,color .22s ease,transform .22s ease}.selection-clear[_ngcontent-%COMP%]:hover{color:#fff;border-color:#4a5a73;background:#18202b;transform:translateY(-1px)}.selection-clear[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed;transform:none}.selection-clear[_ngcontent-%COMP%]:disabled:hover{color:#9aa4b2;border-color:#2f3f58;background:#14181f}.market-settings-card[_ngcontent-%COMP%]{margin-top:14px;padding:14px;border:1px solid #2a3950;border-radius:12px;background:#101722}.toggle-chip-group[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}.toggle-chip[_ngcontent-%COMP%]{min-height:40px;padding:0 14px;border:1px solid #314156;border-radius:999px;background:#101722;color:#c8d3df;font-size:13px;font-weight:600;cursor:pointer}.toggle-chip.active[_ngcontent-%COMP%]{background:#0c56de;border-color:#0c56de;color:#fff}[_nghost-%COMP%]     app-multiple-select{display:block}@media(max-width:768px){.settings-group[_ngcontent-%COMP%]{min-height:0;padding:14px}.settings-row[_ngcontent-%COMP%]{flex-direction:column;gap:12px}.settings-row__label[_ngcontent-%COMP%]{max-width:none}.settings-row__control[_ngcontent-%COMP%]{width:100%}.selection-tools[_ngcontent-%COMP%]{justify-content:flex-start}}"]});let i=o;return i})();var Co=(i,o)=>o.key;function hd(i,o){if(i&1){let r=R();a(0,"div",4)(1,"span",32),d(2),l(),a(3,"button",33),_("click",function(t){S(r);let n=u();return v(n.multipleSelect.clearSelection(t))}),d(4," Clear "),l()()}if(i&2){let r=u();c(2),g(" ",r.multipleSelect.isImplicitAllSelected?"All symbols":r.multipleSelect.selectionCount+" selected"," "),c(),b("disabled",r.multipleSelect.isImplicitAllSelected)}}function gd(i,o){i&1&&(a(0,"span",38),d(1,"Playing preview"),l())}function _d(i,o){if(i&1){let r=R();a(0,"div",35)(1,"button",36),_("click",function(){let t=S(r).$implicit,n=u(2);return v(n.chooseSoundAlert(t))}),a(2,"span",37)(3,"span"),d(4),l(),P(5,gd,2,0,"span",38),l()(),a(6,"button",39),_("click",function(t){let n=S(r).$implicit,s=u(2);return v(s.toggleSoundPreview(n,t))}),y(7,"ion-icon",40),l()()}if(i&2){let r=o.$implicit,e=u(2);w("active",e.selectedSoundAlert===r.label),c(4),T(r.label),c(),C(e.playingSoundLabel===r.label?5:-1),c(),w("playing",e.playingSoundLabel===r.label),H("aria-label",e.playingSoundLabel===r.label?"Pause sound preview":"Play sound preview")}}function fd(i,o){if(i&1&&(a(0,"div",14),q(1,_d,8,7,"div",34,et),l()),i&2){let r=u();c(),G(r.soundAlertOptions)}}function xd(i,o){if(i&1){let r=R();a(0,"button",26),_("click",function(){let t=S(r).$implicit,n=u();return v(n.toggleMispricingMonth(t.key))}),d(1),l()}if(i&2){let r=o.$implicit,e=u();w("active",e.isMispricingMonthSelected(r.key)),H("aria-pressed",e.isMispricingMonthSelected(r.key)),c(),g(" ",r.label," ")}}function bd(i,o){if(i&1){let r=R();a(0,"button",44),_("click",function(){let t=S(r).$implicit,n=u(2).$implicit,s=u();
16return v(s.chooseMispricingAmount(n.key,t))}),d(1),l()}if(i&2){let r=o.$implicit,e=u(2).$implicit;w("active",e.value===r),c(),g(" ",r," ")}}function yd(i,o){if(i&1&&(a(0,"div",14),q(1,bd,2,3,"button",43,et),l()),i&2){let r=u().$implicit;c(),G(r.options)}}function Cd(i,o){if(i&1){let r=R();a(0,"div",29)(1,"label",41),d(2),l(),a(3,"div",10)(4,"button",42),_("click",function(){let t=S(r).$implicit,n=u();return v(n.toggleMispricingDropdown(t.key))}),a(5,"span",12),d(6),l(),y(7,"span",13),l(),P(8,yd,3,0,"div",14),l()()}if(i&2){let r=o.$implicit,e=u();c(),b("for","mispricing-range-"+r.key),c(),g(" ",r.label," "),c(2),w("open",e.openMispricingDropdownKey===r.key),b("id","mispricing-range-"+r.key),H("aria-expanded",e.openMispricingDropdownKey===r.key),c(2),T(r.value),c(2),C(e.openMispricingDropdownKey===r.key?8:-1)}}function Pd(i,o){if(i&1){let r=R();a(0,"button",44),_("click",function(){let t=S(r).$implicit,n=u(2).$implicit,s=u();return v(s.choosePopPercentage(n.key,t))}),d(1),l()}if(i&2){let r=o.$implicit,e=u(2).$implicit;w("active",e.value===r),c(),g(" ",r," ")}}function Sd(i,o){if(i&1&&(a(0,"div",14),q(1,Pd,2,3,"button",43,et),l()),i&2){let r=u().$implicit;c(),G(r.options)}}function vd(i,o){if(i&1){let r=R();a(0,"div",29)(1,"label",41),d(2),l(),a(3,"div",10)(4,"button",42),_("click",function(){let t=S(r).$implicit,n=u();return v(n.togglePopDropdown(t.key))}),a(5,"span",12),d(6),l(),y(7,"span",13),l(),P(8,Sd,3,0,"div",14),l()()}if(i&2){let r=o.$implicit,e=u();c(),b("for","pop-setting-"+r.key),c(),g(" ",r.label," "),c(2),w("open",e.openPopDropdownKey===r.key),b("id","pop-setting-"+r.key),H("aria-expanded",e.openPopDropdownKey===r.key),c(2),T(r.value),c(2),C(e.openPopDropdownKey===r.key?8:-1)}}var _a=(()=>{let o=class o{get defaultSelectAllOnly(){return this.selectedSymbols.length===0&&this.symbolOptions.length>0}constructor(e){this.modalCtrl=e,this.symbolOptions=[],this.selectedSymbols=[],this.soundAlertOptions=[{label:"1- Alert",value:"assets/sound/Alert.wav"},{label:"2- Beep Default",value:"assets/sound/beep.mp3"},{label:"3- Item Collect",value:"assets/sound/alexis_gaming_cam-item-collected-1-367087.mp3"},{label:"4- Glass Break",value:"assets/sound/dragon-studio-glass-breaking-504033.mp3"},{label:"5- Beep Double",value:"assets/sound/freesound_community-beep-beep-43875.mp3"},{label:"6- Beep Basic",value:"assets/sound/freesound_community-public-domain-beep-sound-100267.mp3"},{label:"7- Radio Wave",value:"assets/sound/freesound_community-radio-wave-101552.mp3"},{label:"8- Beep Short",value:"assets/sound/freesound_community-short-beep-tone-47916.mp3"},{label:"9- Beep Start",value:"assets/sound/freesound_community-start-sound-beep-102201.mp3"},{label:"10- Notif Strange",value:"assets/sound/freesound_community-strange-notification-36458.mp3"},{label:"11- Water Drip",value:"assets/sound/freesound_community-water-drip-45622.mp3"},{label:"12- Beep Soft",value:"assets/sound/musheran-beep-313342.mp3"},{label:"13- Expert Advisor Buy Alert",value:"assets/sound/ExpertAdvisorBuyAlert.wav"},{label:"14- ScriptAlert",value:"assets/sound/ScriptAlert.WAV"},{label:"15- trade alert",value:"assets/sound/trade alert.mp3"}],this.monthWiseMispricingOptions=[{key:"near",label:"Near Month"},{key:"next",label:"Next Month"},{key:"far",label:"Far Month"}],this.mispricingRangeSettings=[{key:"near",label:"Near Month",value:5e3,options:[5e3,1e4,15e3,2e4,25e3,3e4]},{key:"next",label:"Next Month",value:1e4,options:[1e4,15e3,2e4,25e3,3e4,4e4]},{key:"far",label:"Far Month",value:2e4,options:[2e4,25e3,3e4,35e3,4e4,5e4]}],this.popSettings=[{key:"near",label:"Near Month POP%",value:70,options:[60,65,70,75,80,85,90,95]},{key:"next",label:"Next Month POP%",value:70,options:[60,65,70,75,80,85,90,95]},{key:"far",label:"Far Month POP%",value:70,options:[60,65,70,75,80,85,90,95]}],this.selectedSoundAlert=this.soundAlertOptions[0].label,this.selectedSoundAlertPath=this.soundAlertOptions[0].value,this.soundAlertEnabled=!0,this.selectedMispricingMonths=["near","next","far"],this.selectedSortDirection="desc",this.selectedSortValueMode="absolute",this.selectedMispricingStep=null,this.isSoundAlertOpen=!1,this.openMispricingDropdownKey=null,this.openPopDropdownKey=null,this.playingSoundLabel=null,this.previewAudio=null}ngOnDestroy(){this.stopPreview()}toggleSoundAlertDropdown(){this.isSoundAlertOpen=!this.isSoundAlertOpen}chooseSoundAlert(e){this.selectedSoundAlert=e.label,this.selectedSoundAlertPath=e.value,this.isSoundAlertOpen=!1}toggleSoundPreview(e,t){return k(this,null,function*(){if(t?.stopPropagation(),this.playingSoundLabel===e.label){this.stopPreview();return}this.stopPreview();let n=new Audio(e.value);this.previewAudio=n,this.playingSoundLabel=e.label,n.addEventListener("ended",()=>{this.previewAudio===n&&(this.previewAudio=null,this.playingSoundLabel=null)}),n.addEventListener("pause",()=>{n.currentTime<n.duration||this.previewAudio===n&&(this.previewAudio=null,this.playingSoundLabel=null)});try{yield n.play()}catch{this.stopPreview()}})}stopPreview(){if(!this.previewAudio){this.playingSoundLabel=null;return}this.previewAudio.pause(),this.previewAudio.currentTime=0,this.previewAudio=null,this.playingSoundLabel=null}toggleMispricingDropdown(e){this.openMispricingDropdownKey=this.openMispricingDropdownKey===e?null:e}
16chooseMispricingAmount(e,t){let n=this.mispricingRangeSettings.find(s=>s.key===e);n&&(n.value=t,this.openMispricingDropdownKey=null)}togglePopDropdown(e){this.openPopDropdownKey=this.openPopDropdownKey===e?null:e}choosePopPercentage(e,t){let n=this.popSettings.find(s=>s.key===e);n&&(n.value=t,this.openPopDropdownKey=null)}toggleMispricingMonth(e){if(this.selectedMispricingMonths.includes(e)){if(this.selectedMispricingMonths.length===1)return;this.selectedMispricingMonths=this.selectedMispricingMonths.filter(t=>t!==e);return}this.selectedMispricingMonths=[...this.selectedMispricingMonths,e]}isMispricingMonthSelected(e){return this.selectedMispricingMonths.includes(e)}getValues(){return{symbols:this.multipleSelect?this.multipleSelect.isImplicitAllSelected?[]:[...this.multipleSelect.selected]:this.selectedSymbols,soundAlert:{type:this.selectedSoundAlert,path:this.selectedSoundAlertPath,enabled:this.soundAlertEnabled},selectedMispricingMonths:this.selectedMispricingMonths,sortDirection:this.selectedSortDirection,sortValueMode:this.selectedSortValueMode,mispricingRanges:this.mispricingRangeSettings.map(t=>({month:t.label,amount:t.value})),popSettings:this.popSettings.map(t=>({month:t.label,percentage:t.value})),mispricingStep:this.selectedMispricingStep}}onSave(){this.modalCtrl.dismiss({action:"save",data:this.getValues()})}onCancel(){this.modalCtrl.dismiss({action:"cancel"})}};o.\u0275fac=function(t){return new(t||o)(Z(ye))},o.\u0275cmp=L({type:o,selectors:[["app-scanner-pop-up"]],viewQuery:function(t,n){if(t&1&&jt(on,5),t&2){let s;Kt(s=$t())&&(n.multipleSelect=s.first)}},inputs:{symbolOptions:"symbolOptions",selectedSymbols:"selectedSymbols"},decls:74,vars:23,consts:[[1,"scanner-settings-section"],[1,"settings-card","settings-card-inline"],[1,"settings-label"],[1,"scanner-symbol-control"],[1,"selection-tools"],[3,"options","selectedOptions","defaultSelectAllOnly"],[1,"settings-card"],[1,"sound-alert-row"],[1,"field-group","field-grow"],["for","sound-alert",1,"settings-label"],[1,"custom-dropdown"],["id","sound-alert","type","button",1,"custom-select","custom-select-button",3,"click"],[1,"custom-select-value"],["aria-hidden","true",1,"custom-select-caret"],[1,"custom-options-panel"],["aria-label","Enable sound alert",1,"switch"],["type","checkbox",3,"ngModelChange","ngModel"],[1,"switch-track"],[1,"switch-thumb"],[1,"group-heading"],[1,"toggle-chip-group"],["type","button",1,"toggle-chip",3,"active"],[1,"sort-grid"],[1,"field-group"],[1,"section-label"],["role","group","aria-label","Sort direction",1,"toggle-chip-group"],["type","button",1,"toggle-chip",3,"click"],["role","group","aria-label","Positive and negative handling",1,"toggle-chip-group"],[1,"stacked-field-list"],[1,"field-surface"],["for","mispricing-step",1,"settings-label"],["id","mispricing-step","type","number","placeholder","Enter step value",1,"custom-input","step-input",3,"ngModelChange","ngModel"],[1,"selection-chip"],["type","button",1,"selection-clear",3,"click","disabled"],[1,"custom-option","custom-option-row",3,"active"],[1,"custom-option","custom-option-row"],["type","button",1,"custom-option-select",3,"click"],[1,"custom-option-copy"],[1,"custom-option-status"],["type","button",1,"sound-preview-button",3,"click"],["name","volume-high-outline"],[1,"settings-label",3,"for"],["type","button",1,"custom-select","custom-select-button",3,"click","id"],["type","button",1,"custom-option",3,"active"],["type","button",1,"custom-option",3,"click"]],template:function(t,n){t&1&&(a(0,"section",0)(1,"div",1)(2,"label",2),d(3,"Select Your Favourite Symbol"),l(),a(4,"div",3),P(5,hd,5,2,"div",4),y(6,"app-multiple-select",5),l()(),a(7,"div",6)(8,"div",7)(9,"div",8)(10,"label",9),d(11,"Sound Alert"),l(),a(12,"div",10)(13,"button",11),_("click",function(){return n.toggleSoundAlertDropdown()}),a(14,"span",12),d(15),l(),y(16,"span",13),l(),P(17,fd,3,0,"div",14),l()(),a(18,"label",15)(19,"input",16),De("ngModelChange",function(p){return Re(n.soundAlertEnabled,p)||(n.soundAlertEnabled=p),p}),l(),a(20,"span",17),y(21,"span",18),l()()()(),a(22,"div",6)(23,"div",19)(24,"h3"),d(25,"Select Month Wise Mispricing"),l()(),a(26,"div",20),q(27,xd,2,4,"button",21,Co),l()(),a(29,"div",6)(30,"div",19)(31,"h3"),d(32,"Sorting"),l(),a(33,"span"),d(34,"Choose the order and whether sign should affect ranking."),l()(),a(35,"div",22)(36,"div",23)(37,"label",24),d(38,"Sort direction"),l(),a(39,"div",25)(40,"button",26),_("click",function(){return n.selectedSortDirection="desc"}),d(41," Highest to lowest "),l(),a(42,"button",26),_("click",function(){return n.selectedSortDirection="asc"}),d(43," Lowest to highest "),l()()(),a(44,"div",23)(45,"label",24),d(46,"Positive / negative handling"),l(),a(47,"div",27)(48,"button",26),_("click",function(){return n.selectedSortValueMode="absolute"}),d(49," Ignore sign "),l(),a(50,"button",26),_("click",function(){return n.selectedSortValueMode="signed"}),d(51," Respect sign "),l()()()()(),a(52,"div",6)(53,"div",19)(54,"h3"),d(55,"Mispricing Range"),l(),a(56,"span"),d(57,"Set the mispricing amount for each month."),l()(),a(58,"div",28),q(59,Cd,9,8,"div",29,Co),l()(),a(61,"div",6)(62,"div",19)(63,"h3"),d(64,"POP (Probability of Profit)"),l(),a(65,"span"),d(66,"Select the POP percentage for each month or enter a custom value."),l()(),a(67,"div",28),q(68,vd,9,8,"div",29,Co),l()(),a(70,"div",1)(71,"label",30),d(72," Mispricing Change Step (\u20B9) "),l(),a(73,"input",31),De("ngModelChange",function(p){return Re(n.selectedMispricingStep,p)||(n.selectedMispricingStep=p),p}),l()()()),t&2&&(c(5),C(n.multipleSelect!=null&&n.multipleSelect.hasSelection?5:-1),c(),b("options",n.symbolOptions)("selectedOptions",n.selectedSymbols)("defaultSelectAllOnly",n.defaultSelectAllOnly),c(7),w("open",n.isSoundAlertOpen),H("aria-expanded",n.isSoundAlertOpen),c(2),T(n.selectedSoundAlert),c(2),C(n.isSoundAlertOpen?17:-1),c(2),ke("ngModel",n.soundAlertEnabled),c(8),G(n.monthWiseMispricingOptions),c(13),w("active",n.selectedSortDirection==="desc"),H("aria-pressed",n.selectedSortDirection==="desc"),c(2),w("active",n.selectedSortDirection==="asc"),H("aria-pressed",n.selectedSortDirection==="asc"),
16c(6),w("active",n.selectedSortValueMode==="absolute"),H("aria-pressed",n.selectedSortValueMode==="absolute"),c(2),w("active",n.selectedSortValueMode==="signed"),H("aria-pressed",n.selectedSortValueMode==="signed"),c(9),G(n.mispricingRangeSettings),c(9),G(n.popSettings),c(5),ke("ngModel",n.selectedMispricingStep))},dependencies:[on,ne,te,dt,vt,_i,gi,ct,Yt],styles:[".scanner-settings-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;padding:2px 0 0}.settings-card[_ngcontent-%COMP%]{padding:16px;background:#1a2331;border:1px solid #2a3950;border-radius:14px}.settings-card-inline[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px}.scanner-symbol-control[_ngcontent-%COMP%]{width:min(100%,280px)}.selection-tools[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;align-items:center;gap:10px;margin-bottom:10px}.selection-chip[_ngcontent-%COMP%]{padding:6px 12px;border-radius:999px;background:#0c56de33;border:1px solid rgba(12,86,222,.35);color:#d7e7ff;font-size:12px;font-weight:700}.selection-clear[_ngcontent-%COMP%]{min-height:32px;padding:0 12px;border-radius:999px;border:1px solid #314156;background:#101722;color:#d8e1ee;font-size:12px;font-weight:700;cursor:pointer;transition:border-color .18s ease,color .18s ease,opacity .18s ease}.selection-clear[_ngcontent-%COMP%]:hover:not(:disabled){border-color:#45628d;color:#fff}.selection-clear[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.group-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;color:#f8fafc;font-size:15px;font-weight:700}.group-heading[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;margin-top:6px;color:#9aa6b2;font-size:12px}.settings-label[_ngcontent-%COMP%], .section-label[_ngcontent-%COMP%]{display:block;color:#f8fafc;font-size:13px;font-weight:700}.section-label[_ngcontent-%COMP%]{margin-bottom:10px}.custom-input[_ngcontent-%COMP%], .custom-select[_ngcontent-%COMP%]{width:200px;height:40px;padding:0 14px;border:1px solid #42536e;border-radius:10px;background:#151d29;color:#f8fafc;font-size:14px;box-sizing:border-box}.custom-select[_ngcontent-%COMP%]{padding-right:40px;appearance:none;cursor:pointer;background-image:linear-gradient(45deg,transparent 50%,#b7c3d8 50%),linear-gradient(135deg,#b7c3d8 50%,transparent 50%);background-position:calc(100% - 18px) 16px,calc(100% - 12px) 16px;background-size:6px 6px,6px 6px;background-repeat:no-repeat}.custom-input[_ngcontent-%COMP%]:focus, .custom-select[_ngcontent-%COMP%]:focus{outline:none;border-color:#0c56de;box-shadow:0 0 0 3px #0c56de2e}.custom-input[_ngcontent-%COMP%]::placeholder{color:#8ea0bb}.custom-select[_ngcontent-%COMP%]:hover{border-color:#5d7394;background-color:#182230}.custom-select[_ngcontent-%COMP%]   option[_ngcontent-%COMP%]{background:#151d29;color:#f8fafc}.custom-dropdown[_ngcontent-%COMP%]{position:relative;width:190px;margin-top:10px}.custom-select-button[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;text-align:left;background-image:none;padding-right:14px}.custom-select-button.open[_ngcontent-%COMP%]{border-color:#0c56de;box-shadow:0 0 0 3px #0c56de2e}.custom-select-value[_ngcontent-%COMP%]{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.custom-select-caret[_ngcontent-%COMP%]{width:9px;height:9px;flex:0 0 auto;border-right:1.5px solid #c2cede;border-bottom:1.5px solid #c2cede;transform:rotate(45deg);margin-top:-3px;transition:transform .2s ease,margin-top .2s ease}.custom-select-button.open[_ngcontent-%COMP%]   .custom-select-caret[_ngcontent-%COMP%]{transform:rotate(-135deg);margin-top:3px}.custom-options-panel[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 8px);left:0;padding:6px 0;background:linear-gradient(180deg,#171f2c,#131a25);border:1px solid #33445d;border-radius:12px;box-shadow:0 18px 40px #00000073;z-index:40;overflow:hidden}.custom-option[_ngcontent-%COMP%]{width:100%;min-height:40px;padding:0 12px;border:0;background:transparent;color:#d7e0ec;font-size:12px;font-weight:600;text-align:left;cursor:pointer;transition:background-color .16s ease,color .16s ease}.custom-option-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 8px}.custom-option-select[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0;min-height:40px;padding:0 10px;border:0;border-radius:8px;background:transparent;color:inherit;cursor:pointer;text-align:left}.custom-option-row[_ngcontent-%COMP%]:hover   .custom-option-select[_ngcontent-%COMP%]{background:#31415638}.custom-option-copy[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;min-width:0}.custom-option-copy[_ngcontent-%COMP%] > span[_ngcontent-%COMP%]:first-child{display:block;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.custom-option-status[_ngcontent-%COMP%]{color:#7db1ff;font-size:10px;font-weight:600}.custom-option[_ngcontent-%COMP%]:hover{background:#31415661;color:#fff}.custom-option.active[_ngcontent-%COMP%]{background:#0c56de38;color:#fff}.sound-preview-button[_ngcontent-%COMP%]{width:40px;height:40px;padding:0;align-self:center;border:1px solid #3c4e69;border-radius:8px;background:#111925;color:#dbe6f4;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background-color .16s ease,border-color .16s ease,color .16s ease}.sound-preview-button[_ngcontent-%COMP%]:hover{border-color:#5f7ca8;background:#172131;color:#fff}.sound-preview-button.playing[_ngcontent-%COMP%]{border-color:#0c56de;background:#0c56de2e;color:#fff}.sound-preview-button[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:16px}.sound-alert-row[_ngcontent-%COMP%]{display:flex;align-items:flex-end;
16gap:16px}.field-group[_ngcontent-%COMP%]{min-width:0}.field-grow[_ngcontent-%COMP%]{flex:1 1 auto}.field-grow[_ngcontent-%COMP%]   .custom-select[_ngcontent-%COMP%]{width:min(100%,170px)}.switch[_ngcontent-%COMP%]{display:inline-flex;align-items:center;cursor:pointer;margin-left:auto}.switch[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]{position:absolute;opacity:0;pointer-events:none}.switch-track[_ngcontent-%COMP%]{position:relative;width:34px;height:18px;display:inline-flex;align-items:center;padding:2px;border-radius:999px;background:#52627a;transition:background-color .2s ease}.switch-thumb[_ngcontent-%COMP%]{width:14px;height:14px;border-radius:50%;background:#fff;transition:transform .2s ease;box-shadow:0 2px 6px #00000059}.switch[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]:checked + .switch-track[_ngcontent-%COMP%]{background:#0c56de}.switch[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]:checked + .switch-track[_ngcontent-%COMP%]   .switch-thumb[_ngcontent-%COMP%]{transform:translate(16px)}.toggle-chip-group[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:10px;margin-top:14px}.toggle-chip[_ngcontent-%COMP%]{min-height:38px;padding:0 14px;border:1px solid #314156;border-radius:999px;background:#101722;color:#c8d3df;font-size:13px;font-weight:600;cursor:pointer;transition:background-color .2s ease,border-color .2s ease,color .2s ease}.toggle-chip[_ngcontent-%COMP%]:hover{border-color:#45628d;color:#fff}.toggle-chip.active[_ngcontent-%COMP%]{background:#0c56de;border-color:#0c56de;color:#fff}.sort-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:14px}.stacked-field-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px;margin-top:14px}.field-surface[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 12px;border:1px solid #2a3950;border-radius:12px;background:#151d29}.field-surface[_ngcontent-%COMP%]   .custom-select[_ngcontent-%COMP%]{width:min(100%,160px)}.step-input[_ngcontent-%COMP%]{width:180px}@media(max-width:768px){.settings-card-inline[_ngcontent-%COMP%], .sound-alert-row[_ngcontent-%COMP%], .field-surface[_ngcontent-%COMP%]{flex-direction:column;align-items:stretch}.custom-input[_ngcontent-%COMP%], .custom-select[_ngcontent-%COMP%], .custom-dropdown[_ngcontent-%COMP%], .field-grow[_ngcontent-%COMP%]   .custom-select[_ngcontent-%COMP%], .field-surface[_ngcontent-%COMP%]   .custom-select[_ngcontent-%COMP%], .step-input[_ngcontent-%COMP%], .scanner-symbol-control[_ngcontent-%COMP%]{width:100%}.sort-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}"]});let i=o;return i})();var wd=["scannerPopUp"],fa=(()=>{let o=class o{constructor(){this.modalCtrl=D(ye),this.symbolOptions=[],this.selectedSymbols=[]}close(){return k(this,null,function*(){yield this.modalCtrl.dismiss({action:"cancel"})})}save(){return k(this,null,function*(){yield this.modalCtrl.dismiss({action:"save",scannerSettings:this.scannerPopUp?.getValues()??null})})}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-scanner-settings-dialog"]],viewQuery:function(t,n){if(t&1&&jt(wd,5),t&2){let s;Kt(s=$t())&&(n.scannerPopUp=s.first)}},inputs:{symbolOptions:"symbolOptions",selectedSymbols:"selectedSymbols"},decls:24,vars:2,consts:[["scannerPopUp",""],[1,"settings-dialog"],[1,"dialog-header"],["type","button","aria-label","Close settings",1,"icon-button",3,"click"],["name","close-outline"],[1,"dialog-body"],[1,"settings-group"],[1,"group-heading"],[1,"scanner-host"],[3,"symbolOptions","selectedSymbols"],[1,"dialog-footer"],["type","button",1,"footer-button","secondary",3,"click"],["type","button",1,"footer-button","primary",3,"click"]],template:function(t,n){if(t&1){let s=R();a(0,"section",1)(1,"header",2)(2,"div")(3,"h2"),d(4,"Scanner Settings"),l(),a(5,"p"),d(6,"Configure scanner inputs independently from the other panels."),l()(),a(7,"button",3),_("click",function(){return S(s),v(n.close())}),y(8,"ion-icon",4),l()(),a(9,"div",5)(10,"div",6)(11,"div",7)(12,"h3"),d(13,"Scanner Settings"),l(),a(14,"span"),d(15,"Configure scanner inputs from this dedicated popup."),l()(),a(16,"div",8),y(17,"app-scanner-pop-up",9,0),l()()(),a(19,"footer",10)(20,"button",11),_("click",function(){return S(s),v(n.close())}),d(21," Cancel "),l(),a(22,"button",12),_("click",function(){return S(s),v(n.save())}),d(23," Save "),l()()()}t&2&&(c(17),b("symbolOptions",n.symbolOptions)("selectedSymbols",n.selectedSymbols))},dependencies:[ne,te,_a],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.settings-dialog[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;background:#131820;color:#f8fafc;border:1px solid #243144;border-radius:16px;overflow:hidden;box-shadow:0 18px 40px #0006}.dialog-header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 24px 16px;border-bottom:1px solid rgba(143,155,179,.18);background:#131820}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{margin:0;font-size:22px;font-weight:700}.dialog-header[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:6px 0 0;color:#9aa6b2;font-size:13px;line-height:1.4}.icon-button[_ngcontent-%COMP%]{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #314156;border-radius:10px;background:#1b2230;color:#f8fafc;cursor:pointer}.icon-button[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:18px}.dialog-body[_ngcontent-%COMP%]{flex:1;padding:20px 24px;overflow-y:auto;background:#131820}.settings-group[_ngcontent-%COMP%]{padding:18px;background:#171f2b;border:1px solid #273244;border-radius:14px}.settings-group[_ngcontent-%COMP%] + .settings-group[_ngcontent-%COMP%]{margin-top:16px}.group-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;font-size:15px;font-weight:700}.group-heading[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;margin-top:6px;color:#9aa6b2;font-size:12px}.dialog-footer[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px 20px;border-top:1px solid rgba(143,155,179,.18);background:#131820}.footer-button[_ngcontent-%COMP%]{min-width:94px;height:40px;padding:0 18px;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer}.footer-button.secondary[_ngcontent-%COMP%]{border:1px solid #314156;background:transparent;color:#c8d3df}.footer-button.primary[_ngcontent-%COMP%]{border:1px solid #0043ba;background:#0043ba;color:#fff}.custom-input[_ngcontent-%COMP%]{width:100%;height:42px;padding:0 14px;border:1px solid #314156;border-radius:10px;background:#101722;color:#f8fafc;font-size:14px;box-sizing:border-box}.input-label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;color:#9aa6b2;font-size:12px;font-weight:600}.detail-empty-state[_ngcontent-%COMP%]{margin-top:14px;padding:18px;border:1px dashed #314156;border-radius:12px;color:#9aa6b2;background:#101722}@media(max-width:768px){.dialog-header[_ngcontent-%COMP%], .dialog-body[_ngcontent-%COMP%], .dialog-footer[_ngcontent-%COMP%]{padding-left:16px;padding-right:16px}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{font-size:18px}.dialog-footer[_ngcontent-%COMP%]{justify-content:stretch}.footer-button[_ngcontent-%COMP%]{flex:1}}.scanner-host[_ngcontent-%COMP%]{margin-top:14px}"]});let i=o;return i})();var Od=(i,o)=>o.id;function Md(i,o){if(i&1){let r=R();a(0,"button",12),_("click",function(){let t=S(r).$implicit,n=u();return v(n.toggleSection(t.id))}),a(1,"span",13)(2,"span",14),y(3,"ion-icon",15),l(),a(4,"span",16)(5,"span",17),d(6),l(),a(7,"span",18),d(8),l()()(),a(9,"span",19)(10,"span",20),d(11),l(),a(12,"span",21),y(13,"span",22),l()()()}if(i&2){let r=o.$implicit,e=u();w("active",e.isSectionSelected(r.id)),H("aria-pressed",e.isSectionSelected(r.id)),c(3),b("name",r.icon),c(3),g(" ",r.label," "),c(2),g(" ",r.module," "),c(3),g(" ",e.isSectionSelected(r.id)?"SHOW":"HIDE"," ")}}var xa=(()=>{let o=class o{constructor(){this.modalCtrl=D(ye),this.visibleSections=[],this.sectionOptions=[{id:"market-watch",label:"Market Watch",module:"MODULE_01",icon:"eye-outline"},{id:"market-info",label:"Market Info",module:"MODULE_02",icon:"information-circle-outline"},{id:"price-matrix",label:"Price Matrix",module:"MODULE_03",icon:"grid-outline"},{id:"idea-info",label:"Idea Info",module:"MODULE_04",icon:"bulb-outline"},{id:"futures-matrix",label:"Futures Matrix",module:"MODULE_05",icon:"trending-up-outline"}],this.selectedSectionIds=this.sectionOptions.map(e=>e.id)}ngOnChanges(e){if(!e.visibleSections)return;let t=new Set(this.sectionOptions.map(s=>s.id)),n=this.visibleSections.filter(s=>t.has(s));this.selectedSectionIds=n.length?n:this.sectionOptions.map(s=>s.id)}isSectionSelected(e){return this.selectedSectionIds.includes(e)}toggleSection(e){this.selectedSectionIds=this.isSectionSelected(e)?this.selectedSectionIds.filter(t=>t!==e):[...this.selectedSectionIds,e]}close(){return k(this,null,function*(){yield this.modalCtrl.dismiss({action:"cancel"})})}save(){return k(this,null,function*(){yield this.modalCtrl.dismiss({action:"save",detailSettings:{visibleSections:this.selectedSectionIds}})})}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-detail-settings-dialog"]],inputs:{visibleSections:"visibleSections"},features:[ve],decls:22,vars:0,consts:[[1,"settings-dialog"],[1,"dialog-header"],["type","button","aria-label","Close settings",1,"icon-button",3,"click"],["name","close-outline"],[1,"dialog-body"],[1,"settings-group","detail-settings-panel"],[1,"detail-settings-heading"],["role","group","aria-label","Detail sections",1,"section-toggle-list"],["type","button",1,"section-toggle-button",3,"active"],[1,"dialog-footer"],["type","button",1,"footer-button","secondary",3,"click"],["type","button",1,"footer-button","primary",3,"click"],["type","button",1,"section-toggle-button",3,"click"],[1,"section-toggle-button__content"],["aria-hidden","true",1,"section-toggle-button__icon"],[3,"name"],[1,"section-toggle-button__copy"],[1,"section-toggle-button__label"],[1,"section-toggle-button__module"],[1,"section-toggle-button__state"],[1,"section-toggle-button__state-text"],["aria-hidden","true",1,"section-toggle-button__switch"],[1,"section-toggle-button__thumb"]],template:function(t,n){t&1&&(a(0,"section",0)(1,"header",1)(2,"div")(3,"h2"),d(4,"Details Settings"),l()(),a(5,"button",2),_("click",function(){return n.close()}),y(6,"ion-icon",3),l()(),a(7,"div",4)(8,"div",5)(9,"div",6)(10,"h3"),d(11,"Details Settings"),l(),a(12,"span"),d(13,"Select the detail sections you want to keep visible."),l()(),a(14,"div",7),q(15,Md,14,7,"button",8,Od),l()()(),a(17,"footer",9)(18,"button",10),_("click",function(){return n.close()}),d(19," Cancel "),l(),a(20,"button",11),_("click",function(){return n.save()}),d(21," Save Changes "),l()()()),t&2&&(c(15),G(n.sectionOptions))},dependencies:[ne,te],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.settings-dialog[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;background:#131820;color:#f8fafc;border:1px solid #243144;border-radius:16px;overflow:hidden;box-shadow:0 18px 40px #0006}.dialog-header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 24px 16px;border-bottom:1px solid rgba(143,155,179,.18);background:#131820}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{margin:0;font-size:22px;font-weight:700}.dialog-header[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:6px 0 0;color:#9aa6b2;font-size:13px;line-height:1.4}.icon-button[_ngcontent-%COMP%]{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #314156;border-radius:10px;background:#1b2230;color:#f8fafc;cursor:pointer}.icon-button[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:18px}.dialog-body[_ngcontent-%COMP%]{flex:1;padding:20px 24px;overflow-y:auto;background:#131820}.settings-group[_ngcontent-%COMP%]{padding:18px;background:#171f2b;border:1px solid #273244;border-radius:14px}.settings-group[_ngcontent-%COMP%] + .settings-group[_ngcontent-%COMP%]{margin-top:16px}.group-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;font-size:15px;font-weight:700}.group-heading[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;margin-top:6px;color:#9aa6b2;font-size:12px}.dialog-footer[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px 20px;border-top:1px solid rgba(143,155,179,.18);background:#131820}.footer-button[_ngcontent-%COMP%]{min-width:94px;height:40px;padding:0 18px;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer}.footer-button.secondary[_ngcontent-%COMP%]{border:1px solid #314156;background:transparent;color:#c8d3df}.footer-button.primary[_ngcontent-%COMP%]{border:1px solid #0043ba;background:#0043ba;color:#fff}.custom-input[_ngcontent-%COMP%]{width:100%;height:42px;padding:0 14px;border:1px solid #314156;border-radius:10px;background:#101722;color:#f8fafc;font-size:14px;box-sizing:border-box}.input-label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;color:#9aa6b2;font-size:12px;font-weight:600}.detail-empty-state[_ngcontent-%COMP%]{margin-top:14px;padding:18px;border:1px dashed #314156;border-radius:12px;color:#9aa6b2;background:#101722}@media(max-width:768px){.dialog-header[_ngcontent-%COMP%], .dialog-body[_ngcontent-%COMP%], .dialog-footer[_ngcontent-%COMP%]{padding-left:16px;padding-right:16px}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{font-size:18px}.dialog-footer[_ngcontent-%COMP%]{justify-content:stretch}.footer-button[_ngcontent-%COMP%]{flex:1}}[_nghost-%COMP%]   .settings-dialog[_ngcontent-%COMP%]{background:#263247;margin:0%}[_nghost-%COMP%]   .dialog-header[_ngcontent-%COMP%]{align-items:center;padding:18px 24px;background:#111a2c;border-bottom-color:#263247}[_nghost-%COMP%]   .dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{color:#fff;font-size:18px}[_nghost-%COMP%]   .group-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{color:#fff}[_nghost-%COMP%]   .dialog-body[_ngcontent-%COMP%]{padding:20px 16px;background:#101827}[_nghost-%COMP%]   .dialog-footer[_ngcontent-%COMP%]{background:#222c3c;border-top-color:#2e3a4f}
16.detail-settings-panel[_ngcontent-%COMP%]{padding:10px 0 24px;border:0;background:transparent}.detail-settings-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;color:#eef4fb;font-size:24px;font-weight:800}.detail-settings-heading[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;margin-top:10px;color:#a8b3c1;font-size:14px;font-weight:600}.section-toggle-list[_ngcontent-%COMP%]{display:grid;gap:8px;margin-top:24px}.section-toggle-button[_ngcontent-%COMP%]{width:100%;min-height:72px;display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 16px;border:1px solid #26364d;border-radius:5px;background:#111a2c;color:#d7dfeb;cursor:pointer;transition:border-color .2s ease,background .2s ease,color .2s ease}.section-toggle-button[_ngcontent-%COMP%]:hover{border-color:#3b4f6d;background:#142034}.section-toggle-button[_ngcontent-%COMP%]:focus-visible{outline:2px solid #5f8fb0;outline-offset:2px}.section-toggle-button.active[_ngcontent-%COMP%]{border-color:#26364d;background:#111a2c;color:#fff}.section-toggle-button.active[_ngcontent-%COMP%]:hover{border-color:#3b4f6d;background:#142034}.section-toggle-button__content[_ngcontent-%COMP%]{min-width:0;display:inline-flex;align-items:center;gap:14px}.section-toggle-button__icon[_ngcontent-%COMP%]{width:40px;height:40px;flex:0 0 40px;display:inline-flex;align-items:center;justify-content:center;border-radius:3px;background:#253048;color:#dadde1}.section-toggle-button__icon[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:23px}.section-toggle-button__copy[_ngcontent-%COMP%]{min-width:0;display:grid;gap:4px}.section-toggle-button__label[_ngcontent-%COMP%]{color:#dce4f0;font-size:14px;font-weight:800;line-height:1.1}.section-toggle-button__module[_ngcontent-%COMP%]{color:#9ba8b8;font-size:10px;font-weight:800;letter-spacing:0;line-height:1}.section-toggle-button__state[_ngcontent-%COMP%]{position:relative;right:clamp(80px,16vw,190px);min-width:108px;display:inline-flex;align-items:center;justify-content:flex-end;gap:12px;color:#b98787}.section-toggle-button__state-text[_ngcontent-%COMP%]{font-size:11px;font-weight:900}.section-toggle-button__switch[_ngcontent-%COMP%]{width:42px;height:24px;display:inline-flex;align-items:center;padding:2px;border-radius:999px;background:#2c3b52;transition:background .2s ease}.section-toggle-button__thumb[_ngcontent-%COMP%]{width:18px;height:18px;border-radius:999px;background:#aeb8c5;transform:translate(0);transition:background .2s ease,transform .2s ease}.section-toggle-button.active[_ngcontent-%COMP%]   .section-toggle-button__state[_ngcontent-%COMP%]{color:#78aacb}.section-toggle-button.active[_ngcontent-%COMP%]   .section-toggle-button__switch[_ngcontent-%COMP%]{background:#0c56de}.section-toggle-button.active[_ngcontent-%COMP%]   .section-toggle-button__thumb[_ngcontent-%COMP%]{background:#eef6fb;transform:translate(18px)}.section-toggle-button[_ngcontent-%COMP%]:not(.active)   .section-toggle-button__icon[_ngcontent-%COMP%]{color:#93a1b2}[_nghost-%COMP%]   .footer-button.primary[_ngcontent-%COMP%]{min-width:154px;border-color:#2f6f8f;background:#0c56de;color:#fff;font-weight:800}"]});let i=o;return i})();function Ed(i,o){if(i&1){let r=R();a(0,"button",20),_("click",function(){let t=S(r).$implicit,n=u();return v(n.chooseDate(t.value))}),a(1,"span",21)(2,"span",22),d(3),l()(),a(4,"span",23),y(5,"span",24),l()()}if(i&2){let r=o.$implicit,e=u();w("active",e.isExpirySelected(r.value)),H("aria-pressed",e.isExpirySelected(r.value)),c(3),T(r.label)}}function Td(i,o){if(i&1){let r=R();a(0,"button",36),_("click",function(){let t=S(r).$implicit,n=u(2).$implicit,s=u();return v(s.chooseMispricingAmount(n.key,t))}),d(1),z(2,"number"),l()}if(i&2){let r=o.$implicit;c(),g(" ",Pt(2,1,r)," ")}}function Id(i,o){if(i&1&&(a(0,"div",34),P(1,Td,3,3,"button",35),l()),i&2){let r=u().$implicit;c(),b("ngForOf",r.options)}}function kd(i,o){if(i&1){let r=R();a(0,"div",25)(1,"div",10)(2,"div",26)(3,"label",27),d(4),l()(),a(5,"div",28)(6,"div",29)(7,"input",30),_("ngModelChange",function(t){let n=S(r).$implicit,s=u();
16return v(s.onMispricingAmountChange(n.key,+t))}),l(),a(8,"button",31),_("click",function(){let t=S(r).$implicit,n=u();return v(n.toggleMispricingDropdown(t.key))}),y(9,"span",32),l()()(),P(10,Id,2,1,"div",33),l()()}if(i&2){let r=o.$implicit,e=u();c(3),b("for","mispricing-value-"+r.key),c(),g(" ",r.label," "),c(3),b("id","mispricing-value-"+r.key)("ngModel",r.value),c(),H("aria-expanded",e.openMispricingDropdownKey===r.key),c(2),b("ngIf",e.openMispricingDropdownKey===r.key)}}function Rd(i,o){if(i&1){let r=R();a(0,"button",36),_("click",function(){let t=S(r).$implicit,n=u(2).$implicit,s=u();return v(s.choosePopPercentage(n.key,t))}),d(1),l()}if(i&2){let r=o.$implicit;c(),g(" ",r,"% ")}}function Dd(i,o){if(i&1&&(a(0,"div",34),P(1,Rd,2,1,"button",35),l()),i&2){let r=u(2);c(),b("ngForOf",r.popPercentageOptions)}}function Nd(i,o){if(i&1){let r=R();a(0,"div",25)(1,"div",10)(2,"label",27),d(3),l(),a(4,"div",29)(5,"input",37),_("ngModelChange",function(t){let n=S(r).$implicit,s=u();return v(s.onCustomPopPercentageChange(n.key,+t))}),l(),a(6,"button",31),_("click",function(){let t=S(r).$implicit,n=u();return v(n.togglePopDropdown(t.key))}),y(7,"span",32),l()(),P(8,Dd,2,1,"div",33),l()()}if(i&2){let r=o.$implicit,e=u();c(2),b("for","pop-value-"+r.key),c(),g(" ",r.label," "),c(2),b("id","pop-value-"+r.key)("ngModel",r.value),c(),H("aria-expanded",e.openPopDropdownKey===r.key),c(2),b("ngIf",e.openPopDropdownKey===r.key)}}var ba=(()=>{let o=class o{constructor(){this.modalCtrl=D(ye,{optional:!0}),this.mispricingSettings=D(Nt),this.useModalController=!0,this.title="Flow Settings",this.description="Choose the active expiry and apply a preferred price range.",this.originId="",this.dates=[],this.metaOptions=[],this.selectedDate="",this.selectedDates=[],this.presetPrices=[],this.selectedPrice=null,this.sortDirection="desc",this.sortValueMode="absolute",this.mispricingRanges=[],this.cancelled=new ce,this.saved=new ce,this.expiryOptions=[],this.popPercentageOptions=[70,75,80,85,90,95],this.mispricingMonthSettings=[{key:"near",label:"Near Month",value:5e3,options:[5e3,1e4,15e3,2e4,25e3,3e4]},{key:"next",label:"Next Month",value:1e4,options:[1e4,15e3,2e4,25e3,3e4,4e4]},{key:"far",label:"Far Month",value:2e4,options:[2e4,25e3,3e4,35e3,4e4,5e4]}],this.popMonthSettings=[{key:"near",label:"Near Month POP%",value:70},{key:"next",label:"Next Month POP%",value:70},{key:"far",label:"Far Month POP%",value:70}],this.selectedExpiry="",this.selectedExpiries=[],this.openMispricingDropdownKey=null,this.openPopDropdownKey=null,this.selectedSortDirection="desc",this.selectedSortValueMode="absolute"}ngOnInit(){if(this.useModalController&&(this.metaOptions=this.metaOptions.length?this.metaOptions:this.mispricingSettings.flowMeta(),this.dates=this.dates.length?this.dates:this.mispricingSettings.dates(),this.presetPrices=this.presetPrices.length?this.presetPrices:this.mispricingSettings.presetPrices,this.selectedDate=this.selectedDate||this.mispricingSettings.selectedDate(),this.selectedDates=this.selectedDates.length?[...this.selectedDates]:[...this.mispricingSettings.selectedDates()],this.selectedPrice??=this.mispricingSettings.selectedPrice(),this.sortDirection=this.mispricingSettings.sortDirection(),this.sortValueMode=this.mispricingSettings.getSortValueMode(this.originId),this.mispricingRanges=this.mispricingRanges.length?this.mispricingRanges:this.mispricingSettings.dialogMispricingRanges()),this.expiryOptions=this.createExpiryOptions(),this.selectedExpiry=this.getInitialSelectedExpiry(),this.selectedExpiries=this.selectedDates.length?[...this.selectedDates]:this.selectedExpiry?[this.selectedExpiry]:[],!this.selectedExpiries.length&&this.expiryOptions.length){let e=this.expiryOptions[0].value;this.selectedExpiries=[e],this.selectedExpiry=e,this.selectedDate=e}this.selectedSortDirection=this.sortDirection,this.selectedSortValueMode=this.sortValueMode,this.syncMispricingRanges()}chooseDate(e){if(this.selectedExpiries.includes(e)){if(this.selectedExpiries.length===1)return;this.selectedExpiries=this.selectedExpiries.filter(t=>t!==e),this.selectedExpiry===e&&(this.selectedExpiry=this.selectedExpiries[0]??"",this.selectedDate=this.selectedExpiry);return}this.selectedExpiries=[...this.selectedExpiries,e],this.selectedExpiry||(this.selectedExpiry=e,this.selectedDate=e)}isExpirySelected(e){return this.selectedExpiries.includes(e)}toggleMispricingDropdown(e){this.openMispricingDropdownKey=this.openMispricingDropdownKey===e?null:e}
16chooseMispricingAmount(e,t){let n=this.mispricingMonthSettings.find(s=>s.key===e);n&&(n.value=t,this.openMispricingDropdownKey=null)}onMispricingAmountChange(e,t){let n=this.mispricingMonthSettings.find(s=>s.key===e);n&&(n.value=Number.isFinite(t)?t:0)}togglePopDropdown(e){this.openPopDropdownKey=this.openPopDropdownKey===e?null:e}choosePopPercentage(e,t){let n=this.popMonthSettings.find(s=>s.key===e);n&&(n.value=t,this.openPopDropdownKey=null)}onCustomPopPercentageChange(e,t){let n=this.popMonthSettings.find(s=>s.key===e);n&&(n.value=Number.isFinite(t)?t:0)}close(){return k(this,null,function*(){if(this.useModalController&&this.modalCtrl){yield this.modalCtrl.dismiss({action:"cancel"});return}this.cancelled.emit()})}save(){return k(this,null,function*(){let e=this.mispricingMonthSettings.map(s=>({month:s.label,amount:s.value})),t=this.popMonthSettings.map(s=>({month:s.label.replace(" POP%",""),percentage:s.value})),n={selectedDate:this.selectedExpiry,selectedDates:this.selectedExpiries,selectedPrice:this.getSelectedPrice(e),selectedPriceMonth:this.getSelectedPriceMonth(),sortDirection:this.selectedSortDirection,sortValueMode:this.selectedSortValueMode,mispricingRanges:e,popSettings:t};if(this.mispricingSettings.applySettings(n),this.useModalController&&this.modalCtrl){yield this.modalCtrl.dismiss(f({action:"save"},n));return}this.saved.emit(n)})}createExpiryOptions(){return this.metaOptions.length?this.metaOptions.map(e=>({value:e.date,label:`${e.label} Expiry`})):this.dates.map((e,t)=>({value:e,label:`Expiry ${t+1}`}))}getInitialSelectedExpiry(){return this.selectedDate&&this.expiryOptions.some(e=>e.value===this.selectedDate)?this.selectedDate:this.expiryOptions[0]?.value??this.selectedDate}getSelectedPrice(e){let t=this.getSelectedPriceMonth();return e.find(n=>n.month===t)?.amount}getSelectedPriceMonth(){if(this.selectedExpiry===this.expiryOptions[0]?.value)return"Near Month";if(this.selectedExpiry===this.expiryOptions[1]?.value)return"Next Month";if(this.selectedExpiry===this.expiryOptions[2]?.value)return"Far Month"}syncMispricingRanges(){if(this.mispricingRanges.length)for(let e of this.mispricingMonthSettings){let t=this.mispricingRanges.find(n=>e.key==="near"?n.month==="Near Month":e.key==="next"?n.month==="Next Month":e.key==="far"?n.month==="Far Month":!1);t&&(e.value=t.amount)}}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-mispricing-flow-settings-dialog"]],inputs:{useModalController:"useModalController",title:"title",description:"description",originId:"originId",dates:"dates",metaOptions:"metaOptions",selectedDate:"selectedDate",selectedDates:"selectedDates",presetPrices:"presetPrices",selectedPrice:"selectedPrice",sortDirection:"sortDirection",sortValueMode:"sortValueMode",mispricingRanges:"mispricingRanges"},outputs:{cancelled:"cancelled",saved:"saved"},decls:60,vars:17,consts:[[1,"settings-dialog"],[1,"dialog-header"],["type","button","aria-label","Close settings",1,"icon-button",3,"click"],["name","close-outline"],[1,"dialog-body"],[1,"settings-group"],[1,"group-heading"],[1,"expiry-toggle-list"],["type","button","class","expiry-toggle-row",3,"active","click",4,"ngFor","ngForOf"],[1,"sort-grid"],[1,"field-group"],[1,"input-label"],["role","group","aria-label","Sort direction",1,"toggle-chip-group"],["type","button",1,"toggle-chip",3,"click"],["role","group","aria-label","Positive and negative handling",1,"toggle-chip-group"],[1,"pop-month-list"],["class","pop-month-card",4,"ngFor","ngForOf"],[1,"dialog-footer"],["type","button",1,"footer-button","secondary",3,"click"],["type","button",1,"footer-button","primary",3,"click"],["type","button",1,"expiry-toggle-row",3,"click"],[1,"expiry-copy"],[1,"expiry-label"],["aria-hidden","true",1,"expiry-toggle"],[1,"expiry-toggle-thumb"],[1,"pop-month-card"],[1,"month-card-header"],[1,"input-label",3,"for"],[1,"range-input-field"],[1,"pop-combobox"],["type","number","placeholder","Enter amount",1,"pop-combobox-input",3,"ngModelChange","id","ngModel"],["type","button",1,"pop-combobox-toggle",3,"click"],[1,"pop-combobox-caret"],["class","pop-dropdown",4,"ngIf"],[1,"pop-dropdown"],["type","button","class","pop-dropdown-item",3,"click",4,"ngFor","ngForOf"],["type","button",1,"pop-dropdown-item",3,"click"],["type","number","placeholder","Enter custom percentage",1,"pop-combobox-input",3,"ngModelChange","id","ngModel"]],template:function(t,n){t&1&&(a(0,"section",0)(1,"header",1)(2,"div")(3,"h2"),d(4),l(),a(5,"p"),d(6),l()(),a(7,"button",2),_("click",function(){return n.close()}),y(8,"ion-icon",3),l()(),a(9,"div",4)(10,"div",5)(11,"div",6)(12,"h3"),d(13,"Select Month Wise Mispricing"),l()(),a(14,"div",7),P(15,Ed,6,4,"button",8),l()(),a(16,"div",5)(17,"div",6)(18,"h3"),d(19,"Sorting"),l(),a(20,"span"),d(21,"Choose the order and whether sign should affect ranking."),l()(),a(22,"div",9)(23,"div",10)(24,"label",11),d(25,"Sort direction"),l(),a(26,"div",12)(27,"button",13),_("click",function(){return n.selectedSortDirection="desc"}),d(28," Highest to lowest "),l(),a(29,"button",13),_("click",function(){return n.selectedSortDirection="asc"}),d(30," Lowest to highest "),l()()(),a(31,"div",10)(32,"label",11),d(33,"Positive / negative handling"),l(),a(34,"div",14)(35,"button",13),_("click",function(){return n.selectedSortValueMode="absolute"}),d(36," Ignore sign "),l(),a(37,"button",13),_("click",function(){return n.selectedSortValueMode="signed"}),d(38," Respect sign "),l()()()()(),a(39,"div",5)(40,"div",6)(41,"h3"),d(42,"Mispricing Range"),l(),a(43,"span"),d(44,"Set the mispricing amount for each month."),l()(),a(45,"div",15),P(46,kd,11,6,"div",16),l()(),a(47,"div",5)(48,"div",6)(49,"h3"),d(50,"POP (Probability of Profit)"),l(),a(51,"span"),d(52,"Select the POP percentage for each month or enter a custom value."),l()(),a(53,"div",15),P(54,Nd,9,6,"div",16),l()()(),a(55,"footer",17)(56,"button",18),_("click",function(){return n.close()}),d(57," Cancel "),l(),a(58,"button",19),_("click",function(){return n.save()}),d(59," Save "),l()()()),t&2&&(c(4),T(n.title),c(2),T(n.description),c(9),b("ngForOf",n.expiryOptions),c(12),w("active",n.selectedSortDirection==="desc"),H("aria-pressed",n.selectedSortDirection==="desc"),c(2),w("active",n.selectedSortDirection==="asc"),H("aria-pressed",n.selectedSortDirection==="asc"),c(6),w("active",n.selectedSortValueMode==="absolute"),H("aria-pressed",n.selectedSortValueMode==="absolute"),c(2),w("active",n.selectedSortValueMode==="signed"),H("aria-pressed",n.selectedSortValueMode==="signed"),c(9),b("ngForOf",n.mispricingMonthSettings),c(8),b("ngForOf",n.popMonthSettings))},dependencies:[ne,te,ze,dt,vt,_i,ct,Yt,st,St],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.settings-dialog[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;background:#131820;color:#f8fafc;border:1px solid #243144;border-radius:16px;overflow:hidden;box-shadow:0 18px 40px #0006}.dialog-header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 24px 16px;border-bottom:1px solid rgba(143,155,179,.18);background:#131820}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{margin:0;font-size:22px;font-weight:700}.dialog-header[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:6px 0 0;color:#9aa6b2;font-size:13px;line-height:1.4}.mode-tab-buttons[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:10px;padding:14px 24px 0;background:#131820}.mode-tab-button[_ngcontent-%COMP%]{min-height:38px;padding:0 14px;border:1px solid #314156;border-radius:999px;background:#101722;color:#c8d3df;font-size:13px;font-weight:600;cursor:pointer;transition:background-color .2s ease,border-color .2s ease,color .2s ease}.mode-tab-button.active[_ngcontent-%COMP%]{background:#0c56de;border-color:#0c56de;color:#fff}.icon-button[_ngcontent-%COMP%]{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #314156;border-radius:10px;background:#1b2230;color:#f8fafc;cursor:pointer;transition:background-color .2s ease,border-color .2s ease}.icon-button[_ngcontent-%COMP%]:hover{background:#232c3d;border-color:#41516a}.icon-button[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:18px}.dialog-body[_ngcontent-%COMP%]{flex:1;padding:20px 24px;overflow-y:auto;background:#131820}.settings-group[_ngcontent-%COMP%]{padding:18px;background:#171f2b;border:1px solid #273244;border-radius:14px}.settings-group[_ngcontent-%COMP%] + .settings-group[_ngcontent-%COMP%]{margin-top:16px}
16.market-settings-stack[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;margin-top:14px}.market-settings-card[_ngcontent-%COMP%]{padding:14px;border:1px solid #273244;border-radius:12px;background:#101722}.card-title[_ngcontent-%COMP%]{display:block;margin-bottom:12px;color:#f8fafc;font-size:14px;font-weight:600}.metric-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.input-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:6px;flex:1 1 180px}.toggle-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:42px;padding-top:20px}.detail-empty-state[_ngcontent-%COMP%]{margin-top:14px;padding:18px;border:1px dashed #314156;border-radius:12px;color:#9aa6b2;background:#101722}.group-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;font-size:15px;font-weight:700}.group-heading[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;margin-top:6px;color:#9aa6b2;font-size:12px}.expiry-toggle-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:10px;margin-top:14px}.expiry-toggle-row[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 14px;border:1px solid #273244;border-radius:12px;background:#101722;color:#f8fafc;cursor:pointer;transition:border-color .2s ease,background-color .2s ease,box-shadow .2s ease}.expiry-label[_ngcontent-%COMP%]{font-size:14px;font-weight:600;text-align:left}.expiry-copy[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;min-width:0}.expiry-status[_ngcontent-%COMP%]{color:#9aa6b2;font-size:12px;line-height:1.2;text-align:left}.expiry-toggle[_ngcontent-%COMP%]{position:relative;width:48px;height:28px;flex-shrink:0;border-radius:999px;background:#3b4658;transition:background-color .2s ease}.expiry-toggle-thumb[_ngcontent-%COMP%]{position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:#fff;box-shadow:0 3px 8px #00000059;transition:transform .2s ease}.expiry-toggle-row.active[_ngcontent-%COMP%]   .expiry-toggle[_ngcontent-%COMP%]{background:#0c56de}.expiry-toggle-row.active[_ngcontent-%COMP%]   .expiry-toggle-thumb[_ngcontent-%COMP%]{transform:translate(20px)}.price-form-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:14px;margin-top:14px}.sort-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:14px}.toggle-chip-group[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:10px}.toggle-chip[_ngcontent-%COMP%]{min-height:40px;padding:0 14px;border:1px solid #314156;border-radius:999px;background:#101722;color:#c8d3df;font-size:13px;font-weight:600;cursor:pointer;transition:background-color .2s ease,border-color .2s ease,color .2s ease}.toggle-chip[_ngcontent-%COMP%]:hover{border-color:#45628d;color:#fff}.toggle-chip.active[_ngcontent-%COMP%]{background:#0c56de;border-color:#0c56de;color:#fff}.field-group[_ngcontent-%COMP%]{min-width:0}.input-label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;color:#9aa6b2;font-size:12px;font-weight:600}.custom-input[_ngcontent-%COMP%]{width:100%;height:42px;padding:0 14px;border:1px solid #314156;border-radius:10px;background:#101722;color:#f8fafc;font-size:14px;box-sizing:border-box}.custom-input[_ngcontent-%COMP%]:focus{outline:none;border-color:#0043ba;box-shadow:0 0 0 3px #0043ba33}.custom-select[_ngcontent-%COMP%]{width:100%;height:42px;padding:0 40px 0 14px;border:1px solid #314156;border-radius:10px;background:#101722;color:#f8fafc;font-size:14px;box-sizing:border-box;appearance:none;background-image:linear-gradient(45deg,transparent 50%,#9aa6b2 50%),linear-gradient(135deg,#9aa6b2 50%,transparent 50%);background-position:calc(100% - 18px) 18px,calc(100% - 12px) 18px;background-size:6px 6px,6px 6px;background-repeat:no-repeat}.custom-select[_ngcontent-%COMP%]:focus{outline:none;border-color:#0043ba;box-shadow:0 0 0 3px #0043ba33}.pop-month-list[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:14px;margin-top:14px}.pop-month-card[_ngcontent-%COMP%]{padding:14px;border:1px solid #273244;border-radius:12px;background:#101722;position:relative}.month-card-header[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;margin-bottom:12px}.month-card-header[_ngcontent-%COMP%]   .input-label[_ngcontent-%COMP%]{margin-bottom:0}.range-input-field[_ngcontent-%COMP%]{display:block}.pop-combobox[_ngcontent-%COMP%]{display:flex;align-items:stretch;flex:1}.pop-combobox-input[_ngcontent-%COMP%]{width:100%;height:42px;padding:0 14px;border:1px solid #314156;border-right:0;border-radius:10px 0 0 10px;background:#101722;color:#f8fafc;font-size:14px;box-sizing:border-box;appearance:textfield;-moz-appearance:textfield}.pop-combobox-input[_ngcontent-%COMP%]::-webkit-outer-spin-button, .pop-combobox-input[_ngcontent-%COMP%]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.pop-combobox-input[_ngcontent-%COMP%]:focus{outline:none;border-color:#0043ba;box-shadow:0 0 0 3px #0043ba33;position:relative;z-index:1}.pop-combobox-toggle[_ngcontent-%COMP%]{width:44px;height:42px;border:1px solid #314156;border-left:0;border-radius:0 10px 10px 0;background:#101722;color:#9aa6b2;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:background-color .2s ease,border-color .2s ease}.pop-combobox-toggle[_ngcontent-%COMP%]:hover{background:#141d2b;border-color:#45628d}.pop-combobox-caret[_ngcontent-%COMP%]{width:10px;height:10px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg) translateY(-2px)}.pop-dropdown[_ngcontent-%COMP%]{margin-top:8px;padding:6px;border:1px solid #273244;border-radius:10px;background:#131b27;display:flex;flex-direction:column;gap:4px}.pop-dropdown-item[_ngcontent-%COMP%]{min-height:36px;padding:0 12px;border:0;border-radius:8px;background:transparent;color:#c8d3df;font-size:13px;font-weight:600;text-align:left;cursor:pointer;transition:background-color .2s ease,color .2s ease}.pop-dropdown-item[_ngcontent-%COMP%]:hover{background:#1a2637;color:#fff}.dialog-footer[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;
16gap:10px;padding:16px 24px 20px;border-top:1px solid rgba(143,155,179,.18);background:#131820}.footer-button[_ngcontent-%COMP%]{min-width:94px;height:40px;padding:0 18px;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer;transition:background-color .2s ease,border-color .2s ease,box-shadow .2s ease}.footer-button.secondary[_ngcontent-%COMP%]{border:1px solid #314156;background:transparent;color:#c8d3df}.footer-button.secondary[_ngcontent-%COMP%]:hover{background:#1a2230}.footer-button.primary[_ngcontent-%COMP%]{border:1px solid #0043ba;background:#0043ba;color:#fff}.footer-button.primary[_ngcontent-%COMP%]:hover{background:#0c56de;border-color:#0c56de;box-shadow:0 10px 20px #0043ba40}@media(max-width:768px){.dialog-header[_ngcontent-%COMP%], .dialog-body[_ngcontent-%COMP%], .dialog-footer[_ngcontent-%COMP%]{padding-left:16px;padding-right:16px}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{font-size:18px}.dialog-footer[_ngcontent-%COMP%]{justify-content:stretch}.price-form-grid[_ngcontent-%COMP%], .sort-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}.month-card-header[_ngcontent-%COMP%]{margin-bottom:10px}.footer-button[_ngcontent-%COMP%]{flex:1}}"]});let i=o;return i})();var Fd=(i,o)=>o.id;function Ld(i,o){if(i&1){let r=R();vr(0),a(1,"button",12),_("click",function(){let t=S(r).$implicit,n=u();return v(n.toggleSection(t.id))}),a(2,"span",13)(3,"span",14),y(4,"ion-icon",15),l(),a(5,"span",16)(6,"span",17),d(7),l(),a(8,"span",18),d(9),l()()(),a(10,"span",19)(11,"span",20),d(12),l(),a(13,"span",21),y(14,"span",22),l()()()}if(i&2){let r=o.$implicit,e=u().isSectionSelected(r.id);c(),w("active",e),H("aria-pressed",e),c(3),b("name",r.icon),c(3),g(" ",r.label," "),c(2),g(" ",r.module," "),c(3),g(" ",e?"SHOW":"HIDE"," ")}}var ya=(()=>{let o=class o{constructor(){this.modalCtrl=D(ye),this.sectionOptions=[{id:"show-overvalued",label:"Show Overvalued",module:"MODULE_01",icon:"trending-up-outline"},{id:"show-undervalued",label:"Show Undervalued",module:"MODULE_02",icon:"trending-down-outline"},{id:"show-overvalued-undervalued",label:"Show Overvalued Undervalued",module:"MODULE_03",icon:"swap-vertical-outline"}],this.selectedSectionIds=[this.sectionOptions[0].id]}ngOnChanges(e){if(!e.visibleSections)return;let t=new Set(this.sectionOptions.map(s=>s.id)),n=this.visibleSections?.find(s=>t.has(s));this.selectedSectionIds=[n??this.sectionOptions[0].id]}isSectionSelected(e){return this.selectedSectionIds.includes(e)}toggleSection(e){this.selectedSectionIds=[e]}close(){return k(this,null,function*(){yield this.modalCtrl.dismiss({action:"cancel"})})}save(){return k(this,null,function*(){yield this.modalCtrl.dismiss({action:"save",hedgeRatioSettings:{visibleSections:this.selectedSectionIds}})})}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-hedge-ratio-settings-dialog"]],inputs:{visibleSections:"visibleSections"},features:[ve],decls:22,vars:0,consts:[[1,"settings-dialog"],[1,"dialog-header"],["type","button","aria-label","Close settings",1,"icon-button",3,"click"],["name","close-outline"],[1,"dialog-body"],[1,"settings-group","detail-settings-panel"],[1,"detail-settings-heading"],["role","group","aria-label","Detail sections",1,"section-toggle-list"],["type","button",1,"section-toggle-button",3,"active"],[1,"dialog-footer"],["type","button",1,"footer-button","secondary",3,"click"],["type","button",1,"footer-button","primary",3,"click"],["type","button",1,"section-toggle-button",3,"click"],[1,"section-toggle-button__content"],["aria-hidden","true",1,"section-toggle-button__icon"],[3,"name"],[1,"section-toggle-button__copy"],[1,"section-toggle-button__label"],[1,"section-toggle-button__module"],[1,"section-toggle-button__state"],[1,"section-toggle-button__state-text"],["aria-hidden","true",1,"section-toggle-button__switch"],[1,"section-toggle-button__thumb"]],template:function(t,n){t&1&&(a(0,"section",0)(1,"header",1)(2,"div")(3,"h2"),d(4,"Delta Metrics"),l()(),a(5,"button",2),_("click",function(){return n.close()}),y(6,"ion-icon",3),l()(),a(7,"div",4)(8,"div",5)(9,"div",6)(10,"h2"),d(11,"Delta Metrics"),l(),a(12,"span"),d(13,"Select the detail sections you want to keep visible."),l()(),a(14,"div",7),q(15,Ld,15,7,"button",8,Fd),l()()(),a(17,"footer",9)(18,"button",10),_("click",function(){return n.close()}),d(19," Cancel "),l(),a(20,"button",11),_("click",function(){return n.save()}),d(21," Save "),l()()()),t&2&&(c(15),G(n.sectionOptions))},dependencies:[ne,te],styles:["[_nghost-%COMP%]{display:block;width:100%;height:100%}.settings-dialog[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;flex-direction:column;background:#131820;color:#f8fafc;border:1px solid #243144;border-radius:16px;overflow:hidden;box-shadow:0 18px 40px #0006}.dialog-header[_ngcontent-%COMP%]{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 24px 16px;border-bottom:1px solid rgba(143,155,179,.18);background:#131820}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{margin:0;font-size:22px;font-weight:700}.dialog-header[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:6px 0 0;color:#9aa6b2;font-size:13px;line-height:1.4}.icon-button[_ngcontent-%COMP%]{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #314156;border-radius:10px;background:#1b2230;color:#f8fafc;cursor:pointer}.icon-button[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:18px}.dialog-body[_ngcontent-%COMP%]{flex:1;padding:20px 24px;overflow-y:auto;background:#131820}.settings-group[_ngcontent-%COMP%]{padding:18px;background:#171f2b;border:1px solid #273244;border-radius:14px}.settings-group[_ngcontent-%COMP%] + .settings-group[_ngcontent-%COMP%]{margin-top:16px}.group-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;font-size:15px;font-weight:700}.group-heading[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;margin-top:6px;color:#9aa6b2;font-size:12px}.dialog-footer[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px 20px;border-top:1px solid rgba(143,155,179,.18);background:#131820}.footer-button[_ngcontent-%COMP%]{min-width:94px;height:40px;padding:0 18px;border-radius:10px;font-size:13px;font-weight:600;cursor:pointer}.footer-button.secondary[_ngcontent-%COMP%]{border:1px solid #314156;background:transparent;color:#c8d3df}.footer-button.primary[_ngcontent-%COMP%]{border:1px solid #0043ba;background:#0043ba;color:#fff}.custom-input[_ngcontent-%COMP%]{width:100%;height:42px;padding:0 14px;border:1px solid #314156;border-radius:10px;background:#101722;color:#f8fafc;font-size:14px;box-sizing:border-box}.input-label[_ngcontent-%COMP%]{display:block;margin-bottom:8px;color:#9aa6b2;font-size:12px;font-weight:600}.detail-empty-state[_ngcontent-%COMP%]{margin-top:14px;padding:18px;border:1px dashed #314156;border-radius:12px;color:#9aa6b2;background:#101722}@media(max-width:768px){.dialog-header[_ngcontent-%COMP%], .dialog-body[_ngcontent-%COMP%], .dialog-footer[_ngcontent-%COMP%]{padding-left:16px;padding-right:16px}.dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{font-size:18px}.dialog-footer[_ngcontent-%COMP%]{justify-content:stretch}.footer-button[_ngcontent-%COMP%]{flex:1}}[_nghost-%COMP%]   .settings-dialog[_ngcontent-%COMP%]{background:#263247;margin:0}[_nghost-%COMP%]   .dialog-header[_ngcontent-%COMP%]{align-items:center;padding:18px 24px;background:#111a2c;border-bottom-color:#263247}[_nghost-%COMP%]   .dialog-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{color:#fff;font-size:18px}[_nghost-%COMP%]   .group-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{color:#fff}[_nghost-%COMP%]   .dialog-body[_ngcontent-%COMP%]{padding:20px 16px;background:#101827}[_nghost-%COMP%]   .dialog-footer[_ngcontent-%COMP%]{background:#222c3c;border-top-color:#2e3a4f}
16.detail-settings-panel[_ngcontent-%COMP%]{padding:10px 0 24px;border:0;background:transparent}.detail-settings-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;color:#eef4fb;font-size:24px;font-weight:800}.detail-settings-heading[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;margin-top:10px;color:#a8b3c1;font-size:14px;font-weight:600}.section-toggle-list[_ngcontent-%COMP%]{display:grid;gap:8px;margin-top:24px}.section-toggle-button[_ngcontent-%COMP%]{width:100%;min-height:72px;display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 16px;border:1px solid #26364d;border-radius:5px;background:#111a2c;color:#d7dfeb;cursor:pointer;transition:border-color .2s ease,background .2s ease,color .2s ease}.section-toggle-button[_ngcontent-%COMP%]:hover{border-color:#3b4f6d;background:#142034}.section-toggle-button[_ngcontent-%COMP%]:focus-visible{outline:2px solid #5f8fb0;outline-offset:2px}.section-toggle-button.active[_ngcontent-%COMP%]{border-color:#26364d;background:#111a2c;color:#fff}.section-toggle-button.active[_ngcontent-%COMP%]:hover{border-color:#3b4f6d;background:#142034}.section-toggle-button__content[_ngcontent-%COMP%]{min-width:0;display:inline-flex;align-items:center;gap:14px}.section-toggle-button__icon[_ngcontent-%COMP%]{width:40px;height:40px;flex:0 0 40px;display:inline-flex;align-items:center;justify-content:center;border-radius:3px;background:#253048;color:#dadde1}.section-toggle-button__icon[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:23px}.section-toggle-button__copy[_ngcontent-%COMP%]{min-width:0;display:grid;gap:4px;justify-items:start;text-align:left}.section-toggle-button__label[_ngcontent-%COMP%]{color:#dce4f0;font-size:14px;font-weight:800;line-height:1.1}.section-toggle-button__module[_ngcontent-%COMP%]{color:#9ba8b8;font-size:10px;font-weight:800;letter-spacing:0;line-height:1}.section-toggle-button__state[_ngcontent-%COMP%]{position:relative;right:clamp(80px,16vw,190px);min-width:108px;display:inline-flex;align-items:center;justify-content:flex-end;gap:12px;color:#b98787}.section-toggle-button__state-text[_ngcontent-%COMP%]{font-size:11px;font-weight:900}.section-toggle-button__switch[_ngcontent-%COMP%]{width:42px;height:24px;display:inline-flex;align-items:center;padding:2px;border-radius:999px;background:#2c3b52;transition:background .2s ease}.section-toggle-button__thumb[_ngcontent-%COMP%]{width:18px;height:18px;border-radius:999px;background:#aeb8c5;transform:translate(0);transition:background .2s ease,transform .2s ease}.section-toggle-button.active[_ngcontent-%COMP%]   .section-toggle-button__state[_ngcontent-%COMP%]{color:#78aacb}.section-toggle-button.active[_ngcontent-%COMP%]   .section-toggle-button__switch[_ngcontent-%COMP%]{background:#0c56de}.section-toggle-button.active[_ngcontent-%COMP%]   .section-toggle-button__thumb[_ngcontent-%COMP%]{background:#eef6fb;transform:translate(18px)}.section-toggle-button[_ngcontent-%COMP%]:not(.active)   .section-toggle-button__icon[_ngcontent-%COMP%]{color:#93a1b2}[_nghost-%COMP%]   .footer-button.primary[_ngcontent-%COMP%]{min-width:154px;border-color:#2f6f8f;background:#0c56de;color:#fff;font-weight:800}@media(max-width:600px){[_nghost-%COMP%]   .dialog-header[_ngcontent-%COMP%], [_nghost-%COMP%]   .dialog-body[_ngcontent-%COMP%], [_nghost-%COMP%]   .dialog-footer[_ngcontent-%COMP%]{padding-left:12px;padding-right:12px}
16.detail-settings-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{font-size:20px}.section-toggle-button[_ngcontent-%COMP%]{align-items:flex-start;flex-direction:column;gap:12px;padding:12px}.section-toggle-button__content[_ngcontent-%COMP%]{width:100%}.section-toggle-button__state[_ngcontent-%COMP%]{right:0;min-width:0;width:100%}[_nghost-%COMP%]   .dialog-footer[_ngcontent-%COMP%]{gap:8px}[_nghost-%COMP%]   .footer-button[_ngcontent-%COMP%], [_nghost-%COMP%]   .footer-button.primary[_ngcontent-%COMP%]{flex:1 1 0;min-width:0}}"]});let i=o;return i})();var Ca=(()=>{let o=class o{constructor(e){this.http=e,this.apiUrl=`${we.product_management_url}/api/strategy`,this.cache=new Map}getStrategyContent(e,t){let n=`${e}:${t}`,s=this.cache.get(n);if(s)return s;let p=this.getByProductAndStrategyId(e,t).pipe(dn(m=>{let h=us(t);if(!h)throw m;return this.getByUrl(h)}),gr({bufferSize:1,refCount:!1}));return this.cache.set(n,p),p}invalidate(e,t){this.cache.delete(`${e}:${t}`)}getByProductAndStrategyId(e,t){let n=new at().set("product_id",e).set("strategy_id",t);return this.getSettings(n)}getByUrl(e){let t=new at().set("url",e);return this.getSettings(t)}getSettings(e){return this.http.get(`${this.apiUrl}/get-settings`,{params:e}).pipe(Ue(t=>this.unwrapResponse(t)))}updateStrategyContent(e,t){let n=new at().set("url",e);return this.http.put(`${this.apiUrl}/update-settings`,t,{params:n}).pipe(Ue(s=>this.unwrapResponse(s)))}unwrapResponse(e){return"data"in e&&e.data?e.data:e}};o.\u0275fac=function(t){return new(t||o)(V(Ne))},o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();function Ud(i,o){i&1&&(a(0,"div",2),d(1,"Loading How To Use..."),l())}function Hd(i,o){i&1&&(a(0,"div",3),d(1," Strategy details are not available for this route. "),l())}function Vd(i,o){if(i&1&&(a(0,"div",4)(1,"h3"),d(2,"Unable to Load Strategy"),l(),a(3,"p"),d(4),l()()),i&2){let r=u();c(4),T(r.message)}}function Bd(i,o){if(i&1){let r=R();a(0,"button",20),_("click",function(){S(r);let t=u(2),n=u(3);return v(n.enableEdit(t))}),a(1,"span"),d(2,"Edit Mode"),l()()}}function qd(i,o){if(i&1&&(a(0,"h1",7),d(1),l()),i&2){let r=u();c(),g(" ",r.title," ")}}function Gd(i,o){if(i&1){let r=R();a(0,"input",21),De("ngModelChange",function(t){S(r);let n=u();return Re(n.title,t)||(n.title=t),v(t)}),l()}if(i&2){let r=u();ke("ngModel",r.title)}}function zd(i,o){if(i&1&&(a(0,"h3",7),d(1),l()),i&2){let r=u(2);c(),g(" ",r.subtitle," ")}}function jd(i,o){if(i&1){let r=R();a(0,"input",22),De("ngModelChange",function(t){S(r);let n=u();return Re(n.subtitle,t)||(n.subtitle=t),v(t)}),l()}if(i&2){let r=u();ke("ngModel",r.subtitle)}}function Kd(i,o){if(i&1&&(a(0,"p",11),d(1),l()),i&2){let r=u();c(),g(" ",r.description," ")}}function $d(i,o){if(i&1){let r=R();a(0,"textarea",23),De("ngModelChange",function(t){S(r);let n=u();return Re(n.description,t)||(n.description=t),v(t)}),l()}if(i&2){let r=u();ke("ngModel",r.description)}}function Qd(i,o){if(i&1&&(tt(0),d(1),nt()),i&2){let r=u().$implicit;c(),g(" ",r," ")}}function Yd(i,o){if(i&1){let r=R();a(0,"input",25),De("ngModelChange",function(t){S(r);let n=u().$index,s=u(2);return Re(s.whenToUse[n],t)||(s.whenToUse[n]=t),v(t)}),l()}if(i&2){let r=u().$index,e=u(2);ke("ngModel",e.whenToUse[r])}}function Xd(i,o){if(i&1&&(a(0,"li"),P(1,Qd,2,1,"ng-container")(2,Yd,1,1,"input",24),l()),i&2){let r=u(6);c(),C(r.isEditMode()?-1:1),c(),C(r.isEditMode()?2:-1)}}function Wd(i,o){if(i&1&&(a(0,"div",13)(1,"h3"),d(2,"When To Use"),l(),a(3,"ul"),q(4,Xd,3,2,"li",null,He),l()()),i&2){let r=u();c(4),G(r.whenToUse)}}function Zd(i,o){if(i&1&&(a(0,"span"),d(1),l()),i&2){let r=u().$implicit;c(),T(r)}}function Jd(i,o){if(i&1){let r=R();a(0,"input",25),De("ngModelChange",function(t){S(r);let n=u().$index,s=u(2);return Re(s.howToUse[n],t)||(s.howToUse[n]=t),v(t)}),l()}if(i&2){let r=u().$index,e=u(2);ke("ngModel",e.howToUse[r])}}function ep(i,o){if(i&1&&(a(0,"li")(1,"strong"),d(2),l(),P(3,Zd,2,1,"span")(4,Jd,1,1,"input",24),l()),i&2){let r=o.$index,e=u(6);c(2),g("Step ",r+1,""),c(),C(e.isEditMode()?-1:3),c(),C(e.isEditMode()?4:-1)}}function tp(i,o){if(i&1&&(a(0,"div",13)(1,"h3"),d(2,"How To Use"),l(),a(3,"ol",26),q(4,ep,5,3,"li",null,He),l()()),i&2){let r=u();c(4),G(r.howToUse)}}function np(i,o){if(i&1&&(tt(0),d(1),nt()),i&2){let r=u().$implicit;c(),g(" ",r," ")}}function ip(i,o){if(i&1){let r=R();a(0,"input",25),De("ngModelChange",function(t){S(r);let n=u().$index,s=u(2);return Re(s.bestFor[n],t)||(s.bestFor[n]=t),v(t)}),l()}if(i&2){let r=u().$index,e=u(2);ke("ngModel",e.bestFor[r])}}function op(i,o){if(i&1&&(a(0,"li"),P(1,np,2,1,"ng-container")(2,ip,1,1,"input",24),l()),i&2){let r=u(6);c(),C(r.isEditMode()?-1:1),c(),C(r.isEditMode()?2:-1)}}function rp(i,o){if(i&1&&(a(0,"div",14)(1,"h3"),d(2,"Who This Is Best For"),l(),a(3,"ul"),q(4,op,3,2,"li",null,He),l()()),i&2){let r=u();c(4),G(r.bestFor)}}function sp(i,o){if(i&1&&(tt(0),d(1),nt()),i&2){let r=u().$implicit;c(),g(" ",r," ")}}function ap(i,o){if(i&1){let r=R();a(0,"input",25),De("ngModelChange",function(t){S(r);let n=u().$index,s=u(2);return Re(s.whoShouldNotUse[n],t)||(s.whoShouldNotUse[n]=t),v(t)}),l()}if(i&2){let r=u().$index,e=u(2);ke("ngModel",e.whoShouldNotUse[r])}}function lp(i,o){if(i&1&&(a(0,"li"),P(1,sp,2,1,"ng-container")(2,ap,1,1,"input",24),l()),i&2){let r=u(6);c(),C(r.isEditMode()?-1:1),c(),C(r.isEditMode()?2:-1)}}function cp(i,o){if(i&1&&(a(0,"div",15)(1,"h3"),d(2,"Who Should NOT Use This Strategy"),l(),a(3,"ul"),q(4,lp,3,2,"li",null,He),l()()),i&2){let r=u();
16c(4),G(r.whoShouldNotUse)}}function dp(i,o){if(i&1&&(a(0,"p",11),d(1),l()),i&2){let r=u(2);c(),g(" ",r.notUseReason," ")}}function pp(i,o){if(i&1){let r=R();a(0,"textarea",28),De("ngModelChange",function(t){S(r);let n=u(2);return Re(n.notUseReason,t)||(n.notUseReason=t),v(t)}),l()}if(i&2){let r=u(2);ke("ngModel",r.notUseReason)}}function up(i,o){if(i&1&&(a(0,"div",15)(1,"h3"),d(2,"Not Use Reason"),l(),P(3,dp,2,1,"p",11)(4,pp,1,1,"textarea",27),l()),i&2){let r=u(5);c(3),C(r.isEditMode()?-1:3),c(),C(r.isEditMode()?4:-1)}}function mp(i,o){if(i&1&&(tt(0),a(1,"h4"),d(2),l(),a(3,"p"),d(4),l(),nt()),i&2){let r=u().$implicit;c(2),T(r.title),c(2),T(r.description)}}function hp(i,o){if(i&1){let r=R();tt(0),a(1,"input",31),De("ngModelChange",function(t){S(r);let n=u().$index,s=u(2);return Re(s.risks[n].title,t)||(s.risks[n].title=t),v(t)}),l(),a(2,"textarea",32),De("ngModelChange",function(t){S(r);let n=u().$index,s=u(2);return Re(s.risks[n].description,t)||(s.risks[n].description=t),v(t)}),l(),nt()}if(i&2){let r=u().$index,e=u(2);c(),ke("ngModel",e.risks[r].title),c(),ke("ngModel",e.risks[r].description)}}function gp(i,o){if(i&1&&(a(0,"article",30),P(1,mp,5,2,"ng-container")(2,hp,3,2,"ng-container"),l()),i&2){let r=u(6);c(),C(r.isEditMode()?-1:1),c(),C(r.isEditMode()?2:-1)}}function _p(i,o){if(i&1&&(a(0,"div",13)(1,"h3"),d(2,"Strategy Risks"),l(),a(3,"div",29),q(4,gp,3,2,"article",30,He),l()()),i&2){let r=u();c(4),G(r.risks)}}function fp(i,o){if(i&1&&(a(0,"p",16),d(1),l()),i&2){let r=u();c(),g(" ",r.notes," ")}}function xp(i,o){if(i&1){let r=R();a(0,"textarea",33),De("ngModelChange",function(t){S(r);let n=u();return Re(n.notes,t)||(n.notes=t),v(t)}),l()}if(i&2){let r=u();ke("ngModel",r.notes)}}function bp(i,o){if(i&1&&(a(0,"p",11),d(1),l()),i&2){let r=u(2);c(),g(" ",r.tradeOff," ")}}function yp(i,o){if(i&1){let r=R();a(0,"textarea",35),De("ngModelChange",function(t){S(r);let n=u(2);return Re(n.tradeOff,t)||(n.tradeOff=t),v(t)}),l()}if(i&2){let r=u(2);ke("ngModel",r.tradeOff)}}function Cp(i,o){if(i&1&&(a(0,"div",18)(1,"h3"),d(2,"Trade Off"),l(),P(3,bp,2,1,"p",11)(4,yp,1,1,"textarea",34),l()),i&2){let r=u(5);c(3),C(r.isEditMode()?-1:3),c(),C(r.isEditMode()?4:-1)}}function Pp(i,o){if(i&1){let r=R();a(0,"div",19)(1,"button",36),_("click",function(){S(r);let t=u(5);return v(t.saveStrategy())}),d(2),l(),a(3,"button",37),_("click",function(){S(r);let t=u(5);return v(t.cancelEdit())}),d(4," Cancel "),l()()}if(i&2){let r=u(5);c(),b("disabled",r.isSaving()),c(),g(" ",r.isSaving()?"Saving...":"Save"," "),c(),b("disabled",r.isSaving())}}function Sp(i,o){if(i&1&&(P(0,Bd,3,0,"button",5),a(1,"h1",6),d(2,"How To Use"),l(),P(3,qd,2,1,"h1",7)(4,Gd,1,1,"input",8)(5,zd,2,1,"h3",7)(6,jd,1,1,"input",9),y(7,"div",10),P(8,Kd,2,1,"p",11)(9,$d,1,1,"textarea",12)(10,Wd,6,0,"div",13)(11,tp,6,0,"div",13)(12,rp,6,0,"div",14)(13,cp,6,0,"div",15)(14,up,5,2,"div",15)(15,_p,6,0,"div",13)(16,fp,2,1,"p",16)(17,xp,1,1,"textarea",17)(18,Cp,5,2,"div",18)(19,Pp,5,3,"div",19)),i&2){let r=o,e=u(),t=u(3);C(!t.isEditMode()&&t.isAdmin?0:-1),c(3),C(t.isEditMode()?-1:3),c(),C(t.isEditMode()?4:-1),c(),C(e.subtitle?5:-1),c(),C(t.isEditMode()?6:-1),c(2),C(!t.isEditMode()&&r.description?8:-1),c(),C(t.isEditMode()?9:-1),c(),C(r.whenToUse.length?10:-1),c(),C(r.howToUse.length>0?11:-1),c(),C(r.bestFor.length?12:-1),c(),C(r.whoShouldNotUse.length?13:-1),c(),C(t.isEditMode()||e.notUseReason&&e.notUseReason.trim().length>0?14:-1),c(),C(r.risks.length?15:-1),c(),C(!t.isEditMode()&&r.notes?16:-1),c(),C(t.isEditMode()?17:-1),c(),C(t.isEditMode()||e.tradeOff?18:-1),c(),C(t.isEditMode()?19:-1)}}function vp(i,o){if(i&1&&P(0,Sp,20,17),i&2){let r,e=u(3);C((r=e.currentStrategy())?0:-1,r)}}function wp(i,o){if(i&1&&P(0,vp,1,1),i&2){let r,e=u();C((r=e.strategy)?0:-1,r)}}function Op(i,o){if(i&1&&(a(0,"div",1),P(1,Ud,2,0,"div",2)(2,Hd,2,0,"div",3)(3,Vd,5,1,"div",4)(4,wp,1,1),l()),i&2){let r;c(),C((r=o.status)==="loading"?1:r==="empty"?2:r==="error"?3:r==="ready"?4:-1)}}var Pa=(()=>{let o=class o{constructor(e,t,n,s){this.strategyContent=e,this.alert=t,this.auth=n,this.destroyRef=s,this.productId=E.required(),this.strategyId=E.required(),this.isEditMode=O(!1),this.isSaving=O(!1),this.editableStrategy=O(void 0),this.state=O({status:"empty"}),this.currentStrategy=M(()=>this.isEditMode()?this.editableStrategy():this.state().strategy),this.isAdmin=this.auth.hasRole("admin"),re(p=>{let m=this.productId().trim(),h=this.strategyId().trim();if(this.cancelEdit(),!m||!h){this.state.set({status:"empty"});return}this.state.set({status:"loading"});let x=this.strategyContent.getStrategyContent(m,h).subscribe({next:I=>{this.state.set({status:"ready",strategy:I})},error:()=>{this.state.set({status:"error",message:"We couldn't load the strategy details right now. Please try again later."})}});p(()=>x.unsubscribe())})}enableEdit(e){this.isEditMode.set(!0),this.editableStrategy.set(this.cloneStrategy(e))}cancelEdit(){this.isEditMode.set(!1),this.isSaving.set(!1),this.editableStrategy.set(void 0)}saveStrategy(){let e=this.editableStrategy();if(!e?.url)return;let t=this.cloneStrategy(e);delete t._id,this.isSaving.set(!0),this.strategyContent.updateStrategyContent(t.url,t).pipe(Gn(this.destroyRef)).subscribe({next:n=>
16{this.strategyContent.invalidate(n.product_id,n.strategy_id),this.isEditMode.set(!1),this.isSaving.set(!1),this.editableStrategy.set(void 0),this.alert.SuccesAlert("Strategy updated successfully."),this.state.set({status:"ready",strategy:n})},error:()=>{this.isSaving.set(!1),this.alert.ErrorAlert("Unable to update strategy. Please try again.")}})}cloneStrategy(e){return structuredClone(e)}};o.\u0275fac=function(t){return new(t||o)(Z(Ca),Z(Tn),Z(En),Z(vn))},o.\u0275cmp=L({type:o,selectors:[["app-how-to-use-pop-up"]],inputs:{productId:[1,"productId"],strategyId:[1,"strategyId"]},decls:2,vars:1,consts:[[1,"strategy-page"],[1,"strategy-card"],["role","status",1,"state-panel"],[1,"state-panel"],[1,"state-panel","state-panel--error"],["type","button",1,"open-modal-btn"],[1,"How-to"],[1,"strategy-title"],["placeholder","Title",3,"ngModel"],["placeholder","Subtitle",3,"ngModel"],[1,"divider"],[1,"strategy-description"],["placeholder","Description",3,"ngModel"],[1,"section"],[1,"section","best-for"],[1,"section","danger"],[1,"note"],["placeholder","Notes",3,"ngModel"],[1,"section","warning"],[1,"action-buttons"],["type","button",1,"open-modal-btn",3,"click"],["placeholder","Title",3,"ngModelChange","ngModel"],["placeholder","Subtitle",3,"ngModelChange","ngModel"],["placeholder","Description",3,"ngModelChange","ngModel"],[3,"ngModel"],[3,"ngModelChange","ngModel"],[1,"how-to-steps"],["placeholder","Not Use Reason",3,"ngModel"],["placeholder","Not Use Reason",3,"ngModelChange","ngModel"],[1,"risk-grid"],[1,"risk-card"],["placeholder","Risk Title",3,"ngModelChange","ngModel"],["placeholder","Risk Description",3,"ngModelChange","ngModel"],["placeholder","Notes",3,"ngModelChange","ngModel"],["placeholder","Trade Off",3,"ngModel"],["placeholder","Trade Off",3,"ngModelChange","ngModel"],["type","button",1,"save-btn",3,"click","disabled"],["type","button",1,"cancel-btn",3,"click","disabled"]],template:function(t,n){if(t&1&&(a(0,"section",0),P(1,Op,5,1,"div",1),l()),t&2){let s;c(),C((s=n.state())?1:-1,s)}},dependencies:[dt,vt,ct,Yt],styles:[".strategy-page[_ngcontent-%COMP%]{height:70vh;overflow:auto;padding:32px;color:#e5e7eb;font-family:Inter,system-ui,sans-serif;letter-spacing:.2px}.open-modal-btn[_ngcontent-%COMP%]{background:linear-gradient(135deg,#2563eb,#1e40af);border:1px solid rgba(147,197,253,.35);color:#f8fafc;padding:10px 22px;border-radius:10px;font-weight:600;font-size:13px;cursor:pointer;box-shadow:0 6px 18px #2563eb40,inset 0 0 0 1px #ffffff0d}.open-modal-btn[_ngcontent-%COMP%]:hover{transform:translateY(-1px);box-shadow:0 10px 24px #2563eb59}input[_ngcontent-%COMP%], textarea[_ngcontent-%COMP%]{width:100%;max-width:100%;margin:6px 0;padding:8px 10px;border-radius:6px;border:1px solid rgba(148,163,184,.35);background:#0f172ae0;color:#f8fafc;font-size:13px;line-height:1.5;outline:none}input[_ngcontent-%COMP%]:focus, textarea[_ngcontent-%COMP%]:focus{border-color:#3b82f6;box-shadow:0 0 0 2px #3b82f62e}textarea[_ngcontent-%COMP%]{min-height:74px;resize:vertical}.action-buttons[_ngcontent-%COMP%]{display:flex;align-items:center;gap:12px;margin-top:22px}.save-btn[_ngcontent-%COMP%], .cancel-btn[_ngcontent-%COMP%]{border:0;border-radius:8px;padding:9px 18px;color:#fff;font-size:13px;font-weight:700;cursor:pointer;transition:transform .15s ease,opacity .15s ease,box-shadow .15s ease}.save-btn[_ngcontent-%COMP%]:hover:not(:disabled), .cancel-btn[_ngcontent-%COMP%]:hover:not(:disabled){transform:translateY(-1px)}.save-btn[_ngcontent-%COMP%]:disabled, .cancel-btn[_ngcontent-%COMP%]:disabled{cursor:not-allowed;opacity:.65}.save-btn[_ngcontent-%COMP%]{background:linear-gradient(135deg,#16a34a,#15803d);box-shadow:0 8px 18px #16a34a40}.cancel-btn[_ngcontent-%COMP%]{background:linear-gradient(135deg,#475569,#334155);box-shadow:0 8px 18px #0f172a4d}.strategy-card[_ngcontent-%COMP%]{max-width:860px;margin:auto;background:#0c1016;border:1px solid rgba(148,163,184,.15);border-radius:16px;padding:32px;box-shadow:0 30px 60px #0009,inset 0 1px #ffffff08}.strategy-title[_ngcontent-%COMP%]{font-size:22px;font-weight:700;color:#f8fafc;letter-spacing:.3px}.strategy-subtitle[_ngcontent-%COMP%]{font-size:12px;color:#94a3b8;margin-top:6px;text-transform:uppercase;letter-spacing:.12em}.divider[_ngcontent-%COMP%]{height:1px;background:linear-gradient(to right,transparent,rgba(148,163,184,.35),transparent);margin:22px 0}.strategy-description[_ngcontent-%COMP%]{font-size:14px;line-height:1.7;color:#cbd5f5;max-width:760px}.section[_ngcontent-%COMP%]{margin-top:26px}.section[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{font-size:13px;font-weight:600;color:#e2e8f0;margin-bottom:10px;letter-spacing:.4px}.section[_ngcontent-%COMP%]   ul[_ngcontent-%COMP%]{padding-left:18px}.section[_ngcontent-%COMP%]   ul[_ngcontent-%COMP%]   li[_ngcontent-%COMP%]{font-size:13px;color:#d1d5db;margin-bottom:8px;line-height:1.55}.how-to-steps[_ngcontent-%COMP%]{padding-left:24px;margin:10px 0 0}.how-to-steps[_ngcontent-%COMP%]   li[_ngcontent-%COMP%]{margin-bottom:8px;color:#e5e7eb;font-size:14px;line-height:1.55}.how-to-steps[_ngcontent-%COMP%]   li[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{display:inline-block;margin-right:8px;color:#f8fafc;font-weight:700}.how-to-steps[_ngcontent-%COMP%]   li[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{color:#d1d5db}.note[_ngcontent-%COMP%]{margin-top:10px;font-size:12px;color:#93c5fd;background:#2563eb14;border-left:3px solid #3b82f6;padding:8px 12px;border-radius:6px}.danger[_ngcontent-%COMP%], .warning[_ngcontent-%COMP%], .best-for[_ngcontent-%COMP%]{margin-top:26px;padding:16px;border-radius:10px;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.danger[_ngcontent-%COMP%]{background:#ef444412;border-left:3px solid #ef4444}.warning[_ngcontent-%COMP%]{background:#eab30812;border-left:3px solid #eab308}.tradeoff[_ngcontent-%COMP%]{font-size:12px;color:#fde68a;margin-top:10px}.best-for[_ngcontent-%COMP%]{background:#22c55e12;border-left:3px solid #22c55e}.best-for[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{color:#dcfce7}.How-to[_ngcontent-%COMP%]{text-align:center;margin-bottom:.5rem}.strategy-card[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{text-align:center;font-size:1.25rem;font-weight:600}.strategy-card[_ngcontent-%COMP%]   h1.strategy-title[_ngcontent-%COMP%]{font-size:2.2rem;font-weight:700}.strategy-card[_ngcontent-%COMP%]   h3.strategy-title[_ngcontent-%COMP%]{font-size:1.1rem;font-weight:400;color:#1985ff}.put-structure-wrap[_ngcontent-%COMP%]{display:grid;gap:18px}.put-structure-card[_ngcontent-%COMP%]{border-radius:12px;padding:18px 18px 16px;border-left:3px solid transparent;border:1px solid rgba(255,255,255,.06)}.put-structure-card[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{margin:8px 0 12px;font-size:28px;line-height:1.2;color:#f8fafc;text-align:left;font-weight:700}.put-structure-card[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:#d1d5db}
16.put-structure-card[_ngcontent-%COMP%]   h4[_ngcontent-%COMP%]{margin:14px 0 6px;font-size:20px;line-height:1.25;color:#f1f5f9;font-weight:700}.put-structure-card[_ngcontent-%COMP%]   .strategy-description[_ngcontent-%COMP%]{max-width:none;margin:0;color:#d5dbe4}.put-structure-card.card-one[_ngcontent-%COMP%]{background:linear-gradient(120deg,#2a26148c,#181b11e6);border-left-color:#facc15}.put-structure-card.card-two[_ngcontent-%COMP%]{background:linear-gradient(120deg,#032b28bf,#051e27e6);border-left-color:#22c55e}"],changeDetection:0});let i=o;return i})();function Mp(i,o){if(i&1&&y(0,"app-market-watch-settings-dialog",1),i&2){let r=u(2);b("title",r.title)("originId",r.originId)("symbolOptions",r.symbolOptions)("selectedSymbols",r.selectedSymbols)}}function Ep(i,o){if(i&1&&y(0,"app-scanner-settings-dialog",2),i&2){let r=u(2);b("symbolOptions",r.symbolOptions)("selectedSymbols",r.selectedSymbols)}}function Tp(i,o){if(i&1&&y(0,"app-detail-settings-dialog",3),i&2){let r=u(2);b("visibleSections",r.visibleDetailSections)}}function Ip(i,o){if(i&1&&y(0,"app-mispricing-flow-settings-dialog",4),i&2){let r=u(2);b("title",r.title)("description","Tune the mispricing flow thresholds, sorting, and expiries from one dedicated popup.")("originId",r.originId)}}function kp(i,o){i&1&&y(0,"app-hedge-ratio-settings-dialog")}function Rp(i,o){if(i&1&&P(0,Mp,1,4,"app-market-watch-settings-dialog",1)(1,Ep,1,2,"app-scanner-settings-dialog",2)(2,Tp,1,1,"app-detail-settings-dialog",3)(3,Ip,1,3,"app-mispricing-flow-settings-dialog",4)(4,kp,1,0,"app-hedge-ratio-settings-dialog"),i&2){let r=u();C(r.initialTab==="market"?0:r.initialTab==="scanner"?1:r.initialTab==="detail"?2:r.initialTab==="mispricing-flow"?3:r.initialTab==="hedge-ratio"?4:-1)}}function Dp(i,o){if(i&1){let r=R();a(0,"div",5),_("click",function(){S(r);let t=u();return v(t.closeModal())}),y(1,"ion-icon",6),l(),y(2,"app-how-to-use-pop-up",7)}if(i&2){let r=u();c(2),b("productId",r.productId)("strategyId",r.originId)}}var Hi=(()=>{let o=class o{constructor(e){this.modalCtrl=e,this.type="",this.title="",this.productId="",this.originId="",this.initialTab="market",this.symbolOptions=[],this.selectedSymbols=[],this.visibleDetailSections=[],this.tradeKey="",this.segment="indexes",this.exIndexes="1_2",this.exitAt=500}closeModal(){this.modalCtrl.dismiss({dismissed:!0},"close")}};o.\u0275fac=function(t){return new(t||o)(Z(ye))},o.\u0275cmp=L({type:o,selectors:[["app-hedging-modal"]],inputs:{type:"type",title:"title",productId:"productId",originId:"originId",initialTab:"initialTab",symbolOptions:"symbolOptions",selectedSymbols:"selectedSymbols",visibleDetailSections:"visibleDetailSections",tradeKey:"tradeKey",segment:"segment",exIndexes:"exIndexes",exitAt:"exitAt"},decls:3,vars:1,consts:[[1,"generic-modal-section"],[3,"title","originId","symbolOptions","selectedSymbols"],[3,"symbolOptions","selectedSymbols"],[3,"visibleSections"],[3,"title","description","originId"],[1,"close-btn",3,"click"],["name","close"],[3,"productId","strategyId"]],template:function(t,n){t&1&&(a(0,"section",0),P(1,Rp,5,1)(2,Dp,3,2),l()),t&2&&(c(),C(n.type==="settings"?1:n.type==="how-to-use"?2:-1))},dependencies:[ga,fa,xa,ba,ya,ne,te,Pa],styles:[".generic-modal-section[_ngcontent-%COMP%]{width:100%;height:100%;display:flex;justify-content:center;align-items:center;overflow:hidden}.generic-modal-section[_ngcontent-%COMP%]   app-mispricing-flow-settings-dialog[_ngcontent-%COMP%], .generic-modal-section[_ngcontent-%COMP%]   app-how-to-use-pop-up[_ngcontent-%COMP%]{width:100%;height:100%;display:block}.close-btn[_ngcontent-%COMP%]{position:absolute;top:20px;right:20px;width:26px;height:26px;border-radius:2px;background-color:#dc2626;color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .3s ease;z-index:10;border:1px solid #dc2626}.close-btn[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{height:24px;width:24px;font-weight:900}.close-btn[_ngcontent-%COMP%]:hover{background:#dc2626d9;transform:scale(1.1)}"]});let i=o;return i})();function Np(i,o){i&1&&Cr(0)}function Fp(i,o){if(i&1&&(a(0,"p"),P(1,Np,1,0,"ng-container",2),l()),i&2){u();
16let r=mn(5);c(),b("ngTemplateOutlet",r)}}function Lp(i,o){i&1&&(a(0,"p"),y(1,"ion-icon",3),l())}function Ap(i,o){if(i&1&&(a(0,"p"),d(1),l()),i&2){let r=u();c(),T(r.label())}}function Up(i,o){i&1&&y(0,"app-icon",4)}var Sa=(()=>{let o=class o{constructor(e){this.userStateService=e,this.type=E.required(),this.title=E(),this.label=E.required(),this.showLabel=E(!0),this.productId=E(""),this.originId=E(""),this.modalResult=X(),this.isHowToUse=E(!1),this.modalCtrl=D(ye)}openModal(){return k(this,null,function*(){if(this.isHowToUse()){let n=this.userStateService.getState().is_how_to_use_opened;this.userStateService.updateStateAndSave({is_how_to_use_opened:!n})}else{let n=this.userStateService.getState().is_settings_opened;this.userStateService.updateStateAndSave({is_settings_opened:!n})}let e=yield this.modalCtrl.create({component:Hi,componentProps:{type:this.type(),title:this.title(),productId:this.productId(),originId:this.originId()},cssClass:["place-order-modal","global-popup-css"]});yield e.present();let{data:t}=yield e.onWillDismiss();this.modalResult.emit(t)})}};o.\u0275fac=function(t){return new(t||o)(Z(Oe))}
16,o.\u0275cmp=L({type:o,selectors:[["app-hedge-modal-button"]],inputs:{type:[1,"type"],title:[1,"title"],label:[1,"label"],showLabel:[1,"showLabel"],productId:[1,"productId"],originId:[1,"originId"],isHowToUse:[1,"isHowToUse"]},outputs:{modalResult:"modalResult"},decls:6,vars:3,consts:[["how_to_use",""],["type","button",1,"modal-trigger","instant-tooltip",3,"click"],[4,"ngTemplateOutlet"],["name","settings-outline"],["name","how-to-use","size","20"]],template:function(t,n){if(t&1){let s=R();a(0,"button",1),_("click",function(){return S(s),v(n.openModal())}),P(1,Fp,2,1,"p")(2,Lp,2,0,"p")(3,Ap,2,1,"p"),l(),P(4,Up,1,0,"ng-template",null,0,it)}t&2&&(H("data-tooltip",n.label()),c(),C(n.isHowToUse()?1:2),c(2),C(n.showLabel()?3:-1))},dependencies:[wr,ne,te,Ui],styles:[".modal-trigger[_ngcontent-%COMP%]{background:transparent;border:none;color:#fff;cursor:pointer;font:inherit;padding:0;display:flex;align-items:center;justify-content:center;height:100%;min-width:var(--nav-icon-box-size, 32px)}.modal-trigger[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:0;padding:0;display:flex;align-items:center;justify-content:center}.modal-trigger[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]   svg[_ngcontent-%COMP%]{height:var(--nav-icon-size, 16px);width:var(--nav-icon-size, 16px);fill:#fff;color:#fff}.modal-trigger[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:var(--nav-icon-size, 16px);color:#fff}.instant-tooltip[_ngcontent-%COMP%]{position:relative}.instant-tooltip[_ngcontent-%COMP%]:after{content:attr(data-tooltip);position:absolute;left:50%;top:calc(100% + 8px);transform:translate(-50%);background:#0b1220;color:#fff;border:1px solid #2a2f3a;border-radius:6px;padding:4px 8px;font-size:11px;line-height:1.2;white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;z-index:50;transition:opacity 0ms linear,visibility 0ms linear}.instant-tooltip[_ngcontent-%COMP%]:hover:after, .instant-tooltip[_ngcontent-%COMP%]:focus-visible:after{opacity:1;visibility:visible}"],changeDetection:0});let i=o;return i})();function Hp(i,o){if(i&1&&(a(0,"span"),d(1),z(2,"uppercase"),l()),i&2){let r=u();c(),g(" ",Pt(2,1,r.store.marketWatchTitle().split("-").join(" "))," ")}}function Vp(i,o){i&1&&y(0,"app-icon",7)}function Bp(i,o){i&1&&y(0,"app-icon",8)}function qp(i,o){i&1&&y(0,"app-icon",23)}function Gp(i,o){i&1&&y(0,"app-icon",24)}function zp(i,o){if(i&1){let r=R();a(0,"div",29),_("click",function(){S(r);let t=u();return v(t.closeVideo())}),a(1,"section",30),_("click",function(t){return S(r),v(t.stopPropagation())}),a(2,"button",31),_("click",function(){S(r);let t=u();return v(t.closeVideo())}),y(3,"ion-icon",32),l(),y(4,"iframe",33),l()()}if(i&2){let r=u();c(4),b("src",r.videoUrl,xr)}}var Po=(()=>{let o=class o{constructor(){this.videoUrls={hindi:"https://drive.google.com/file/d/16Ukq30ONj_3ZMmXALF7c7cW0lI-buTEw/preview",english:"https://drive.google.com/file/d/1CTBtncCIERZ09s_p5-XMGIT9M9nW5lV3/preview"},this.videoUrl=null,this.store=D(ae),this.sync=D(Xe),this.ui=D(he),this.browser=D(Dt),this.page=D(de),this.hasDeltaPanel=M(()=>nn(this.page.originId())),this.hasMatrixPanel=M(()=>Bn(this.page.primaryId(),this.page.originId())),this.switcherState=M(()=>({views:this.store.views,activeView:this.store.currentView(),market:{visible:this.ui.showMarketPanel(),compact:this.ui.hideColumns(),expandDisabled:this.ui.isMarketFullView(),contractDisabled:!1},scanner:{visible:this.ui.showScannerPanel(),compact:this.ui.hideScannerColumns(),expandDisabled:this.ui.isScannerFullView(),contractDisabled:!1,splitViewVisible:this.ui.isScannerSplitView()},delta:{available:this.hasDeltaPanel(),visible:this.ui.showDeltaPanel(),expandDisabled:this.ui.isDeltaFullView(),contractDisabled:!1},matrix:{available:this.hasMatrixPanel(),visible:this.ui.showMatrixPanel(),expandDisabled:this.ui.isMatrixFullView(),contractDisabled:!1},detail:{visible:this.ui.showDetailPanel(),chartVisible:!0,expandDisabled:this.ui.isDetailFullView(),contractDisabled:!1}})),this.modalCtrl=D(ye),this.sanitizer=D(Mr)}onSwitcherAction(e){switch(e.section){case"market":this.handleMarketAction(e.action);return;case"scanner":this.handleScannerAction(e.action);return;case"delta":this.handleDeltaAction(e.action);return;case"matrix":this.handleMatrixAction(e.action);return;case"detail":this.handleDetailAction(e.action);return}}openVideo(e){this.videoUrl=this.sanitizer.bypassSecurityTrustResourceUrl(this.videoUrls[e])}closeVideo(){this.videoUrl=null}openTradingAutomationRequest(){return k(this,null,function*(){let e=this.page.activeStrategyName(),t={primary:this.page.primaryId(),secondary:this.page.originId()},n=this.page.activeAnalysisTitle(),s={strategyName:e,strategyNameInput:e,strategyNameSource:this.page.activeStrategyName,routeParam
16s:t,currentAnalysisTitle:n,strategyDescription:n},p=yield this.modalCtrl.create({component:na,componentProps:s,cssClass:["place-order-modal","global-popup-css"]});console.log("[Modal opener] Modal created",{passedStrategyName:e,liveStoreTitle:this.store.title(),liveActiveStrategyName:this.page.activeStrategyName()}),yield p.present()})}handleMarketAction(e){switch(e){case"toggle-visibility":this.ui.toggleMarketPanel();return;case"expand":case"contract":this.ui.toggleMarketFullView();return;case"toggle-compact":this.ui.onCompactToggle(!this.ui.hideColumns());return;case"duplicate":this.ui.requestMarketPopup();return;default:return}}handleScannerAction(e){switch(e){case"toggle-visibility":this.ui.toggleScannerPanel();return;case"expand":case"contract":this.ui.toggleScannerFullView();return;case"toggle-compact":this.ui.onScannerCompactToggle(!this.ui.hideScannerColumns());return;case"toggle-chart":this.ui.toggleFlowChart();return;case"toggle-split-view":this.ui.toggleScannerSplitView();return;case"duplicate":this.ui.requestScannerPopup();return}}handleDetailAction(e){switch(e){case"toggle-visibility":this.ui.toggleDetailPanel();return;case"expand":case"contract":this.ui.toggleDetailFullView();return;case"duplicate":this.ui.requestDetailPopup();return}}handleDeltaAction(e){switch(e){case"toggle-visibility":this.ui.toggleDeltaPanel();return;case"expand":case"contract":this.ui.toggleDeltaFullView();return;case"duplicate":this.ui.requestDeltaPopup();return}}handleMatrixAction(e){switch(e){case"toggle-visibility":this.ui.toggleMatrixPanel
16();return;case"expand":case"contract":this.ui.toggleMatrixFullView();return;case"duplicate":this.ui.requestMatrixPopup();return}}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-list-header"]],decls:31,vars:28,consts:[[1,"table-header"],[1,"left-controls"],[3,"viewSelected","action","state"],[1,"header-title",3,"title"],[1,"right-controls"],[1,"risk-group"],[1,"risk-shield","instant-tooltip",3,"click"],["name","shield-off","size","18"],["name","shield-on","size","18"],["data-tooltip","Settings",1,"risk-action","instant-tooltip",3,"type","label","title","productId","originId","showLabel","isHowToUse"],["data-tooltip","How To Use",1,"risk-action","instant-tooltip",3,"type","label","productId","originId","showLabel","isHowToUse"],["data-tooltip","Request For Semi Auto and Auto Trading",1,"risk-action","instant-tooltip",3,"click"],["name","trading-request","size","18"],[1,"icon-group"],["data-tooltip","Toggle Fullscreen",1,"icon-btn","instant-tooltip",3,"click"],["name","square-outline"],["data-tooltip","Zoom Out",1,"icon-btn","instant-tooltip",3,"click"],["name","remove-circle-outline"],["data-tooltip","Re
16set Zoom (100%)",1,"icon-btn","instant-tooltip",3,"click"],["name","refresh-circle-outline"],["data-tooltip","Zoom In",1,"icon-btn","instant-tooltip",3,"click"],["name","add-circle-outline"],["type","button",1,"monitor-toggle","instant-tooltip","icon-btn",3,"disabled"],["name","monitor-off","size","18",1,"custom-icon"],["name","monitor-on","size","18",1,"custom-icon"],[1,"mute-icon","instant-tooltip","icon-btn",3,"click"],[3,"name"],[1,"status-badge","instant-tooltip"],[1,"video-popup-backdrop"],[1,"video-popup-backdrop",3,"click"],["aria-label","Video player",1,"video-popup",3,"click"],["type","button",1,"video-popup-close",3,"click"],["name","close-outline"],["width","560","height","315","title","How to use video player","frameborder","0","allow","autoplay","referrerpolicy","strict-origin-when-cross-origin","allowfullscreen","",3,"src"]],template:function(t,n){t&1&&(a(0,"span",0)(1,"div",1)(2,"app-hedge-view-switcher",2),_("viewSelected",function(p){return n.sync.switchView(p)})("action",function(p){return n.onSwitcherAction(p)}),l()(),a(3,"div",3),P(4,Hp,3,3,"span"),l(),a(5,"div",4)(6,"div",5)(7,"p",6),_("click",function(){return n.ui.toggleShield()}),P(8,Vp,1,0,"app-icon",7)(9,Bp,1,0,"app-icon",8),l(),y(10,"app-hedge-modal-button",9)(11,"app-hedge-modal-button",10),a(12,"p",11),_("click",function(){return n.openTradingAutomationRequest()}),y(13,"app-icon",12),l()(),a(14,"div",13)(15,"p",14),_("click",function(){return n.browser.toggleFullscreen()}),y(16,"ion-icon",15),l(),a(17,"p",16),_("click",function(){return n.ui.decreaseScreenZoom()}),y(18,"ion-icon",17),l(),a(19,"p",18),_("click",function(){return n.ui.resetScreenZoom()}),y(20,"ion-icon",19),l(),a(21,"p",20),_("click",function(){return n.ui.increaseScreenZoom()}),y(22,"ion-icon",21),l(),a(23,"button",22),P(24,qp,1,0,"app-icon",23)(25,Gp,1,0,"app-icon",24),l(),a(26,"p",25),_("click",function(){return n.browser.toggleVolume()}),y(27,"ion-icon",26),l(),a(28,"p",27),d(29,"Beta v1.01"),l()()()(),P(30,zp,5,1,"div",28)),t&2&&(c(2),b("state",n.switcherState()),c(),b("title",n.store.marketWatchTitle()),c(),C(n.store.marketWatchTitle()?4:-1),c(3),H("data-tooltip",n.ui.isProtected()?"Disable Protection":"Enable Protection"),c(),C(n.ui.isProtected()?9:8),c(2),b("type","settings")("label","Settings")("title",n.store.marketWatchTitle()||n.store.title())("productId",n.page.primaryId())("originId",n.page.originId())("showLabel",!1)("isHowToUse",!1),c(),b("type","how-to-use")("label","How to use")("productId",n.page.primaryId())("originId",n.page.originId())("showLabel",!1)("isHowToUse",!0),c(5),Se("color",n.browser.isFullscreen()?"rgba(25, 133, 255, 1)":"#ffffff"),c(7),w("disabled",!n.browser.isAllowed()),b("disabled",!n.browser.isAllowed()),H("data-tooltip",n.browser.isAllowed()?"Internet Availability: Enabled":"Internet Availability: Disabled"),c(),C(n.browser.isAllowed()?25:24),c(2),H("data-tooltip",n.browser.isMuted()?"Alerts auto-enable when internet goes offline":"Mute Alerts"),c(),b("name",n.browser.isMuted()?"volume-mute-outline":"volume-high-outline"),c(3),C(n.videoUrl?30:-1))},dependencies:[ha,Ui,Sa,ne,te,Or],styles:["[_nghost-%COMP%]{display:contents}p[_ngcontent-%COMP%]{margin:0}.table-header[_ngcontent-%COMP%]{--toolbar-height: 32px;--toolbar-radius: 10px;--toolbar-gap: 8px;--toolbar-border: #2a2f3a;--toolbar-surface: #141a24;--toolbar-surface-alt: #1f2733;--toolbar-hover: #202938;--toolbar-text: #ffffff;--toolbar-text-muted: #a9b4c6;--nav-icon-size: 16px;--nav-icon-box-size: var(--toolbar-height);--toolbar-font-size: 12px;display:flex;align-items:center;flex-wrap:wrap;gap:var(--toolbar-gap);justify-content:space-between;width:100%;padding:3px 5px;margin-bottom:8px;overflow:visible;scrollbar-width:thin;border:1px solid var(--toolbar-border);border-radius:12px;background:linear-gradient(180deg,#252e3df2,#19202cfa);box-shadow:inset 0 1px #ffffff0a}.mute-icon[_ngcontent-%COMP%]{display:flex;align-items:center;cursor:pointer}.risk-group[_ngcontent-%COMP%]{display:flex;align-items:center;flex:0 0 auto;min-height:var(--toolbar-height);overflow:visible;border:1px solid var(--toolbar-border);border-radius:var(--toolbar-radius);background:var(--toolbar-surface);box-shadow:inset 0 1px #ffffff08}.risk-shield[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:var(--nav-icon-box-size);height:100%;cursor:pointer;border-left:none}.risk-shield[_ngcontent-%COMP%]   svg[_ngcontent-%COMP%]{width:var(--nav-icon-size);height:var(--nav-icon-size);color:var(--toolbar-text)}.risk-action[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;height:100%;padding:0 10px;border-right:1px solid var(--toolbar-border)}.risk-shield[_ngcontent-%COMP%]:hover, .risk-action[_ngcontent-%COMP%]:hover{background:var(--toolbar-hover)}.youtube-menu[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center;width:var(--nav-icon-box-size);height:var(--nav-icon-box-size);padding:0;border-radius:8px;background:transparent;color:#fff;cursor:pointer;transition:background .25s ease,transform .2s ease}.youtube-play-icon[_ngcontent-%COMP%]{display:block;width:30px;height:20px;flex:0 0 30px;color:#f03;padding:0;overflow:visible}.youtube-menu[_ngcontent-%COMP%]:hover, .youtube-menu[_ngcontent-%COMP%]:focus-within{background:var(--toolbar-hover)}.youtube-menu-options[_ngcontent-%COMP%]{position:absolute;top:100%;left:50%;z-index:60;min-width:170px;overflow:hidden;padding:0;border:1px solid #404040;border-radius:0;background:#1a1a1a;box-shadow:0 4px 10px #00000080;opacity:0;visibility:hidden;transform:translate(-50%,-5px);transition:opacity .3s ease,visibility .3s ease,transform .3s ease}.youtube-menu[_ngcontent-%COMP%]:hover   .youtube-menu-options[_ngcontent-%COMP%], .youtube-menu[_ngcontent-%COMP%]:focus-within   .youtube-menu-options[_ngcontent-%COMP%]{opacity:1;visibility:visible;transform:translate(-50%)}.youtube-menu-options[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{display:block;width:100%;min-height:32px;padding:7px 12px;border:0;border-bottom:1px solid #404040;background:transparent;color:var(--toolbar-text);font:inherit;font-size:12px;font-weight:500;text-align:left;white-space:nowrap;cursor:pointer;transition:background .25s ease}.youtube-menu-options[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]:last-child{border-bottom:0}.youtube-menu-options[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]:hover, .youtube-menu-options[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]:focus-visible{background:#0043ba;color:#fff;outline:none}.video-popup-backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:10000;display:flex;align-items:center;justify-content:center;padding:20px;background:#000000b8}.video-popup[_ngcontent-%COMP%]{position:relative;width:min(560px,92vw);aspect-ratio:16/9;border:1px solid var(--toolbar-border);background:#000;box-shadow:0 18px 48px #0000008c}.video-popup[_ngcontent-%COMP%]   iframe[_ngcontent-%COMP%]{display:block;width:100%;height:100%;border:0}.video-popup-close[_ngcontent-%COMP%]{position:absolute;top:-36px;right:0;display:flex;align-items:center;justify-content:center;width:30px;height:30px;padding:0;border:1px solid var(--toolbar-border);border-radius:6px;background:var(--toolbar-surface);color:var(--toolbar-text);cursor:pointer}.video-popup-close[_ngcontent-%COMP%]:hover, .video-popup-close[_ngcontent-%COMP%]:focus-visible{background:var(--toolbar-hover);outline:none}.video-popup-close[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{width:18px;height:18px;font-size:18px}.icon-group[_ngcontent-%COMP%]{display:flex;align-items:center;flex:0 0 auto;min-height:var(--toolbar-height);overflow:visible;padding:0 4px;border:1px solid var(--toolbar-border);border-radius:var(--toolbar-radius);background:var(--toolbar-surface);box-shadow:inset 0 1px #ffffff08}.icon-group[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:var(--nav-icon-size);height:var(--nav-icon-size);padding:0;color:var(--toolbar-text);font-size:var(--nav-icon-size);transition:all .2s ease}.icon-group[_ngcontent-%COMP%]   .icon-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:var(--nav-icon-box-size);height:var(--nav-icon-box-size);margin:0;cursor:pointer;border-radius:8px!important}.icon-group[_ngcontent-%COMP%]   .icon-btn[_ngcontent-%COMP%]:hover{background:var(--toolbar-hover)}.icon-group[_ngcontent-%COMP%]   .icon-btn[_ngcontent-%COMP%]:not(:last-child){border-left:1px solid var(--toolbar-border)}.icon-group[_ngcontent-%COMP%]   .icon-btn[_ngcontent-%COMP%]:first-child{border:none!important}.icon-group[_ngcontent-%COMP%]   .icon-btn[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{width:var(--nav-icon-size);height:var(--nav-icon-size)}.icon-group[_ngcontent-%COMP%]   .mute-icon[_ngcontent-%COMP%]{justify-content:center;width:var(--nav-icon-box-size);height:var(--nav-icon-box-size);margin:0}.icon-group[_ngcontent-%COMP%]   .mute-icon[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{width:var(--nav-icon-size);height:var(--nav-icon-size);color:var(--toolbar-text)}.icon-group[_ngcontent-%COMP%]   .mute-icon[_ngcontent-%COMP%]:hover{background:var(--toolbar-hover)}.icon-group[_ngcontent-%COMP%]   .custom-icon[_ngcontent-%COMP%]{width:var(--nav-icon-size);height:var(--nav-icon-size);color:var(--toolbar-text)}.icon-group[_ngcontent-%COMP%]   ion-icon.active[_ngcontent-%COMP%]{color:#d4af37;background:#d4af371f}.monitor-toggle[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:var(--nav-icon-box-size);height:var(--nav-icon-box-size);padding:0;background:transparent;color:inherit;cursor:pointer;border-radius:0 8px 8px 0}.monitor-toggle.disabled[_ngcontent-%COMP%], .monitor-toggle[_ngcontent-%COMP%]:disabled{opacity:.45;cursor:not-allowed}.instant-tooltip[_ngcontent-%COMP%]{position:relative}.header-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;flex:1 1 280px;min-width:180px;height:var(--toolbar-height);padding:0 14px;overflow:hidden;color:var(--toolbar-text);font-size:var(--toolbar-font-size);font-weight:700;letter-spacing:0;text-align:center}.header-title[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.status-badge[_ngcontent-%COMP%]{display:flex;align-items:center;align-self:stretch;padding:0 10px;margin-left:4px;color:var(--toolbar-text-muted);border-left:1px solid var(--toolbar-border);font-size:11px;font-weight:700;line-height:1;letter-spacing:.05em;text-transform:uppercase}.risk-shield[_ngcontent-%COMP%]:focus-visible, .risk-action[_ngcontent-%COMP%]:focus-visible, .icon-btn[_ngcontent-%COMP%]:focus-visible, .mute-icon[_ngcontent-%COMP%]:focus-visible, .monitor-toggle[_ngcontent-%COMP%]:focus-visible{outline:2px solid rgba(56,182,255,.6);outline-offset:1px}.instant-tooltip[_ngcontent-%COMP%]:after{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;z-index:50;padding:4px 8px;border:1px solid #2a2f3a;border-radius:6px;background:#0b1220;color:#fff;font-size:11px;line-height:1.2;white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transform:translate(-50%);transition:opacity 0ms linear,visibility 0ms linear}.instant-tooltip[_ngcontent-%COMP%]:hover:after, .instant-tooltip[_ngcontent-%COMP%]:focus-visible:after{opacity:1;visibility:visible}@media(max-width:1200px){.table-header[_ngcontent-%COMP%]{justify-content:flex-start}.header-title[_ngcontent-%COMP%]{order:3;justify-content:flex-start;flex-basis:100%;text-align:left}}@media(max-width:992px){.table-header[_ngcontent-%COMP%]{--toolbar-gap: 6px;--toolbar-height: 30px;--nav-icon-size: 15px}}
16.left-controls[_ngcontent-%COMP%], .right-controls[_ngcontent-%COMP%]{display:flex;align-items:center;flex:0 0 auto;gap:var(--toolbar-gap)}"],changeDetection:0});let i=o;return i})();var Vi=(()=>{let o=class o{constructor(){this.modalCtrl=D(ye)}open(e){return k(this,null,function*(){let t=yield this.modalCtrl.create({component:Hi,componentProps:{type:"settings",title:e.title,originId:e.originId,initialTab:e.panel,symbolOptions:e.symbolOptions??[],selectedSymbols:e.selectedSymbols??[],visibleDetailSections:e.visibleDetailSections??[]},cssClass:["place-order-modal","global-popup-css"]});yield t.present();let{data:n}=yield t.onWillDismiss();return n??null})}};o.\u0275fac=function(t){return new(t||o)},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var So="hedge-detail-snapshot-patch",vo="hedge-detail-market-watch-update",wo="hedge-detail-matrix-update",Zn="hedge-detail-trades-update",Oo="hedge-detail-depth-update",Mo="hedge-detail-metrics-update",Eo="hedge-detail-metadata-update",Bi="SubscribeDetailSelection",To="UnsubscribeDetailSelection",va=i=>{let o=i.instrument_token.filter(Number.isFinite).join(","),r=i.expiry||"default",e=Number.isFinite(i.spot_token)?String(i.spot_token):null,t=Number.isFinite(i.put_lot)?String(i.put_lot):null,n=["detail",i.primary_id||"primary",i.secondary_id||i.secondary_route_id||"secondary",i.segment||"segment",o,r];return(e!==null||t!==null)&&n.push(e??""),t!==null&&n.push(t),n.join("::")},Jn=i=>[...i].filter(Number.isFinite);var qn=class{constructor(o,r,e){this.quantity=0,this.price=0,this.orders=0,this.price=o,this.quantity=r,this.orders=e}},Pn=class{constructor(o){this.price=0,this.quantity=0,this.time=0,this.color="white",Object.assign(this,o)}},qi=class{constructor(o=Array(5).fill(0).map(()=>new qn(0,0,0)),r=Array(5).fill(0).map(()=>new qn(0,0,0)),e=new qn(0,0,0),t=new qn(0,0,0),n=0){this.buy=o,this.sell=r,this.bid=e,this.ask=t,this.spread=n}};var ei=(()=>{let o=class o{matrix(e){return e?.matrix_structure}trades(e){return Object.entries(e??{}).map(([t,n])=>({key:t,trade:n})).sort((t,n)=>(t.trade.order??Number.MAX_SAFE_INTEGER)-(n.trade.order??Number.MAX_SAFE_INTEGER))}marketWatchRows(e,t){let n=new Map(this.trades(t).map(({key:s},p)=>[s,p]));return Object.entries(e?.market_watch_info??{}).sort(([s],[p])=>(n.get(s)??Number.MAX_SAFE_INTEGER)-(n.get(p)??Number.MAX_SAFE_INTEGER)||Number(s)-Number(p)).map(([,s])=>F(f({},s),{price_direction:s.price_direction??"none",change_direction:s.change_direction??(s.change>0?"positive_change":s.change<0?"negative_change":"none")}))}depthView(e,t){let n=this.depthLegs(e,t),s=n[0],p=n[1];return{legs:n,depth:{primary:s?.depth??this.toDepthItem(void 0),secondary:p?.depth??this.toDepthItem(void 0)},depthTrades:{primary:s?.latestTrade??new Pn,secondary:p?.latestTrade??new Pn},tradeDepthLevels:{primary:s?.tradeDepthLevels??[],secondary:p?.tradeDepthLevels??[]},aggression:{primary:s?.aggression??[],secondary:p?.aggression??[]},aggressionSampleCount:{primary:s?.aggressionSampleCount??0,secondary:p?.aggressionSampleCount??0},aggressionEvents:{primary:s?.aggressionEvents??[],secondary:p?.aggressionEvents??[]}}}lines(e){if(!e?.futures_matrix||!e.matrix_structure?.spot)return[];let t=this.selectedExpiryDisplayIndex(e),n=e.futures_matrix[`f_${t}`],s=e.matrix_structure.spot;return n?[{id:"Spot",point:[0,s.price],color:"#FFFFFF"},{id:"Fair",point:[1,n.fair_value],color:"#ffdc61",dashed:!0},{id:"F",point:[2,n.market_price],color:this.futuresLineColor(n.market_price,s.price,n.fair_value)}]:[]}futuresLineColor(e,t,n){return e>n?"#FF0800":e<t?"#00FF00":"#0000FF"}selectedExpiryDisplayIndex(e){if(!e)return 1;let t=Number.isFinite(e.selected_expiry_index)?e.selected_expiry_index:0,n=e.expiries?.length??0;return Math.min(Math.max(t+1,1),Math.max(n,1))}spotView(e,t){if(!e?.matrix_structure?.spot)return{spot$:()=>({name:e?.symbol??"AXISBANK",color:"",value:0})};let n=e.matrix_structure.spot;return{spot$:()=>({name:e.symbol,value:n.price,color:t&&t!=="none"?t:n.price_direction})}}payloadForTrade(e,t){if(!(!e||!t))return e.expiry_payloads[String(t.instrument_token)]}depthLegs(e,t){if(!e)return[];let n=new Map(this.trades(t).map(s=>[s.key,s]));return Object.entries(e.expiry_payloads??{}).sort(([s],[p])=>{let m=n.get(s)?.trade.order??Number.MAX_SAFE_INTEGER,h=n.get(p)?.trade.order??Number.MAX_SAFE_INTEGER;return m-h||Number(s)-Number(p)}).map(([s,p])=>this.toDepthLeg(s,n.get(s)?.trade,p,e))}
16toDepthLeg(e,t,n,s){return{key:e,symbol:this.depthLegSymbol(e,t,s),action:t?.position??"-",depth:this.toDepthItem(n),latestTrade:this.latestTrade(n),tradeDepthLevels:this.tradeDepthLevels(n),aggression:this.aggression(n),aggressionSampleCount:this.aggressionSampleCount(n),aggressionEvents:this.aggressionEvents(n)}}depthLegSymbol(e,t,n){if(t)return`${t.symbol}-${t.instrument_type}`;let s=n.market_watch_info?.[e];return s?`${s.symbol}-${s.instrument}`:e}toDepthItem(e){return{market:e?.market??new qi,spread:e?.spread??[]}}latestTrade(e){let t=e?.depth_trades??[],n=t[t.length-1];return new Pn(n??{})}tradeDepthLevels(e){return(e?.depth_trades??[]).map(t=>new Pn(t))}aggression(e){return[{label:"Buy",value:e?.aggression?.buy??0,color:"green"},{label:"Sell",value:e?.aggression?.sell??0,color:"red"}]}aggressionSampleCount(e){return e?.aggression?.sample_count??0}aggressionEvents(e){return(e?.aggression_events??[]).map(n=>this.normalizeAggressionEvent(n)).filter(n=>n!==null)}normalizeAggressionEvent(e){if(!e||typeof e!="object")return null;let t=e,n=Number(t.price),s=t.type,p=t.short_message??t.shortMessage;return!Number.isFinite(n)||s!=="ask"&&s!=="bid"||p!=="AB"&&p!=="AS"?null:{price:n,type:s,short_message:p}}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var ti=(()=>{let o=class o{constructor(e){this.helper=e,this.snapshotState=O(null),this.tradesState=O(null),this.loadingState=O(!1),this.errorMessageState=O(""),this.detailPendingState=O(!1),this.detailPendingMessageState=O(""),this.tradesLoadingState=O(!1),this.tradesErrorMessageState=O(""),this.tradesPendingState=O(!1),this.tradesPendingMessageState=O(""),this.tradesStaleState=O(!1),this.spotDirectionState=O("none"),this.snapshot=this.snapshotState.asReadonly(),this.tradesSnapshot=this.tradesState.asReadonly(),this.isLoading=this.loadingState.asReadonly(),this.errorMessage=this.errorMessageState.asReadonly(),this.isDetailPending=this.detailPendingState.asReadonly(),this.detailPendingMessage=this.detailPendingMessageState.asReadonly(),this.isTradesLoading=this.tradesLoadingState.asReadonly(),this.tradesErrorMessage=this.tradesErrorMessageState.asReadonly(),this.isTradesPending=this.tradesPendingState.asReadonly(),this.tradesPendingMessage=this.tradesPendingMessageState.asReadonly(),this.tradesStale=this.tradesStaleState.asReadonly(),this.priceMatr
16ix=M(()=>this.helper.matrix(this.snapshot())),this.futuresMatrix=M(()=>this.snapshot()?.futures_matrix??{}),this.futuresIndexes=M(()=>[1,2,3]),this.expiries=M(()=>this.snapshot()?.expiries??[]),this.selectedExpiry=M(()=>this.tradesSnapshot()?.selected_expiry??this.snapshot()?.selected_expiry??""),this.expiryIndex=M(()=>this.helper.selectedExpiryDisplayIndex(this.snapshot())),this.marketWatchRows=M(()=>this.helper.marketWatchRows(this.snapshot(),this.tradesSnapshot()?.trades)),this.tradeRows=M(()=>this.helper.trades(this.tradesSnapshot()?.trades)),this.depthView=M(()=>this.helper.depthView(this.snapshot(),this.tradesSnapshot()?.trades)),this.lines=M(()=>this.helper.lines(this.snapshot())),this.protectionMetrics=M(()=>this.snapshot()?.protection_metrics??null),this.boxSpread=M(()=>this.snapshot()?.box_spread??null),this.spotView=M(()=>this.helper.spotView(this.snapshot(),this.spotDirectionState()))}setSnapshot(e){let t=this.snapshotState();this.errorMessageState.set(""),this.setDetailPending(!1),this.spotDirectionState.set(this.resolveSnapshotSpotDirection(t,e)),this.snapshotState.set(e)}setTradesSnapshot(e){this.tradesState.set(F(f({},e),{trades:f({},e.trades)})),this.tradesErrorMessageState.set(""),this.setTradesPending(!1),this.tradesStaleState.set(!1)}replaceTrades(e){this.tradesState.update(t=>t&&F(f({},t),{trades:f({},e)})),this.tradesStaleState.set(!1)}patchSnapshot(e){this.snapshotState.update(t=>{if(!t)return t;let n=this.normalizePatch(e);this.updateSpotDirection(t,n);let s=f(f({},t),n);return n.matrix_structure!==void 0&&(s.matrix_structure=f(f({},t.matrix_structure??{}),n.matrix_structure)),n.expiry_payloads!==void 0&&(s.expiry_payloads=n.expiry_payloads,this.setDetailPending(!1),this.loadingState.set(!1)),n.market_watch_info!==void 0&&(s.market_watch_info=this.mergeMarketWatchInfo(t.market_watch_info,n.market_watch_info)),s})}setLoading(e){this.loadingState.set(e)}setTradesLoading(e){this.tradesLoadingState.set(e)}setTradesErrorMessage(e){this.tradesErrorMessageState.set(e)}setTradesPending(e,t=""){this.tradesPendingState.set(e),this.tradesPendingMessageState.set(e?t:"")}markTradesStale(){this.tradesStaleState.set(this.tradesState()!==null)}setErrorMessage(e){this.errorMessageState.set(e)}setDetailPending(e,t=""){this.detailPendingState.set(e),this.detailPendingMessageState.set(e?t:"")}clearDetailState(){this.snapshotState.set(null),this.setDetailPending(!1),this.spotDirectionState.set("none")}clearTradesState(){this.tradesState.set(null),this.tradesLoadingState.set(!1),this.tradesErrorMessageState.set(""),this.setTradesPending(!1),this.tradesStaleState.set(!1)}reset(){this.snapshotState.set(null),this.loadingState.set(!1),this.errorMessageState.set(""),this.setDetailPending(!1),this.spotDirectionState.set("none"),this.clearTradesState()}updateSpotDirection(e,t){let n=t.matrix_structure?.spot?.price;if(typeof n!="number"||!Number.isFinite(n))return;let s=e.matrix_structure?.spot?.price;if(typeof s!="number"||!Number.isFinite(s)){this.spotDirectionState.set(t.matrix_structure?.spot?.price_direction??this.spotDirectionState());return}if(n>s){this.spotDirectionState.set("positive");return}if(n<s){this.spotDirectionState.set("negative");return}this.spotDirectionState()==="none"&&this.spotDirectionState.set("positive")}resolveSnapshotSpotDirection(e,t){let n=t.matrix_structure?.spot,s=e?.matrix_structure?.spot;if(!s)return n?.price_direction??"none";let p=s.price,m=n?.price;return typeof p!="number"||!Number.isFinite(p)||typeof m!="number"||!Number.isFinite(m)?n?.price_direction??this.spotDirectionState():m>p?"positive":m<p?"negative":this.spotDirectionState()!=="none"?this.spotDirectionState():n?.price_direction??"none"}normalizePatch(e){let t=f({},e);for(let n of Object.keys(t))t[n]===void 0&&delete t[n];return t}mergeMarketWatchInfo(e,t){let n=f({},e);for(let[s,p]of Object.entries(t)){if(!Object.hasOwn(e,s))continue;let m=e[s],h=f(f({},m),p);n[s]=F(f({},h),{price_direction:this.resolveMarketWatchPriceDirection(m,h),change_direction:h.change>0?"positive_change":h.change<0?"negative_change":"none"})}return n}
16resolveMarketWatchPriceDirection(e,t){let n=e?.ltp,s=t.ltp;return typeof n!="number"||!Number.isFinite(n)||typeof s!="number"||!Number.isFinite(s)?t.price_direction??"none":s>n?"positive":s<n?"negative":e?.price_direction??t.price_direction??"none"}};o.\u0275fac=function(t){return new(t||o)(V(ei))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Me=class Me{constructor(o){this.signalR=o,this.currentSelectionKey=null,this.disposed=!1,this.registeredHandlers=new Map,this.hubConnection=this.signalR.connection,this.hubConnection.onreconnected(()=>{this.handleReconnect()})}configureHandler(o){this.unregisterHandlers(),this.onUpdate=o,this.registerHandler(So,r=>o(this.withoutTradePatch(r))),this.registerPatchHandler(vo,"market_watch_info"),this.registerHandler(wo,r=>o(this.toPatchUpdate(r,{matrix_structure:this.readUpdateData(r,"matrix_structure"),futures_matrix:this.readUpdateData(r,"futures_matrix"),protection_metrics:this.readUpdateData(r,"protection_metrics")}))),this.registerPatchHandler(Oo,"expiry_payloads"),this.registerPatchHandler(Mo,"protection_metrics"),this.registerHandler(Eo,r=>o(this.toPatchUpdate(r,{symbol:this.readUpdateData(r,"symbol"),expiries:this.readUpdateData(r,"expiries"),selected_expiry:this.readUpdateData(r,"selected_expiry"),selected_expiry_index:this.readUpdateData(r,"selected_expiry_index")})))}subscribe(o){return k(this,null,function*(){let r=va(o);this.currentSelectionKey!==r&&(yield this.unsubscribeCurrentSelection(),this.currentSelectionKey=r,yield this.retainSelection(r))})}configureTradesHandler(o){let r=this.registeredHandlers.get(Zn);r&&this.hubConnection.off(Zn,r),this.registerHandler(Zn,e=>o(e))}configureReconnectHandler(o){this.onReconnect=o}unsubscribeCurrentSelection(){return k(this,null,function*(){let o=this.currentSelectionKey;o&&(this.currentSelectionKey=null,yield this.releaseSelection(o))})}destroy(){this.disposed=!0,this.unsubscribeCurrentSelection(),this.unregisterHandlers(),this.onUpdate=void 0,this.onReconnect=void 0}registerPatchHandler(o,r){this.registerHandler(o,e=>this.onUpdate?.(this.toPatchUpdate(e,{[r]:this.readPatchData(e,r)})))}registerHandler(o,r){this.registeredHandlers.set(o,r),this.hubConnection.on(o,r)}unregisterHandlers(){for(let[o,r]of this.registeredHandlers)this.hubConnection.off(o,r);this.registeredHandlers.clear()}toPatchUpdate(o,r){let e=this.toUpdateMetadata(o);return F(f({},e),{patch:this.omitUndefinedPatchValues(r)})}toUpdateMetadata(o){if(!o||typeof o!="object")return{};let n=o,{data:r,patch:e}=n;return so(n,["data","patch"])}readUpdateData(o,r){if(!o||typeof o!="object")return;let e=o;return(e.data&&typeof e.data=="object"?e.data:e)[r]??e[r]}readPatchData(o,r){let e=this.readUpdateData(o,r);return e!==void 0?e:!o||typeof o!="object"?void 0:o.data}omitUndefinedPatchValues(o){let r=f({},o);for(let e of Object.keys(r))r[e]===void 0&&delete r[e];return r}withoutTradePatch(o){let r=o,n=r.patch??{},{trades:e}=n,t=so(n,["trades"]);return F(f({},r),{patch:t})}handleReconnect(){return k(this,null,function*(){yield this.resubscribeCurrentSelection(),!this.disposed&&this.currentSelectionKey&&this.onReconnect?.()})}resubscribeCurrentSelection(){return k(this,null,function*(){this.disposed||!this.currentSelectionKey||(yield this.invokeSelection(Bi,this.currentSelectionKey))})}retainSelection(o){return k(this,null,function*(){let r=Me.selectionRefCounts.get(o)??0;Me.selectionRefCounts.set(o,r+1),!(r>0)&&(yield this.enqueueSelectionOperation(o,()=>this.invokeSelection(Bi,o)))})}releaseSelection(o){return k(this,null,function*(){let r=Me.selectionRefCounts.get(o)??0;if(r>1){Me.selectionRefCounts.set(o,r-1);return}r!==0&&(Me.selectionRefCounts.delete(o),yield this.enqueueSelectionOperation(o,()=>this.invokeSelection(To,o)))})}enqueueSelectionOperation(o,r){let t=(Me.selectionOperationQueue.get(o)??Promise.resolve()).catch(()=>{}).then(r).finally(()=>{Me.selectionOperationQueue.get(o)===t&&Me.selectionOperationQueue.delete(o)});return Me.selectionOperationQueue.set(o,t),t}invokeSelection(o,r){return k(this,null,function*(){if(this.hubConnection.state===se.Connected)try{yield this.hubConnection.invoke(o,r)}catch(e){console.error(`${o} failed:`,e)}})}};
16Me.selectionRefCounts=new Map,Me.selectionOperationQueue=new Map,Me.\u0275fac=function(r){return new(r||Me)(V(Fe))},Me.\u0275prov=U({token:Me,factory:Me.\u0275fac});var rn=Me;var Qp=256265,Yp=2,We=(()=>{let o=class o{constructor(e,t,n){this.snapshotRepository=e,this.store=t,this.liveManager=n,this.snapshot=this.store.snapshot,this.isLoading=this.store.isLoading,this.errorMessage=this.store.errorMessage,this.isDetailPending=this.store.isDetailPending,this.detailPendingMessage=this.store.detailPendingMessage,this.tradesSnapshot=this.store.tradesSnapshot,this.isTradesLoading=this.store.isTradesLoading,this.tradesErrorMessage=this.store.tradesErrorMessage,this.isTradesPending=this.store.isTradesPending,this.tradesPendingMessage=this.store.tradesPendingMessage,this.tradesStale=this.store.tradesStale,this.priceMatrix=this.store.priceMatrix,this.futuresMatrix=this.store.futuresMatrix,this.futuresIndexes=this.store.futuresIndexes,this.expiries=this.store.expiries,this.selectedExpiry=this.store.selectedExpiry,this.expiryIndex=this.store.expiryIndex,this.marketWatchRows=this.store.marketWatchRows,this.tradeRows=this.store.tradeRows,this.depthView=this.store.depthView,this.lines=this.store.lines,this.protectionMetrics=this.store.protectionMetrics,this.boxSpread=this.store.boxSpread,this.spotView=this.store.spotView,this.request=be.EMPTY,this.tradesRequest=be.EMPTY,this.prefetchRequests=new be,this.cache=new Map,this.tradesCache=new Map,this.pendingPrefetches=new Set,this.pendingPatch=null,this.patchFrameHandle=null,this.latestLiveVersion=0,this.latestTradesLiveVersion=0,this.requestVersion=0,this.tradesRequestVersion=0,this.activeTradesCacheKey="",this.activeViewCount=0,this.currentSelection=null,this.liveManager.configureHandler(s=>this.applyLiveUpdate(s)),this.liveManager.configureTradesHandler(s=>this.applyTradesLiveUpdate(s)),this.liveManager.configureReconnectHandler(()=>this.refetchCurrentTrades())}attachView(){this.activeViewCount++}detachView(){this.activeViewCount=Math.max(0,this.activeViewCount-1),this.activeViewCount===0&&this.suspendActiveView()}loadIndex(e,t,n,s,p,m,h,x,I=1,N="",B=!0,$=null){if(!t||s===null||!x){this.cancelDetailRequest(),this.cancelTradesRequest(),this.liveManager.unsubscribeCurrentSelection(),this.cancelPendingPatch(),this.currentSelection=null,this.store.reset();return}let K=this.toInstrumentTokens(s,p,m,x,N);if(x===Ke.id&&K.length!==2){this.cancelDetailRequest(),this.cancelTradesRequest(),this.liveManager.unsubscribeCurrentSelection(),this.cancelPendingPatch(),this.currentSelection=null,this.store.reset();return}let oe=this.toSpotToken(s,x,K),le=this.toSelectionSegment(t,x),Ce=this.toPutLot(h,x),xe=K.length>1,Ie=x===j.id||x===ee.id||x===ie.id||x===Q.id?this.normalizeExpiry($):null;this.cancelDetailRequest(),this.currentSelection={primaryId:N,secondaryRouteId:e,segment:le,instrumentTokens:K,productId:x,expiry:Ie,spotToken:oe,putLot:Ce,enableLiveUpdates:B,loadDetails:!0},this.prepareTradesState(),B||this.liveManager.unsubscribeCurrentSelection();let Ze=this.cacheKey(le,K,x,Ie??"",oe,Ce),Le=this.cache.get(Ze);if(Le){this.applyCombinedSnapshot(Le,Ze),xe||this.loadPendingExpiry(I);return}this.fetchSnapshot({segment:le,instrumentTokens:K,productId:x,expiry:Ie??void 0,spotToken:oe,putLot:Ce,afterLoad:()=>{xe||this.loadPendingExpiry(I)}})}loadTradesIndex(e,t,n,s,p,m,h,x,I=1,N=""){if(!t||s===null||!x){this.cancelDetailRequest(),this.cancelTradesRequest(),this.liveManager.unsubscribeCurrentSelection(),this.currentSelection=null,this.store.clearTradesState();return}this.cancelDetailRequest();let B=this.toInstrumentTokens(s,p,m,x,N),$=this.toSpotToken(s,x,B),K=this.toSelectionSegment(t,x),oe={primaryId:N,secondaryRouteId:e,segment:K,instrumentTokens:B,productId:x,expiry:null,spotToken:$,putLot:this.toPutLot(h,x),enableLiveUpdates:!0,loadDetails:!1},Ce=xn(this.toApiRequest(oe))===this.activeTradesCacheKey&&this.store.tradesSnapshot()!==null;if(this.currentSelection=oe,Ce){this.subscribeCurrentLiveSelection();return}this.prepareTradesState()}applyPayoffTrades(e){if(!this.currentSelection)return;let t=xn(this.toApiRequest(this.currentSelection));this.cancelTradesRequest(),this.activeTradesCacheKey=t,this.latestTradesLiveVersion=0,this.tradesCache.set(t,e),this.store.setTradesSnapsh
16ot(e),this.store.setTradesLoading(!1),this.subscribeCurrentLiveSelection()}clearDeferredPayoffTrades(){this.cancelTradesRequest(),this.activeTradesCacheKey="",this.latestTradesLiveVersion=0,this.store.clearTradesState(),this.liveManager.unsubscribeCurrentSelection()}preloadIndex(e,t,n,s,p,m=1){if(this.activeViewCount===0||this.pendingPrefetches.size>=Yp||!t||s===null||!p)return;let h=this.toInstrumentTokens(s,null,[],p),x=this.toSpotToken(s,p,h),I=this.toSelectionSegment(t,p),N=this.cacheKey(I,h,p,"",x,null);if(this.cache.has(N)||this.pendingPrefetches.has(N))return;this.pendingPrefetches.add(N);let B=this.snapshotRepository.getSnapshot({segment:I,instrument_token:h,secondary_id:p,expiry:null,spot_token:x}).subscribe({next:$=>{this.cache.set(N,$),this.pendingPrefetches.delete(N)},error:()=>this.pendingPrefetches.delete(N)});this.prefetchRequests.add(B)}onExpiryChange(e,t){if(!this.currentSelection)return;let n=this.normalizeExpiry(e);n!==this.currentSelection.expiry&&(this.currentSelection=F(f({},this.currentSelection),{expiry:n}),this.currentSelection.loadDetails&&this.loadExpiry(e,this.currentSelection,{forceRefresh:!0}))}destroy(){this.activeViewCount=0,this.cancelDetailRequest(),this.cancelTradesRequest(),this.prefetchRequests.unsubscribe(),this.prefetchRequests=new be,this.pendingPrefetches.clear(),this.cancelPendingPatch(),this.liveManager.destroy(),this.currentSelection=null,this.store.reset()}suspendActiveView(){this.cancelDetailRequest(),this.cancelTradesRequest(),this.prefetchRequests.unsubscribe(),this.prefetchRequests=new be,this.pendingPrefetches.clear(),this.cancelPendingPatch(),this.liveManager.unsubscribeCurrentSelection(),this.currentSelection=null}fetchSnapshot(e){this.cancelDetailRequest(),this.cancelPendingPatch(),this.prepareTradesState(),this.store.clearDetailState(),this.store.setLoading(!0),this.store.setErrorMessage("");let t=++this.requestVersion,n=this.toApiRequest({segment:e.segment,instrumentTokens:e.instrumentTokens,productId:e.productId,expiry:e.expiry??null,spotToken:e.spotToken??null,putLot:e.putLot??null});this.request=this.snapshotRepository.getSnapshot(n,s=>{t===this.requestVersion&&(this.store.setDetailPending(!0,s.missing_trading_symbol?`Waiting for live tick: ${s.missing_trading_symbol}`:s.message),this.store.setErrorMessage(""))}).subscribe({next:s=>{if(t!==this.requestVersion)return;let p=this.cacheKey(e.segment,e.instrumentTokens,e.productId,e.expiry,e.spotToken,e.putLot);this.cache.set(p,s),this.applyCombinedSnapshot(s,p),this.store.setLoading(!1),e.afterLoad?.()},error:s=>{t===this.requestVersion&&(this.store.setLoading(!1),this.store.clearDetailState(),this.store.clearTradesState(),this.store.setErrorMessage(this.getDetailErrorMessage(s)),console.error(s))}})}loadTradesForCurrentSelection(e={}){let t=this.currentSelection;if(!t)return;let n=this.toApiRequest(t),s=xn(n),p=s!==this.activeTradesCacheKey,m=this.tradesCache.get(s);if(!p&&!e.forceRefresh&&this.store.isTradesLoading())return;this.cancelTradesRequest(),this.activeTradesCacheKey=s,this.latestTradesLiveVersion=0,m?(this.store.setTradesSnapshot(m),this.store.markTradesStale()):this.store.clearTradesState(),this.store.setTradesLoading(!0),this.store.setTradesErrorMessage("");let h=++this.tradesRequestVersion;this.tradesRequest=this.snapshotRepository.getTrades(n,x=>{h!==this.tradesRequestVersion||s!==this.activeTradesCacheKey||(this.store.setTradesPending(!0,x.missing_trading_symbol?`Waiting for live tick: ${x.missing_trading_symbol}`:x.message),this.store.setTradesErrorMessage(""))}).subscribe({next:x=>{h!==this.tradesRequestVersion||s!==this.activeTradesCacheKey||(this.tradesCache.set(s,x),this.store.setTradesSnapshot(x),this.store.setTradesLoading(!1),this.subscribeCurrentLiveSelection())},error:x=>{h!==this.tradesRequestVersion||s!==this.activeTradesCacheKey||(this.store.setTradesLoading(!1),this.store.setTradesPending(!1),m&&this.store.markTradesStale(),this.store.setTradesErrorMessage(this.getTradesErrorMessage(x)),console.error(x))}})}prepareTradesState(){this.currentSelection&&(this.cancelTradesRequest(),this.activeTradesCacheKey=xn(this.toApiRequest(this.currentSelection)),this.latestTradesLiveVersion=0,this.store.clearTradesState(),this.store.setTradesLoading(!0))}toApiRequest(e){return{segment:e.segment,secondary_id:e.productId,instrument_token:e.instrumentTokens,expiry:e.expiry,spot_token:e.spotToken,put_lot:Number.isFinite(e.putLot)?e.putLot:void 0}}cancelTradesRequest(){this.tradesRequestVersion++,this.tradesRequest.unsubscribe(),this.tradesRequest=be.EMPTY,this.store.setTradesLoading(!1),this.store.setTradesPending(!1)}
16cancelDetailRequest(){this.requestVersion++,this.request.unsubscribe(),this.request=be.EMPTY,this.store.setLoading(!1),this.store.setDetailPending(!1)}refetchCurrentTrades(){this.currentSelection&&this.loadTradesForCurrentSelection({forceRefresh:!0})}applyTradesLiveUpdate(e){if(!this.isActiveTradesLiveUpdate(e)||e.version<=this.latestTradesLiveVersion)return;this.latestTradesLiveVersion=e.version,this.store.replaceTrades(e.data);let t=this.store.tradesSnapshot();t&&this.tradesCache.set(this.activeTradesCacheKey,t)}isActiveTradesLiveUpdate(e){let t=this.currentSelection;return!t||!this.activeTradesCacheKey?!1:(e.primary_id==null||e.primary_id===t.primaryId)&&(e.secondary_route_id==null||e.secondary_route_id===t.secondaryRouteId)&&e.secondary_id===t.productId&&e.segment.toLowerCase()===t.segment.toLowerCase()&&this.areTokensEqual(Jn(e.instrument_token),Jn(t.instrumentTokens))&&this.normalizeExpiry(e.expiry)===this.normalizeExpiry(t.expiry)&&e.spot_token===t.spotToken&&e.put_lot===t.putLot&&this.activeTradesCacheKey===xn(this.toApiRequest(t))}loadPendingExpiry(e){let t=this.expiries()[e-1];!t||t===this.selectedExpiry()||this.onExpiryChange(t,e)}loadExpiry(e,t=this.currentSelection,n={}){if(!t)return;let s=this.cacheKey(t.segment,t.instrumentTokens,t.productId,e,t.spotToken,t.putLot),p=n.forceRefresh?void 0:this.cache.get(s);if(p){this.applyCombinedSnapshot(p,s);return}this.fetchSnapshot(F(f({},t),{expiry:e}))}applyCombinedSnapshot(e,t){let n={selected_expiry:e.selected_expiry,generated_at_utc:e.generated_at_utc,trades:e.trades};this.activeTradesCacheKey=t,this.latestTradesLiveVersion=0,this.tradesCache.set(t,n),this.store.setSnapshot(e),this.store.setTradesSnapshot(n),this.store.setTradesLoading(!1),this.subscribeCurrentLiveSelection()}applyLiveUpdate(e){this.isActiveLiveUpdate(e)&&(e.version&&e.version<=this.latestLiveVersion||(this.latestLiveVersion=e.version??this.latestLiveVersion,this.queuePatch(e.patch)))}queuePatch(e){this.pendingPatch=this.mergePatches(this.pendingPatch,e),this.patchFrameHandle===null&&(this.patchFrameHandle=requestAnimationFrame(()=>{if(this.patchFrameHandle=null,!this.pendingPatch)return;let t=this.pendingPatch;this.pendingPatch=null,this.store.patchSnapshot(t)}))}mergePatches(e,t){return e?F(f(f({},e),t),{market_watch_info:t.market_watch_info??e.market_watch_info,expiry_payloads:t.expiry_payloads??e.expiry_payloads}):t}isActiveLiveUpdate(e){if(!this.currentSelection)return!1;let t=this.currentSelection,n=Jn(e.instrument_token??[]),s=Jn(t.instrumentTokens),p=e.primary_id,m=e.secondary_route_id,h=e.secondary_id,x=e.spot_token,I=e.put_lot;return(!p||p===t.primaryId)&&(!m||m===t.secondaryRouteId)&&h===t.productId&&e.segment===t.segment&&this.areTokensEqual(n,s)&&this.isLiveSpotTokenMatch(x,t.spotToken,t.productId)&&(I==null||I===t.putLot)&&this.normalizeExpiry(e.expiry)===this.normalizeExpiry(t.expiry)}areTokensEqual(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}isLiveSpotTokenMatch(e,t,n){return e==null||e===t?!0:t===null&&n===ut&&e===Qp}subscribeCurrentLiveSelection(){!this.currentSelection||!this.currentSelection.enableLiveUpdates||this.liveManager.subscribe({primary_id:this.currentSelection.primaryId,secondary_route_id:this.currentSelection.secondaryRouteId,secondary_id:this.currentSelection.productId,segment:this.currentSelection.segment,instrument_token:this.currentSelection.instrumentTokens,expiry:this.currentSelection.expiry,spot_token:this.currentSelection.spotToken,put_lot:this.currentSelection.putLot})}normalizeExpiry(e){return e||null}cancelPendingPatch(){this.patchFrameHandle!==null&&(cancelAnimationFrame(this.patchFrameHandle),this.patchFrameHandle=null),this.pendingPatch=null}cacheKey(e,t,n,s="",p=null,m=null){return xn({segment:e,secondary_id:n,instrument_token:t,expiry:s,spot_token:p,put_lot:m})}toPutLot(e,t=""){return t===Ke.id?1:t===pt.id?null:t===j.id||t===ee.id||t===Q.id?Number.isFinite(e)&&Number(e)>0?Number(e):1:Number.isFinite(e)?e:null}toSelectionSegment(e,t){return t===pt.id?"equity":e}toInstrumentTokens(e,t,n=[],s="",p=""){if(s===pt.id){let h=(n.length?n:[t]).map(Number).filter((x,I,N)=>Number.isFinite(x)&&x>0&&x!==e&&N.indexOf(x)===I);return h.length===1?[e,h[0]]:[e]}if(s===_t){let[h,x,I]=n;return h&&x&&I?[x,I,h]:n.filter(Number.isFinite)}if(gn(s)){let h=n.filter(x=>Number.isFinite(x)&&x>0);return h.length===3?h:[]}if(fe(s)){let h=n.filter(x=>Number.isFinite(x)&&x>0);return h.length===3?h:[]}if(s===Ot.id||s===Bt.id){let[h,x,I]=n;return h&&x&&I?[x,h,I]:n.filter(Number.isFinite)}if(s===_n.id){let[h,x,I]=n;return h&&x&&I?[h,x,I]:n.filter(Number.isFinite)}
16if(s===j.id||s===ee.id||s===ie.id||s===Q.id){let h=n.map(Number).filter(x=>Number.isFinite(x)&&x>0&&x!==e).filter((x,I,N)=>N.indexOf(x)===I);return h.length===4?h:[e]}if(s===Tt.id)return[e];if(s===Et.id){let h=n.filter(Number.isFinite);return h.length?[e,...h]:[e]}if(s===ue.id){let h=n.filter(x=>Number.isFinite(x)&&x>0&&x!==e).filter((x,I,N)=>N.indexOf(x)===I);return h.length>=2?[e,...h.slice(0,2)]:[e]}if(s===Mt.id||s===_t||s===Ke.id||s===Vt.id||s===$e){let[h,x]=n;return h&&x?[x,h]:n.filter(Number.isFinite)}if(p===qt||s===Vt.id){let[h,x]=n;if(h&&x)return[x,h]}let m=s==="09679757-905f-422c-a601-3230243f6fc3"||s===Wt.id?n.length===2?n:[]:as(s)?t?[t]:[]:t?[t]:[];return m.length?[e,...m]:[e]}toSpotToken(e,t,n=[]){return gn(t)||fe(t)?n.length===3?null:e:t===Ot.id||t===_t||t===Mt.id||t===Ke.id||t===Vt.id||t===Bt.id||t===_n.id||t===$e?e:null}getDetailErrorMessage(e){let t=this.getRawErrorMessage(e),n=t.toLowerCase();return this.getApiErrorCode(e)==="NO_DETAIL_DATA_FOUND"&&(this.currentSelection?.productId===j.id||this.currentSelection?.productId===ee.id||this.currentSelection?.productId===ie.id||this.currentSelection?.productId===Q.id)?"No positive executable box-spread opportunity is currently available.":this.getApiErrorCode(e)==="NO_DETAIL_DATA_FOUND"&&this.currentSelection?.productId===pt.id&&this.currentSelection.instrumentTokens.length===1?"No eligible PE is currently available in the 0.35\u20130.60 delta range.":t.includes("DETAIL_DATA_PENDING")||n.includes("detail data is pending")?"Market data subscription is starting. Try again after the first live tick.":t.includes("Incomplete market quote detail response")?"Detail data is incomplete for this selection. Refreshing the latest result should resolve it.":t.includes("requires one or two instrument_token values")?"Select an ETF first. You can optionally add one matching PE option.":t.includes("requires zero, one, or two instrument_token values")?"Select an index spot, or choose one matching future and optional PE option.":t.includes("requires zero, one, or three instrument_token values")?"Select an index spot, or choose a future with matching PE and CE options.":t.includes("requires zero or three instrument_token values")?"Select a spot first, or choose a future with matching PE and CE options.":t.includes("requires spot_token to be null")?"Clear the spot selection when using explicit future, PE, and CE tokens.":t.includes("requires spot_token")?"Select a spot first.":t.includes("No applicable equity option conversion pair was found")?t:t.includes("spot_token must be an equity spot token")?"The selected spot must be an equity spot token.":t.includes("spot_token must be an index spot token")?"The selected spot must be an index spot token.":t.includes("the first instrument_token must be an index futures token")?"Select an index futures token for this strategy.":t.includes("the first instrument_token must be an equity futures token")?"Select an equity futures token for this strategy.":t.includes("the first instrument_token must be an ETF token")?"The selected underlying must be an ETF for this strategy.":t.includes("is not mapped to a supported underlying index")?"This ETF is not mapped to NIFTY or BANKNIFTY yet.":t.includes("the second instrument_token must be a PE index option token")?"Select a matching PE index option for this strategy.":t.includes("the second instrument_token must be a PE equity option token")?"Select a matching PE equity option for this strategy.":t.includes("the second instrument_token must be an index option token")?"The selected option must be an index option.":t.includes("the second instrument_token must be a NIFTY option token")?"This ETF maps to NIFTY. Select a NIFTY PE option.":t.includes("the second instrument_token must be a BANKNIFTY option token")?"This ETF maps to BANKNIFTY. Select a BANKNIFTY PE option.":t.includes("the second instrument_token must be a PE option token")?"Select a PE option for this ETF protective-put strategy.":e instanceof lt&&e.status===0?"Unable to reach the detail service.":e instanceof lt&&t&&t!==e.message?t:"Unable to load detail data for this selection."}getTradesErrorMessage(e){let t=this.getDetailErrorMessage(e);return t==="Unable to load detail data for this selection."?"Trade data is unavailable for this selection. You can retry by reopening the panel.":t}getRawErrorMessage(e){if(e instanceof lt){let t=e.error;if(typeof t=="string")return t;if(t&&typeof t=="object"){let n=t;return String(n.message??n.error??n.title??e.message)}return e.message}return e instanceof Error?e.message:String(e??"")}
16getApiErrorCode(e){if(!(e instanceof lt))return"";let t=e.error;return t&&typeof t=="object"?String(t.code??""):""}};o.\u0275fac=function(t){return new(t||o)(V(Fn),V(ti),V(rn))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();function wa(i){let o=Xp(i);return o.length?o:[Wp(i),...Zp(i)]}function Xp(i){return[i.isMarketFullView?"spot-trades-area--market-full":"",i.isScannerFullView?"spot-trades-area--scanner-full":"",i.isDeltaFullView?"spot-trades-area--delta-full":"",i.isMatrixFullView?"spot-trades-area--matrix-full":"",i.isDetailFullView?"spot-trades-area--detail-full":""].filter(Boolean)}function Wp(i){let o=[i.showMarket,i.showScanner,i.showStrategyPanel,i.showSecondaryStrategyPanel,i.showDetail].filter(Boolean).length;return`spot-trades-area--${Math.max(1,o)}-panels`}function Zp(i){let{showMarket:o,showScanner:r,showStrategyPanel:e,showSecondaryStrategyPanel:t,showDetail:n,isMarketCompact:s,isScannerCompact:p}=i,m=e||t,h=e&&t,x=m&&n;return[o&&r&&n&&m?"spot-trades-area--strategy-panel":"",o&&r&&n&&h?"spot-trades-area--double-strategy-panel":"",o&&r&&n&&m&&s?"spot-trades-area--strategy-panel-market-compact":"",o&&r&&n&&h&&s?"spot-trades-area--double-strategy-panel-market-compact":"",o&&r&&n&&m&&p?"spot-trades-area--strategy-panel-scanner-compact":"",o&&r&&n&&h&&p?"spot-trades-area--double-strategy-panel-scanner-compact":"",o&&r&&n&&s?"spot-trades-area--market-compact":"",o&&r&&n&&p?"spot-trades-area--scanner-compact":"",!o&&r&&n&&p?"spot-trades-area--market-hidden-scanner-compact":"",o&&!r&&n&&s?"spot-trades-area--scanner-hidden-market-compact":"",o&&r&&!n&&s?"spot-trades-area--detail-hidden-market-compact":"",o&&r&&!n&&p?"spot-trades-area--detail-hidden-scanner-compact":"",o&&r&&n&&m&&s&&p?"spot-trades-area--strategy-panel-dual-compact":"",o&&r&&n&&h&&s&&p?"spot-trades-area--double-strategy-panel-dual-compact":"",o&&r&&n&&s&&p?"spot-trades-area--dual-compact":"",o&&r&&!n&&m?"spot-trades-area--detail-hidden-strategy-panel":"",o&&r&&!n&&h?"spot-trades-area--detail-hidden-double-strategy-panel":"",o&&r&&!n&&m&&s&&p?"spot-trades-area--detail-hidden-strategy-panel-dual-compact":"",o&&r&&!n&&h&&s&&p?"spot-trades-area--detail-hidden-double-strategy-panel-dual-compact":"",o&&r&&!n&&m&&s?"spot-trades-area--detail-hidden-strategy-panel-market-compact":"",o&&r&&!n&&h&&s?"spot-trades-area--detail-hidden-double-strategy-panel-market-compact":"",o&&r&&!n&&m&&p?"spot-trades-area--detail-hidden-strategy-panel-scanner-compact":"",o&&r&&!n&&h&&p?"spot-trades-area--detail-hidden-double-strategy-panel-scanner-compact":"",!o&&r&&n&&m?"spot-trades-area--market-hidden-strategy-panel":"",!o&&r&&n&&h?"spot-trades-area--market-hidden-double-strategy-panel":"",o&&!r&&n&&m?"spot-trades-area--scanner-hidden-strategy-panel":"",o&&!r&&n&&h?"spot-trades-area--scanner-hidden-double-strategy-panel":"",x&&!o&&r&&p?"spot-trades-area--market-hidden-strategy-panel-scanner-compact":"",h&&!o&&r&&n&&p?"spot-trades-area--market-hidden-double-strategy-panel-scanner-compact":"",x&&o&&!r&&s?"spot-trades-area--scanner-hidden-strategy-panel-market-compact":"",h&&o&&!r&&n&&s?"spot-trades-area--scanner-hidden-double-strategy-panel-market-compact":""].filter(Boolean)}var ni=(()=>{let o=class o{constructor(){this.ui=D(he),this.page=D(de),this.store=D(ae),this.settingsModal=D(Vi),this.userState=D(Oe)}open(e){return k(this,null,function*(){let t=yield this.settingsModal.open({panel:e,title:this.getTitle(e),originId:this.page.originId(),symbolOptions:this.getSymbolOptions(e),selectedSymbols:this.getSelectedSymbols(e),visibleDetailSections:this.getVisibleDetailSections(e)});this.applyResult(e,t)})}applyResult(e,t){if(e==="market"&&t?.action==="save"&&t.marketSettings){this.store.setSelectedMarketSymbols(t.marketSettings.selectedSymbols??[]);let n=this.userState.getState();this.userState.updateStateAndSave({market_watch_settings:F(f({},n.market_watch_settings),{favorite_symbols:t.marketSettings.selectedSymbols??[]})})}if(e==="scanner"&&t?.action==="save"&&t.scannerSettings){this.store.setSelectedScannerSymbols(t.scannerSettings.symbols??[]);let n=this.userState.getState();this.userState.updateStateAndSave({scanner_settings:F(f({},n.scanner_settings),{favorite_symbols:t.scannerSettings.symbols??[],sound_alert:this.resolveSoundAlert(t.scannerSettings.soundAlert?.type),sort_direction:t.scannerSettings.sortDirection==="asc"?en.LowestToHighest:en.HighestToLowest,sign_handling:t.scannerSettings.sortValueMode==="signed"?tn.RespectSign:tn.IgnoreSign,month_selection:this.resolveMonthSelection(t.scannerSettings.selectedMispricingMonths??[]),mispricing_range:{near_month:this.resolveMonthAmount(t.scannerSettings.mispricingRanges,"Near Month"),next_month:this.resolveMonthAmount(t.scannerSettings.mispricingRanges,"Next Month"),far_month:this.resolveMonthAmount(t.scannerSettings.mispricingRanges,"Far Month")},pop_settings:{near_month:this.resolvePopPercentage(t.scannerSettings.popSettings,"Near Month POP%"),next_month:this.resolvePopPercentage(t.scannerSettings.popSettings,"Next Month POP%"),far_month:this.resolvePopPercentage(t.scannerSettings.popSettings,"Far Month POP%")},mispricing_change_step:t.scannerSettings.mispricingStep??null})})}if(e==="hedge-ratio"&&t?.action==="save"){let n=this.userState.getState();this.userState.updateStateAndSave({hedge_table_settings:f({},n.hedge_table_settings)})}if(e==="detail"&&t?.action==="save"){let n=this.userState.getState();this.userState.updateStateAndSave({details_settings:F(f({},n.details_settings),{visible_sections:this.resolveDetailSections(t.detailSettings?.visibleSections)})})}}getTitle(e){return e==="market"?"Market Watch Settings":e==="mispricing-flow"?"Flow Settings":e==="hedge-ratio"?"Hedge Ratio Settings":e==="scanner"?this.ui.isFlowChart()?"Flow Settings":"Scanner Settings":"Details Settings"}getSymbolOptions(e){return e==="market"?this.getUniqueSymbols(this.store.allEquityR
16ows(),t=>t.spot_info.symbol):e==="scanner"?this.getUniqueSymbols(this.store.scannerQueueRows(),t=>t.spot_info.symbol):[]}getSelectedSymbols(e){return e==="market"?this.store.selectedMarketSymbols():e==="scanner"?this.store.selectedScannerSymbols():[]}getVisibleDetailSections(e){return e==="detail"?this.userState.getState().details_settings.visible_sections:[]}getUniqueSymbols(e,t){return[...new Set(e.map(t).filter(Boolean))]}resolveSoundAlert(e){let t=Number(e?.split("-")[0]);return t>=Be.Alert&&t<=Be.BeepShort?t:Be.Alert}resolveMonthSelection(e){return{near_month:e.includes("near"),next_month:e.includes("next"),far_month:e.includes("far")}}resolveMonthAmount(e,t){return e?.find(n=>n.month===t)?.amount??null}resolvePopPercentage(e,t){return e?.find(n=>n.month===t)?.percentage??null}resolveDetailSections(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}};o.\u0275fac=function(t){return new(t||o)},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Jp=[[["","panel-controls",""]]],eu=["[panel-controls]"];function tu(i,o){if(i&1&&(a(0,"div",1)(1,"h5"),d(2),l()()),i&2){let r=u();c(2),T(r.title())}}function nu(i,o){if(i&1){let r=R();a(0,"button",7),_("click",function(){S(r);let t=u(2);return v(t.onSettingsClick())}),y(1,"ion-icon",8),l()}}function iu(i,o){if(i&1){let r=R();a(0,"button",9),_("click",function(){S(r);let t=u(2);return v(t.onInfoClick())}),y(1,"ion-icon",10),l()}}function ou(i,o){if(i&1&&(a(0,"div",3)(1,"div",4),P(2,nu,2,0,"button",5)(3,iu,2,0,"button",6),l()()),i&2){let r=u();c(2),C(r.showSettings()?2:-1),c(),C(r.showInfo()?3:-1)}}var Ft=(()=>{let o=class o{constructor(){this.title=E(""),this.showSettings=E(!0),this.showInfo=E(!1),this.settingsClick=X(),this.infoClick=X()}onSettingsClick(){this.settingsClick.emit()}onInfoClick(){this.infoClick.emit()}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-board-panel-header"]],inputs:{title:[1,"title"],showSettings:[1,"showSettings"],showInfo:[1,"showInfo"]},outputs:{settingsClick:"settingsClick",infoClick:"infoClick"},ngContentSelectors:eu,decls:5,vars:2,consts:[[1,"panel-header"],[1,"panel-header-title"],[1,"panel-header-controls"],[1,"panel-header-actions"],[1,"board-action-bar"],["type","button","aria-label","Open settings",1,"icon-button"],["type","button","aria-label","Show information",1,"icon-button"],["type","button","aria-label","Open settings",1,"icon-button",3,"click"],["name","settings-outline"],["type","button","aria-label","Show information",1,"icon-button",3,"click"],["name","information-circle-outline"]],template:function(t,n){t&1&&(pi(Jp),a(0,"header",0),P(1,tu,3,1,"div",1),a(2,"div",2),ui(3),l(),P(4,ou,4,2,"div",3),l()),t&2&&(c(),C(n.title()&&n.title()!="Details"?1:-1),c(3),C(n.showSettings()||n.showInfo()?4:-1))},dependencies:[ne,te],styles:["[_nghost-%COMP%]{display:block}.panel-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;min-width:0;gap:10px;padding:0 10px;margin-bottom:5px;border-radius:10px;background:#1f2633}.panel-header-title[_ngcontent-%COMP%]{display:flex;flex:0 1 auto;min-width:0;align-items:center;justify-content:flex-start}.panel-header-title[_ngcontent-%COMP%]   h5[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0;margin:0 10px 0 0;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.panel-header-controls[_ngcontent-%COMP%]{display:flex;flex:1 1 auto;min-width:0;align-items:center;justify-content:flex-end}.panel-header-actions[_ngcontent-%COMP%]{display:flex;align-items:center;flex:0 0 auto;justify-content:flex-end;gap:8px;min-width:0}.board-action-bar[_ngcontent-%COMP%]{display:flex;align-items:center;margin:2px 0;background-color:#14181f;border-radius:10px}.icon-button[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;width:var(--toolbar-height, 30px);min-width:var(--toolbar-height, 30px);height:var(--toolbar-height, 30px);padding:4px;color:inherit;background:transparent;border:1px solid #1f2633;cursor:pointer}.icon-button[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:18px}@media(max-width:900px){.panel-header[_ngcontent-%COMP%]{align-items:flex-start;flex-wrap:wrap;padding-block:4px}.panel-header-controls[_ngcontent-%COMP%]{order:3;flex:1 0 100%;justify-content:flex-start}.panel-header-actions[_ngcontent-%COMP%]{margin-left:auto}}"],changeDetection:0});let i=o;return i})();var Oa=(()=>{let o=class o{constructor(e,t){this.elementRef=e,this.renderer=t,this.blinkClass="blink-change"}ngOnChanges(e){let t=e.appBlinkOnChange;if(!t||t.firstChange||t.previousValue===t.currentValue)return;let n=this.elementRef.nativeElement;this.renderer.removeClass(n,this.blinkClass),n.offsetWidth,this.renderer.addClass(n,this.blinkClass)}onAnimationEnd(){this.renderer.removeClass(this.elementRef.nativeElement,this.blinkClass)}};o.\u0275fac=function(t){return new(t||o)(Z(di),Z(br))},o.\u0275dir=yr({type:o,selectors:[["","appBlinkOnChange",""]],hostBindings:function(t,n){t&1&&_("animationend",function(){return n.onAnimationEnd()})},inputs:{appBlinkOnChange:"appBlinkOnChange",blinkClass:"blinkClass"},features:[ve]});let i=o;return i})();var ru=["app-hedging-table",""],su=(i,o)=>o.spot_info.instrument_token;function au(i,o){if(i&1&&(a(0,"td"),d(1),l()),i&2){let r=u().$implicit,e=u();w("hidden-col",e.hideColumns()),c(),T(r.spot_info.exchange)}}function lu(i,o){if(i&1&&(a(0,"td")(1,"p"),d(2),z(3,"number"),l()(),a(4,"td")(5,"p"),d(6),z(7,"number"),l()(),a(8,"td")(9,"p"),d(10),z(11,"number"),l()()),i&2){let r=u().$implicit,e=u();w("hidden-col",e.hideColumns()),c(),J("base-properties "+r.mispricingDirection.f_1),c(),g(" ",W(3,15,r.mispricing.f_1==null?null:r.mispricing.f_1.value,"1.0-2")," "),c(2),w("hidden-col",e.hideColumns()),c(),J("base-properties "+r.mispricingDirection.f_2),c(),g(" ",W(7,18,r.mispricing.f_2==null?null:r.mispricing.f_2.value,"1.0-2")," "),c(2),w("hidden-col",e.hideColumns()),c(),J("base-properties "+r.mispricingDirection.f_3),c(),g(" ",W(11,21,r.mispricing.f_3==null?null:r.mispricing.f_3.value,"1.0-2")," ")}}function cu(i,o){if(i&1){let r=R();a(0,"tr",1),_("click",function(){let t=S(r),n=t.$implicit,s=t.$index,p=u();return v(p.selectHedgingRow(n.spot_info.symbol,n.spot_info.instrument_token,s))}),a(1,"td"),d(2),l(),a(3,"td",2)(4,"p"),d(5),l()(),P(6,au,2,3,"td",3),a(7,"td")(8,"p"),d(9),l()(),a(10,"td")(11,"p"),d(12),z(13,"number"),l()(),a(14,"td",4),d(15),z(16,"date"),l(),P(17,lu,12,24),l()}if(i&2){let r=o.$implicit,e=o.$index,t=u();w("selected",t.isSelectedRow(r,e)),c(2),T(e+1),c(2),J("base-properties "+(t.hideColumns()?r.direction.changeDirection:"")),c(),g(" ",r.spot_info.symbol," "),c(),C(t.primarySection()==="etf"||t.primarySection()==="commodity"?6:-1),c(),w("hidden-col",t.hideColumns()),c(),J("base-properties "+r.direction.priceDirection),c(),g(" ",r.spot_info.price," "),c(),w("hidden-col",t.hideColumns()),c(),J("base-properties "+r.direction.changeDirection),c(),g(" ",Pt(13,22,r.spot_info.change)," "),c(2),w("hidden-col",t.hideColumns()),b("appBlinkOnChange",r.spot_info.update),
16c(),g(" ",Ht(16,24,r.spot_info.update,"HH:mm:ss","+0530")," "),c(2),C(t.showMispricingColumns()?17:-1)}}var Ma=(()=>{let o=class o{constructor(){this.rows=E(),this.currentView=E("market"),this.isFutures=E(!1),this.hideColumns=E(!1),this.activeAnalysis=E(null),this.primarySection=E(""),this.selectedRowIndex=E(-1),this.selectedRowSource=E(null),this.selectedIndexName=E(""),this.selectedInstrumentToken=E(null),this.selectedHedgingRow=new ce,this.previewHedgingRow=new ce}showMispricingColumns(){return this.primarySection()==="equity-futures"||this.primarySection()==="index-futures"||this.primarySection()==="index-options"||ho(this.activeAnalysis())}isSelectedRow(e,t){if(this.selectedRowSource()==="hedging"&&this.selectedRowIndex()===t)return!0;let n=Number(this.selectedInstrumentToken());if(Number.isFinite(n)&&n>0&&Number(e.spot_info.instrument_token)===n)return!0;let s=this.selectedIndexName().trim().toUpperCase();return!!s&&e.spot_info.symbol.trim().toUpperCase()===s}selectHedgingRow(e,t,n){this.selectedHedgingRow.emit({indexName:e,instrumentToken:t,rowIndex:n})}previewIndexName(e,t){this.previewHedgingRow.emit({indexName:e,instrumentToken:t})}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["","app-hedging-table",""]],inputs:{rows:[1,"rows"],currentView:[1,"currentView"],isFutures:[1,"isFutures"],hideColumns:[1,"hideColumns"],activeAnalysis:[1,"activeAnalysis"],primarySection:[1,"primarySection"],selectedRowIndex:[1,"selectedRowIndex"],selectedRowSource:[1,"selectedRowSource"],selectedIndexName:[1,"selectedIndexName"],selectedInstrumentToken:[1,"selectedInstrumentToken"]},outputs:{selectedHedgingRow:"selectedHedgingRow",previewHedgingRow:"previewHedgingRow"},attrs:ru,decls:2,vars:0,consts:[[3,"selected"],[3,"click"],[1,"symbol"],[3,"hidden-col"],[1,"last-update-column",3,"appBlinkOnChange"]],template:function(t,n){t&1&&q(0,cu,18,28,"tr",0,su),t&2&&G(n.rows())},dependencies:[Oa,St,Mn],styles:["tr[_ngcontent-%COMP%]{transition:background .2s ease}tr[_ngcontent-%COMP%]:hover{background:#00215d}tr.selected[_ngcontent-%COMP%]{background:#0043ba}tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]{border-bottom:none}td[_ngcontent-%COMP%]{font-size:14px;color:#e6edf3;border-bottom:1px solid #2d3748;white-space:nowrap;text-align:center}.hidden-col[_ngcontent-%COMP%]{display:none}.price[_ngcontent-%COMP%]{font-weight:600}.price.up[_ngcontent-%COMP%]{color:#00c853}.price.down[_ngcontent-%COMP%]{color:#ff5252}.base-properties[_ngcontent-%COMP%]{color:#fff!important;padding:5px;border-radius:2px;margin:5px}.positive[_ngcontent-%COMP%]{background-color:var(--up)}.negative[_ngcontent-%COMP%]{background-color:var(--negative)}.positive_change[_ngcontent-%COMP%]{background-color:#001cf2}.negative_change[_ngcontent-%COMP%]{background-color:#c90076}.equity-values[_ngcontent-%COMP%]{max-width:1153px;overflow:auto}.symbol[_ngcontent-%COMP%]{text-align:left}.last-update-column[_ngcontent-%COMP%]{width:160px;min-width:160px;max-width:160px;text-align:center;white-space:nowrap}.blink-change[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinkChangeBg .7s ease-out}@keyframes _ngcontent-%COMP%_blinkChangeBg{0%{box-shadow:inset 0 0 0 999px #006d62}to{box-shadow:inset 0 0 0 999px #ffca2800}}"],changeDetection:0});let i=o;return i})();var ii={basis_dev:{entry:[.6,.9,1.2],exit:.2},pop_percent:{entry:[50,65,80],exit:.2},spread_dev:{entry:[400,700,1e3],exit:.2},stress_dev:{entry:[-80,-150,-200],exit:.2},convexity_mis:{entry:[200,400,600],exit:.2},mispricing:{entry:[0,1e3,2e3],exit:.2}};function Gi(i,o,r,e=ii){let[t,n,s]=e[o]?.entry??[0,0,0],p=r==="positive",m=i<0?Math.abs(i):i;return(p?m>t&&m<n:m<t&&m>n)?"low":(p?m>=n&&m<=s:m<=n&&m>=s)?"mid":(p?m>s:m<s)?"high":""}var du=["app-scanner-queue-table",""],zi=i=>({background:i});function pu(i,o){return this.getRowKey(o)}function uu(i,o){if(i&1){let r=R();a(0,"tr",1),_("pointerdown",function(){let t=S(r),n=u(),s=n.$implicit,p=n.$index,m=u();return v(m.setMaxLossRow(t,p+1,m.getRowKey(s)))}),a(1,"td"),d(2),l(),a(3,"td",2)(4,"p",3),d(5),l()(),a(6,"td",4)(7,"p",3),d(8),l()(),a(9,"td"),d(10),z(11,"number"),l(),a(12,"td")(13,"p",5),d(14),z(15,"number"),l()(),a(16,"td"),d(17),z(18,"date"),l(),a(19,"td")(20,"p",3),d(21),l()(),a(22,"td"),d(23),z(24,"number"),l(),a(25,"td"),d(26),z(27,"number"),l(),a(28,"td"),d(29),l(),a(30,"td"),d(31),z(32,"number"),l(),a(33,"td")(34,"p",3),d(35),l()()()}if(i&2){let r=o,e=u(),t=e.$implicit,n=e.$index,s=u();w("selected",s.selectedRowSource()==="scanner"&&s.selectedRowKey()===s.getRowKey(t)),c(2),T(n+1),c(3),T(r.max_loss_row.symbol),c(3),g(" ",r.max_loss_row.option_leg.trading_symbol," "),c(),w("hidden-col",s.hideColumns()),c(),g(" ",W(11,33,r.max_loss_row.last_price,"1.0-2")," "),c(2),w("hidden-col",s.hideColumns()),c(),b("ngStyle",gt(52,zi,r.spot_info.changeDirection)),c(),g(" ",W(15,36,r.max_loss_row.percent_change,"1.0-2")," "),c(2),w("hidden-col",s.hideColumns()),c(),g(" ",Ht(18,39,r.max_loss_row.last_update,"HH:mm:ss",s.lastUpdateTimezone())," "),c(2),w("hidden-col",s.hideColumns()),c(2),T(r.max_loss_row.expiry),c(),w("hidden-col",s.hideColumns()),c(),g(" ",W(24,43,r.max_loss_row.option_leg.strike,"1.0-2")," "),c(2),w("hidden-col",s.hideColumns()),c(),g(" ",W(27,46,r.max_loss_row.option_leg.delta,"1.2-4")," "),c(2),w("hidden-col",s.hideColumns()),c(),g(" ",r.max_loss_row.option_leg.put_lot," "),c(),w("hidden-col",s.hideColumns()),c(),g(" ",W(32,49,r.max_loss_row.option_leg.last_price,"1.0-2")," "),c(2),w("hidden-col",s.hideColumns()),c(2),T(s.formatMaxLoss(r))}}function mu(i,o){if(i&1){let r=R();a(0,"tr",1),_("pointerdown",function(){let t=S(r),n=u(2),s=n.$implicit,p=n.$index,m=u();return v(m.setProtectivePutRow(t,p+1,m.getRowKey(s)))}),a(1,"td"),d(2),l(),a(3,"td",2)(4,"p",3),d(5),l()(),a(6,"td",4)(7,"p",3),d(8),l()(),a(9,"td"),d(10),z(11,"number"),l(),a(12,"td")(13,"p",5),d(14),z(15,"number"),l()(),a(16,"td"),d(17
16),z(18,"date"),l(),a(19,"td")(20,"p"),d(21),l()(),a(22,"td")(23,"p"),d(24),z(25,"number"),l()(),a(26,"td")(27,"p"),d(28),l()(),a(29,"td")(30,"p",3),d(31),l()()()}if(i&2){let r=o,e=u(2),t=e.$implicit,n=e.$index,s=u();w("selected",s.selectedRowSource()==="scanner"&&s.selectedRowKey()===s.getRowKey(t)),c(2),T(n+1),c(3),g(" ",r.protective_put.symbol," "),c(3),g(" ",r.protective_put.option_leg.trading_symbol," "),c(),w("hidden-col",s.hideColumns()),c(),g(" ",W(11,33,r.protective_put.last_price,"1.0-2")," "),c(2),w("hidden-col",s.hideColumns()),c(),b("ngStyle",gt(46,zi,r.spot_info.changeDirection)),c(),g(" ",W(15,36,r.protective_put.percent_change,"1.0-2")," "),c(2),w("hidden-col",s.hideColumns()),c(),g(" ",Ht(18,39,r.protective_put.last_update,"HH:mm:ss",s.lastUpdateTimezone())," "),c(2),w("hidden-col",s.hideColumns()),c(),J(s.getExpiryClass(r)),c(),g(" ",r.protective_put.expiry," "),c(),w("hidden-col",s.hideColumns()),c(),J(s.getProtectivePutDiffClass(r)),c(),g(" ",W(25,43,r.protective_put.breakeven_diff_percent,"1.0-2")," "),c(2),w("hidden-col",s.hideColumns()),c(),J(s.getMatrix2Class(r)),c(),g(" ",r.protective_put.matrix_2," "),c(),w("hidden-col",s.hideColumns()),c(2),g(" ",s.formatTargetDatePop(r)," ")}}function hu(i,o){if(i&1){let r=R();a(0,"tr",7),_("pointerdown",function(){S(r);let t=u(),n=u(3).$index,s=u();return v(s.setLongBoxRow(t,n+1,s.getRowKey(t)))}),a(1,"td"),d(2),l(),a(3,"td",8)(4,"p",3),d(5),l()(),a(6,"td"),d(7),z(8,"number"),l(),a(9,"td")(10,"p",5),d(11),z(12,"number"),l()(),a(13,"td"),d(14),z(15,"date"),l(),a(16,"td")(17,"p"),d(18),l()(),a(19,"td"),d(20),l()()}if(i&2){let r=u(),e=u(3).$index,t=u();w("selected",t.selectedRowSource()==="scanner"&&t.selectedRowKey()===t.getRowKey(r)),c(2),T(e+1),c(3),T(r.spot_info.symbol),c(),w("hidden-col",t.hideColumns()),c(),g(" ",W(8,22,r.spot_info.price,"1.0-2")," "),c(2),w("hidden-col",t.hideColumns()),c(),b("ngStyle",gt(32,zi,r.spot_info.changeDirection)),c(),g(" ",W(12,25,r.spot_info.change,"1.0-2")," "),c(2),w("hidden-col",t.hideColumns()),c(),g(" ",Ht(15,28,r.spot_info.update,"HH:mm:ss",t.lastUpdateTimezone())," "),c(2),w("hidden-col",t.hideColumns()),c(),J(t.getExpiryClass(r)),c(),g(" ",r.price_matrix.expiry," "),c(),w("hidden-col",t.hideColumns()),c(),g(" ",t.formatLongBoxMetric(t.getLongBoxTotalProfit(r,o.edge_rupees))," ")}}function gu(i,o){if(i&1&&P(0,hu,21,34,"tr",6),i&2){let r,e=u(4);C((r=e.getLongBoxSpread(o))?0:-1,r)}}function _u(i,o){if(i&1&&(a(0,"td")(1,"p"),d(2),l()()),i&2){let r=u(4).$implicit,e=u();w("hidden-col",e.hideColumns()),c(),J(e.getMispricingClass(r)),c(),g(" ",e.formatScannerDisplayValue(r)," ")}}function fu(i,o){if(i&1&&(a(0,"td"),d(1),l()),i&2){let r=u(4).$implicit,e=u();w("hidden-col",e.hideColumns()),c(),g(" ",r.spot_info.exchange," ")}}function xu(i,o){if(i&1&&(a(0,"td")(1,"p"),d(2),l()()),i&2){let r=u(4).$implicit,e=u();w("hidden-col",e.hideColumns()),c(),J(e.getMispricingClass(r)),c(),g(" ",e.formatScannerDisplayValue(r)," ")}}function bu(i,o){if(i&1){let r=R();a(0,"tr",1),_("pointerdown",function(){let t;S(r);let n=u(3),s=n.$implicit,p=n.$index,m=u();return v(m.setIndexName(s.spot_info.symbol,s.spot_info.instrument_token,p+1,s.price_matrix.expiry_index||-1,m.getRowKey(s),(t=s.trade_tokens)!==null&&t!==void 0?t:null,(t=s.instrument_tokens)!==null&&t!==void 0?t:[]))}),a(1,"td"),d(2),l(),a(3,"td",8)(4,"p",3),d(5),l()(),P(6,_u,3,5,"td",9)(7,fu,2,3,"td",9),a(8,"td")(9,"p"),d(10),l()(),a(11,"td")(12,"p",10),d(13),z(14,"number"),l()(),a(15,"td"),d(16),z(17,"date"),l(),a(18,"td")(19,"p"),d(20),l()(),P(21,xu,3,5,"td",9),l()}if(i&2){let r=u(3),e=r.$implicit,t=r.$index,n=u();w("selected",n.selectedRowSource()==="scanner"&&n.selectedRowKey()===n.getRowKey(e)),c(2),T(t+1),c(3),g(" ",e.spot_info.symbol," "),c(),C(n.isFuturesProductAnalysis()?6:-1),c(),C(n.primarySection()==="etf"||n.primarySection()==="commodity"?7:-1),c(),w("hidden-col",n.hideColumns()),c(),J("base-properties "+e.spot_info.priceDirection),c(),g(" ",e.spot_info.price," "),c(),w("hidden-col",n.hideColumns()),c(),J("base-properties "),b("ngStyle",gt(32,zi,e.spot_info.changeDirection)),c(),g(" ",Pt(14,26,e.spot_info.change)," "),c(2),w("hidden-col",n.hideColumns()),c(),g(" ",Ht(17,28,e.spot_info.update,"HH:mm:ss",n.lastUpdateTimezone())," "),c(2),w("hidden-col",n.hideColumns()),c(),J(n.getExpiryClass(e)),c(),g(" ",e.price_matrix.expiry," "),c(),C(!n.isFuturesProductAnalysis()&&n.shouldShowTradeTokenMispricing()?21:-1)}}function yu(i,o){if(i&1&&P(0,gu,1,1)(1,bu,22,34,"tr",0),i&2){let r,e=u(2).$implicit,t=u();C((r=t.asLongBoxRow(e))?0:1,r)}}function Cu(i,o){if(i&1&&P(0,mu,32,48,"tr",0)(1,yu,2,1),i&2){let r,e=u().$implicit,t=u();C((r=t.asProtectivePutRow(e))?0:1,r)}}function Pu(i,o){if(i&1&&P(0,uu,36,54,"tr",0)(1,Cu,2,1),i&2){let r,e=o.$implicit,t=u();C((r=t.asMaxLossRow(e))?0:1,r)}}var Su=1e5,vu=new Set([j.id,ee.id,Q.id,mt.id,It.id]),Ea=(()=>{let o=class o{constructor(){this.rows=E([]),this.currentView=E("market"),this.activeAnalysis=E(null),this.isFutures=E(!1),this.hideColumns=E(!1),this.primarySection=E(""),this.secondaryId=E(""),this.selectedRowIndex=E(-1),this.selectedRowKey=E(null),this.selectedRowSource=E(null),this.lastUpdateTimezone=M(()=>{let e=this.secondaryId()||this.activeAnalysis()||"";return vu.has(e)?"+0530":"UTC"}),this.selectedScannerRow=new ce,this.previewScannerRow=new ce,this.thresholds=ii}getEntryOrExit(e,t,n,s="entry"){return s!=="entry"?"":Gi(e,t,n,this.thresholds)}getMispricingClass(e){if(!e.isLatestForSymbolExpiry)return"base-properties";let t=e.price_matrix.value;if(typeof t!="number"||!Number.isFinite(t))return"base-properties";
16if(this.activeAnalysis()===_e.id){let s=this.getReverseCarryMispricingClass(e.price_matrix.expiry_index??1,t);return s?`base-properties ${s}`:"base-properties"}let n=this.getEntryOrExit(t,"mispricing","positive");return n?`base-properties ${n}`:"base-properties"}isFuturesProductAnalysis(){return yi.has(this.activeAnalysis()??"")}shouldShowTradeTokenMispricing(){let e=this.activeAnalysis()??"";return In(e)||fe(e)||this.isShortBoxScannerAnalysis()}getScannerDisplayValue(e){return this.isShortBoxScannerAnalysis()?e.trade_tokens?.max_profit??null:this.isEquitySpotOptionParityAnalysis()?e.price_matrix.value:this.isIndexOptionsParityAnalysis()?e.trade_tokens?.max_profit??e.price_matrix.value:e.trade_tokens?.mispricing??e.price_matrix.value}formatScannerDisplayValue(e){let t=this.getScannerDisplayValue(e);return this.isEquitySpotOptionParityAnalysis()&&(e.price_matrix.max_profit_is_unlimited===!0||typeof t=="number"&&t>Su)?"Unlimited":typeof t=="number"&&Number.isFinite(t)?t.toLocaleString("en-IN",{maximumFractionDigits:0}):"-"}isEquitySpotOptionParityAnalysis(){return ot(this.activeAnalysis())}isIndexOptionsParityAnalysis(){return fe(this.activeAnalysis()??"")}isShortBoxScannerAnalysis(){return this.activeAnalysis()===ue.id}isLongBoxScannerAnalysis(){let e=this.activeAnalysis();return e===j.id||e===ee.id||e===ie.id||e===Q.id}getExpiryClass(e){let t=e.price_matrix.expiry_index??0;return t===1?"base-properties expiry-band-1":t===2?"base-properties expiry-band-2":t===3?"base-properties expiry-band-3":"base-properties"}getReverseCarryMispricingClass(e,t){let n=Math.abs(t);if(e===1){if(n>=5e3&&n<1e4)return"reverse-band-1";if(n>=1e4&&n<15e3)return"reverse-band-2";if(n>=15e3&&n<2e4)return"reverse-band-3";if(n>=2e4&&n<25e3)return"reverse-band-4";if(n>=25e3)return"reverse-band-5"}if(e===2){if(n>=1e4&&n<15e3)return"reverse-band-1";if(n>=15e3&&n<2e4)return"reverse-band-2";if(n>=2e4&&n<25e3)return"reverse-band-3";if(n>=25e3&&n<3e4)return"reverse-band-4";if(n>=3e4)return"reverse-band-5"}if(e===3){if(n>=2e4&&n<25e3)return"reverse-band-1";if(n>=25e3&&n<3e4)return"reverse-band-2";if(n>=3e4&&n<35e3)return"reverse-band-3";if(n>=35e3&&n<4e4)return"reverse-band-4";if(n>=4e4)return"reverse-band-5"}return""}getRowKey(e){return Ye(e,this.activeAnalysis()??"")}asProtectivePutRow(e){return Hn(e)?e:null}asMaxLossRow(e){return Jt(e)?e:null}asLongBoxRow(e){return this.isLongBoxScannerAnalysis()&&go(e)?e:null}getLongBoxSpread(e){return Ti(e)}getOrderedLongBoxLegs(e){return _o(e)}formatLongBoxMetric(e,t=2){return typeof e=="number"&&Number.isFinite(e)?e.toLocaleString("en-IN",{maximumFractionDigits:t}):"-"}getLongBoxTotalProfit(e,t){return this.activeAnalysis()!==j.id?this.toFiniteNumberOrNull(t):this.toFiniteNumberOrNull(e.total_profit)??this.toFiniteNumberOrNull(e.box_spread?.total_profit)??this.toFiniteNumberOrNull(e.spread?.total_profit)??this.toFiniteNumberOrNull(t)}setLongBoxRow(e,t,n){let s=this.getOrderedLongBoxLegs(e);s.length===4&&this.selectedScannerRow.emit({indexName:e.spot_info.symbol,instrumentToken:e.spot_info.instrument_token,expiryIndex:e.price_matrix.expiry_index||1,expiry:e.price_matrix.expiry,rowKey:n,rowIndex:t,tradeTokens:null,optionInstrumentTokens:s.map(p=>p.instrument_token)})}formatMaxLoss(e){return e.max_loss_row.max_loss_is_unlimited?"Unlimited":Number.isFinite(e.max_loss_row.max_loss)?e.max_loss_row.max_loss.toLocaleString("en-IN",{maximumFractionDigits:2}):"-"}setMaxLossRow(e,t,n){this.selectedScannerRow.emit({indexName:e.max_loss_row.symbol,instrumentToken:e.max_loss_row.instrument_token,expiryIndex:1,rowKey:n,rowIndex:t,tradeTokens:null,optionInstrumentTokens:[e.max_loss_row.option_leg.instrument_token]})}getProtectivePutDiffClass(e){let t=e.protective_put.breakeven_diff_percent;return t>=0&&t<1?"base-properties breakeven-band-yellow":t<2?"base-properties breakeven-band-blue":t<3?"base-properties breakeven-band-green":"base-properties"}getMatrix2Class(e){let t=e.protective_put.matrix_2;return Number.isFinite(t)?t<0?"base-properties matrix-2-band-red":t>=5e3&&t<1e4?"base-properties matrix-2-band-green":t>=1e4&&t<=2e4?"base-properties matrix-2-band-blue":t>2e4?"base-properties matrix-2-band-yellow":"base-properties":"base-properties"}formatTargetDatePop(e){let t=e.protective_put.target_date_pop;return typeof t=="number"&&Number.isFinite(t)?`${t.toFixed(2)}%`:"-"}setProtectivePutRow(e,t,n){let s=e.protective_put_selection,p=s.option_instrument_token===null?[]:[s.option_instrument_token];this.selectedScannerRow.emit({indexName:e.protective_put.symbol,instrumentToken:s.instrument_token,expiryIndex:e.price_matrix.expiry_index||1,rowKey:n,rowIndex:t,tradeTokens:null,optionInstrumentTokens:p})}setIndexName(e,t,n,s,p,m=null,h=[]){let x=this.secondaryId()||this.activeAnalysis()||"",I=x===ge.id||x===_e.id;this.selectedScannerRow.emit(f({indexName:e,instrumentToken:m?.spot??t,expiryIndex:s,rowKey:p,rowIndex:n,tradeTokens:m},I?{payoffInstrumentTokens:[...h]}:{}))}previewIndexName(e,t,n){this.previewScannerRow.emit({indexName:e,instrumentToken:t,expiryIndex:n})}toFiniteNumberOrNull(e){if(e==null||e==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["","app-scanner-queue-table",""]],inputs:{rows:[1,"rows"],currentView:[1,"currentView"],activeAnalysis:[1,"activeAnalysis"],isFutures:[1,"isFutures"],hideColumns:[1,"hideColumns"],primarySection:[1,"primarySection"],secondaryId:[1,"secondaryId"],selectedRowIndex:[1,"selectedRowIndex"],selectedRowKey:[1,"selectedRowKey"],selectedRowSource:[1,"selectedRowSource"]},outputs:{selectedScannerRow:"selectedScannerRow",previewScannerRow:"previewScannerRow"},attrs:du,decls:2,vars:0,consts:[[3,"selected"],[3,"pointerdown"],[1,"symbol",2,"min-width","180px"],[1,"base-properties"],[1,"symbol",2,"min-width","230px"],[1,"base-properties",3,"ngStyle"],[1,"long-box-row",3,"selected"],[1,"long-box-row",3,"pointerdown"],[1,"symbol"],[3,"hidden-col"],[3,"ngStyle"]],template:function(t,n){t&1&&q(0,Pu,2,1,null,null,pu,!0),t&2&&G(n.rows())},dependencies:[hi,St,Mn],styles:["tr[_ngcontent-%COMP%]{transition:background .2s ease}tr[_ngcontent-%COMP%]:hover{background:#00215d}tr.selected[_ngcontent-%COMP%]{background:#0043ba}tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]{border-bottom:none}td[_ngcontent-%COMP%]{font-size:14px;color:#e6edf3;border-bottom:1px solid #2d3748;white-space:nowrap;text-align:center}.hidden-col[_ngcontent-%COMP%]{display:none}.price[_ngcontent-%COMP%]{font-weight:600}.price.up[_ngcontent-%COMP%]{color:#00c853}.price.down[_ngcontent-%COMP%]{color:#ff5252}.base-properties[_ngcontent-%COMP%]{color:#fff!important;padding:5px;border-radius:2px;margin:5px}.positive[_ngcontent-%COMP%]{background-color:var(--up)}.negative[_ngcontent-%COMP%]{background-color:var(--negative)}.positive_change[_ngcontent-%COMP%]{background-color:#001cf2}.negative_change[_ngcontent-%COMP%]{background-color:#c90076}.equity-values[_ngcontent-%COMP%]{max-width:1153px;overflow:auto}.symbol[_ngcontent-%COMP%]{text-align:left}.last-update-column[_ngcontent-%COMP%]{width:160px;min-width:160px;max-width:160px;text-align:center;white-space:nowrap}.blink-change[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinkChangeBg .7s ease-out}@keyframes _ngcontent-%COMP%_blinkChangeBg{0%{box-shadow:inset 0 0 0 999px #006d62}to{box-shadow:inset 0 0 0 999px #ffca2800}}","tr[_ngcontent-%COMP%]{transition:none}.expiry-band-1[_ngcontent-%COMP%]{background-color:#0d620d}.expiry-band-2[_ngcontent-%COMP%]{background-color:#00f}.expiry-band-3[_ngcontent-%COMP%]{background-color:#c00}.low[_ngcontent-%COMP%]{background-color:#0d620d}.mid[_ngcontent-%COMP%]{background-color:#00f}.high[_ngcontent-%COMP%]{background-color:#6a329f}.breakeven-band-yellow[_ngcontent-%COMP%]{background-color:#efbf04;color:#000!important}.breakeven-band-blue[_ngcontent-%COMP%]{background-color:#00f}.breakeven-band-green[_ngcontent-%COMP%]{background-color:#0d620d}.matrix-2-band-red[_ngcontent-%COMP%]{background-color:#c00}.matrix-2-band-green[_ngcontent-%COMP%]{background-color:#0d620d}.matrix-2-band-blue[_ngcontent-%COMP%]{background-color:#00f}.matrix-2-band-yellow[_ngcontent-%COMP%]{background-color:#efbf04;color:#000!important}.reverse-band-1[_ngcontent-%COMP%]{background-color:#6a329f}.reverse-band-2[_ngcontent-%COMP%]{background-color:#0d620d}.reverse-band-3[_ngcontent-%COMP%]{background-color:#00f}.reverse-band-4[_ngcontent-%COMP%]{background-color:#c90076}.reverse-band-5[_ngcontent-%COMP%]{background-color:#efbf04;color:#000!important}"],changeDetection:0});let i=o;return i})();var wu=["app-price-deviation-table",""],Ou=(i,o)=>o.spot_info.instrument_token;function Mu(i,o){if(i&1&&(a(0,"td")(1,"p"),d(2),z(3,"number"),l()(),a(4,"td")(5,"p"),d(6),z(7,"number"),l()(),a(8,"td")(9,"p"),d(10),z(11,"number"),l()(),a(12,"td")(13,"p"),d(14),z(15,"number"),l()(),a(16,"td")(17,"p"),d(18),z(19,"number"),l()(),a(20,"td")(21,"p"),d(22),z(23,"number"),l()(),a(24,"td"),d(25,"0"),l(),a(26,"td"),d(27,"0"),l(),a(28,"td"),d(29,"0"),l()),i&2){let r=u().$implicit,e=u();w("hidden-col",e.hideColumns()),c(),J("base-properties "+e.getEntryOrExit(r.futures_spread.f1_f2_bs,"spread_dev","positive")),c(),g(" ",W(3,36,r.futures_spread.f1_f2_bs,"1.0-0")," "),c(2),w("hidden-col",e.hideColumns()),c(),J("base-properties "+e.getEntryOrExit(r.futures_spread.f1_f3_bs,"spread_dev","positive")),c(),g(" ",W(7,39,r.futures_spread.f1_f3_bs,"1.0-0")," "),c(2),w("hidden-col",e.hideColumns()),c(),J("base-properties "+e.getEntryOrExit(r.futures_spread.f2_f3_bs,"spread_dev","positive")),c(),g(" ",W(11,42,r.futures_spread.f2_f3_bs,"1.0-0")," "),c(2),w("hidden-col",e.hideColumns()),c(),J("base-properties "+e.getEntryOrExit(r.futures_spread.f1_f2_sb,"spread_dev","positive")),c(),g(" ",W(15,45,r.futures_spread.f1_f2_sb,"1.0-0")," "),c(2),w("hidden-col",e.hideColumns()),c(),J("base-properties "+e.getEntryOrExit(r.futures_spread.f1_f3_sb,"spread_dev","positive")),c(),g(" ",W(19,48,r.futures_spread.f1_f3_sb,"1.0-0")," "),c(2),w("hidden-col",e.hideColumns()),c(),J("base-properties "+e.getEntryOrExit(r.futures_spread.f2_f3_sb,"spread_dev","positive")),c(),g(" ",W(23,51,r.futures_spread.f2_f3_sb,"1.0-0")," "),c(2),w("hidden-col",e.hideColumns()),c(2),w("hidden-col",e.hideColumns()),c(2),w("hidden-col",e.hideColumns())}}function Eu(i,o){if(i&1){let r=R();a(0,"tr",1),_("click",function(){let t=S(r),n=t.$implicit,s=t.$index,p=u();return v(p.setIndexName(n.spot_info.symbol,n.spot_info.instrument_token,s))}),a(1,"td"),d(2),l(),a(3,"td",2),d(4),l(),a(5,"td")(6,"p"),d(7),l()(),a(8,"td")(9,"p"),d(10),z(11,"number"),l()(),a(12,"td"),d(13),z(14,"date"),l(),a(15,"td")(16,"p"),d(17
16),z(18,"number"),l()(),a(19,"td")(20,"p"),d(21),z(22,"number"),l()(),a(23,"td")(24,"p"),d(25),z(26,"number"),l()(),P(27,Mu,30,54),l()}if(i&2){let r=o.$implicit,e=o.$index,t=u();w("selected",t.isSelectedRow(r,e)),c(2),T(e+1),c(2),T(r.spot_info.symbol),c(),w("hidden-col",t.hideColumns()),c(),J("base-properties "+r.direction.priceDirection),c(),g(" ",r.spot_info.price," "),c(),w("hidden-col",t.hideColumns()),c(),J("base-properties "+r.direction.changeDirection),c(),g(" ",Pt(11,33,r.spot_info.change)," "),c(2),w("hidden-col",t.hideColumns()),c(),g(" ",Ht(14,35,r.spot_info.update,"HH:mm:ss","UTC")," "),c(2),w("hidden-col",t.hideColumns()),c(),J("base-properties "),c(),g(" ",W(18,39,r.spread_values.spot_futures,"1.0-0")," "),c(2),w("hidden-col",t.hideColumns()),c(),J("base-properties "),c(),g(" ",W(22,42,r.spread_values.spot_synthetic_futures,"1.0-0")," "),c(2),w("hidden-col",t.hideColumns()),c(),J("base-properties "),c(),g(" ",W(26,45,r.spread_values.futures_synthetic_futures,"1.0-0")," "),c(2),C(r.futures_spread?27:-1)}}var Ta=(()=>{let o=class o{constructor(){this.rows=E(),this.currentView=E("market"),this.isFutures=E(!1),this.hideColumns=E(!1),this.primarySection=E(""),this.selectedRowIndex=E(-1),this.selectedRowSource=E(null),this.selectedIndexName=E(""),this.selectedInstrumentToken=E(null),this.selectedHedgingRow=new ce,this.thresholds=ii}getEntryOrExit(e,t,n,s="entry"){return s!=="entry"?"":Gi(e,t,n,this.thresholds)}isSelectedRow(e,t){if(this.selectedRowSource()==="hedging"&&this.selectedRowIndex()===t)return!0;let n=Number(this.selectedInstrumentToken());if(Number.isFinite(n)&&n>0&&Number(e.spot_info.instrument_token)===n)return!0;let s=this.selectedIndexName().trim().toUpperCase();return!!s&&e.spot_info.symbol.trim().toUpperCase()===s}setIndexName(e,t,n){this.selectedHedgingRow.emit({indexName:e,instrumentToken:t,rowIndex:n})}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["","app-price-deviation-table",""]],inputs:{rows:[1,"rows"],currentView:[1,"currentView"],isFutures:[1,"isFutures"],hideColumns:[1,"hideColumns"],primarySection:[1,"primarySection"],selectedRowIndex:[1,"selectedRowIndex"],selectedRowSource:[1,"selectedRowSource"],selectedIndexName:[1,"selectedIndexName"],selectedInstrumentToken:[1,"selectedInstrumentToken"]},outputs:{selectedHedgingRow:"selectedHedgingRow"},attrs:wu,decls:2,vars:0,consts:[[3,"selected"],[3,"click"],[1,"symbol"]],template:function(t,n){t&1&&q(0,Eu,28,48,"tr",0,Ou),t&2&&G(n.rows())},dependencies:[St,Mn],styles:["tr[_ngcontent-%COMP%]{transition:background .2s ease}tr[_ngcontent-%COMP%]:hover{background:#00215d}tr.selected[_ngcontent-%COMP%]{background:#0043ba}tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]{border-bottom:none}td[_ngcontent-%COMP%]{font-size:14px;color:#e6edf3;border-bottom:1px solid #2d3748;white-space:nowrap;text-align:center}.hidden-col[_ngcontent-%COMP%]{display:none}.price[_ngcontent-%COMP%]{font-weight:600}.price.up[_ngcontent-%COMP%]{color:#00c853}.price.down[_ngcontent-%COMP%]{color:#ff5252}.base-properties[_ngcontent-%COMP%]{color:#fff!important;padding:5px;border-radius:2px;margin:5px}.positive[_ngcontent-%COMP%]{background-color:var(--up)}.negative[_ngcontent-%COMP%]{background-color:var(--negative)}.positive_change[_ngcontent-%COMP%]{background-color:#001cf2}.negative_change[_ngcontent-%COMP%]{background-color:#c90076}.equity-values[_ngcontent-%COMP%]{max-width:1153px;overflow:auto}.symbol[_ngcontent-%COMP%]{text-align:left}.last-update-column[_ngcontent-%COMP%]{width:160px;min-width:160px;max-width:160px;text-align:center;white-space:nowrap}.blink-change[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_blinkChangeBg .7s ease-out}@keyframes _ngcontent-%COMP%_blinkChangeBg{0%{box-shadow:inset 0 0 0 999px #006d62}to{box-shadow:inset 0 0 0 999px #ffca2800}}"],changeDetection:0});let i=o;return i})();function Tu(i,o){if(i&1&&(a(0,"th"),d(1),l()),i&2){let r=o.$implicit,e=o.$index,t=u();w("hidden-col",t.hideColumns()&&e>=t.compactVisibleHeadCount())("last-update-column",r.trim().toUpperCase()==="LAST UPDATE"),c(),g(" ",r," ")}}function Iu(i,o){if(i&1){let r=R();a(0,"tbody",6),_("selectedHedgingRow",function(t){S(r);let n=u();return v(n.onSelectedHedgingRow(t))})("previewHedgingRow",function(t){S(r);let n=u();return v(n.onPreviewHedgingRow(t))}),l()}if(i&2){let r=u();w("table-switch-animate",r.isSwitching()),b("rows",r.rows())("primarySection",r.primarySection())("hideColumns",r.hideColumns())("isFutures",!1)("currentView",r.currentView())("activeAnalysis",r.activeAnalysis())("selectedIndexName",r.selectedIndexName())("selectedInstrumentToken",r.selectedInstrumentToken())("selectedRowIndex",r.selectedRowIndex())("selectedRowSource",r.selectedRowSource())}}function ku(i,o){if(i&1){let r=R();a(0,"tbody",7),_("selectedScannerRow",function(t){S(r);let n=u();return v(n.onSelectedScannerRow(t))})("previewScannerRow",function(t){S(r);let n=u();return v(n.onPreviewScannerRow(t))}),l()}if(i&2){let r=u();w("table-switch-animate",r.isSwitching()),b("rows",r.rows())("primarySection",r.primarySection())("hideColumns",r.hideColumns())("isFutures",!1)("currentView",r.currentView())("activeAnalysis",r.activeAnalysis())("secondaryId",r.secondaryId())("selectedRowIndex",r.selectedRowIndex())("selectedRowKey",r.selectedRowKey())("selectedRowSource",r.selectedRowSource())}}function Ru(i,o){if(i&1){let r=R();a(0,"tbody",8),_("click",function(){S(r);let t=u();return v(t.columnsToggled.emit(!t.hideColumns()))})("selectedHedgingRow",function(t){S(r);let n=u();return v(n.onSelectedHedgingRow(t))}),l()}if(i&2){let r=u();w("table-switch-animate",r.isSwitching()),b("rows",r.rows())("primarySection",r.primarySection())("isFutures",!1)("currentView",r.currentView())("selectedIndexName",r.selectedIndexName())("selectedInstrumentToken",r.selectedInstrumentToken())("selectedRowIndex",r.selectedRowIndex())("selectedRowSource",r.selectedRowSource())}}var Ia=(()=>{let o=class o{constructor(){this.rows=E([]),this.theads=E([]),this.primarySection=E(""),this.tableKind=E("market"),this.isSwitching=E(!1),this.currentView=E("market"),this.selectedRowIndex=E(-1),this.selectedRowKey=E(null),this.selectedRowSource=E(null),this.selectedIndexName=E(""),this.selectedInstrumentToken=E(null),this.selectedHedgingRow=X(),this.previewHedgingRow=X(),this.selectedScannerRow=X(),this.previewScannerRow=X(),this.activeAnalysis=E(null),this.secondaryId=E(""),this.hideColumns=E(!1),this.columnsToggled=X(),this.displayHeads=M(()=>Fs(this.primarySection(),this.tableKind(),this.theads(),this.activeAnalysis())),this.compactVisibleHeadCount=M(()=>this.tableKind()==="scanner"&&(Ee(this.activeAnalysis())||me(this.activeAnalysis()))?2:1)}onSelectedHedgingRow(e){this.selectedHedgingRow.emit(e)}onPreviewHedgingRow(e){this.previewHedgingRow.emit(e)}onSelectedScannerRow(e){this.selectedScannerRow.emit(e)}onPreviewScannerRow(e){this.previewScannerRow.emit(e)}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-hedge-table"]],inputs:{rows:[1,"rows"],theads:[1,"theads"],primarySection:[1,"primarySection"],tableKind:[1,"tableKind"],isSwitching:[1,"isSwitching"],currentView:[1,"currentView"],selectedRowIndex:[1,"selectedRowIndex"],selectedRowKey:[1,"selectedRowKey"],selectedRowSource:[1,"selectedRowSource"],selectedIndexName:[1,"selectedIndexName"],selectedInstrumentToken:[1,"selectedInstrumentToken"],activeAnalysis:[1,"activeAnalysis"],secondaryId:[1,"secondaryId"],hideColumns:[1,"hideColumns"]},outputs:{selectedHedgingRow:"selectedHedgingRow",previewHedgingRow:"previewHedgingRow",selectedScannerRow:"selectedScannerRow",previewScannerRow:"previewScannerRow",columnsToggled:"columnsToggled"},decls:11,vars:1,consts:[[1,"equity-table-container"],[1,"equity-table"],[3,"hidden-col","last-update-column"],["app-hedging-table","",3,"table-switch-animate","rows","primarySection","hideColumns","isFutures","currentView","activeAnalysis","selectedIndexName","selectedInstrumentToken","selectedRowIndex","selectedRowSource"],["app-scanner-queue-table","",3,"table-switch-animate","rows","primarySection","hideColumns","isFutures","currentView","activeAnalysis","secondaryId","selectedRowIndex","selectedRowKey","selectedRowSource"],["app-price-deviation-table","",3,"table-switch-animate","rows","primarySection","isFutures","currentView","selectedIndexName","selectedInstrumentToken","selectedRowIndex","selectedRowSource"],["app-hedging-table","",3,"selectedHedgingRow","previewHedgingRow","rows","primarySection","hideColumns","isFutures","currentView","activeAnalysis","selectedIndexName","selectedInstrumentToken","selectedRowIndex","selectedRowSource"],["app-scanner-queue-table","",3,"selectedScannerRow","previewScannerRow","rows","primarySection","hideColumns","isFutures","currentView","activeAnalysis","secondaryId","selectedRowIndex","selectedRowKey","selectedRowSource"],["app-price-deviation-table","",3,"click","selectedHedgingRow","rows","primarySection","isFutures","currentView","selectedIndexName","selectedInstrumentToken","selectedRowIndex","selectedRowSource"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"table",1)(2,"thead")(3,"tr")(4,"th"),d(5,"Sno."),l(),q(6,Tu,2,5,"th",2,He),l()(),P(8,Iu,1,12,"tbody",3)(9,ku,1,12,"tbody",4)(10,Ru,1,10,"tbody",5),l()()),t&2&&(c(6),G(n.displayHeads()),c(2),C(n.tableKind()==="market"?8:n.tableKind()==="scanner"?9:10))},dependencies:[Ma,Ea,Ta],styles:[".equity-table-container[_ngcontent-%COMP%]{padding:2px;position:relative}.equity-table-container[_ngcontent-%COMP%]   .equity-table[_ngcontent-%COMP%]{width:100%}.last-update-column[_ngcontent-%COMP%]{width:160px;min-width:160px;max-width:160px;text-align:center;white-space:nowrap}.table-toolbar[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;margin-bottom:8px}.table-action-btn[_ngcontent-%COMP%]{width:32px;height:32px;border:1px solid #2d3748;border-radius:8px;background:#161b22;position:absolute;z-index:100;right:3px;top:8px;color:#d4af37;display:grid;place-items:center;cursor:pointer;transition:background .2s ease,border-color .2s ease,transform .2s ease}.table-action-btn[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:18px}.table-action-btn[_ngcontent-%COMP%]:hover{background:#1f2633;border-color:#d4af37;transform:translateY(-1px)}.table-action-btn.is-active[_ngcontent-%COMP%]{background:#1f2633;border-color:#d4af37;color:#e6edf3}tbody.table-switch-animate[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_tableSwitchIn .28s ease}.hidden-col[_ngcontent-%COMP%]{display:none}@keyframes _ngcontent-%COMP%_tableSwitchIn{0%{opacity:0;transform:translateY(8px) scale(.995);filter:blur(2px)}to{opacity:1;transform:translateY(0) scale(1);filter:blur(0)}}"],changeDetection:0});let i=o;return i})();function Du(i,o){if(i&1){let r=R();a(0,"section",3)(1,"div",4)(2,"app-hedge-table",5),_("selectedHedgingRow",function(t){S(r);let n=u();return v(n.onHedgingRowSelected(t))})("previewHedgingRow",function(t){S(r);let n=u();return v(n.onHedgingRowPreview(t))}),l()()()}if(i&2){let r=u();w("table-panel--compact",r.compact),c(),Se("zoom",r.ui.marketPanelZoom(),"%"),c(),b("rows",r.store.marketRows())("theads",r.store.theads())("primarySection",r.page.primarySection())("tableKind",r.store.currentView())("hideColumns",r.ui.hideColumns())("isSwitching",r.store.isTableSwitching())("currentView",r.store.currentView())("activeAnalysis",r.page.activeAnalysis())("selectedIndexName",r.store.selectedIndexName())("selectedInstrumentToken",r.store.selectedInstrumentToken())("selectedRowIndex",r.store.selectedRowIndex())("selectedRowSource",r.store.selectedRowSource())}}function Nu(i,o){i&1&&(a(0,"p",8),d(1,"Loading scanner rows..."),l())}function Fu(i,o){if(i&1&&(a(0,"p",9),d(1),l()),i&2){let r=u(2);c(),g(" ",r.store.scannerQueueError()," ")}}function Lu(i,o){i&1&&d(0," No rows match the selected scanner symbols. ")}function Au(i,o){if(i&1&&d(0),i&2){let r=u(3);g(" ",r.store.scannerQueueEmptyMessage()," ")}}function Uu(i,o){if(i&1&&d(0),i&2){let r=u(3);g(" Scanner data is unavailable while the live connection is ",r.live.connectionState(),". ")}}function Hu(i,o){i&1&&d(0," No scanner results are currently available. ")}function Vu(i,o){if(i&1&&(a(0,"p",8),P(1,Lu,1,0)(2,Au,1,1)(3,Uu,1,1
16)(4,Hu,1,0),l()),i&2){let r=u(2);c(),C(r.store.scannerQueueRows().length?1:r.store.scannerQueueEmptyMessage()?2:r.live.connectionState()!=="connected"?3:4)}}function Bu(i,o){if(i&1){let r=R();a(0,"section",6)(1,"div",4)(2,"app-hedge-table",7),_("selectedScannerRow",function(t){S(r);let n=u();return v(n.onScannerRowSelected(t))})("previewScannerRow",function(t){S(r);let n=u();return v(n.onScannerRowPreview(t))}),l(),P(3,Nu,2,0,"p",8)(4,Fu,2,1,"p",9)(5,Vu,5,1,"p",8),l()()}if(i&2){let r=u();w("table-panel--compact",r.compact),c(),Se("zoom",r.ui.scannerPanelZoom(),"%"),c(),b("rows",r.store.scannerRows())("theads",r.store.theads())("primarySection",r.page.primarySection())("tableKind","scanner")("hideColumns",r.ui.hideScannerColumns())("isSwitching",r.store.isTableSwitching())("currentView",r.store.currentView())("activeAnalysis",r.page.activeAnalysis())("secondaryId",r.page.originId())("selectedRowIndex",r.store.selectedRowIndex())("selectedRowKey",r.store.selectedRowKey())("selectedRowSource",r.store.selectedRowSource()),c(),C(r.store.scannerQueueLoading()&&!r.store.scannerQueueRows().length?3:r.store.scannerQueueError()?4:r.store.scannerQueueLoaded()&&!r.store.scannerRows().length?5:-1)}}var oi=(()=>{let o=class o{constructor(){this.isMarket=!1,this.isScanner=!1,this.compact=!1,this.store=D(ae),this.sync=D(Xe),this.ui=D(he),this.page=D(de),this.live=D(yn),this.detailsFacade=D(We)}onHedgingRowSelected(e){this.sync.selectDetailsTarget({source:"hedging",indexName:e.indexName,instrumentToken:e.instrumentToken,rowIndex:e.rowIndex}),this.store.markPriceMatrixSelection()}onScannerRowSelected(e){this.sync.selectDetailsTarget({source:"scanner",indexName:e.indexName,instrumentToken:e.instrumentToken,expiryIndex:e.expiryIndex,rowKey:e.rowKey,rowIndex:e.rowIndex,tradeTokens:e.tradeTokens,optionInstrumentTokens:e.optionInstrumentTokens,payoffInstrumentTokens:e.payoffInstrumentTokens,expiry:e.expiry,putLot:e.putLot}),this.store.markPriceMatrixSelection()}onHedgingRowPreview(e){this.detailsFacade.preloadIndex(this.page.originId(),this.page.primarySection(),e.indexName,e.instrumentToken,Y(this.page.originId())??"")}onScannerRowPreview(e){this.detailsFacade.preloadIndex(this.page.originId(),this.page.primarySection(),e.indexName,e.instrumentToken,Y(this.page.originId())??"",e.expiryIndex)}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-board-tables"]],inputs:{isMarket:"isMarket",isScanner:"isScanner",compact:"compact"},decls:3,vars:2,consts:[[1,"board-tables"],[1,"table-panel","table-panel--market",3,"table-panel--compact"],[1,"table-panel","table-panel--scanner",3,"table-panel--compact"],[1,"table-panel","table-panel--market"],[1,"table-container"],[3,"selectedHedgingRow","previewHedgingRow","rows","theads","primarySection","tableKind","hideColumns","isSwitching","currentView","activeAnalysis","selectedIndexName","selectedInstrumentToken","selectedRowIndex","selectedRowSource"],[1,"table-panel","table-panel--scanner"],[3,"selectedScannerRow","previewScannerRow","rows","theads","primarySection","tableKind","hideColumns","isSwitching","currentView","activeAnalysis","secondaryId","selectedRowIndex","selectedRowKey","selectedRowSource"],[1,"scanner-status"],[1,"scanner-status","scanner-status--error"]],template:function(t,n){t&1&&(a(0,"div",0),P(1,Du,3,16,"section",1)(2,Bu,6,17,"section",2),l()),t&2&&(c(),C(n.isMarket?1:-1),c(),C(n.isScanner?2:-1))},dependencies:[Ia],styles:["[_nghost-%COMP%]{display:block;min-height:0;height:100%}.board-tables[_ngcontent-%COMP%]{display:flex;justify-content:space-between;min-height:0;height:100%}.table-panel[_ngcontent-%COMP%]{width:100%;min-height:0;height:100%;max-height:90vh;overflow:auto;background:#131a23;border:1px solid #1f2937;border-radius:14px;box-shadow:0 10px 30px #00000038}.table-panel--compact[_ngcontent-%COMP%]{width:unset}.table-panel--scanner[_ngcontent-%COMP%]   .table-container[_ngcontent-%COMP%]{height:100%;overflow:auto;scrollbar-gutter:stable}.scanner-status[_ngcontent-%COMP%]{margin:18px;color:#94a3b8;font-size:13px;text-align:center}.scanner-status--error[_ngcontent-%COMP%]{color:#fb7185}"],changeDetection:0});let i=o;return i})();var Io=(()=>{let o=class o{constructor(){this.ui=D(he),this.settingsRequested=X()}openSettings(){this.settingsRequested.emit("market")}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-board-market-panel"]],outputs:{settingsRequested:"settingsRequested"},decls:2,vars:3,consts:[[3,"settingsClick","title"],[3,"isMarket","compact"]],template:function(t,n){t&1&&(a(0,"app-board-panel-header",0),_("settingsClick",function(){return n.openSettings()}),l(),y(1,"app-hedge-protection-board-tables",1)),t&2&&(b("title","Market Watch"),c(),b("isMarket",!0)("compact",n.ui.hideColumns()))},dependencies:[Ft,oi],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;min-height:90vh;height:90vh;max-height:90vh;min-width:0}[_nghost-%COMP%] > app-hedge-protection-board-tables[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0}"],changeDetection:0});let i=o;return i})();var ka=150,ko=(()=>{let o=class o{constructor(e,t){this.signalR=e,this.zone=t,this.updatesSubject=new pe,this.updates$=this.updatesSubject.asObservable(),this.currentSubscription=null,this.subscriptionVersion=0,this.handlersRegistered=!1,this.disposed=!1,this.pendingUpdate=null,this.updateFlushTimer=null,this.lastUpdateEmittedAt=0,this.handleFlowChartUpdate=n=>{if(!this.currentSubscription||this.disposed||!this.matchesCurrentSubscription(n))return;this.pendingUpdate=n;let s=Date.now()-this.lastUpdateEmittedAt;if(this.lastUpdateEmittedAt===0||s>=ka){this.flushPendingUpdate();return}this.updateFlushTimer===null&&this.zone.runOutsideAngular(()=>{this.updateFlushTimer=setTimeout(()=>{this.updateFlushTimer=null,this.flushPendingUpdate()},ka-s)})},this.hubConnection=this.signalR.connection,this.hubConnection.onreconnected(()=>{if(this.disposed)return;let n=this.currentSubscription;n&&this.invokeSubscribe(n)})}subscribe(e){return k(this,null,function*(){this.disposed=!1;let t=this.normalizeRequest(e);if(this.currentSubscription&&this.isSameRequest(this.currentSubscription,t))return;let n=++this.subscriptionVersion;this.registerHandlers(),this.clearPendingUpdate();let s=this.currentSubscription;this.currentSubscription=null,s&&(yield this.invokeUnsubscribe(s)),!(this.disposed||n!==this.subscriptionVersion)&&(this.currentSubscription=t,yield this.invokeSubscribe(t),(this.disposed||n!==this.subscriptionVersion)&&(this.currentSubscription&&this.isSameRequest(this.currentSubscription,t)&&(this.currentSubscription=null),yield this.invokeUnsubscribe(t)))})}unsubscribe(e){return k(this,null,function*(){++this.subscriptionVersion,this.clearPendingUpdate();let t=e?this.normalizeRequest(e):this.currentSubscription;t&&(this.currentSubscription&&this.isSameRequest(this.currentSubscription,t)&&(this.currentSubscription=null),yield this.invokeUnsubscribe(t))})}dispose(){return k(this,null,function*(){this.disposed=!0,yield this.unsubscribe(),this.handlersRegistered&&(this.hubConnection.off("flow-chart-updated",this.handleFlowChartUpdate),this.handlersRegistered=!1)})}registerHandlers(){this.handlersRegistered||(this.hubConnection.on("flow-chart-updated",this.handleFlowChartUpdate),this.handlersRegistered=!0)}flushPendingUpdate(){let e=this.pendingUpdate;this.pendingUpdate=null,!(!e||!this.currentSubscription||this.disposed||!this.matchesCurrentSubscription(e))&&(this.lastUpdateEmittedAt=Date.now(),this.zone.run(()=>this.updatesSubject.next(e)))}clearPendingUpdate(){this.pendingUpdate=null,this.lastUpdateEmittedAt=0,this.updateFlushTimer!==null&&(clearTimeout(this.updateFlushTimer),this.updateFlushTimer=null)}matchesCurrentSubscription(e){let t=e.secondary_id?.trim();return!t||t===this.currentSubscription?.secondary_id}invokeSubscribe(e){return k(this,null,function*(){if(this.hubConnection.state===se.Connected)try{yield this.hubConnection.invoke("SubscribeFlowChart",e)}catch(t){console.error("SubscribeFlowChart failed:",t)}})}normalizeRequest(e){let t=e.mode==="multi"?"":e.name?.trim(),n=e.secondary_id===Pe.equityOptionLongBox,s=e.secondary_id===Pe.indexOptionLongBox||e.secondary_id===Pe.indexOptionShortBox,p=e.secondary_id===Pe.indexOptionShortBox,m=e.secondary_id===Pe.equityOptionShortBox,h=n||s||m;return f(f(f({secondary_id:e.secondary_id,expiries:s?null:[...e.expiries??[]],mode:e.mode},h?{name:t||null}:t?{name:t}:{}),p?{equity_trading_symbol:null,equity_options_expiry:null}:{}),e.limit!=null?{limit:e.limit}
16:h?{limit:50}:{})}invokeUnsubscribe(e){return k(this,null,function*(){if(this.hubConnection.state===se.Connected)try{yield this.hubConnection.invoke("UnsubscribeFlowChart",e)}catch(t){console.error("UnsubscribeFlowChart failed:",t)}})}isSameRequest(e,t){return e.secondary_id===t.secondary_id&&this.areSameExpiries(e.expiries,t.expiries)&&e.mode===t.mode&&e.name===t.name&&e.limit===t.limit&&e.equity_trading_symbol===t.equity_trading_symbol&&e.equity_options_expiry===t.equity_options_expiry}areSameExpiries(e,t){return e===null||t===null?e===t:e.length===t.length&&e.every((n,s)=>n===t[s])}};o.\u0275fac=function(t){return new(t||o)(V(Fe),V(qe))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var ji=(()=>{let o=class o{resolveRange(e){let t=Math.max(0,e.itemCount),n=Math.max(1,e.rowHeight),s=Math.max(1,e.windowSize),p=Math.max(0,e.overscan);if(!t)return{startIndex:0,endIndex:0};let m=Math.max(0,Math.floor(e.scrollTop/n)),h=Math.max(0,m-p),x=Math.min(t,m+s+p);return{startIndex:h,endIndex:Math.max(h,x)}}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var qu="#4ade80",Gu={min:0,max:100},zu=[10,14],ju="rgba(0, 0, 0, 0.001)",Ra=(()=>{let o=class o{constructor(){this.data=E.required(),this.height=E(320),this.maxItems=E(null),this.seriesName=E("Value"),this.visibleCount=E(3),this.animationDurationUpdate=E(300),this.backgroundColor=E("#101218"),this.inverse=E(!0),this.showValueLabels=E(!0),this.enableRealtimeSort=E(!0),this.sortDirection=E("desc"),this.valueLabelPosition=E("right"),this.itemSelected=X(),this.labelSelected=X(),this.labelFormatter=({value:e,data:t})=>t?.displayValue??this.formatValue(e),this.normalizedItems=M(()=>{let t=(this.data()??[]).map(s=>({label:s.label,value:Number.isFinite(s.value)?+s.value.toFixed(2):0,color:s.color??qu,displayValue:s.displayValue,indexName:s.indexName,instrumentToken:s.instrumentToken,payoffInstrumentTokens:s.payoffInstrumentTokens,expiryIndex:s.expiryIndex,optionInstrumentTokens:s.optionInstrumentTokens,putLot:s.putLot,selectionContext:s.selectionContext}));this.sortDirection()==="asc"?t.sort((s,p)=>s.value-p.value):this.sortDirection()==="desc"&&t.sort((s,p)=>p.value-s.value);let n=this.maxItems();return typeof n=="number"&&Number.isFinite(n)?t.slice(0,Math.max(0,n)):t}),this.chartOptions=M(()=>{let e=this.normalizedItems(),t=new Array(e.length),n=new Array(e.length);for(let p=0;p<e.length;p+=1){let m=e[p];t[p]=m.label,n[p]={value:m.value,itemStyle:{color:m.color}
16,displayValue:m.displayValue}}let s=this.resolveAxisBounds(e);return{backgroundColor:this.backgroundColor(),grid:{left:"4%",right:"8%",top:16,bottom:12,outerBounds:{top:0,right:0,bottom:0,left:0}},xAxis:{type:"value",axisLabel:{color:"#8b949e",fontSize:11,show:!1},axisTick:{show:!1},axisLine:{show:!1},splitLine:{lineStyle:{color:"rgba(255,255,255,0.05)"}},min:s.min,max:s.max},yAxis:{type:"category",inverse:this.inverse(),triggerEvent:!0,animationDuration:150,animationDurationUpdate:this.animationDurationUpdate(),axisLabel:{color:"#c9d1d9",fontWeight:600,fontSize:12,padding:zu,backgroundColor:ju},axisLine:{show:!1},axisTick:{show:!1},data:t,max:Math.max(0,Math.min(this.visibleCount(),t.length)-1)},legend:{show:!1},tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(11, 18, 32, 0.96)",borderColor:"rgba(48, 54, 61, 0.9)",borderWidth:1,textStyle:{color:"#e6edf3"}},animationDuration:0,animationDurationUpdate:this.animationDurationUpdate(),animationEasing:"linear",animationEasingUpdate:"linear",series:[{id:"realtime-rank-series",name:this.seriesName(),type:"bar",realtimeSort:this.enableRealtimeSort(),data:n,barWidth:30,barMaxWidth:30,itemStyle:{borderRadius:0,shadowBlur:12,shadowColor:"rgba(59,130,246,0.12)"},label:{show:this.showValueLabels(),position:this.valueLabelPosition(),color:"#ffffff",fontWeight:700,fontSize:12,valueAnimation:!0,formatter:this.labelFormatter},emphasis:{itemStyle:{shadowBlur:18,shadowColor:"rgba(59,130,246,0.4)",opacity:1},label:{color:"#ffffff"}},animationDurationUpdate:this.animationDurationUpdate()}]}})}resolveAxisBounds(e){if(!e.length)return Gu;let t=e[0].value,n=e[0].value;for(let s=1;s<e.length;s+=1){let p=e[s].value;p<t&&(t=p),p>n&&(n=p)}return t>=0?{min:0,max:n>0?+(n*1.1).toFixed(2):100}:n<=0?{min:+(t*1.1).toFixed(2),max:0}:{min:+(t*1.1).toFixed(2),max:+(n*1.1).toFixed(2)}}formatValue(e){return typeof e=="number"?e.toLocaleString():String(e)}onChartCanvasClick(e){let t=e.targetText?this.normalizedItems().find(h=>h.label===e.targetText):void 0;if(t){this.labelSelected.emit(this.toOutputItem(t));return}let n=[e.offsetX,e.offsetY];if(!e.chart.containPixel({gridIndex:0},n))return;let s=e.chart.convertFromPixel({yAxisIndex:0},e.offsetY),p=Math.round(s);if(!Number.isFinite(p)||p<0)return;let m=this.normalizedItems()[p];m&&this.itemSelected.emit(this.toOutputItem(m))}toOutputItem(e){return{label:e.label,value:e.value,color:e.color,displayValue:e.displayValue,indexName:e.indexName,instrumentToken:e.instrumentToken,payoffInstrumentTokens:e.payoffInstrumentTokens,expiryIndex:e.expiryIndex,optionInstrumentTokens:e.optionInstrumentTokens,putLot:e.putLot,selectionContext:e.selectionContext}}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-realtime-rank-chart"]],inputs:{data:[1,"data"],height:[1,"height"],maxItems:[1,"maxItems"],seriesName:[1,"seriesName"],visibleCount:[1,"visibleCount"],animationDurationUpdate:[1,"animationDurationUpdate"],backgroundColor:[1,"backgroundColor"],inverse:[1,"inverse"],showValueLabels:[1,"showValueLabels"],enableRealtimeSort:[1,"enableRealtimeSort"],sortDirection:[1,"sortDirection"],valueLabelPosition:[1,"valueLabelPosition"]},outputs:{itemSelected:"itemSelected",labelSelected:"labelSelected"},decls:1,vars:4,consts:[[1,"current-chart",3,"chartCanvasClick","options","background"]],template:function(t,n){t&1&&(a(0,"app-chart",0),_("chartCanvasClick",function(p){return n.onChartCanvasClick(p)}),l()),t&2&&(Se("height",n.height()+"px"),b("options",n.chartOptions())("background",n.backgroundColor()))},dependencies:[gs],styles:[".current-chart[_ngcontent-%COMP%]{display:flex;cursor:pointer}@media(min-width:768px)and (max-width:1024px){.current-chart[_ngcontent-%COMP%]{min-width:0;max-width:100%;box-sizing:border-box}}@media(max-width:767px){.current-chart[_ngcontent-%COMP%]{min-width:0;max-width:100%;box-sizing:border-box}}"],changeDetection:0});let i=o;return i})();var Ki=(()=>{let o=class o{constructor(){this.windowing=D(ji),this.items=E.required(),this.rowHeight=E(44),this.windowSize=E(25),this.overscan=E(6),this.minViewportHeight=E(360),this.seriesName=E("Value"),this.animationDurationUpdate=E(140),this.backgroundColor=E("transparent"),this.inverse=E(!0),this.showValueLabels=E(!0),this.enableRealtimeSort=E(!1),this.sortDirection=E("desc"),this.valueLabelPosition=E("right"),this.nearEndThresholdRows=E(6),this.itemSelected=X(),this.labelSelected=X(),this.scrolledNearEnd=X(),this.nearEndEmitted=!1,this.scrollTop=O(0),this.viewportHeight=M(()=>Math.max(this.minViewportHeight(),Math.min(this.windowSize(),this.sortedItems().length||1)*this.rowHeight())),this.sortedItems=M(()=>{let e=[...this.items()??[]],t=this.sortDirection();return t==="asc"?e.sort((n,s)=>n.value-s.value):t==="desc"&&e.sort((n,s)=>s.value-n.value),e}),this.windowRange=M(()=>this.windowing.resolveRange({itemCount:this.sortedItems().length,rowHeight:this.rowHeight(),windowSize:this.windowSize(),overscan:this.overscan(),scrollTop:this.scrollTop()})),this.visibleItems=M(()=>{let e=this.windowRange();return this.sortedItems().slice(e.startIndex,e.endIndex)}),this.topOffset=M(()=>this.windowRange().startIndex*this.rowHeight()),this.totalHeight=M(()=>this.sortedItems().length*this.rowHeight()),this.chartHeight=M(()=>Math.max(this.minViewportHeight(),this.visibleItems().length*this.rowHeight())),this.visibleCount=M(()=>this.visibleItems().length)}onViewportScroll(e){let t=e.target;t instanceof HTMLElement&&(this.scrollTop.set(t.scrollTop),this.emitNearEndIfNeeded(t))}onItemSelected(e){this.itemSelected.emit(e)}onLabelSelected(e){this.labelSelected.emit(e)}emitNearEndIfNeeded(e){let t=Math.max(1,this.nearEndThresholdRows())*this.rowHeight();if(!(e.scrollTop+e.clientHeight>=e.scrollHeight-t)){this.nearEndEmitted=!1;return}this.nearEndEmitted||(this.nearEndEmitted=!0,this.scrolledNearEnd.emit())}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-windowed-bar-chart"]],inputs:{items:[1,"items"],rowHeight:[1,"rowHeight"],windowSize:[1,"windowSize"],overscan:[1,"overscan"],minViewportHeight:[1,"minViewportHeight"],seriesName:[1,"seriesName"],animationDurationUpdate:[1,"animationDurationUpdate"],backgroundColor:[1,"backgroundColor"],inverse:[1,"inverse"],showValueLabels:[1,"showValueLabels"],enableRealtimeSort:[1,"enableRealtimeSort"],sortDirection:[1,"sortDirection"],valueLabelPosition:[1,"valueLabelPosition"],nearEndThresholdRows:[1,"nearEndThresholdRows"]},outputs:{itemSelected:"itemSelected",labelSelected:"labelSelected",scrolledNearEnd:"scrolledNearEnd"},decls:4,vars:18,consts:[[1,"windowed-rank-chart__viewport",3,"scroll"],[1,"windowed-rank-chart__spacer"],[1,"windowed-rank-chart__slice"],[1,"windowed-rank-chart__chart",3,"itemSelected","labelSelected","data","height","maxItems","seriesName","visibleCount","animationDurationUpdate","backgroundColor","inverse","showValueLabels","enableRealtimeSort","sortDirection","valueLabelPosition"]],template:function(t,n){t&1&&(a(0,"div",0),_("scroll",function(p){return n.onViewportScroll(p)}),a(1,"div",1)(2,"div",2)(3,"app-realtime-rank-chart",3),_("itemSelected",function(p){return n.onItemSelected(p)})("labelSelected",function(p){return n.onLabelSelected(p)}),l()()()()),t&2&&(Se("height",n.viewportHeight(),"px"),c(),Se("height",n.totalHeight(),"px"),c(),Se("transform","translateY("+n.topOffset()+"px)"),c(),b("data",n.visibleItems())("height",n.chartHeight())("maxItems",null)("seriesName",n.seriesName())("visibleCount",n.visibleCount())("animationDurationUpdate",n.animationDurationUpdate())("backgroundColor",n.backgroundColor())("inverse",n.inverse())("showValueLabels",n.showValueLabels())("enableRealtimeSort",n.enableRealtimeSort())("sortDirection","none")("valueLabelPosition",n.valueLabelPosition()))},dependencies:[Ra],styles:["[_nghost-%COMP%]{display:block;min-width:0;height:100%}.windowed-rank-chart__viewport[_ngcontent-%COMP%]{height:100%;overflow-y:auto;overflow-x:hidden;scrollbar-color:rgba(139,148,158,.45) transparent}.windowed-rank-chart__spacer[_ngcontent-%COMP%]{position:relative;min-width:0}.windowed-rank-chart__slice[_ngcontent-%COMP%]{position:absolute;inset-inline:0;top:0;will-change:transform}.windowed-rank-chart__chart[_ngcontent-%COMP%]{display:block;width:100%;min-width:0}"],changeDetection:0});let i=o;return i})();function Ku(i,o){if(i&1&&(a(0,"header",1)(1,"h3"),d(2),l()()),i&2){let r=u();c(2),T(r.flowChartTitle())}}function $u(i,o){i&1&&(a(0,"div",3),d(1,"Loading flow-chart rows..."),l())}function Qu(i,o){if(i&1&&(a(0,"div",3),d(1),l()),i&2){let r=u();c(),T(r.chartMessage())}}function Yu(i,o){if(i&1){let r=R();a(0,"app-windowed-bar-chart",5),_("itemSelected",function(t){S(r);let n=u();return v(n.onChartItemSelected(t))})("labelSelected",function(){S(r);let t=u();return v(t.onChartLabelSelected())})("scrolledNearEnd",function(){S(r);let t=u();return v(t.onChartScrolledNearEnd())}),l()}if(i&2){let r=u();b("items",r.chartData())("windowSize",r.chartWindowSize())("overscan",r.chartOverscan)("rowHeight",r.chartRowHeight)("minViewportHeight",r.chartMinViewportHeight())("seriesName",r.chartSeriesName())("animationDurationUpdate",140)("backgroundColor","transparent")("inverse",!0)("showValueLabels",!0)("enableRealtimeSort",!1)("sortDirection",r.sortDirection())("valueLabelPosition","right")}}var Xu=new Set([Et.id,Tt.id]),Ro={near:{type:"linear",x:0,y:0,x2:1,y2:0,global:!1,colorStops:[{offset:0,color:"#15803D"},{offset:.86,color:"#013314"},{offset:.86,color:"#028432"},{offset:1,color:"#028432"}]},next:{type:"linear",x:0,y:0,x2:1,y2:0,global:!1,colorStops:[{offset:0,color:"#0044ff"},{offset:.86,color:"#001762"},{offset:.86,color:"#0044ff"},{offset:1,color:"#0044ff"}]},far:{type:"linear",x:0,y:0,x2:1,y2:0,global:!1,colorStops:[{offset:0,color:"#da0000"},{offset:.86,color:"#5a0000"},{offset:.86,color:"#da0000"},{offset:1,color:"#da0000"}]}},Do=new Intl.NumberFormat("en-IN",{minimumFractionDigits:0,maximumFractionDigits:2}),Wu=new Intl.NumberFormat("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2}),$i={near:1,next:2,far:3},Da={1:"near",2:"next",3:"far"},Zu=25,Ju=6,Na=44,em=28,Fa=360,tm=50,La=/^\d{4}-\d{2}-\d{2}$/,nm=1e5,Aa=(()=>{let o=class o{constructor(){this.store=D(ae),this.sync=D(Xe),this.page=D(de),this.settings=D(Nt),this.repository=D(Zt),this.realtime=D(ko),this.alert=D(Tn),this.protectivePutFlowItems=O([]),this.protectivePutFlowLoading=O(!1),this.protectivePutFlowMessage=O(""),this.protectivePutFlowCursor=O(null),this.protectivePutFlowHasMore=O(!0),this.protectivePutFlowSubscription=be.EMPTY,this.latestProtectivePutFlowRequestKe
16y="",this.protectivePutFlowLiveRevision=0,this.protectivePutFlowLiveSubscription=be.EMPTY,this.flowChartMode=E("multi"),this.flowChartExpiryId=E(null),this.flowChartTitle=E(""),this.compact=E(!1),this.flowMeta=this.settings.flowMeta,this.monthThresholds=this.settings.monthThresholds,this.selectedDates=this.settings.selectedDates,this.sortDirection=M(()=>this.isMaxLossFlowChart()||this.isIndexParityFlowChart()||this.isEquityOptionConversionFlowChart()||this.isLongBoxFlowChart()?"desc":this.isProtectivePutFlowChart()?"asc":this.settings.sortDirection()),this.sortValueMode=M(()=>this.settings.getSortValueMode(this.page.originId())),this.chartWindowSize=M(()=>this.compact()?8:Zu),this.chartMinViewportHeight=M(()=>this.compact()?300:this.isApiFlowChart()&&this.protectivePutFlowItems().length?Math.min(Fa,this.protectivePutFlowItems().length*Na+em):Fa),this.chartOverscan=Ju,this.chartRowHeight=Na,this.chartSeriesName=M(()=>this.isMaxLossFlowChart()?"Max Loss":this.isIndexParityFlowChart()||this.isEquityOptionConversionFlowChart()||this.isLongBoxFlowChart()||this.isCarryArbitrageFlowChart()?"Max Profit":this.isProtectivePutFlowChart()?"Breakeven Diff %":this.isParityScannerFlowChart()?"Max Profit":"Mispricing"),this.isChartLoading=M(()=>this.isApiFlowChart()&&this.protectivePutFlowLoading()&&!this.protectivePutFlowItems().length||this.isParityScannerFlowChart()&&this.store.scannerQueueLoading()&&!this.parityScannerFlowChartData().length),this.chartMessage=M(()=>this.isApiFlowChart()?this.protectivePutFlowMessage():this.isParityScannerFlowChart()?this.parityScannerFlowMessage():""),this.isProtectivePutFlowChart=M(()=>{let e=this.activeSecondaryId();return me(e)||e===ft.id||e===rt.id}),this.isMaxLossFlowChart=M(()=>me(this.activeSecondaryId())),this.isIndexParityFlowChart=M(()=>fe(this.activeSecondaryId())),this.isEquityOptionConversionFlowChart=M(()=>this.activeSecondaryId()===Pe.equityOptionShortBoxConversion),this.isLongBoxFlowChart=M(()=>this.activeSecondaryId()===Pe.equityOptionLongBox||this.activeSecondaryId()===Pe.indexOptionLongBox||this.activeSecondaryId()===Pe.equityOptionShortBox||this.activeSecondaryId()===Pe.indexOptionShortBox),this.isIndexLongBoxFlowChart=M(()=>this.activeSecondaryId()===Pe.indexOptionLongBox||this.activeSecondaryId()===Pe.indexOptionShortBox),this.isShortBoxFlowChart=M(()=>this.activeSecondaryId()===Pe.equityOptionShortBox||this.activeSecondaryId()===Pe.indexOptionShortBox),this.requiresSnapshotBeforeLiveSubscription=M(()=>this.isIndexParityFlowChart()||this.isLongBoxFlowChart()),this.isApiFlowChart=M(()=>this.isProtectivePutFlowChart()||this.isIndexParityFlowChart()||this.isEquityOptionConversionFlowChart()||this.isLongBoxFlowChart()||this.isCarryArbitrageFlowChart()),this.isParityScannerFlowChart=M(()=>In(this.activeSecondaryId())),this.isReverseCarryFlowChart=M(()=>this.activeSecondaryId()===_e.id),this.isCarryArbitrageFlowChart=M(()=>{let e=this.activeSecondaryId();return e===ge.id||e===_e.id}),this.scannerExpiryDates=M(()=>{let e=new Map,t=[];for(let s of this.store.scannerRows()){let p=this.toApiExpiryDate(s.price_matrix.expiry);if(!p)continue;let m=Number(s.price_matrix.expiry_index);if(Number.isFinite(m)&&m>0){e.has(m)||e.set(m,p);continue}t.includes(p)||t.push(p)}let n=[...e.entries()].sort((s,p)=>s[0]-p[0]).map(([,s])=>s);return[...n,...t.filter(s=>!n.includes(s))]}),this.protectivePutFlowExpiryDate=M(()=>this.resolveSelectedApiExpiryDate()),this.protectivePutFlowRequest=M(()=>{if(!this.isApiFlowChart())return null;let e=this.activeSecondaryId(),t=e===Pe.indexOptionShortBox,n=t||this.isCarryArbitrageFlowChart()?"multi":this.flowChartMode(),s=n==="single"?this.resolveSelectedTradingSymbol():"";return!e||n==="single"&&!s?null:f(f({secondary_id:e,expiries:this.isIndexParityFlowChart()?this.resolveSelectedIndexParityExpiries():this.isLongBoxFlowChart()?this.isIndexLongBoxFlowChart()?[]:this.isShortBoxFlowChart()?[]:this.resolveSelectedExpiryIds():this.isMaxLossFlowChart()?this.resolveSelectedExpiryIds():this.isEquityOptionConversionFlowChart()?this.resolveSelectedApiExpiryDates():n==="multi"?this.resolveSelectedExpiryIds():[],mode:n},s?{name:s}:{}),t?{}:{limit:tm})}),this.effectiveSelectedDates=M(()=>{let e=this.selectedDates();return e.length?e:this.flowMeta().filter(t=>t.enabled).map(t=>t.date)}),this.selectedExpiryMeta=M(()=>{let e=new Map(this.flowMeta().map(t=>[t.date,t]));return this.effectiveSelectedDates().reduce((t,n)=>{let s=e.get(n);
16return s&&t.push(F(f({},s),{threshold:this.monthThresholds()[s.id],color:Ro[s.id]})),t},[])}),this.legacyMispricingChartData=M(()=>{let e=this.store.equityRows()??[],t=this.selectedExpiryMeta(),n=this.sortValueMode();return e.reduce((s,p)=>{for(let m of t){let h=p.mispricing?.[m.mispricingKey],x=Number.isFinite(h?.value)?h?.value??0:0,I=Math.abs(x);(n==="signed"?x>m.threshold:I>m.threshold)&&s.push({label:`${p.spot_info.symbol} (${m.label})`,value:n==="signed"?x:I,displayValue:Do.format(x),color:m.color,indexName:p.spot_info.symbol,instrumentToken:h?.token||p.spot_info.instrument_token,expiryIndex:$i[m.id]})}return s},[])}),this.parityScannerFlowChartData=M(()=>{let e=new Set(this.selectedExpiryMeta().map(t=>t.id));return this.store.scannerRows().reduce((t,n,s)=>{let p=Number(n.price_matrix.value);if(!(Number.isFinite(p)&&p>0))return t;let m=this.resolveScannerFlowExpiryIndex(n),h=this.resolveScannerFlowExpiryId(m);if(e.size&&!e.has(h))return t;let x=n.trade_tokens??null,I=Ye(n,this.activeSecondaryId()),N=this.toApiExpiryDate(n.price_matrix.expiry);return t.push({label:N?`${n.spot_info.symbol} (${N})`:n.spot_info.symbol,value:p,displayValue:this.formatScannerMaxProfit(n,p),color:Ro[h],indexName:n.spot_info.symbol,instrumentToken:x?.spot??n.spot_info.instrument_token,expiryIndex:m,optionInstrumentTokens:this.resolveParityFlowOptionTokens(n),putLot:null,selectionContext:{scannerRowIndex:s,scannerRowKey:I,tradeTokens:x}}),t},[])}),this.parityScannerFlowMessage=M(()=>{let e=this.store.scannerQueueError();return e||(this.store.scannerRows().length?this.parityScannerFlowChartData().length?"":"No max-profit rows":this.store.scannerQueueLoaded()?"No scanner rows":"Waiting for scanner rows")}),this.chartData=M(()=>this.isApiFlowChart()?this.protectivePutFlowItems():this.isParityScannerFlowChart()?this.parityScannerFlowChartData():this.legacyMispricingChartData()),this.protectivePutFlowLiveSubscription=this.realtime.updates$.subscribe(e=>{this.applyProtectivePutFlowLiveUpdate(e)}),re(()=>{let e=this.protectivePutFlowRequest();this.loadProtectivePutFlowChart(e),this.requiresSnapshotBeforeLiveSubscription()||this.updateProtectivePutFlowLiveSubscription(e)})}ngOnDestroy(){this.protectivePutFlowSubscription.unsubscribe(),this.protectivePutFlowLiveSubscription.unsubscribe(),this.realtime.dispose()}onChartItemSelected(e){if(this.isApiFlowChart()){this.selectProtectivePutFlowItem(e);return}if(this.isParityScannerFlowChart()){this.selectParityScannerFlowItem(e);return}if(!e.indexName||!e.instrumentToken||!e.expiryIndex)return;let t=(this.store.marketRows()??[]).findIndex(n=>n.spot_info.symbol===e.indexName);this.sync.selectDetailsTarget({source:"hedging",indexName:e.indexName,instrumentToken:e.instrumentToken,expiryIndex:e.expiryIndex,rowIndex:t>=0?t:void 0})}onChartLabelSelected(){this.alert.ErrorAlert("API not connect.")}onChartScrolledNearEnd(){!this.isApiFlowChart()||this.isIndexParityFlowChart()||this.loadNextProtectivePutFlowPage()}loadProtectivePutFlowChart(e,t=!1){if(!e){this.realtime.unsubscribe(),this.resetProtectivePutFlowState(this.resolveProtectivePutFlowWaitingMessage());return}let n=JSON.stringify(e);!t&&n===this.latestProtectivePutFlowRequestKey||(this.requiresSnapshotBeforeLiveSubscription()&&this.realtime.unsubscribe(),this.latestProtectivePutFlowRequestKey=n,this.protectivePutFlowLiveRevision=0,this.protectivePutFlowSubscription.unsubscribe(),this.protectivePutFlowItems.set([]),this.protectivePutFlowCursor.set(null),this.protectivePutFlowHasMore.set(!0),this.protectivePutFlowLoading.set(!1),this.protectivePutFlowMessage.set(""),this.loadProtectivePutFlowPage(e,n,!0))}loadNextProtectivePutFlowPage(){if(this.isIndexParityFlowChart())return;let e=this.protectivePutFlowRequest();if(!e||this.protectivePutFlowLoading()||!this.protectivePutFlowHasMore())return;let t=JSON.stringify(e);if(t!==this.latestProtectivePutFlowRequestKey){this.loadProtectivePutFlowChart(e);return}let n=this.protectivePutFlowCursor();n&&this.loadProtectivePutFlowPage(F(f({},e),{cursor:n}),t,!1)}loadProtectivePutFlowPage(e,t,n){if(this.protectivePutFlowLoading())return;this.protectivePutFlowSubscription.unsubscribe(),this.protectivePutFlowLoading.set(!0),n&&this.protectivePutFlowMessage.set("");let s=this.protectivePutFlowLiveRevision;
16this.protectivePutFlowSubscription=this.repository.getFlowChart(e).subscribe({next:p=>{if(t!==this.latestProtectivePutFlowRequestKey||s!==this.protectivePutFlowLiveRevision)return;let m=this.toProtectivePutFlowItems(p,e.expiries??[]);this.protectivePutFlowItems.update(h=>n?m:[...h,...m]),this.applyProtectivePutFlowPagination(p),this.protectivePutFlowLoading.set(!1),this.loadMoreIfProtectivePutFlowCannotScroll(),n&&(this.protectivePutFlowMessage.set(m.length?"":this.resolveProtectivePutFlowEmptyMessage()),this.requiresSnapshotBeforeLiveSubscription()&&this.subscribeToSuccessfulSnapshotRequest(e,t))},error:p=>{if(t===this.latestProtectivePutFlowRequestKey){if(!n&&this.isInvalidCursorError(p)){this.protectivePutFlowLoading.set(!1),this.loadProtectivePutFlowChart(this.protectivePutFlowRequest(),!0);return}if(!n){this.protectivePutFlowLoading.set(!1);return}this.protectivePutFlowItems.set([]),this.protectivePutFlowCursor.set(null),this.protectivePutFlowHasMore.set(!1),this.protectivePutFlowLoading.set(!1),this.protectivePutFlowMessage.set(this.resolveFlowChartErrorMessage(p))}}})}resetProtectivePutFlowState(e=""){this.latestProtectivePutFlowRequestKey="",this.protectivePutFlowLiveRevision=0,this.protectivePutFlowSubscription.unsubscribe(),this.protectivePutFlowItems.set([]),this.protectivePutFlowCursor.set(null),this.protectivePutFlowHasMore.set(!0),this.protectivePutFlowLoading.set(!1),this.protectivePutFlowMessage.set(e)}resolveProtectivePutFlowWaitingMessage(){return this.isApiFlowChart()?this.flowChartMode()==="single"?"Select a symbol before loading flow-chart rows":"Waiting for flow-chart rows":""}loadMoreIfProtectivePutFlowCannotScroll(){this.isIndexParityFlowChart()||!this.protectivePutFlowHasMore()||!this.protectivePutFlowCursor()||this.protectivePutFlowItems().length>this.chartWindowSize()||queueMicrotask(()=>{this.loadNextProtectivePutFlowPage()})}updateProtectivePutFlowLiveSubscription(e){return k(this,null,function*(){if(!e){yield this.realtime.unsubscribe();return}yield this.realtime.subscribe(e)})}subscribeToSuccessfulSnapshotRequest(e,t){return k(this,null,function*(){!this.requiresSnapshotBeforeLiveSubscription()||t!==this.latestProtectivePutFlowRequestKey||(yield this.realtime.subscribe(e))})}applyProtectivePutFlowLiveUpdate(e){let t=this.protectivePutFlowRequest();if(!t||!this.isLiveFlowResponseForRequest(e,t))return;let n=this.toProtectivePutFlowItems(e,t.expiries??[]);this.protectivePutFlowLiveRevision+=1,this.areSameFlowItems(this.protectivePutFlowItems(),n)||this.protectivePutFlowItems.set(n),this.applyProtectivePutFlowPagination(e),this.protectivePutFlowLoading.set(!1),this.protectivePutFlowMessage.set(n.length?"":this.resolveProtectivePutFlowEmptyMessage())}isLiveFlowResponseForRequest(e,t){return t.secondary_id!==Pe.indexOptionLongBox&&t.secondary_id!==Pe.indexOptionShortBox&&t.secondary_id!==Pe.indexSpotOptionReversal&&t.secondary_id!==ge.id&&t.secondary_id!==_e.id?!0:e.secondary_id?.trim()===t.secondary_id}applyProtectivePutFlowPagination(e){if(this.isIndexParityFlowChart()){this.protectivePutFlowCursor.set(null),this.protectivePutFlowHasMore.set(!1);return}let t=this.normalizeCursor(e.metadata?.next_cursor);this.protectivePutFlowCursor.set(t),this.protectivePutFlowHasMore.set(e.metadata?.has_more===!0&&!!t)}normalizeCursor(e){return(typeof e=="string"?e.trim():"")||null}areSameFlowItems(e,t){return e.length!==t.length?!1:e.every((n,s)=>{let p=t[s];return n.label===p.label&&n.value===p.value&&n.displayValue===p.displayValue&&n.indexName===p.indexName&&n.instrumentToken===p.instrumentToken&&n.expiryIndex===p.expiryIndex&&n.putLot===p.putLot&&this.areSameNumberArrays(n.payoffInstrumentTokens,p.payoffInstrumentTokens)&&this.areSameNumberArrays(n.optionInstrumentTokens,p.optionInstrumentTokens)})}areSameNumberArrays(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((n,s)=>n===t[s])}toProtectivePutFlowItems(e,t=[]){let n=this.toApiExpiryDate(t)||this.protectivePutFlowExpiryDate(),s=this.resolveExpiryIndex(n),p=this.resolveExpiryId(n,s);return(e.data??[]).reduce((m,h)=>{let x=this.isMaxLossFlowChart(),I=this.isIndexParityFlowChart(),N=this.isEquityOptionConversionFlowChart(),B=this.isLongBoxFlowChart(),$=this.isCarryArbitrageFlowChart(),K=I||N||B||$,oe=x?h.max_loss:K?h.max_profit:h.symmetric_breakeven_percent_difference,le=Number(oe),Ce=$?this.resolveCarryArbitrageFlowInstrumentTokens(h):[],xe=$?Ce[0]??0:Number(h.equity_spot_instrument_token),Ie=Number(h.equity_option_instrument_token);if(oe==null||!Number.isFinite(le)||!x&&!K&&le<=0||!Number.isFinite(xe)||xe<=0)return m;let Ze=h.trading_symbol?.trim(),Le=(N||B||$)&&Ze?Ze:this.resolveSpotSymbol(xe),ro=$?[]:K?B?this.resolveLongBoxFlowOptionTokens(h):this.resolveConversionFlowOptionTokens(h):Number.isFinite(Ie)&&Ie>0?[Ie]:[],li=this.normalizeFlowChartExpiryBucket(h.expiry_bucket)??p,Ql=$i[li],Yl=Ro[li];return m.push({label:h.trading_symbol,value:le,displayValue:x||K?Do.format(le):`${Wu.format(le)}%`,color:Yl,indexName:Le,instrumentToken:xe,payoffInstrumentTokens:Ce,expiryIndex:Ql,optionInstrumentTokens:ro,putLot:null}),m},[])}normalizeFlowChartExpiryBucket(e){let t=e?.trim().toLowerCase();return t==="near"||t==="next"||t==="far"?t:null}selectProtectivePutFlowItem(e){let t=e.instrumentToken,n=e.expiryIndex;if(!e.indexName||typeof t!="number"||!Number.isFinite(t)||typeof n!="number"||!Number.isFinite(n))return;let s=this.store.scannerRows().findIndex(p=>p.spot_info.instrument_token===t||p.spot_info.symbol===e.indexName);this.sync.selectDetailsTarget({source:"scanner",indexName:e.indexName,instrumentToken:t,expiryIndex:n,rowIndex:s>=0?s:void 0,optionInstrumentTokens:e.optionInstrumentTokens??[],payoffInstrumentTokens:e.payoffInstrumentTokens??[],putLot:e.putLot??null})}
16selectParityScannerFlowItem(e){let t=this.asScannerFlowChartItem(e);if(!t)return;let n=this.store.scannerRows(),s=this.activeSecondaryId(),p=t.selectionContext,m=p.scannerRowIndex,h=n[m];if((!h||Ye(h,s)!==p.scannerRowKey)&&(m=n.findIndex(N=>Ye(N,s)===p.scannerRowKey),h=m>=0?n[m]:void 0),!h)return;let x=h.trade_tokens??p.tradeTokens??null,I=x?.spot??h.spot_info.instrument_token;this.sync.selectDetailsTarget({source:"scanner",indexName:h.spot_info.symbol,instrumentToken:I,expiryIndex:this.resolveScannerFlowExpiryIndex(h),rowKey:Ye(h,s),rowIndex:m,tradeTokens:x,optionInstrumentTokens:this.resolveParityFlowOptionTokens(h),putLot:null}),Xu.has(s)&&this.store.markPriceMatrixSelection()}asScannerFlowChartItem(e){let t=e.selectionContext;return typeof t?.scannerRowIndex=="number"&&typeof t.scannerRowKey=="string"?e:null}activeSecondaryId(){return Y(this.page.originId())??""}resolveSelectedTradingSymbol(){let e=(this.store.selectedIndexName()??"").trim();if(e)return e;let t=this.store.selectedInstrumentToken();if(!Number.isFinite(t))return"";let n=this.store.marketRows().find(p=>p.spot_info.instrument_token===t);return n?n.spot_info.symbol:this.store.scannerRows().find(p=>p.spot_info.instrument_token===t)?.spot_info.symbol??""}resolveSelectedExpiryIds(){let e=new Set(this.selectedDates());return this.flowMeta().reduce((t,n)=>((e.has(n.id)||e.has(n.label)||e.has(n.date))&&t.push(n.id),t),[])}resolveSelectedIndexParityExpiries(){return this.selectedDates().reduce((e,t)=>{let n=t.trim().toLowerCase(),p=this.flowMeta().find(m=>m.id===n||m.label.toLowerCase()===n||m.date.toLowerCase()===n)?.id??(La.test(t)?t:null);return p&&!e.includes(p)&&e.push(p),e},[])}resolveSelectedApiExpiryDates(){let e=this.selectedDates(),t=[];for(let n of e){let s=this.toApiExpiryDate(n)||this.resolveMetaApiExpiryDate(n);if(!s)return[];let p=s;t.includes(p)||t.push(p)}return t}resolveSelectedApiExpiryDate(){let e=this.flowChartExpiryId();if(e)return this.resolveApiExpiryDateById(e);let t=this.settings.selectedDate(),n=this.toApiExpiryDate(t);if(n)return n;let s=this.resolveMetaApiExpiryDate(t);if(s)return s;for(let p of this.settings.selectedDates()){let m=this.toApiExpiryDate(p);if(m)return m;let h=this.resolveMetaApiExpiryDate(p);if(h)return h}return this.scannerExpiryDates()[0]??""}resolveApiExpiryDateById(e){let t=this.flowMeta().find(s=>s.id===e),n=this.toApiExpiryDate(t?.date);return n||(this.scannerExpiryDates()[$i[e]-1]??"")}resolveMetaApiExpiryDate(e){let t=this.flowMeta().find(s=>s.date===e||s.label===e||s.id===e);if(!t)return"";let n=this.toApiExpiryDate(t.date);return n||(this.scannerExpiryDates()[$i[t.id]-1]??"")}resolveExpiryIndex(e){let t=this.scannerExpiryDates().indexOf(e);return t>=0?t+1:1}resolveExpiryId(e,t){return this.flowMeta().find(s=>this.toApiExpiryDate(s.date)===e)?.id??Da[t]??"near"}resolveScannerFlowExpiryIndex(e){let t=Number(e.price_matrix.expiry_index);return Number.isFinite(t)&&t>0?t:1}resolveScannerFlowExpiryId(e){return Da[e]??"near"}resolveParityFlowOptionTokens(e){let t=e.trade_tokens;return t?[t.pe,t.ce].filter(n=>typeof n=="number"&&Number.isFinite(n)&&n>0):[]}resolveConversionFlowOptionTokens(e){let t=Number(e.call_option_instrument_token);return[Number.isFinite(t)&&t>0?t:e.equity_option_instrument_token,e.put_option_instrument_token].reduce((s,p)=>{let m=Number(p);return Number.isFinite(m)&&m>0&&!s.includes(m)&&s.push(m),s},[])}resolveLongBoxFlowOptionTokens(e){return(e.processed_instrument_tokens??[]).reduce((t,n)=>{let s=Number(n);return Number.isFinite(s)&&s>0&&!t.includes(s)&&t.push(s),t},[])}resolveCarryArbitrageFlowInstrumentTokens(e){let[t,n]=e.processed_instrument_tokens??[],s=Number(t),p=Number(n);return Number.isFinite(s)&&s>0&&Number.isFinite(p)&&p>0?[s,p]:[]}formatScannerMaxProfit(e,t){return e.price_matrix.max_profit_is_unlimited===!0||t>nm?"Unlimited":Do.format(t)}resolveSpotSymbol(e){let t=this.store.marketRows().find(s=>s.spot_info.instrument_token===e);return t?t.spot_info.symbol:this.store.scannerRows().find(s=>s.spot_info.instrument_token===e)?.spot_info.symbol??`Token ${e}`}toApiExpiryDate(e){let t=Array.isArray(e)?(e[0]??"").trim():(e??"").trim();return La.test(t)?t:""}resolveFlowChartErrorMessage(e){if(typeof e=="object"&&e!==null&&"error"in e){let t=e.error;if(typeof t?.message=="string"&&t.message.trim())return t.message}return"Unable to load flow-chart rows"}resolveProtectivePutFlowEmptyMessage(){return this.isCarryArbitrageFlowChart()?this.isReverseCarryFlowChart()?"No reverse-carry opportunities":"No carry-arbitrage opportunities":this.isMaxLossFlowChart()?"No eligible put found":this.isIndexParityFlowChart()||this.isEquityOptionConversionFlowChart()||this.isLongBoxFlowChart()?this.activeSecondaryId()===It.id?"No reversal opportunities":this.isLongBoxFlowChart()?this.isShortBoxFlowChart()?"No short-box opportunities":"No long-box opportunities":"No conversion opportunities":"No flow-chart rows"}isInvalidCursorError(e){let t=typeof e=="object"&&e!==null&&"error"in e?e.error:e;if(typeof t=="string")return t.toLowerCase().includes("invalid_cursor");if(typeof t!="object"||t===null)return!1;let n=t;return[n.code,n.error,n.message].some(s=>typeof s=="string"&&s.toLowerCase().includes("invalid_cursor"))}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-mispricing-flow"]],inputs:{flowChartMode:[1,"flowChartMode"],flowChartExpiryId:[1,"flowChartExpiryId"],flowChartTitle:[1,"flowChartTitle"],compact:[1,"compact"]},features:[Ct([ko])],decls:6,vars:4,consts:[[1,"mispricing-flow-panel"],[1,"mispricing-flow-panel__header"],[1,"mispricing-flow-panel__body"],[1,"mispricing-flow-status"],[1,"chart",3,"items","windowSize","overscan","rowHeight","minViewportHeight","seriesName","animationDurationUpdate","backgroundColor","inverse","showValueLabels","enableRealtimeSort","sortDirection","valueLabelPosition"],[1,"chart",3,"itemSelected","labelSelected","scrolledNearEnd","items","windowSize","overscan","rowHeight","minViewportHeight","seriesName","animationDurationUpdate","backgroundColor","inverse","showValueLabels","enableRealtimeSort","sortDirection","valueLabelPosition"]],template:function(t,n){t&1&&(a(0,"section",0),P(1,Ku,3,1,"header",1),a(2,"div",2),P(3,$u,2,0,"div",3)(4,Qu,2,1,"div",3)(5,Yu,1,13,"app-windowed-bar-chart",4),l()()),t&2&&(w("mispricing-flow-panel--compact",n.compact()),c(),C(n.flowChartTitle()?1:-1),c(2),C(n.isChartLoading()?3:n.chartMessage()?4:5))},dependencies:[Ki],styles:["[_nghost-%COMP%]{display:block;--bg-main: #0b1220;--bg-secondary: #0a0f1a;--text-primary: #e6edf3;--text-secondary: #8b949e;--active: #1f6feb;--inactive: #161b22;--border: #30363d}.mispricing-flow-panel[_ngcontent-%COMP%]{min-width:0;width:100%;display:flex;flex-direction:column;background:#161b22;border:1px solid rgba(48,54,61,.9);border-radius:18px;padding:16px;box-shadow:0 18px 38px #0000006b,0 0 0 1px #3b82f60f,0 0 30px #2563eb14}.mispricing-flow-panel--compact[_ngcontent-%COMP%]{padding:12px;border-radius:14px}.mispricing-flow-panel__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:48px;border-bottom:1px solid rgba(255,255,255,.08);padding-bottom:14px;flex-wrap:wrap}.mispricing-flow-panel--compact[_ngcontent-%COMP%]   .mispricing-flow-panel__header[_ngcontent-%COMP%]{min-height:32px;padding-bottom:8px}.mispricing-flow-panel__header[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;color:var(--text-primary);font-size:18px;font-weight:600;letter-spacing:.01em}.mispricing-flow-panel--compact[_ngcontent-%COMP%]   .mispricing-flow-panel__header[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{font-size:16px}.header-copy[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:4px 0 0;color:var(--text-secondary);font-size:13px;line-height:1.35}.mispricing-flow-panel__body[_ngcontent-%COMP%]{flex:1 1 auto;min-height:87vh;max-height:87vh;overflow:hidden;color:var(--text-secondary);text-align:center;scrollbar-color:rgba(139,148,158,.45) transparent}.mispricing-flow-panel--compact[_ngcontent-%COMP%]   .mispricing-flow-panel__body[_ngcontent-%COMP%]{min-height:320px;max-height:360px}.mispricing-flow-panel__body[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:0}.mispricing-flow-status[_ngcontent-%COMP%]{min-height:360px;display:flex;align-items:center;justify-content:center;color:#c9d1d9;font-size:14px;font-weight:600}.header-actions[_ngcontent-%COMP%]{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}.header-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{background:var(--inactive);border:1px solid var(--border);color:var(--text-secondary);padding:8px 14px;border-radius:10px;font-size:13px;font-weight:600;line-height:1.1;white-space:nowrap;cursor:pointer;transition:background-color .22s ease,border-color .22s ease,color .22s ease,box-shadow .22s ease,transform .22s ease}.header-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]:hover{color:var(--text-primary);border-color:#3b82f661;box-shadow:0 0 12px #3b82f62e;transform:translateY(-1px)}.header-actions[_ngcontent-%COMP%]   button.active[_ngcontent-%COMP%]{background:var(--active);border-color:var(--active);color:#fff;box-shadow:0 10px 24px #1f6feb40}.settings-button[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;min-width:46px;padding:8px 12px}.settings-button[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:18px}.chart[_ngcontent-%COMP%]{width:100%;min-width:0;height:100%}.settings-overlay[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:100000;display:flex;align-items:center;justify-content:center;padding:16px;background:#030814b3}.settings-overlay__dialog[_ngcontent-%COMP%]{width:min(860px,100vw - 32px);height:min(760px,100vh - 32px);box-shadow:0 28px 80px #0000008c}"],changeDetection:0});let i=o;return i})();function im(i,o){i&1&&y(0,"span",3)}function om(i,o){i&1&&y(0,"span",3)}function rm(i,o){if(i&1){let r=R();a(0,"div",7),y(1,"div",8),a(2,"button",9),_("click",function(){S(r);let t=u();return v(t.onModeSelect("single"))}),a(3,"span",4),d(4),l()(),a(5,"button",10),_("click",function(){S(r);let t=u();return v(t.onModeSelect("multi"))}),a(6,"span",4),d(7),l()()()}if(i&2){let r=u();c(),b("ngStyle",r.modeSliderStyle()),c(),w("active",!r.multiMode()),H("aria-pressed",!r.multiMode()),c(2),T(r.compact()?"S":"Single"),c(),w("active",r.multiMode()),H("aria-pressed",r.multiMode()),c(2),T(r.compact()?"M":"Multi")}}var Qi=(()=>{let o=class o{constructor(){this.destroyRef=D(vn),this.flowChartVisible=E(!1),this.multiMode=E(!0),this.showModeToggle=E(!0),this.compact=E(!1),this.action=X(),this.modeSliderStyle=O({transform:"translateX(100%)"}),this.showTooltip=O(!1),re(()=>{this.updateModeSlider()}),this.destroyRef.onDestroy(()=>{this.idleTimer&&clearTimeout(this.idleTimer)})}onSelect(e){let t=e==="flow";if(this.flowChartVisible()===t){this.resetIdleTimer();return}this.action.emit("toggle-chart"),this.resetIdleTimer()}onModeSelect(e){let t=e==="multi";this.multiMode()!==t&&(this.modeSliderStyle.set(this.resolveModeSliderStyle(t)),this.action.emit("toggle-multi-mode"))}updateModeSlider(){this.modeSliderStyle.set(this.resolveModeSliderStyle(this.multiMode()))}resolveModeSliderStyle(e){return{transform:`translateX(${e?"100%":"
160%"})`}}resetIdleTimer(){this.idleTimer&&clearTimeout(this.idleTimer),this.showTooltip.set(!1),this.idleTimer=setTimeout(()=>{this.showTooltip.set(!0)},2200)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-view-toggle"]],inputs:{flowChartVisible:[1,"flowChartVisible"],multiMode:[1,"multiMode"],showModeToggle:[1,"showModeToggle"],compact:[1,"compact"]},outputs:{action:"action"},decls:13,vars:15,consts:[[1,"view-toggle-shell"],[1,"toggle","toggle--view"],["type","button","aria-label","Scanner",1,"option","option--scanner",3,"click"],["aria-hidden","true",1,"blink-dot"],[1,"option-label"],["type","button","aria-label","Flow",1,"option","option--flow",3,"click"],[1,"tooltip"],[1,"toggle","toggle--mode"],[1,"slider","slider--mode",3,"ngStyle"],["type","button","aria-label","Single",1,"option","option--mode",3,"click"],["type","button","aria-label","Multi",1,"option","option--mode",3,"click"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"div",1)(2,"button",2),_("click",function(){return n.onSelect("scanner")}),P(3,im,1,0,"span",3),a(4,"span",4),d(5),l()(),a(6,"button",5),_("click",function(){return n.onSelect("flow")}),a(7,"span",4),d(8),l(),P(9,om,1,0,"span",3),l(),a(10,"div",6),d(11," See real-time price movement -> "),l()(),P(12,rm,8,9,"div",7),l()),t&2&&(w("view-toggle-shell--compact",n.compact()),c(2),w("active",!n.flowChartVisible()),H("aria-pressed",!n.flowChartVisible()),c(),C(n.flowChartVisible()?3:-1),c(2),g(" ",n.compact()?"S":"Scanner"," "),c(),w("active",n.flowChartVisible()),H("aria-pressed",n.flowChartVisible()),c(2),g(" ",n.compact()?"F":"Flow"," "),c(),C(n.flowChartVisible()?-1:9),c(),w("show",n.showTooltip()),c(2),C(n.showModeToggle()?12:-1))},dependencies:[hi],styles:['.view-toggle-shell[_ngcontent-%COMP%]{position:relative;display:inline-flex;align-items:center;align-self:stretch;gap:8px}.toggle[_ngcontent-%COMP%]{position:relative;display:inline-flex;align-items:stretch;gap:2px;width:auto;min-height:var(--toolbar-height, 30px);padding:2px;border:1px solid rgba(82,90,108,.58);border-radius:999px;background:radial-gradient(circle at top,rgba(255,255,255,.05),transparent 58%),linear-gradient(180deg,#171c25,#11161d);box-shadow:inset 0 1px #ffffff0f,0 8px 18px #00000038;overflow:hidden}.toggle--mode[_ngcontent-%COMP%]{display:inline-grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0;width:156px;border-color:#5ce2be38;background:radial-gradient(circle at top,rgba(117,245,205,.1),transparent 58%),linear-gradient(180deg,#121923,#0d1219)}.slider[_ngcontent-%COMP%]{position:absolute;top:2px;left:2px;height:calc(100% - 4px);width:calc(50% - 2px);border-radius:50px;box-shadow:0 6px 12px #0000002e,inset 0 1px #ffffff2e;transition:transform .35s ease,width .35s ease,background .35s ease;z-index:1}.slider--mode[_ngcontent-%COMP%]{background:#237d74;box-shadow:0 6px 16px #4f8ff038,inset 0 1px #ffffff47}.option[_ngcontent-%COMP%]{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;border:none;border-radius:999px;background:transparent;color:#e8eff8b3;font-weight:600;cursor:pointer;z-index:2;min-height:calc(var(--toolbar-height, 30px) - 4px);padding:0 10px;white-space:nowrap;transition:background-color .25s ease,box-shadow .25s ease,color .25s ease,transform .25s ease,opacity .25s ease;font-size:12px;line-height:1;letter-spacing:.015em}.option-label[_ngcontent-%COMP%]{position:relative;z-index:1}.option--mode[_ngcontent-%COMP%]{width:100%;padding:0 10px;color:#d1e8f1b8}.option.active[_ngcontent-%COMP%]{color:#fff;box-shadow:0 6px 12px #0000002e,inset 0 1px #ffffff2e;text-shadow:0 0 12px rgba(255,255,255,.12)}.option--scanner.active[_ngcontent-%COMP%]{background:#c90076}.option--flow.active[_ngcontent-%COMP%]{background:#00f}.option--mode.active[_ngcontent-%COMP%]{color:#fff;box-shadow:none;text-shadow:0 0 12px rgba(102,232,168,.24)}.blink-dot[_ngcontent-%COMP%]{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:#ffd84d;box-shadow:0 0 #ffd84db3;animation:_ngcontent-%COMP%_blinkDot 1s infinite ease-in-out;z-index:3}.tooltip[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 10px);left:50%;transform:translate(-50%) translateY(-4px);background:#090d12f5;color:#f4f7fcf5;padding:6px 10px;border:1px solid rgba(70,79,96,.65);border-radius:10px;font-size:10px;line-height:1.2;opacity:0;pointer-events:none;box-shadow:0 10px 20px #00000038;transition:opacity .25s ease,transform .25s ease;white-space:nowrap;z-index:5}.tooltip[_ngcontent-%COMP%]:before{content:"";position:absolute;
16left:50%;bottom:100%;width:8px;height:8px;background:#090d12f5;border-left:1px solid rgba(70,79,96,.65);border-top:1px solid rgba(70,79,96,.65);transform:translate(-50%) rotate(45deg)}.tooltip.show[_ngcontent-%COMP%]{opacity:1;transform:translate(-50%) translateY(0)}.option[_ngcontent-%COMP%]:focus-visible{outline:2px solid rgba(56,182,255,.6);outline-offset:-2px;border-radius:999px}.view-toggle-shell--compact[_ngcontent-%COMP%]{gap:4px}.view-toggle-shell--compact[_ngcontent-%COMP%]   .toggle--view[_ngcontent-%COMP%]{display:inline-grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0;width:78px}.view-toggle-shell--compact[_ngcontent-%COMP%]   .toggle--mode[_ngcontent-%COMP%]{width:78px}.view-toggle-shell--compact[_ngcontent-%COMP%]   .option[_ngcontent-%COMP%]{gap:4px;padding:0 7px;font-size:10px}.view-toggle-shell--compact[_ngcontent-%COMP%]   .option--mode[_ngcontent-%COMP%]{padding:0 6px}.view-toggle-shell--compact[_ngcontent-%COMP%]   .blink-dot[_ngcontent-%COMP%]{width:4px;height:4px}@keyframes _ngcontent-%COMP%_blinkDot{0%,to{opacity:.35;transform:scale(.85);box-shadow:0 0 #ffd84d8c}50%{opacity:1;transform:scale(1);box-shadow:0 0 0 4px #ffd84d00}}@media(max-width:992px){.option[_ngcontent-%COMP%]{padding:0 9px;font-size:11px}}'],changeDetection:0});let i=o;return i})();function sm(i,o){if(i&1){let r=R();a(0,"button",8),_("click",function(){let t=S(r).$implicit,n=u(2);return v(n.selectMispricingDate(t))}),d(1),l()}if(i&2){let r=o.$implicit,e=u(2);w("active",e.selectedMispricingDatesSet().has(r)),c(),g(" ",r," ")}}function am(i,o){if(i&1){let r=R();a(0,"div",0)(1,"div",1)(2,"app-board-panel-header",2),_("settingsClick",function(){S(r);let t=u();return v(t.openSettings("scanner"))}),l(),y(3,"app-hedge-protection-board-tables",3),l(),a(4,"div",1)(5,"app-board-panel-header",2),_("settingsClick",function(){S(r);let t=u();return v(t.openSettings("mispricing-flow"))}),a(6,"div",4)(7,"div",5),P(8,sm,2,3,"button",6),l()()(),y(9,"app-mispricing-flow",7),l()()}if(i&2){let r=u();c(2),b("title",""),c(),b("isScanner",!0)("compact",r.ui.hideScannerColumns()),c(2),b("title",r.ui.hideScannerColumns()?"F":"Flow"),c(3),b("ngForOf",r.mispricingDates())("ngForTrackBy",r.trackByValue),c(),b("flowChartMode",r.ui.isMultiMode()?"multi":"single")}}function lm(i,o){if(i&1){let r=R();a(0,"app-hedge-view-toggle",10),_("action",function(t){S(r);let n=u(2);return v(n.toggleMispricingView(t))}),l()}if(i&2){let r=u(2);b("flowChartVisible",r.ui.isFlowChart())("multiMode",r.ui.isMultiMode())("showModeToggle",r.canShowSingleMultiToggle())("compact",r.ui.hideScannerColumns())}}function cm(i,o){if(i&1){let r=R();a(0,"button",8),_("click",function(){let t=S(r).$implicit,n=u(2);return v(n.selectMispricingDate(t))}),d(1),l()}if(i&2){let r=o.$implicit,e=u(2);w("active",e.selectedMispricingDatesSet().has(r)),c(),g(" ",r," ")}}function dm(i,o){if(i&1){let r=R();a(0,"app-board-panel-header",2),_("settingsClick",function(){S(r);let t=u();return v(t.openSettings("mispricing-flow"))}),a(1,"div",4),P(2,lm,1,4,"app-hedge-view-toggle",9),a(3,"div",5),P(4,cm,2,3,"button",6),l()()(),y(5,"app-mispricing-flow",7)}if(i&2){let r=u();b("title",""),c(2),C(r.canShowMispricingViewToggle()?2:-1),c(2),b("ngForOf",r.mispricingDates())("ngForTrackBy",r.trackByValue),c(),b("flowChartMode",r.ui.isMultiMode()?"multi":"single")}}function pm(i,o){if(i&1){let r=R();a(0,"app-hedge-view-toggle",10),_("action",function(t){S(r);let n=u(2);return v(n.toggleMispricingView(t))}),l()}if(i&2){let r=u(2);b("flowChartVisible",r.ui.isFlowChart())("multiMode",r.ui.isMultiMode())("showModeToggle",r.canShowSingleMultiToggle())("compact",r.ui.hideScannerColumns())}}function um(i,o){if(i&1){let r=R();a(0,"app-board-panel-header",2),_("settingsClick",function(){S(r);let t=u();return v(t.openSettings("scanner"))}),a(1,"div",4),P(2,pm,1,4,"app-hedge-view-toggle",9),l()(),y(3,"app-hedge-protection-board-tables",3)}if(i&2){let r=u();b("title",""),c(2),C(r.canShowMispricingViewToggle()?2:-1),c(),b("isScanner",!0)("compact",r.ui.hideScannerColumns())}}var mm=new Set([ge.id,_e.id,je.id,Xt.id,xi.id,Et.id,j.id,ie.id,Tt.id,ue.id,mt.id,ee.id,Q.id,It.id,ft.id,rt.id,kn]),hm=new Set([ht,Gt]),No=(()=>{let o=class o{constructor(){this.ui=D(he),this.page=D(de),this.mispricingSettings=D(Nt),this.settingsRequested=X(),this.mispricingDates=this.mispricingSettings.dates,this.selectedMispricingDates=this.mispricingSettings.selectedDates,this.selectedMispricingDatesSet=M(()=>new Set(this.selectedMispricingDates())),this.isProtectivePutBreakevenScanner=M(()=>{let e=Y(this.page.originId())??"";return e===ft.id||e===rt.id}),this.isMaxLossFlowChart=M(()=>me(Y(this.page.originId())??"")),this.canShowMispricingViewToggle=M(()=>mm.has(Y(this.page.originId())??this.page.originId())),this.canShowSingleMultiToggle=M(()=>this.isMaxLossFlowChart()||!this.isProtectivePutBreakevenScanner()&&hm.has(this.page.primaryId())),this.showMispricingFlow=M(()=>this.canShowMispricingViewToggle()&&this.ui.isFlowChart())}openSettings(e){this.settingsRequested.emit(e)}toggleMispricingView(e){if(this.canShowMispricingViewToggle()){if(e==="toggle-chart"){let t=!this.ui.isFlowChart();this.ui.toggleFlowChart(),t&&this.isProtectivePutBreakevenScanner()&&!this.ui.isMultiMode()&&this.ui.toggleMultiMode();return}e==="toggle-multi-mode"&&this.canShowSingleMultiToggle()&&this.ui.toggleMultiMode()}}selectMispricingDate(e){if(this.selectedMispricingDates().includes(e)){let t=this.selectedMispricingDates().filter(n=>n!==e);if(!t.length)return;this.selectedMispricingDates.set(t),this.mispricingSettings.selectedDate(
16)===e&&this.mispricingSettings.selectedDate.set(t[0]);return}this.selectedMispricingDates.set([...this.selectedMispricingDates(),e])}trackByValue(e,t){return t}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-board-scanner-panel"]],outputs:{settingsRequested:"settingsRequested"},decls:3,vars:1,consts:[[1,"scanner-split-layout"],[1,"scanner-split-panel"],[3,"settingsClick","title"],[3,"isScanner","compact"],["panel-controls","",1,"mispricing-header-controls"],[1,"mispricing-expiry-actions"],["type","button","class","mispricing-expiry-button",3,"active","click",4,"ngFor","ngForOf","ngForTrackBy"],[3,"flowChartMode"],["type","button",1,"mispricing-expiry-button",3,"click"],[3,"flowChartVisible","multiMode","showModeToggle","compact"],[3,"action","flowChartVisible","multiMode","showModeToggle","compact"]],template:function(t,n){t&1&&P(0,am,10,7,"div",0)(1,dm,6,5)(2,um,4,4),t&2&&C(n.ui.isScannerSplitView()?0:n.showMispricingFlow()?1:2)},dependencies:[Ft,oi,ze,Aa,Qi],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;min-height:90vh;height:90vh;max-height:90vh;min-width:0;overflow:hidden}[_nghost-%COMP%] > app-hedge-protection-board-tables[_ngcontent-%COMP%], [_nghost-%COMP%] > app-mispricing-flow[_ngcontent-%COMP%], [_nghost-%COMP%] > .scanner-split-layout[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;max-height:100%}.scanner-split-layout[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;min-width:0;min-height:0;height:100%;max-height:100%}.scanner-split-panel[_ngcontent-%COMP%]{display:flex;flex-direction:column;min-width:0;min-height:0;max-height:100%;overflow:hidden}.scanner-split-panel[_ngcontent-%COMP%]   app-hedge-protection-board-tables[_ngcontent-%COMP%], .scanner-split-panel[_ngcontent-%COMP%]   app-mispricing-flow[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0;max-height:100%}.mispricing-header-controls[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:1 1 auto;min-width:0}.mispricing-expiry-actions[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}.mispricing-expiry-button[_ngcontent-%COMP%]{background:#14181f;border:1px solid #2f3847;color:#9aa4b2;padding:6px 12px;border-radius:10px;font-size:12px;font-weight:600;line-height:1.1;white-space:nowrap;cursor:pointer;transition:background-color .22s ease,border-color .22s ease,color .22s ease,box-shadow .22s ease,transform .22s ease}.mispricing-expiry-button[_ngcontent-%COMP%]:hover{color:#fff;border-color:#00c;transform:translateY(-1px)}.mispricing-expiry-button.active[_ngcontent-%COMP%]{background:#00c;border-color:#00c;color:#fff}.mispricing-header-controls[_ngcontent-%COMP%]   app-hedge-view-toggle[_ngcontent-%COMP%]{flex:0 0 auto}.mispricing-header-controls[_ngcontent-%COMP%]   .mispricing-expiry-actions[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0}@media(max-width:1200px){.scanner-split-layout[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr)}}"],changeDetection:0});let i=o;return i})();function Fo(i){return Object.entries(i??{}).sort(([o],[r])=>o.localeCompare(r)).map(([o,r])=>F(f({},r),{expiry:o}))}var gm="equity-option-conversion-price-matrix-updated",Ua="SubscribeEquityOptionConversionPriceMatrix",Ha="UnsubscribeEquityOptionConversionPriceMatrix",Va=(()=>{let o=class o{constructor(e,t){this.signalR=e,this.zone=t,this.updatesSubject=new pe,this.currentRequest=null,this.currentRequestKe
16y="",this.pendingUpdate=null,this.pendingFrame=0,this.priceMatrixUpdated$=this.updatesSubject.asObservable(),this.hubConnection=this.signalR.connection,this.hubConnection.on(gm,n=>{this.enqueueUpdate(n)}),this.hubConnection.onreconnected(()=>{this.resubscribeCurrentRequest()})}subscribe(e){return k(this,null,function*(){let t=this.toLiveRequest(e),n=JSON.stringify(t);this.currentRequestKey!==n&&(yield this.unsubscribeCurrentSelection(),this.currentRequest=t,this.currentRequestKey=n,yield this.invokePriceMatrixMethod(Ua,t))})}unsubscribeCurrentSelection(){return k(this,null,function*(){let e=this.currentRequest;e&&(this.currentRequest=null,this.currentRequestKey="",this.clearPendingUpdate(),yield this.invokePriceMatrixMethod(Ha,e))})}enqueueUpdate(e){this.pendingUpdate=e,!this.pendingFrame&&(this.pendingFrame=requestAnimationFrame(()=>{this.pendingFrame=0;let t=this.pendingUpdate;this.pendingUpdate=null,!(!t||!this.currentRequest)&&this.zone.run(()=>this.updatesSubject.next(t))}))}clearPendingUpdate(){this.pendingUpdate=null,this.pendingFrame&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=0)}resubscribeCurrentRequest(){return k(this,null,function*(){this.currentRequest&&(yield this.invokePriceMatrixMethod(Ua,this.currentRequest))})}invokePriceMatrixMethod(e,t){return k(this,null,function*(){if(this.hubConnection.state===se.Connected)try{yield this.hubConnection.invoke(e,t)}catch(n){if(e===Ha&&this.isConnectionClosedInvocationError(n))return;console.error(`${e} failed:`,n)}})}isConnectionClosedInvocationError(e){let t=e instanceof Error?e.message:typeof e=="string"?e:String(e?.message??"");return t.includes("Invocation canceled")&&t.includes("underlying connection being closed")}toLiveRequest(e){return{secondary_id:e.secondary_id?.trim()??"",instrument_token:Number(e.instrument_token),segment:e.segment}}};o.\u0275fac=function(t){return new(t||o)(V(Fe),V(qe))},o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var Ba="box-spread-best-opportunity-changed",qa="SubscribeBoxSpreadBestOpportunity",Ga="UnsubscribeBoxSpreadBestOpportunity",Yi=(()=>{let o=class o{constructor(e,t,n){this.signalR=e,this.zone=t,this.payoffRepository=n,this.updatesSubject=new pe,this.activeRequestKey="",this.pendingRequestKey="",this.requestGeneration=0,this.currentResponse=null,this.currentSubscriptionRequest=null,this.lastSequence=null,this.recoveryInProgress=!1,this.eventBound=!1,this.bestOpportunityUpdated$=this.updatesSubject.asObservable(),this.handleUpdate=s=>{if(!(!this.matchesCurrentSubscription(s)||!this.isValidDelta(s))){if(s.is_initial){this.lastSequence=this.lastSequence===null?s.sequence:Math.max(this.lastSequence,s.sequence),this.applyDelta(s);return}if(this.lastSequence!==null&&s.sequence!==this.lastSequence+1){this.recoverFromSequenceGap();return}this.lastSequence=s.sequence,this.applyDelta(s)}},this.hubConnection=this.signalR.connection,this.hubConnection.onreconnected(()=>{this.resubscribeCurrentRequest()})}initialize(e){return k(this,null,function*(){let t=this.normalizeRequest(e),n=JSON.stringify(t);if(this.activeRequestKey===n||this.pendingRequestKey===n)return;this.bindEvent();let s=++this.requestGeneration;this.pendingRequestKey=n;let p;try{p=yield this.loadBestOpportunity(t)}catch(x){throw this.isPendingRequest(n,s)&&(this.pendingRequestKey=""),x}if(!this.isPendingRequest(n,s))return;this.pendingRequestKey="";let m=this.resolveUnderlyingToken(t,p);if(m===null&&this.currentSubscriptionRequest)return;if(this.activeRequestKey=n,this.currentResponse=p,this.lastSequence=null,this.emitResponse(p),m===null){this.currentSubscriptionRequest=null;return}let h=this.toSubscriptionRequest(t,m);this.currentSubscriptionRequest=h;try{yield this.signalR.Init()}catch(x){console.error("Unable to initialize box-spread SignalR:",x);return}this.isActiveRequest(n,s)&&(yield this.invokeSubscribe(h))})}cleanup(){return k(this,null,function*(){let e=this.currentSubscriptionRequest!==null;this.requestGeneration+=1,this.activeRequestKey="",this.pendingRequestKey="",this.currentResponse=null,this.currentSubscriptionRequest=null,this.lastSequence=null,this.recoveryInProgress=!1,this.unbindEvent(),e&&(yield this.invokeUnsubscribe())})}bindEvent(){this.eventBound||(this.hubConnection.on(Ba,this.handleUpdate),this.eventBound=!0)}
16unbindEvent(){this.eventBound&&(this.hubConnection.off(Ba,this.handleUpdate),this.eventBound=!1)}resubscribeCurrentRequest(){return k(this,null,function*(){let e=this.currentSubscriptionRequest;!e||e.instrument_token<=0||(this.lastSequence=null,yield this.invokeSubscribe(e))})}recoverFromSequenceGap(){return k(this,null,function*(){if(this.recoveryInProgress)return;let e=this.currentSubscriptionRequest;if(!e)return;let t=JSON.stringify(e),n=this.requestGeneration;this.recoveryInProgress=!0;try{let s=yield this.loadBestOpportunity(e);if(!this.isCurrentSubscription(t,n))return;this.currentResponse=s,this.lastSequence=null,this.emitResponse(s),yield this.invokeSubscribe(e)}catch(s){console.error("Unable to recover box-spread best opportunity:",s)}finally{this.recoveryInProgress=!1}})}applyDelta(e){let t=this.currentResponse;if(!t)return;let n=t.data[e.expiry],s=n?f({},n):{name:e.underlying_symbol,expiry:e.expiry,side:e.side,snapshot_count:0,snapshots:[]};if(e.action==="upsert"&&e.snapshot)s.name=e.underlying_symbol,s.side=e.side,s.snapshot_count=1,s.snapshots=[e.snapshot];else if(e.action==="remove")s.snapshot_count=0,s.snapshots=[];else return;let p=F(f({},t),{data:F(f({},t.data),{[e.expiry]:s})});this.currentResponse=p,this.emitResponse(p)}matchesCurrentSubscription(e){let t=this.currentSubscriptionRequest;return!t||!this.currentResponse||e.secondary_id!==t.secondary_id||Number(e.underlying_token)!==t.instrument_token?!1:t.put_lot==null||Number(e.put_lot)===t.put_lot}isValidDelta(e){return Number.isFinite(Number(e.sequence))&&typeof e.expiry=="string"&&!!e.expiry.trim()&&(e.action==="remove"||e.action==="upsert"&&!!e.snapshot)}resolveUnderlyingToken(e,t){let n=this.toPositiveNumber(e.instrument_token);if(n!==null)return n;for(let s of Object.values(t.data??{}))for(let p of s.snapshots??[]){let m=this.toPositiveNumber(p.underlying_token);if(m!==null)return m}return null}toSubscriptionRequest(e,t){return f({secondary_id:e.secondary_id,instrument_token:t,segment:e.segment},e.secondary_id===j.id&&e.put_lot!=null?{put_lot:e.put_lot}:{})}invokeSubscribe(e){return k(this,null,function*(){if(!(e.instrument_token<=0||this.hubConnection.state!==se.Connected))try{yield this.hubConnection.invoke(qa,e)}catch(t){console.error(`${qa} failed:`,t)}})}invokeUnsubscribe(){return k(this,null,function*(){if(this.hubConnection.state===se.Connected)try{yield this.hubConnection.invoke(Ga)}catch(e){if(this.isConnectionClosedInvocationError(e))return;console.error(`${Ga} failed:`,e)}})}emitResponse(e){this.zone.run(()=>this.updatesSubject.next(e))}isPendingRequest(e,t){return this.pendingRequestKey===e&&this.requestGeneration===t}isActiveRequest(e,t){return this.activeRequestKey===e&&this.requestGeneration===t}isCurrentSubscription(e,t){return this.currentSubscriptionRequest!==null&&JSON.stringify(this.currentSubscriptionRequest)===e&&this.requestGeneration===t}normalizeRequest(e){return f({secondary_id:e.secondary_id.trim(),instrument_token:Number(e.instrument_token),segment:e.segment},e.put_lot!=null?{put_lot:Number(e.put_lot)}:{})}toPositiveNumber(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:null}loadBestOpportunity(e){return k(this,null,function*(){try{return yield cr(this.payoffRepository.getBestOpportunity(e))}catch(t){if(!this.isIndexShortBoxEmptyResponse(e,t))throw t;let n=t.error;return{title:typeof n?.title=="string"&&n.title.trim()?n.title.trim():"Index Short Box Spread",message:typeof n?.message=="string"&&n.message.trim()?n.message.trim():"No qualifying Index Short Box opportunity is available.",data:{}}}})}isIndexShortBoxEmptyResponse(e,t){return e.secondary_id===Q.id&&t instanceof lt&&t.status===404&&t.error?.code==="NO_DETAIL_DATA_FOUND"}isConnectionClosedInvocationError(e){let t=e instanceof Error?e.message:typeof e=="string"?e:String(e?.message??"");return t.includes("Invocation canceled")&&t.includes("underlying connection being closed")}};o.\u0275fac=function(t){return new(t||o)(V(Fe),V(qe),V(Rt))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Xi=(()=>{let o=class o{constructor(e){this.repo=e}getDeltaRangeGroups(e,t){return(t?this.repo.getDeltaRange(e,s=>t(this.getGroups(s.data))):this.repo.getDeltaRange(e)).pipe(Ue(s=>this.getGroups(s.data)))}getGroups(e){return Array.isArray(e)?[{expiry:"All Expiries",rows:e}]:Object.entries(e).map(([t,n])=>({expiry:t,rows:n}))}};o.\u0275fac=function(t){return new(t||o)(V(kt))}
16,o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Wi=class{prepareGroups(o){return o.map(r=>F(f({},r),{rows:r.rows.map(e=>this.prepareRow(e))}))}patchRow(o,r){let e=r.ask??o.ask,t=F(f(f({},o),r),{ask:e});return F(f({},t),{ask_direction:this.getDirection(o.ask,e,Object.hasOwn(r,"ask")),uv_ov_direction:this.getUvOvDirection(t.uv_ov),hcr_background:this.getHcrBackground(t.hcr),hcr_in_days_background:this.getHcrExpiryBackground(t.hcr_in_days),hcr_expiry_background:this.getHcrExpiryBackground(t.hcr_expiry)})}prepareRow(o){return F(f({},o),{ask_direction:"none",uv_ov_direction:this.getUvOvDirection(o.uv_ov),hcr_background:this.getHcrBackground(o.hcr),hcr_in_days_background:this.getHcrExpiryBackground(o.hcr_in_days),hcr_expiry_background:this.getHcrExpiryBackground(o.hcr_expiry)})}getHcrBackground(o){let r=this.getNumericValue(o);return r===null?null:r>=.9&&r<=1.1?"#001cf2":null}getHcrExpiryBackground(o){let r=this.getHcrPerDayPercent(o);return r===null?null:r<=.1?"blue":r<=.12?"#00b050":r<=.15?"#f4b183":r<=.18?"#c90076":"#cc0000"}getHcrPerDayPercent(o){let r=this.getNumericValue(o);return r===null?null:typeof o=="string"&&o.trim().includes("%")?r:this.normalizeHcrPercent(r)}getNumericValue(o){if(o==null)return null;if(typeof o=="number")return Number.isFinite(o)?o:null;let r=String(o).trim(),e=Number(r.replace("%","").replace(/,/g,""));return Number.isFinite(e)?e:null}normalizeHcrPercent(o){return Math.abs(o)<.01?o*100:o}getUvOvDirection(o){return o!==null&&o>0?"uv-ov-positive":"uv-ov-negative"}getDirection(o,r,e){return e?r>o?"positive":"negative":"none"}};var za=(()=>{let o=class o{constructor(){this.groupsState=O([]),this.groups=this.groupsState.asReadonly(),this.rowsByInstrumentToken=new Map,this.removalsByInstrumentToken=new Map,this.knownExpiries=new Set,this.rowProjector=new Wi}setGroups(e){this.rowsByInstrumentToken.clear(),this.removalsByInstrumentToken.clear(),this.knownExpiries.clear(),this.mergeGroupsInternal(e),this.publishRows()}mergeGroups(e){let t=this.knownExpiries.size,n=this.mergeGroupsInternal(e);return(n>0||this.knownExpiries.size!==t)&&this.publishRows(),n}applyRowUpdate(e){let t=this.mergeRow(e);return t&&this.publishRows(),t}applyRowUpdates(e){let t=0;for(let n of e)this.mergeRow(n)&&t++;return t>0&&this.publishRows(),t}removeRow(e){let t=this.applyRemoval(e);return t&&this.publishRows(),t}removeRows(e){let t=0;for(let n of e)this.applyRemoval(n)&&t++;return t>0&&this.publishRows(),t}applyRowChanges(e){let t=0;for(let n of e)(n.kind==="update"?this.mergeRow(n.row):this.applyRemoval(n.removal))&&t++;return t>0&&this.publishRows(),t}clear(){this.rowsByInstrumentToken.clear(),this.removalsByInstrumentToken.clear(),this.knownExpiries.clear(),this.groupsState.set([])}mergeGroupsInternal(e){let t=0;for(let n of e){n.expiry&&n.expiry!=="All Expiries"&&this.knownExpiries.add(n.expiry);for(let s of n.rows)this.mergeRow(F(f({},s),{expiry:s.expiry||n.expiry}))&&t++}return t}mergeRow(e){if(!this.isValidInstrumentToken(e.instrument_token))return!1;let t=this.removalsByInstrumentToken.get(e.instrument_token);if(t&&!this.isNewer(e,t))return!1;let n=this.rowsByInstrumentToken.get(e.instrument_token);if(n&&!this.isNewer(e,n))return!1;let s=n?this.rowProjector.patchRow(n,e):this.rowProjector.prepareRow(e);return this.removalsByInstrumentToken.delete(e.instrument_token),this.rowsByInstrumentToken.set(e.instrument_token,s),!0}applyRemoval(e){if(!this.isValidInstrumentToken(e.instrument_token))return!1;let t=this.removalsByInstrumentToken.get(e.instrument_token);if(t&&!this.isNewer(e,t))return!1;let n=this.rowsByInstrumentToken.get(e.instrument_token);return n&&!this.isNewer(e,n)?!1:(this.rowsByInstrumentToken.delete(e.instrument_token),this.removalsByInstrumentToken.set(e.instrument_token,e),!0)}publishRows(){let e=new Map;for(let n of this.knownExpiries)e.set(n,[]);for(let n of this.rowsByInstrumentToken.values()){let s=n.expiry||"All Expiries",p=e.get(s)??[];p.push(n),e.set(s,p)}let t=Array.from(e,([n,s])=>({expiry:n,rows:s.sort((p,m)=>Math.abs(m.delta)-Math.abs(p.delta))})).sort((n,s)=>n.expiry.localeCompare(s.expiry));this.groupsState.set(t)}isNewer(e,t){let n=Number(e.update_sequence),s=Number(t.update_sequence);if(n>0&&s>0)return n>s;let p=Date.parse(e.updated_at),m=Date.parse(t.updated_at);return Number.isFinite(p)&&Number.isFinite(m)?p>=m:Number.isFinite(p)||!Number.isFinite(m)}isValidInstrumentToken(e){return typeof e=="number"&&Number.isFinite(e)}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();function xm(i,o){if(i&1&&(a(0,"div",4),d(1),l()),i&2){let r=u();c(),g(" ",r.pending?"Greek delta range data is pending...":"Loading..."," ")}}function bm(i,o){if(i&1&&(a(0,"div",5),d(1),l()),i&2){let r=u();c(),g(" ",r.errorMessage," ")}}function ym(i,o){i&1&&(a(0,"div",4),d(1," No delta range data found. "),l())}function Cm(i,o){if(i&1&&(a(0,"div",12),d(1),l()),i&2){let r=u().$implicit,e=u(2);c(),g(" ",e.pending?"Greek delta range data is pending for "+r.expiry+".":"No delta range data found for "+r.expiry+"."," ")}}function Pm(i,o){i&1&&(a(0,"th"),d(1,"MATCHED STRIKE"),l(),a(2,"th"),d(3,"MATCHED LTP"),l())}function Sm(i,o){i&1&&(a(0,"th"),d(1,"BID"),l())}function vm(i,o){if(i&1&&(a(0,"p",18),d(1),l()),i&2){let r,e=u().$implicit;c(),g(" ",(r=e.spot_price)!==null&&r!==void 0?r:"-"," ")}}function wm(i,o){if(i&1&&(a(0,"p"),d(1),l()),i&2){let r=u(5);J("base-properties "+r.spotStore.spot$().color),c(),g(" ",r.spotStore.spot$().value," ")}}function Om(i,o){if(i&1&&(a(0,"td",17),d(1),l(),a(2,"td",17),d(3),l()),i&2){let r,e,t=u().$implicit;c(),g(" ",(r=t.matched_strike)!==null&&r!==void 0?r:"-"," "),c(2),g(" ",(e=t.matched_last_price)!==null&&e!==void 0?e:"-"," ")}}function Mm(i,o){if(i&1&&(a(0,"td",17),d(1),l()),i&2){let r,e=u().$implicit;c(),g(" ",(r=e.bid)!==null&&r!==void 0?r:"-"," ")}}function Em(i,o){if(i&1){let r=R();a(0,"tr",16),_("click",function(){let t=S(r).$implicit,n=u(4);return v(n.selectRow(t))}),a(1,"td"),d(2),l(),a(3,"td",17),P(4,vm,2,1,"p",18)(5,wm,2,3,"p",19),l(),a(6,"td",20)(7,"p"),d(8),l()(),a(9,"td",17),d(10),l(),a(11,"td",17),d(12),l(),a(13,"td",17),d(14),l(),a(15,"td",17),d(16),l(),a(17,"td",17),d(18),l(),P(19,Om,4,2),a(20,"td",17)(21,"p"),d(22),l()(),P(23,Mm,2,1,"td",17),a(24,"td",17),d(25),l(),a(26,"td",17),d(27),l(),a(28,"td",21)(29,"p",22),d(30),l()(),a(31,"td",21)(32,"p",22),d(33),l()(),a(34,"td",17),d(35),l(),a(36,"td",21)(37,"p",22),d(38),l()(),a(39,"td",17),d(40),l(),a(41,"td",17),d(42),l(),a(43,"td",17),d(44),l(),a(45,"td",17),d(46),l(),a(47,"td",17),d(48),l()()}if(i&2){let r,e,t,n,s,p=o.$implicit,m=o.index,h=u(4);c(2),T(m+1),c(2),C(h.isEquityFuturesDeltaRange()?4:5),c(3),J("base-properties "+p.uv_ov_direction),c(),g(" ",p.symbol," "),c(2),Sr(" ",p.delta,"",h.isEquityFuturesDeltaRange()?"%":""," "),c(2),g(" ",(r=p.spot_equity_lot)!==null&&r!==void 0?r:"-"," "),c(2),g(" ",p.shares," "),c(2),g(" ",p.strike," "),c(2),g(" ",1," "),c(),C(h.shouldShowMatchedLtpColumns()?19:-1),c(2),J("base-properties "+p.ask_direction),c(),g(" ",p.ask," "),c(),C(h.isEquityFuturesDeltaRange()?23:-1),c(2),g(" ",p.quantity," "),c(2),g(" ",p.hr," "),c(2),Se("background-color",p.hcr_background),c(),g(" ",p.hcr," "),c(2),Se("background-color",p.hcr_expiry_background),c(),g(" ",p.hcr_expiry||"-"," "),c(2),g(" ",p.days_to_expiry," "),c(2),Se("background-color",p.hcr_in_days_background),c(),g(" ",p.hcr_in_days," "),c(2),g(" ",p.net_delta," "),c(2),g(" ",(e=p.floor)!==null&&e!==void 0?e:"-"," "),c(2),g(" ",(t=p.max_loss)!==null&&t!==void 0?t:"-"," "),c(2),g(" ",(n=p.total_max_loss)!==null&&n!==void 0?n:"-"," "),c(2),g(" ",(s=p.protection_depth)!==null&&s!==void 0?s:"-"," ")}}function Tm(i,o){if(i&1&&(a(0,"div",13)(1,"table",14)(2,"thead")(3,"tr")(4,"th"),d(5,"SNO."),l(),a(6,"th"),d(7),l(),a(8,"th"),d(9,"SYMBOL"),l(),a(10,"th"),d(11),l(),a(12,"th"),d(13),l(),a(14,"th"),d(15),l(),a(16,"th"),d(17,"STRIKE"),l(),a(18,"th"),d(19),l(),P(20,Pm,4,0),a(21,"th"),d(22),l(),P(23,Sm,2,0,"th"),a(24,"th"),d(25,"QUANTITY"),l(),a(26,"th"),d(27,"HR"),l(),a(28,"th"),d(29,"HCR"),l(),a(30,"th"),d(31,"HCRE"),l(),a(32,"th"),d(33,"EXPIRY DAYS"),l(),a(34,"th"),d(35,"HCR DAYS"),l(),a(36,"th"),d(37,"NET DELTA"),l(),a(38,"th"),d(39,"FLOOR"),l(),a(40,"th"),d(41,"MAX LOSS"),l(),a(42,"th"),d(43,"TOTAL MAX LOSS"),l(),a(44,"th"),d(45,"PROTECTION DEPTH"),l()()(),a(46,"tbody"),P(47,Em,49,33,"tr",15),l()()()),i&2){let r=u().$implicit,e=u(2);c(7),g(" ",e.isEquityFuturesDeltaRange()?"FUTURE PRICE":"SPOT PRICE"," "),c(4),g(" ",e.isEquityFuturesDeltaRange()?"DELTA %":"DELTA"," "),c(2),g(" ",e.isEquityFuturesDeltaRange()?"FUTURE LOT SIZE":"PUT LOT"," "),c(2),g(" ",e.isEquityFuturesDeltaRange()?"SHARES PROTECTED":"NO. SHARES"," "),c(4),T(e.isEquityFuturesDeltaRange()?"LOTS":"CALL LOT"),c(),C(e.shouldShowMatchedLtpColumns()?20:-1),c(2),T(e.isEquityFuturesDeltaRange()?"ASK":"LTP"),c(),C(e.isEquityFuturesDeltaRange()?23:-1),c(24),b("ngForOf",r.rows)("ngForTrackBy",e.trackBySymbol)}}function Im(i,o){if(i&1&&(a(0,"section",7)(1,"div",8),d(2),a(3,"span",9),d(4),l()(),P(5,Cm,2,1,"div",10)(6,Tm,48,10,"div",11),l()),i&2){let r=o.$implicit,e=u(2);c(2),hn(" ",e.name," - ",r.expiry," - ",e.side," "),c(2),g("(",r.rows.length,")"),c(),b("ngIf",r.rows.length===0),c(),b("ngIf",r.rows.length>0)}}function km(i,o){if(i&1&&(tt(0),P(1,Im,7,6,"section",6),nt()),i&2){let r=u();c(),b("ngForOf",r.deltaRangeGroups())("ngForTrackBy",r.trackByExpiry)}}var Rm=new Set([Ke.id,pt.id,Wt.id,rt.id,bi.id,zn.id]),Dm=new Set([Wt.id,zn.id]),Nm={spot$:()=>({name:"",value:0,color:""})},Lo=(()=>{let o=class o{constructor(e,t,n,s){this.hedgeRatioPanelService=e,this.greekDeltaRangeRealtime=t,this.hedgeRatioPanelStore=n,this.cdr=s,this.name="AXISBANK",this.side="put",this.min_delta=.05,this.max_delta=.5,this.secondary_id="",this.source=null,this.source_token=null,this.spotStore=Nm,this.optionSelected=new ce,this.deltaRangeGroups=this.hedgeRatioPanelStore.groups,this.loading=!1,this.pending=!1,this.errorMessage="",this.destroy$=new pe,this.pendingChangeDetectionFrame=0,this.activeDeltaRangeRequest=null,this.activeSubscriptionLease=null,this.bufferedLiveEvents=[],this.snapshotLoadId=null,this.hasInitialized=!1,this.destroyed=!1,this.loadVersion=0}ngOnInit(){this.hasInitialized=!0,this.greekDeltaRangeRealtime.groupsUpdated$.pipe(Ut(this.destroy$)).subscribe(e=>this.handleGroupsUpdated(e)),this.greekDeltaRangeRealtime.rowChanges$.pipe(Ut(this.destroy$)).subscribe(e=>this.handleRowChanges(e)),this.greekDeltaRangeRealtime.stateReset$.pipe(Ut(this.destroy$)).subscribe(()=>this.resetForReconnect()),this.greekDeltaRangeRealtime.reconnected$.pipe(Ut(this.destroy$)).subscribe(()=>
16this.reloadSnapshotAfterReconnect()),this.loadDeltaRange()}ngOnChanges(e){this.hasInitialized&&(e.name||e.side||e.min_delta||e.max_delta||e.secondary_id||e.source||e.source_token)&&this.loadDeltaRange()}ngOnDestroy(){this.destroyed=!0,this.loadVersion++,this.discardBufferedLiveEvents(),this.pendingChangeDetectionFrame&&cancelAnimationFrame(this.pendingChangeDetectionFrame),this.destroy$.next(),this.destroy$.complete(),this.unsubscribeActiveDeltaRange()}loadDeltaRange(){return k(this,null,function*(){let e=this.getDeltaRangeRequest(),t=++this.loadVersion;if(this.discardBufferedLiveEvents(),yield this.unsubscribeActiveDeltaRange(),!e){this.loading=!1,this.pending=!1,this.hedgeRatioPanelStore.clear(),this.cdr.markForCheck();return}if(t===this.loadVersion){if(this.hedgeRatioPanelStore.clear(),this.loading=!0,this.pending=!1,this.errorMessage="",this.beginBufferingLiveEvents(t),yield this.subscribeActiveDeltaRange(e,t),t!==this.loadVersion||this.destroyed){this.discardBufferedLiveEvents(t);return}this.loadSnapshot(e,t)}})}trackByExpiry(e,t){return t.expiry}trackBySymbol(e,t){return t.instrument_token||e}selectRow(e){if(!Rm.has(this.secondary_id))return;let t=this.getSelectedInstrumentTokens(e);t.length!==0&&this.optionSelected.emit({instrumentTokens:[...t],putLot:this.toPutLot(e.spot_equity_lot)})}shouldShowMatchedLtpColumns(){return Dm.has(this.secondary_id)}isEquityFuturesDeltaRange(){return this.secondary_id===Ke.id}applyRowUpdate(e){return this.hedgeRatioPanelStore.applyRowUpdate(e)?(this.scheduleChangeDetection(),!0):!1}applyRowUpdates(e){let t=this.hedgeRatioPanelStore.applyRowUpdates(e);return t>0&&this.scheduleChangeDetection(),t}applyGroupsUpdated(e){this.hedgeRatioPanelStore.mergeGroups(e),this.loading=!1,this.pending=!1,this.scheduleChangeDetection()}applyRowChanges(e){let t=this.hedgeRatioPanelStore.applyRowChanges(e);return t>0&&this.scheduleChangeDetection(),t}applyRowRemoval(e){return this.hedgeRatioPanelStore.removeRow(e)?(this.scheduleChangeDetection(),!0):!1}applyRowRemovals(e){let t=this.hedgeRatioPanelStore.removeRows(e);return t>0&&this.scheduleChangeDetection(),t}getDeltaRangeRequest(){let e=this.secondary_id===pt.id,t=this.isEquityFuturesDeltaRange(),n=e||t?"put":this.side,s=e?.35:t?.05:this.min_delta,p=e?.6:t?.5:this.max_delta;return this.name.trim()?this.isValidDeltaRange(s,p)?f(F(f({name:this.name,side:n,min_delta:s,max_delta:p},this.secondary_id?{secondary_id:this.secondary_id}:{}),{source:t?"future":this.source||"spot"}),this.source_token!=null?{source_token:this.source_token}:{}):(this.errorMessage="Enter a valid min/max delta between 0 and 1.",null):(this.errorMessage="Enter a valid name.",null)}isValidDeltaRange(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>0&&t>0&&e<=1&&t<=1&&e<=t}resetForReconnect(){let e=++this.loadVersion;this.beginBufferingLiveEvents(e),this.hedgeRatioPanelStore.clear(),this.loading=!0,this.pending=!1,this.errorMessage="",this.cdr.markForCheck()}getSelectedInstrumentTokens(e){if(this.isEquityFuturesDeltaRange()){let t=Number(e.instrument_token),n=Number(e.source_token??e.future_token);return Number.isFinite(t)&&t>0&&Number.isFinite(n)&&n>0?[t,n]:[]}return this.secondary_id===Wt.id?e.matched_instrument_token&&e.instrument_token?[e.matched_instrument_token,e.instrument_token]:[]:e.instrument_token?[e.instrument_token]:[]}toPutLot(e){return this.isEquityFuturesDeltaRange()?1:e!==null&&Number.isFinite(e)?e:null}getErrorMessage(e){let t=e,n=t.status;if(n===400){if(typeof t.error=="string"&&t.error.trim())return t.error;if(typeof t.error=="object"&&t.error!==null&&typeof t.error.message=="string"&&t.error.message.trim())return t.error.message}return n===404?`No Greek snapshots found for ${this.name} ${this.side}.`:n===0?"Unable to reach Greek snapshot service.":"Failed to load Greek snapshot data."}scheduleChangeDetection(){this.pendingChangeDetectionFrame||(this.pendingChangeDetectionFrame=requestAnimationFrame(()=>{this.pendingChangeDetectionFrame=0,this.cdr.markForCheck()}))}subscribeActiveDeltaRange(e,t){return k(this,null,function*(){try{let n=yield this.greekDeltaRangeRealtime.subscribeDeltaRange(e);if(t===this.loadVersion&&!this.destroyed){this.activeDeltaRangeRequest=e,this.activeSubscriptionLease=n;return}yield this.greekDeltaRangeRealtime.unsubscribeDeltaRange(e,n)}catch(n){console.error("SubscribeGreekDeltaRange failed:",n)}})}unsubscribeActiveDeltaRange(){return k(this,null,function*(){let e=this.activeDeltaRangeRequest,t=this.activeSubscriptionLease;if(e){this.activeDeltaRangeRequest=null,this.activeSubscriptionLease=null;try{yield this.greekDeltaRangeRealtime.unsubscribeDeltaRange(e,t??void 0)}catch(n){console.error("UnsubscribeGreekDeltaRange failed:",n)}}})}
16loadSnapshot(e,t){this.hedgeRatioPanelService.getDeltaRangeGroups(e,n=>{t!==this.loadVersion||this.destroyed||(this.hedgeRatioPanelStore.setGroups(n),this.pending=!0,this.loading=!0,this.errorMessage="",this.cdr.markForCheck())}).pipe(Ut(this.destroy$)).subscribe({next:n=>{t!==this.loadVersion||this.destroyed||(this.hedgeRatioPanelStore.setGroups(n),this.replayBufferedLiveEvents(t),this.pending=!1,this.loading=!1,this.cdr.markForCheck())},error:n=>{t!==this.loadVersion||this.destroyed||(this.errorMessage=this.getErrorMessage(n),this.hedgeRatioPanelStore.clear(),this.replayBufferedLiveEvents(t),this.hedgeRatioPanelStore.groups().length>0&&(this.errorMessage=""),this.pending=!1,this.loading=!1,this.cdr.markForCheck())}})}handleGroupsUpdated(e){if(this.snapshotLoadId!==null){this.bufferedLiveEvents.push({kind:"groups",groups:e});return}this.applyGroupsUpdated(e)}handleRowChanges(e){if(this.snapshotLoadId!==null){this.bufferedLiveEvents.push({kind:"rows",changes:e});return}this.applyRowChanges(e)}beginBufferingLiveEvents(e){this.snapshotLoadId=e,this.bufferedLiveEvents=[]}replayBufferedLiveEvents(e){if(this.snapshotLoadId!==e)return;let t=this.bufferedLiveEvents;this.snapshotLoadId=null,this.bufferedLiveEvents=[];for(let n of t)n.kind==="groups"?this.hedgeRatioPanelStore.mergeGroups(n.groups):this.hedgeRatioPanelStore.applyRowChanges(n.changes)}discardBufferedLiveEvents(e){e!==void 0&&this.snapshotLoadId!==e||(this.snapshotLoadId=null,this.bufferedLiveEvents=[])}reloadSnapshotAfterReconnect(){if(this.destroyed)return;let e=this.activeDeltaRangeRequest;if(!e){this.loadDeltaRange();return}let t=this.snapshotLoadId??++this.loadVersion;this.snapshotLoadId===null&&(this.beginBufferingLiveEvents(t),this.hedgeRatioPanelStore.clear(),this.loading=!0,this.pending=!1,this.errorMessage="",this.cdr.markForCheck()),this.loadSnapshot(e,t)}};o.\u0275fac=function(t){return new(t||o)(Z(Xi),Z(Li),Z(za),Z(mi))},o.\u0275cmp=L({type:o,selectors:[["app-hedge-ratio-panel"]],inputs:{name:"name",side:"side",min_delta:"min_delta",max_delta:"max_delta",secondary_id:"secondary_id",source:"source",source_token:"source_token",spotStore:"spotStore"},outputs:{optionSelected:"optionSelected"},features:[ve],decls:5,vars:4,consts:[[1,"hedge-ratio-panel"],["class","panel-status",4,"ngIf"],["class","panel-status error",4,"ngIf"],[4,"ngIf"],[1,"panel-status"],[1,"panel-status","error"],["class","expiry-table-group",4,"ngFor","ngForOf","ngForTrackBy"],[1,"expiry-table-group"],[1,"expiry-heading"],[1,"snapshot-count"],["class","panel-status expiry-empty-status",4,"ngIf"],["class","scanner-table-wrapper",4,"ngIf"],[1,"panel-status","expiry-empty-status"],[1,"scanner-table-wrapper"],[1,"scanner-table"],[3,"click",4,"ngFor","ngForOf","ngForTrackBy"],[3,"click"],[1,"value-cell"],[1,"base-properties"],[3,"class"],[1,"symbol"],[1,"value-cell","hcr-expiry-cell"],[1,"hcr-expiry-badge"]],template:function(t,n){t&1&&(a(0,"div",0),P(1,xm,2,1,"div",1)(2,bm,2,1,"div",2)(3,ym,2,0,"div",1)(4,km,2,2,"ng-container",3),l()),t&2&&(c(),b("ngIf",n.loading),c(),b("ngIf",!n.loading&&n.errorMessage),c(),b("ngIf",!n.loading&&!n.errorMessage&&n.deltaRangeGroups().length===0),c(),b("ngIf",!n.errorMessage&&(!n.loading||n.pending)))},dependencies:[st,ze],styles:["[_nghost-%COMP%]{display:block}.hedge-ratio-panel[_ngcontent-%COMP%]{--panel-border: #2d3748;--panel-shell: #161b22;--panel-head: #1f2633;--panel-row: #161b22;--panel-row-hover: #1f2633;--panel-text: #e6edf3;--panel-muted: #9aa4b2;color:var(--panel-text);max-height:90vh;overflow:auto}.expiry-table-group[_ngcontent-%COMP%] + .expiry-table-group[_ngcontent-%COMP%]{margin-top:14px}.expiry-heading[_ngcontent-%COMP%]{margin:0 0 6px;color:#dce9fb;font-size:12px;font-weight:900}.panel-status[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:40px;padding:0 12px;border:1px solid var(--panel-border);border-radius:8px;background:var(--panel-shell);color:#9eb1c8;font-size:12px;font-weight:800}.panel-status.error[_ngcontent-%COMP%]{color:#ff9faf}.scanner-table-wrapper[_ngcontent-%COMP%]{width:100%;overflow-x:auto;overflow-y:hidden;border:1px solid var(--panel-border);border-radius:8px;background:var(--panel-shell);-webkit-overflow-scrolling:touch}.scanner-table[_ngcontent-%COMP%]{width:100%;min-width:1320px;border-collapse:separate;border-spacing:0;background:transparent}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{height:32px;padding:0 10px;text-align:center;background:var(--panel-head);border-bottom:1px solid var(--panel-border);color:var(--panel-muted);font-size:10px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;white-space:nowrap}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child{border-top-left-radius:7px}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:last-child{border-top-right-radius:7px}.scanner-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{height:33px;padding:0 10px;text-align:center;font-size:11px;font-weight:800;color:var(--panel-text);background:var(--panel-row);border-bottom:1px solid var(--panel-border);white-space:nowrap}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child, .scanner-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child{width:46px}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]{border-bottom:0}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]:first-child{border-bottom-left-radius:7px}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]:last-child{border-bottom-right-radius:7px}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:hover   td[_ngcontent-%COMP%]{background:var(--panel-row-hover)}.symbol[_ngcontent-%COMP%]{font-weight:900;color:#fff}.value-cell[_ngcontent-%COMP%]{color:#f4f8ff}.base-properties[_ngcontent-%COMP%]{color:#fff!important;padding:5px;border-radius:2px;margin:5px}.positive[_ngcontent-%COMP%]{background-color:var(--up)}.negative[_ngcontent-%COMP%]{background-color:var(--negative)}.uv-ov-positive[_ngcontent-%COMP%]{background-color:var(--positive-change)}.uv-ov-negative[_ngcontent-%COMP%]{background-color:var(--negative-change)}
16.hcr-expiry-cell[_ngcontent-%COMP%]{color:#fff}.hcr-expiry-badge[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;min-width:54px;height:22px;margin:0;padding:0 8px;border-radius:4px;color:#fff;font:inherit}.status-cell[_ngcontent-%COMP%]{color:#9eb1c8}.status-cell.error[_ngcontent-%COMP%]{color:#ff9faf}.scanner-table-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar{height:8px}.scanner-table-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#0d1520;border-radius:999px}.scanner-table-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#2a3a4f;border-radius:999px}"],changeDetection:0});let i=o;return i})();var ja=(()=>{let o=class o{constructor(e,t){this.signalR=e,this.zone=t,this.updatesSubject=new pe,this.updates$=this.updatesSubject.asObservable(),this.handlersRegistered=!1,this.currentSubscription=null,this.pendingUpdate=null,this.pendingFrame=0,this.hubConnection=this.signalR.connection,this.hubConnection.onreconnected(()=>{let n=this.currentSubscription;n&&this.invokeSubscribe(n)})}subscribe(e){return k(this,null,function*(){let t=this.normalizeRequest(e);this.currentSubscription&&this.isSameRequest(this.currentSubscription,t)||(this.registerHandlers(),this.currentSubscription&&(yield this.unsubscribe(this.currentSubscription)),yield this.invokeSubscribe(t),this.currentSubscription=t)})}unsubscribe(e){return k(this,null,function*(){let t=e?this.normalizeRequest(e):this.currentSubscription;if(t){if(this.hubConnection.state===se.Connected)try{yield this.hubConnection.invoke("UnsubscribeDeltaMetricsFlow",t)}catch(n){console.error("UnsubscribeDeltaMetricsFlow failed:",n)}this.currentSubscription&&this.isSameRequest(this.currentSubscription,t)&&(this.currentSubscription=null,this.clearPendingUpdate())}})}registerHandlers(){this.handlersRegistered||(this.hubConnection.on("delta-metrics-flow-updated",e=>{this.enqueueUpdate(e)}),this.handlersRegistered=!0)}enqueueUpdate(e){this.pendingUpdate=e,!this.pendingFrame&&(this.pendingFrame=requestAnimationFrame(()=>{this.pendingFrame=0;let t=this.pendingUpdate;this.pendingUpdate=null,!(!t||!this.currentSubscription)&&this.zone.run(()=>this.updatesSubject.next(t))}))}clearPendingUpdate(){this.pendingUpdate=null,this.pendingFrame&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=0)}invokeSubscribe(e){return k(this,null,function*(){if(this.hubConnection.state===se.Connected)try{yield this.hubConnection.invoke("SubscribeDeltaMetricsFlow",e)}catch(t){console.error("SubscribeDeltaMetricsFlow failed:",t)}})}normalizeRequest(e){return{secondary_id:e.secondary_id,equity_trading_symbol:e.equity_trading_symbol,limit:e.limit}}isSameRequest(e,t){return e.secondary_id===t.secondary_id&&e.equity_trading_symbol===t.equity_trading_symbol&&e.limit===t.limit}};o.\u0275fac=function(t){return new(t||o)(V(Fe),V(qe))},o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();function Fm(i,o){i&1&&(tt(0),a(1,"div",8),d(2,"Loading flow rows..."),l(),nt())}function Lm(i,o){if(i&1&&(tt(0),a(1,"div",8),d(2),l(),nt()),i&2){let r=u(2).$implicit,e=u();c(2),g(" ",e.bucketMessage(r.id)," ")}}function Am(i,o){if(i&1&&P(0,Lm,3,1,"ng-container",7),i&2){let r=u().$implicit,e=mn(9),t=u();b("ngIf",t.bucketMessage(r.id))("ngIfElse",e)}}function Um(i,o){if(i&1){let r=R();a(0,"app-windowed-bar-chart",9),_("itemSelected",function(t){S(r);let n=u(2);return v(n.onChartItemSelected(t))})("scrolledNearEnd",function(){S(r);let t=u().$implicit,n=u();return v(n.onBucketScrolledNearEnd(t.id))}),l()}if(i&2){let r=u().$implicit,e=u();b("items",e.bucketRows(r.id))("windowSize",e.chartWindowSize)("overscan",e.chartOverscan)("rowHeight",e.chartRowHeight)("minViewportHeight",e.chartMinViewportHeight)("seriesName","Breakeven Diff %")("animationDurationUpdate",140)("backgroundColor","transparent")("inverse",!0)("showValueLabels",!0)("enableRealtimeSort",!1)("sortDirection","none")("valueLabelPosition","right")}}function Hm(i,o){if(i&1&&(a(0,"section",4)(1,"header",5)(2,"h3"),d(3),l()(),a(4,"div",6),P(5,Fm,3,0,"ng-container",7)(6,Am,1,2,"ng-template",null,0,it)(8,Um,1,13,"ng-template",null,1,it),l()()),i&2){let r=o.$implicit,e=mn(7),t=u();c(3),T(r.label),c(2),b("ngIf",t.bucketLoading(r.id)&&!t.bucketRows(r.id).length)("ngIfElse",e)}}var Vm=[{id:"near",label:"Near"},{id:"next",label:"Next"},{id:"far",label:"Far"}],Bm={near:1,next:2,far:3},qm={near:{type:"linear",x:0,y:0,x2:1,y2:0,global:!1,colorStops:[{offset:0,color:"#15803D"},{offset:.86,color:"#013314"},{offset:.86,color:"#028432"},{offset:1,color:"#028432"}]},next:{type:"linear",x:0,y:0,x2:1,y2:0,global:!1,colorStops:[{offset:0,color:"#0044ff"},{offset:.86,color:"#001762"},{offset:.86,color:"#0044ff"},{offset:1,color:"#0044ff"}]},far:{type:"linear",x:0,y:0,x2:1,y2:0,global:!1,colorStops:[{offset:0,color:"#da0000"},{offset:.86,color:"#5a0000"},{offset:.86,color:"#da0000"},{offset:1,color:"#da0000"}]}},Gm=new Intl.NumberFormat("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2}),Ka=50,zm=8,jm=6,Km=44,$m=300,$a=(()=>{let o=class o{constructor(){this.store=D(ae),this.sync=D(Xe),this.page=D(de),this.repository=D(Zt),this.realtime=D(ja),this.bucketStates=O(this.createInitialState()),this.latestBaseRequestKe
16y="",this.initialSubscription=be.EMPTY,this.liveUpdatesSubscription=be.EMPTY,this.bucketSubscriptions={},this.buckets=Vm,this.chartWindowSize=zm,this.chartOverscan=jm,this.chartRowHeight=Km,this.chartMinViewportHeight=$m,this.selectedTradingSymbol=M(()=>this.resolveSelectedTradingSymbol()),this.baseRequest=M(()=>{let e=Y(this.page.originId()),t=this.selectedTradingSymbol();return!Ee(e)||!t?null:{secondary_id:e,equity_trading_symbol:t,limit:Ka}}),this.liveUpdatesSubscription=this.realtime.updates$.subscribe(e=>{this.applyResponse(e,this.allBucketIds(),!0)}),re(()=>{let e=this.baseRequest();this.loadInitialPage(e),this.updateLiveSubscription(e)})}ngOnDestroy(){this.initialSubscription.unsubscribe(),this.liveUpdatesSubscription.unsubscribe(),this.realtime.unsubscribe(this.baseRequest()??void 0),this.unsubscribeBucketSubscriptions()}bucketRows(e){return this.bucketStates()[e].rows}bucketMessage(e){let t=this.bucketStates()[e];return t.message?t.message:!t.loading&&!t.rows.length?"No data":""}bucketLoading(e){return this.bucketStates()[e].loading}onBucketScrolledNearEnd(e){this.loadNextBucketPage(e)}onChartItemSelected(e){let t=e.instrumentToken,n=e.expiryIndex;if(!e.indexName||typeof t!="number"||!Number.isFinite(t)||typeof n!="number"||!Number.isFinite(n))return;let s=this.store.scannerRows().findIndex(p=>p.spot_info.instrument_token===t||p.spot_info.symbol===e.indexName);this.sync.selectDetailsTarget({source:"scanner",indexName:e.indexName,instrumentToken:t,expiryIndex:n,rowIndex:s>=0?s:void 0,optionInstrumentTokens:e.optionInstrumentTokens??[],putLot:e.putLot??null})}trackByBucket(e,t){return t.id}loadInitialPage(e){if(!e){this.latestBaseRequestKey="",this.initialSubscription.unsubscribe(),this.unsubscribeBucketSubscriptions(),this.bucketStates.set(this.createInitialState("Select an equity symbol to load flow rows"));return}let t=JSON.stringify(e);t!==this.latestBaseRequestKey&&(this.latestBaseRequestKey=t,this.initialSubscription.unsubscribe(),this.unsubscribeBucketSubscriptions(),this.bucketStates.set(this.createInitialState("",!0)),this.initialSubscription=this.repository.getDeltaMetricsFlowChart(e).subscribe({next:n=>{t===this.latestBaseRequestKey&&this.applyResponse(n,this.allBucketIds(),!0)},error:()=>{t===this.latestBaseRequestKey&&this.setBucketsMessage("Unable to load flow rows")}}))}updateLiveSubscription(e){return k(this,null,function*(){if(!e){yield this.realtime.unsubscribe();return}yield this.realtime.subscribe(e)})}loadNextBucketPage(e){let t=this.baseRequest(),n=this.bucketStates()[e];if(!t||n.loading||!n.hasMore||!n.cursor)return;if(JSON.stringify(t)!==this.latestBaseRequestKey){this.loadInitialPage(t);return}this.loadBucketPage(e,n.cursor,!1)}loadBucketPage(e,t,n){let s=this.baseRequest();if(!s)return;let p=JSON.stringify(s),m=f(f({},s),this.toCursorPayload(e,t));this.bucketSubscriptions[e]?.unsubscribe(),this.updateBucket(e,f({loading:!0,message:""},n?{rows:[],cursor:null,hasMore:!0}:{})),this.bucketSubscriptions[e]=this.repository.getDeltaMetricsFlowChart(m).subscribe({next:h=>{p===this.latestBaseRequestKey&&this.applyResponse(h,[e],n)},error:h=>{if(p!==this.latestBaseRequestKey)return;if(this.resolveInvalidCursorBucket(h)===e){this.loadBucketPage(e,null,!0);return}this.updateBucket(e,{loading:!1,message:"Unable to load flow rows"})}})}applyResponse(e,t,n){this.bucketStates.update(s=>{let p=f({},s);for(let m of t){let h=this.resolveBucketMeta(e,m),x=this.toBucketChartItems(e.data?.[m]??[],m),I=n?x:[...s[m].rows,...x];p[m]={rows:I,cursor:h.next_cursor??null,hasMore:h.has_more===!0,expiry:h.equity_options_expiry??null,loading:!1,message:I.length?"":"No data"}}return p})}toBucketChartItems(e,t){return e.reduce((n,s)=>{let p=Number(s.symmetric_breakeven_percent_difference),m=Number(s.equity_spot_instrument_token),h=Number(s.equity_option_instrument_token);return!(p>0&&p<3)||!Number.isFinite(m)||m<=0||n.push({label:s.trading_symbol,value:p,displayValue:`${Gm.format(p)}%`,color:qm[t],indexName:this.resolveSpotSymbol(m),instrumentToken:m,expiryIndex:Bm[t],optionInstrumentTokens:Number.isFinite(h)&&h>0?[h]:[],putLot:null}),n},[])}resolveSelectedTradingSymbol(){let e=this.store.selectedIndexName();if(e)return e;let t=Number(this.store.selectedInstrumentToken());if(!Number.isFinite(t))return"";let n=this.store.marketRows().find(p=>p.spot_info.instrument_token===t);return n?n.spot_info.symbol:this.store.scannerRows().find(p=>p.spot_info.instrument_token===t)?.spot_info.symbol??""}resolveSpotSymbol(e){let t=this.store.marketRows().find(s=>s.spot_info.instrument_token===e);return t?t.spot_info.symbol:this.store.scannerRows().find(s=>s.spot_info.instrument_token===e)?.spot_info.symbol??this.selectedTradingSymbol()}resolveBucketMeta(e,t){return e.metadata?.[t]??{count:0,limit:Ka,has_more:!1,next_cursor:null,equity_options_expiry:null}}resolveInvalidCursorBucket(e){let t=e?.error;if(typeof t!="object"||t===null)return null;let n=t.code,s=t.details;if(n!=="invalid_cursor"||typeof s!="object"||!s)return null;let p=s.bucket;return this.isBucketId(p)?p:null}isBucketId(e){return e==="near"||e==="next"||e==="far"}toCursorPayload(e,t){return t?e==="near"?{cursor_near:t}:e==="next"?{cursor_next:t}
16:{cursor_far:t}:{}}setBucketsMessage(e){this.bucketStates.update(t=>{let n=f({},t);for(let s of this.allBucketIds())n[s]=F(f({},n[s]),{loading:!1,message:e});return n})}updateBucket(e,t){this.bucketStates.update(n=>F(f({},n),{[e]:f(f({},n[e]),t)}))}createInitialState(e="",t=!1){return{near:this.createInitialBucketState(e,t),next:this.createInitialBucketState(e,t),far:this.createInitialBucketState(e,t)}}createInitialBucketState(e,t){return{rows:[],cursor:null,hasMore:!0,expiry:null,loading:t,message:e}}allBucketIds(){return["near","next","far"]}unsubscribeBucketSubscriptions(){for(let e of Object.values(this.bucketSubscriptions))e?.unsubscribe()}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-delta-metrics-flow"]],decls:2,vars:2,consts:[["bucketContent",""],["bucketChart",""],[1,"delta-metrics-flow-stack"],["class","delta-metrics-flow-panel",4,"ngFor","ngForOf","ngForTrackBy"],[1,"delta-metrics-flow-panel"],[1,"delta-metrics-flow-panel__header"],[1,"delta-metrics-flow-panel__body"],[4,"ngIf","ngIfElse"],[1,"delta-metrics-flow-status"],[1,"chart",3,"itemSelected","scrolledNearEnd","items","windowSize","overscan","rowHeight","minViewportHeight","seriesName","animationDurationUpdate","backgroundColor","inverse","showValueLabels","enableRealtimeSort","sortDirection","valueLabelPosition"]],template:function(t,n){t&1&&(a(0,"div",2),P(1,Hm,10,3,"section",3),l()),t&2&&(c(),b("ngForOf",n.buckets)("ngForTrackBy",n.trackByBucket))},dependencies:[ze,st,Ki],styles:["[_nghost-%COMP%]{display:block;min-width:0}.delta-metrics-flow-stack[_ngcontent-%COMP%]{display:grid;gap:12px;min-width:0}.delta-metrics-flow-panel[_ngcontent-%COMP%]{min-width:0;width:100%;display:flex;flex-direction:column;background:#161b22;border:1px solid rgba(48,54,61,.9);border-radius:14px;padding:12px;box-shadow:0 18px 38px #0000006b,0 0 0 1px #3b82f60f,0 0 30px #2563eb14}.delta-metrics-flow-panel__header[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:32px;border-bottom:1px solid rgba(255,255,255,.08);padding-bottom:8px}.delta-metrics-flow-panel__header[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;color:#e6edf3;font-size:16px;font-weight:600}.delta-metrics-flow-panel__body[_ngcontent-%COMP%]{flex:1 1 auto;min-height:320px;max-height:360px;overflow:hidden;color:#8b949e;text-align:center}.delta-metrics-flow-status[_ngcontent-%COMP%]{min-height:300px;display:flex;align-items:center;justify-content:center;color:#c9d1d9;font-size:14px;font-weight:600}.chart[_ngcontent-%COMP%]{width:100%;min-width:0;height:100%}"],changeDetection:0});let i=o;return i})();var Zi=(()=>{let o=class o{constructor(e){this.repo=e}getNearestDeltaGroups(e){return this.repo.getNearestDelta(e).pipe(Ue(t=>t.data??{}))}};o.\u0275fac=function(t){return new(t||o)(V(kt))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var Qa=(()=>{let o=class o{constructor(){this.groupsByExpiryState=O({}),this.groupsByExpiry=this.groupsByExpiryState.asReadonly(),this.groups=M(()=>Object.values(this.groupsByExpiryState()))}setGroups(e){let t=Object.entries(e).reduce((n,[s,p])=>(n[s]=this.withSnapshotDirections(p),n),{});this.groupsByExpiryState.set(t)}upsertGroup(e){e.expiry&&this.groupsByExpiryState.update(t=>F(f({},t),{[e.expiry]:this.withSnapshotDirections(e,t[e.expiry])}))}upsertGroups(e){let t=e.filter(n=>!!n.expiry);return t.length===0?0:(this.groupsByExpiryState.update(n=>{let s=f({},n);for(let p of t)s[p.expiry]=this.withSnapshotDirections(p,n[p.expiry]);return s}),t.length)}clear(){this.groupsByExpiryState.set({})}withSnapshotDirections(e,t){let n=new Map(t?.snapshots.filter(s=>s.instrument_token!==null).map(s=>[s.instrument_token,s])??[]);return F(f({},e),{snapshots:e.snapshots.map(s=>{let p=s.instrument_token===null?void 0:n.get(s.instrument_token);return F(f({},s),{last_price_direction:p?(s.last_price??0)>(p.last_price??0)?"positive":"negative":"none",uv_ov_direction:s.uv_ov!==null&&s.uv_ov>0?"uv-ov-positive":"uv-ov-negative"})})})}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();function Xm(i,o){i&1&&(a(0,"div",4),d(1,"Loading..."),l())}function Wm(i,o){if(i&1&&(a(0,"div",5),d(1),l()),i&2){let r=u();c(),g(" ",r.errorMessage," ")}}function Zm(i,o){i&1&&(a(0,"div",4),d(1," No nearest delta data found. "),l())}function Jm(i,o){i&1&&(a(0,"th"),d(1,"MATCHED STRIKE"),l(),a(2,"th"),d(3,"MATCHED LTP"),l())}function eh(i,o){if(i&1&&(a(0,"td",16),d(1),l(),a(2,"td",16),d(3),l()),i&2){let r=u().$implicit;c(),g(" ",r.matched_strike," "),c(2),g(" ",r.matched_last_price," ")}}function th(i,o){if(i&1){let r=R();a(0,"tr",13),_("click",function(){let t=S(r).$implicit,n=u(3);return v(n.selectOption(t))}),a(1,"td"),d(2),l(),a(3,"td",14)(4,"p",15),d(5),l()(),a(6,"td",16)(7,"p"),d(8),l()(),a(9,"td",14)(10,"p"),d(11),l()(),a(12,"td",16)(13,"p"),d(14),l()(),a(15,"td",16)(16,"p"),d(17),l()(),a(18,"td",16)(19,"p"),d(20),l()(),a(21,"td",16)(22,"p"),d(23),l()(),a(24,"td",16),d(25),l(),a(26,"td",16),d(27),l(),a(28,"td",16),d(29),l(),a(30,"td",16),d(31),l(),a(32,"td",16),d(33),l(),P(34,eh,4,2),a(35,"td",16),d(36),l(),a(37,"td"),d(38),l()()}if(i&2){let r,e,t,n,s,p,m,h,x,I=o.$implicit,N=o.index,B=u(3);w("selected",B.selectedInstrumentToken===I.instrument_token),c(2),T(N+1),c(3),g(" ",I.symbol," "),c(2),J("base-properties "+B.spotStore.spot$().color),c(),g(" ",B.getUnderlyingPrice(I)," "),c(2),J("base-properties "+I.uv_ov_direction),c(),g(" ",(r=I.trading_symbol)!==null&&r!==void 0?r:"-"," "),c(2),J("base-properties "+I.last_price_direction),c(),g(" ",(e=I.last_price)!==null&&e!==void 0?e:"-"," "),c(3),T(I.hr),c(3),T((t=I.lot_size)!==null&&t!==void 0?t:"-"),c(3),T(I.hcr),c(2),T((n=I.iv)!==null&&n!==void 0?n:"-"),c(2),T((s=I.delta)!==null&&s!==void 0?s:"-"),c(2),T((p=I.fair_value)!==null&&p!==void 0?p:"-"),c(2),g(" ",(m=I.uv_ov)!==null&&m!==void 0?m:"-"," "),c(2),T((h=I.strike)!==null&&h!==void 0?h:"-"),c(),C(B.showMatchedOptionColumns()?34:-1),c(2),T(I.put_lot),c(2),g(" ",(x=I.delta_shares)!==null&&x!==void 0?x:"-"," ")}}function nh(i,o){if(i&1&&(a(0,"section",7)(1,"div",8),d(2),a(3,"span",9),d(4),l()(),a(5,"div",10)(6,"table",11)(7,"thead")(8,"tr")(9,"th"),d(10,"SNO."),l(),a(11,"th"),d(12,"SYMBOL"),l(),a(13,"th"),d(14),l(),a(15,"th"),d(16,"TRADING SYMBOL"),l(),a(17,"th"),d(18,"LAST PRICE"),l(),a(19,"th"),d(20,"HR"),l(),a(21,"th"),d(22,"NO. SHARES"),l(),a(23,"th"),d(24,"HCR"),l(),a(25,"th"),d(26,"IV"),l(),a(27,"th"),d(28,"DELTA"),l(),a(29,"th"),d(30,"FAIR VALUE"),l(),a(31,"th"),d(32,"UV/OV"),l(),a(33,"th"),d(34,"STRIKE"),l(),P(35,Jm,4,0),a(36,"th"),d(37,"PUT LOT"),l(),a(38,"th"),d(39,"DELTA SHARES"),l()()(),a(40,"tbody"),P(41,th,39,24,"tr",12),l()()()()),i&2){let r=o.$implicit,e=u(2);c(2),hn(" ",r.name," - ",r.expiry," - ",r.side," "),c(2),g("(",r.snapshot_count,")"),c(10),T(e.underlyingPriceHeader()),c(21),C(e.showMatchedOptionColumns()?35:-1),c(6),b("ngForOf",r.snapshots)("ngForTrackBy",e.trackByInstrumentToken)}}function ih(i,o){if(i&1&&(tt(0),P(1,nh,42,8,"section",6),nt()),i&2){let r=u();c(),b("ngForOf",r.nearestDeltaGroups())("ngForTrackBy",r.trackByExpiry)}}var oh={spot$:()=>({name:"",value:0,color:""})},Ao=(()=>{let o=class o{constructor(e,t,n,s){this.nearestDeltaPanelService=e,this.nearestDeltaRealtime=t,this.nearestDeltaPanelStore=n,this.cdr=s,this.name="AXISBANK",this.side="put",this.secondary_id="",this.source=null,this.source_token=null,this.selectedInstrumentToken=null,this.spotStore=oh,this.optionSelected=new ce,this.nearestDeltaGroups=this.nearestDeltaPanelStore.groups,this.loading=!1,this.errorMessage="",this.destroy$=new pe,this.pendingChangeDetectionFrame=0,this.activeHttpRequest=be.EMPTY,this.activeNearestDeltaRequest=null,this.hasInitialized=!1,this.loadVersion=0}ngOnInit(){this.hasInitialized=!0,this.nearestDeltaRealtime.groupUpdates$.pipe(Ut(this.destroy$)).subscribe(e=>this.applyGroupUpdates(e)),this.loadNearestDelta()}ngOnChanges(e){this.hasInitialized&&(e.name||e.side||e.secondary_id||e.source||e.source_token)&&this.loadNearestDelta()}ngOnDestroy(){this.pendingChangeDetectionFrame&&cancelAnimationFrame(this.pendingChangeDetectionFrame),this.activeHttpRequest.unsubscribe(),this.destroy$.next(),this.destroy$.complete(),this.unsubscribeActiveNearestDelta()}loadNearestDelta(){return k(this,null,function*(){let e=this.getNearestDeltaRequest(),t=++this.loadVersion;if(this.activeHttpRequest.unsubscribe(),yield this.unsubscribeActiveNearestDelta(),!e){this.loading=!1,this.nearestDeltaPanelStore.clear(),this.cdr.markForCheck();return}t===this.loadVersion&&(this.loading=!0,this.errorMessage="",this.activeHttpRequest=this.nearestDeltaPanelService.getNearestDeltaGroups(e).pipe(Ut(this.destroy$)).subscribe({next:n=>{t===this.loadVersion&&(this.nearestDeltaPanelStore.setGroups(n),this.loading=!1,this.cdr.markForCheck(),this.subscribeActiveNearestDelta(e,t))},error:n=>{t===this.loadVersion&&(this.errorMessage=this.getErrorMessage(n),this.nearestDeltaPanelStore.clear(),this.loading=!1,this.cdr.markForCheck())}}))})}trackByExpiry(e,t){return t.expiry||`${t.name}-${t.side}-${e}`}trackByInstrumentToken(e,t){return t.instrument_token??e}selectOption(e){this.optionSelected.emit(e)}hasMatchedOption(e){return Ni(e)}showMatchedOptionColumns(){return yo(this.secondary_id)}underlyingPriceHeader(){return this.isFuturesNearestDelta()?"FUTURE PRICE":"SPOT PRICE"}getUnderlyingPrice(e){return this.isFuturesNearestDelta()?e.underlying_last_price??0:this.spotStore.spot$().value}applyGroupUpdate(e){return this.nearestDeltaPanelStore.upsertGroup(e),this.scheduleChangeDetection(),!0}applyGroupUpdates(e){let t=this.nearestDeltaPanelStore.upsertGroups(e);return t>0&&this.scheduleChangeDetection(),t}getNearestDeltaRequest(){return this.name.trim()?f(f(f({name:this.name,side:this.side},this.secondary_id?{secondary_id:this.secondary_id}:{}),this.source?{source:this.source}:{}),this.source_token!=null?{source_token:this.source_token}:{}):(this.errorMessage="Enter a valid name.",null)}isFuturesNearestDelta(){return this.secondary_id===Ot.id||this.secondary_id===Mt.id||this.secondary_id===_t||this.secondary_id===Vt.id||this.secondary_id===Bt.id||this.secondary_id===_n.id||this.secondary_id===$e}getErrorMessage(e){let t=e.status;return t===404?`No nearest delta snapshots found for ${this.name} ${this.side}.`:t===0?"Unable to reach nearest delta service.":"Failed to load nearest delta data."}scheduleChangeDetection(){this.pendingChangeDetectionFrame||(this.pendingChangeDetectionFrame=requestAnimationFrame(()=>{this.pendingChangeDetectionFrame=0,this.cdr.markForCheck()}))}subscribeActiveNearestDelta(e,t){return k(this,null,function*(){try{yield this.nearestDeltaRealtime.subscribeNearestDeltas(e),t===this.loadVersion&&(this.activeNearestDeltaRequest=e)}catch(n){console.error("SubscribeNearestGreekDeltas failed:",n)}})}unsubscribeActiveNearestDelta(){return k(this,null,function*(){let e=this.activeNearestDeltaRequest;if(e){this.activeNearestDeltaRequest=null;try{yield this.nearestDeltaRealtime.unsubscribeNearestDeltas(e)}catch(t){console.error("UnsubscribeNearestGreekDeltas failed:",t)}}})}};o.\u0275fac=function(t){return new(t||o)(Z(Zi),Z(Ai),Z(Qa),Z(mi))},o.\u0275cmp=L({type:o,selectors:[["app-nearest-delta-panel"]],inputs:{name:"name",side:"side",secondary_id:"secondary_id",source:"source",source_token:"source_token",selectedInstrumentToken:"selectedInstrumentToken",spotStore:"spotStore"},outputs:{optionSelected:"optionSelected"},features:[ve],decls:5,vars:4,consts:[[1,"nearest-delta-panel"],["class","panel-status",4,"ngIf"],["class","panel-status error",4,"ngIf"],[4,"ngIf"],[1,"panel-status"],[1,"panel-status","error"],["class","expiry-table-group",4,"ngFor","ngForOf","ngForTrackBy"],[1,"expiry-table-group"],[1,"expiry-heading"],[1,"snapshot-count"],[1,"scanner-table-wrapper"],[1,"scanner-table"],["class","scanner-option-row",3,"selected","click",4,"ngFor","ngForOf","ngForTrackBy"],[1,"scanner-option-row",3,"click"],[1,"symbol"],[1,"base-properties"],[1,"value-cell"]],template:function(t,n){t&1&&(a(0,"div",0),P(1,Xm,2,0,"div",1)(2,Wm,2,1,"div",2)(3,Zm,2,0,"div",1)(4,ih,2,2,"ng-container",3),l()),t&2&&(c(),b("ngIf",n.loading),c(),b("ngIf",!n.loading&&n.errorMessage),c(),b("ngIf",!n.loading&&!n.errorMessage&&n.nearestDeltaGroups().length===0),c(),b("ngIf",!n.loading&&!n.errorMessage))},dependencies:[st,ze],styles:["[_nghost-%COMP%]{display:block}.nearest-delta-panel[_ngcontent-%COMP%]{--panel-border: #2d3748;--panel-shell: #161b22;--panel-head: #1f2633;--panel-row: #161b22;--panel-row-hover: #1f2633;--panel-text: #e6edf3;--panel-muted: #9aa4b2;color:var(--panel-text)}.expiry-table-group[_ngcontent-%COMP%] + .expiry-table-group[_ngcontent-%COMP%]{margin-top:14px}.expiry-heading[_ngcontent-%COMP%]{margin:0 0 6px;color:#dce9fb;font-size:12px;font-weight:900}.snapshot-count[_ngcontent-%COMP%]{color:var(--panel-muted);font-weight:800}.panel-status[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:40px;padding:0 12px;border:1px solid var(--panel-border);border-radius:8px;background:var(--panel-shell);color:#9eb1c8;font-size:12px;font-weight:800}.panel-status.error[_ngcontent-%COMP%]{color:#ff9faf}.scanner-table-wrapper[_ngcontent-%COMP%]{width:100%;overflow-x:auto;overflow-y:hidden;border:1px solid var(--panel-border);border-radius:8px;background:var(--panel-shell);-webkit-overflow-scrolling:touch}.scanner-table[_ngcontent-%COMP%]{width:100%;min-width:980px;border-collapse:separate;border-spacing:0;background:transparent}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{height:32px;padding:0 10px;text-align:center;background:var(--panel-head);border-bottom:1px solid var(--panel-border);color:var(--panel-muted);font-size:10px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;white-space:nowrap}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child{border-top-left-radius:7px}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:last-child{border-top-right-radius:7px}.scanner-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{height:33px;padding:0 10px;text-align:center;font-size:11px;font-weight:800;color:var(--panel-text);background:var(--panel-row);border-bottom:1px solid var(--panel-border);white-space:nowrap}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child, .scanner-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child{width:46px}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]{border-bottom:0}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]:first-child{border-bottom-left-radius:7px}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]:last-child{border-bottom-right-radius:7px}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:hover   td[_ngcontent-%COMP%]{background:var(--panel-row-hover)}.scanner-option-row[_ngcontent-%COMP%]{cursor:pointer}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr.selected[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{background:#183c63;box-shadow:inset 0 1px #5daaff59}.symbol[_ngcontent-%COMP%]{font-weight:900;color:#fff}.value-cell[_ngcontent-%COMP%]{color:#f4f8ff}.base-properties[_ngcontent-%COMP%]{color:#fff!important;padding:5px;border-radius:2px;margin:5px}.positive[_ngcontent-%COMP%]{background-color:var(--up)}.negative[_ngcontent-%COMP%]{background-color:var(--negative)}.uv-ov-positive[_ngcontent-%COMP%]{background-color:var(--positive-change)}.uv-ov-negative[_ngcontent-%COMP%]{background-color:var(--negative-change)}.scanner-table-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar{height:8px}.scanner-table-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#0d1520;border-radius:999px}.scanner-table-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#2a3a4f;border-radius:999px}"],changeDetection:0});let i=o;return i})();function rh(i,o){if(i&1){let r=R();a(0,"app-board-panel-header",0),_("settingsClick",function(){S(r);let t=u();return v(t.openSettings("hedge-ratio"))}),l(),a(1,"app-hedge-ratio-panel",1),_("optionSelected",function(t){S(r);let n=u();return v(n.selectHedgeRatioOption(t))}),l()}if(i&2){let r=u();b("title","Delta Metrics"),c(),b("name",r.store.selectedIndexName())("secondary_id",r.secondaryId())("source",r.greekSource())("source_token",r.greekSourceToken())("spotStore",r.marketSpotView())}}function sh(i,o){if(i&1){let r=R();a(0,"app-hedge-view-toggle",5),_("action",function(t){S(r);let n=u(2);return v(n.toggleDeltaMetricsView(t))}),l()}if(i&2){let r=u(2);b("flowChartVisible",r.ui.isDeltaFlowChart())("multiMode",r.ui.isMultiMode())("showModeToggle",!1)("compact",!1)}}function ah(i,o){i&1&&y(0,"app-delta-metrics-flow")}function lh(i,o){if(i&1){let r=R();a(0,"app-nearest-delta-panel",6),_("optionSelected",function(t){S(r);let n=u(2);return v(n.selectNearestDeltaOption(t))}),l()}if(i&2){let r=u(2);b("name",r.store.selectedIndexName())("side",r.nearestDeltaSide())("secondary_id",r.secondaryId())("source",r.greekSource())("source_token",r.greekSourceToken())("selectedInstrumentToken",r.store.selectedOptionInstrumentToken())("spotStore",r.marketSpotView())}}function ch(i,o){if(i&1&&(a(0,"app-board-panel-header",2),P(1,sh,1,4,"app-hedge-view-toggle",3),l(),P(2,ah,1,0,"app-delta-metrics-flow")(3,lh,1,7,"app-nearest-delta-panel",4)),i&2){let r=u();b("title","Delta Metrics")("showSettings",!0)("showInfo",!0),c(),C(r.showDeltaMetricsViewToggle()?1:-1),c(),C(r.showDeltaMetricsFlowChart()?2:3)}}var Ya=(i,o)=>o.expiry;function dh(i,o){return this.longBoxBestOpportunityRowKey(o)}
16function ph(i,o){return this.priceMatrixRowKey(o)}function uh(i,o){if(i&1&&(a(0,"div",2),d(1),l()),i&2){let r=u();c(),g(" ",r.priceMatrixSelectionWarning()," ")}}function mh(i,o){i&1&&(a(0,"div",3),d(1,"Loading..."),l())}function hh(i,o){if(i&1&&(a(0,"div",4),d(1),l()),i&2){let r=u();c(),g(" ",r.priceMatrixError()," ")}}function gh(i,o){if(i&1&&(a(0,"div",3),d(1),l()),i&2){let r=u();c(),g(" ",r.priceMatrixEmptyMessage()," ")}}function _h(i,o){i&1&&(a(0,"th"),d(1,"PROFIT / LOT"),l(),a(2,"th"),d(3,"LOTS"),l(),a(4,"th"),d(5,"MIN / LOT"),l(),a(6,"th"),d(7,"STATUS"),l())}function fh(i,o){if(i&1&&(a(0,"td",15),d(1),l(),a(2,"td",15),d(3),l(),a(4,"td",15),d(5),l(),a(6,"td",15),d(7),l()),i&2){let r=u().$implicit,e=u(5);c(),g(" ",e.formatCurrency(e.longBoxProfitPerLot(r))," "),c(2),g(" ",e.formatInteger(e.longBoxLotCount(r))," "),c(2),g(" ",e.formatCurrency(e.longBoxMinimumProfitPerLot(r))," "),c(2),g(" ",e.longBoxOpportunityLabel(r)," ")}}function xh(i,o){if(i&1){let r=R();a(0,"tr",12),_("click",function(){let t=S(r).$implicit,n=u(5);return v(n.selectLongBoxBestOpportunityRow(t))})("keydown.enter",function(){let t=S(r).$implicit,n=u(5);return v(n.selectLongBoxBestOpportunityRow(t))})("keydown.space",function(t){let n=S(r).$implicit;return u(5).selectLongBoxBestOpportunityRow(n),v(t.preventDefault())}),a(1,"td"),d(2),l(),a(3,"td",13)(4,"p",14),d(5),l()(),a(6,"td",15),d(7),l(),a(8,"td",15),d(9),l(),a(10,"td",15),d(11),l(),a(12,"td",15),d(13),l(),a(14,"td",15),d(15),l(),a(16,"td",16),d(17),l(),P(18,fh,8,4),a(19,"td",15),d(20),l(),a(21,"td",15),d(22),l()()}if(i&2){let r=o.$implicit,e=o.$index,t=u(5);w("selected",t.isLongBoxBestOpportunityRowSelected(r)),H("aria-pressed",t.isLongBoxBestOpportunityRowSelected(r))("aria-label","Select Box Spread payoff legs for "+(r.underlying_symbol||"symbol")+" "+r.expiry),c(2),T(e+1),c(3),g(" ",r.underlying_symbol||"-"," "),c(2),T(r.expiry||"-"),c(2),g(" ",t.formatNumber(r.box_spread.lower_strike)," "),c(2),g(" ",t.formatNumber(r.box_spread.upper_strike)," "),c(2),g(" ",t.formatNumber(t.isIndependentShortBoxBestOpportunity()?r.box_spread.net_credit:r.box_spread.net_debit)," "),c(2),g(" ",t.formatNumber(r.box_spread.edge_points)," "),c(2),g(" ",t.usesEquityLongBoxLotContract()?t.formatCurrency(t.longBoxTotalProfit(r)):t.formatNumber(r.max_profit)," "),c(),C(t.usesEquityLongBoxLotContract()?18:-1),c(2),g(" ",t.formatInteger(r.box_spread.lot_size)," "),c(2),g(" ",t.formatLongBoxReturn(r.box_spread.return)," ")}}function bh(i,o){if(i&1&&(a(0,"div",8)(1,"table",10)(2,"thead")(3,"tr")(4,"th"),d(5,"SNO."),l(),a(6,"th"),d(7,"UNDERLYING"),l(),a(8,"th"),d(9,"EXPIRY"),l(),a(10,"th"),d(11,"LOWER STRIKE"),l(),a(12,"th"),d(13,"UPPER STRIKE"),l(),a(14,"th"),d(15),l(),a(16,"th"),d(17,"EDGE POINTS"),l(),a(18,"th"),d(19),l(),P(20,_h,8,0),a(21,"th"),d(22),l(),a(23,"th"),d(24,"RETURN"),l()()(),a(25,"tbody"),q(26,xh,23,15,"tr",11,dh,!0),l()()()),i&2){let r=u().$implicit,e=u(3);c(15),g(" ",e.isIndependentShortBoxBestOpportunity()?"NET CREDIT":"NET DEBIT"," "),c(4),g(" ",e.usesEquityLongBoxLotContract()?"TOTAL PROFIT":"MAX PROFIT"," "),c(),C(e.usesEquityLongBoxLotContract()?20:-1),c(2),g(" ",e.usesEquityLongBoxLotContract()?"LOT SIZE":"LOT"," "),c(4),G(r.snapshots)}}function yh(i,o){i&1&&(a(0,"div",9),d(1," No opportunities available "),l())}function Ch(i,o){if(i&1&&(a(0,"section",5)(1,"div",6),d(2),a(3,"span",7),d(4),l()(),P(5,bh,28,4,"div",8)(6,yh,2,0,"div",9),l()),i&2){let r=o.$implicit,e=u(3);c(2),hn(" ",r.name," - ",r.expiry," - ",r.side," "),c(2),g("(",r.snapshot_count,")"),c(),C(e.hasLongBoxBestOpportunityGroupRows(r)?5:6)}}function Ph(i,o){if(i&1&&q(0,Ch,7,5,"section",5,Ya),i&2){let r=u(2);G(r.longBoxBestOpportunityGroups())}}function Sh(i,o){if(i&1){let r=R();a(0,"tr",18),_("click",function(){let t=S(r).$implicit,n=u(5);return v(n.selectPriceMatrixRow(t))})("keydown.enter",function(){let t=S(r).$implicit,n=u(5);return v(n.selectPriceMatrixRow(t))})("keydown.space",function(t){let n=S(r).$implicit;return u(5).selectPriceMatrixRow(n),v(t.preventDefault())}),a(1,"td"),d(2),l(),a(3,"td",13)(4,"p",14),d(5),l()(),a(6,"td",15)(7,"p",19),d(8),l()(),a(9,"td",13)(10,"p",20),d(11),l()(),a(12,"td",15)(13,"p",19),d(14),l()(),a(15,"td",13)(16,"p",21),d(17),l()(),a(18,"td",15)(19,"p",19),d(20),l()(),a(21,"td",15),d(22),l(),a(23,"td",15),d(24),l(),a(25,"td",16),d(26),l()()}if(i&2){let r=o.$implicit,e=o.$index,t=u(5);w("selected",t.isPriceMatrixRowSelected(r)),H("aria-pressed",t.isPriceMatrixRowSelected(r))("aria-label","Select payoff legs for "+(r.underlying_symbol||"symbol")+" "+r.expiry+" str
16ike "+t.formatNumber(r.strike)),c(2),T(e+1),c(3),g(" ",r.underlying_symbol||"-"," "),c(3),g(" ",t.formatNumber(r.underlying_price)," "),c(3),g(" ",r.pe_symbol||"-"," "),c(3),g(" ",t.formatNumber(r.pe_price)," "),c(3),g(" ",r.ce_symbol||"-"," "),c(3),g(" ",t.formatNumber(r.ce_price)," "),c(2),g(" ",t.formatNumber(r.strike)," "),c(2),g(" ",t.formatInteger(r.lot_size)," "),c(2),g(" ",t.formatNumber(r.max_profit)," ")}}function vh(i,o){if(i&1&&(a(0,"div",8)(1,"table",10)(2,"thead")(3,"tr")(4,"th"),d(5,"SNO."),l(),a(6,"th"),d(7,"UNDERLYING"),l(),a(8,"th"),d(9,"UNDERLYING PRICE"),l(),a(10,"th"),d(11,"PE SYMBOL"),l(),a(12,"th"),d(13,"PE PRICE"),l(),a(14,"th"),d(15,"CE SYMBOL"),l(),a(16,"th"),d(17,"CE PRICE"),l(),a(18,"th"),d(19,"STRIKE"),l(),a(20,"th"),d(21,"LOT"),l(),a(22,"th"),d(23,"MAX PROFIT"),l()()(),a(24,"tbody"),q(25,Sh,27,14,"tr",17,ph,!0),l()()()),i&2){let r=u().$implicit;c(25),G(r.snapshots)}}function wh(i,o){i&1&&(a(0,"div",9),d(1," No opportunities available "),l())}function Oh(i,o){if(i&1&&(a(0,"section",5)(1,"div",6),d(2),a(3,"span",7),d(4),l()(),P(5,vh,27,0,"div",8)(6,wh,2,0,"div",9),l()),i&2){let r=o.$implicit,e=u(3);c(2),hn(" ",r.name," - ",r.expiry," - ",r.side||"conversion"," "),c(2),g("(",r.snapshot_count,")"),c(),C(e.hasPriceMatrixGroupRows(r)?5:6)}}function Mh(i,o){if(i&1&&q(0,Oh,7,5,"section",5,Ya),i&2){let r=u(2);G(r.priceMatrixGroups())}}function Eh(i,o){i&1&&(a(0,"div",3),d(1,"Results not available"),l())}function Th(i,o){if(i&1&&P(0,Ph,2,0)(1,Mh,2,0)(2,Eh,2,0,"div",3),i&2){let r=u();C(r.isLongBoxBestOpportunity()?0:r.priceMatrixGroups().length?1:2)}}var Xa="[_nghost-%COMP%]{display:flex;flex-direction:column;min-height:90vh;height:90vh;max-height:90vh;min-width:0}[_nghost-%COMP%] > app-delta-metrics-flow[_ngcontent-%COMP%], [_nghost-%COMP%] > app-hedge-ratio-panel[_ngcontent-%COMP%], [_nghost-%COMP%] > app-nearest-delta-panel[_ngcontent-%COMP%], [_nghost-%COMP%] > .price-matrix-panel[_ngcontent-%COMP%]{flex:1 1 auto;min-height:0}.delta-metrics-flow-stack[_ngcontent-%COMP%]{display:grid;gap:12px;min-width:0}.secondary-strategy-panel[_ngcontent-%COMP%]{min-height:220px;border:1px solid #1f2937;border-radius:6px;background:#111820}.price-matrix-panel[_ngcontent-%COMP%]{--panel-border: #2d3748;--panel-shell: #161b22;--panel-head: #1f2633;--panel-row: #161b22;--panel-row-hover: #1f2633;--panel-text: #e6edf3;--panel-muted: #9aa4b2;display:grid;gap:0;align-content:start;min-width:0;max-height:90vh;padding:10px;color:var(--panel-text);overflow:auto}.spot-trades-area--matrix-full[_nghost-%COMP%]   .price-matrix-panel[_ngcontent-%COMP%], .spot-trades-area--matrix-full   [_nghost-%COMP%]   .price-matrix-panel[_ngcontent-%COMP%]{max-height:90vh}.expiry-table-group[_ngcontent-%COMP%] + .expiry-table-group[_ngcontent-%COMP%]{margin-top:75px}.expiry-heading[_ngcontent-%COMP%]{margin:0 0 6px;color:#dce9fb;font-size:12px;font-weight:900}.snapshot-count[_ngcontent-%COMP%]{color:var(--panel-muted);font-weight:800}.panel-status[_ngcontent-%COMP%]{display:flex;align-items:center;min-height:40px;padding:0 12px;border:1px solid var(--panel-border);border-radius:8px;background:var(--panel-shell);color:#9eb1c8;font-size:12px;font-weight:800}.panel-status.error[_ngcontent-%COMP%]{color:#ff9faf}.panel-status.selection-warning[_ngcontent-%COMP%]{margin-bottom:10px;border-color:#8a6d1d;background:#2b2412;color:#f8d477}.expiry-empty-state[_ngcontent-%COMP%]{justify-content:center}.scanner-table-wrapper[_ngcontent-%COMP%]{width:100%;overflow-x:auto;overflow-y:hidden;border:1px solid var(--panel-border);border-radius:8px;background:var(--panel-shell);-webkit-overflow-scrolling:touch}.scanner-table[_ngcontent-%COMP%]{width:100%;min-width:1160px;border-collapse:separate;border-spacing:0;background:transparent}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{height:32px;padding:0 10px;text-align:center;background:var(--panel-head);border-bottom:1px solid var(--panel-border);color:var(--panel-muted);font-size:10px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;white-space:nowrap}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child{border-top-left-radius:7px}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:last-child{border-top-right-radius:7px}.scanner-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{height:33px;padding:0 10px;text-align:center;font-size:11px;font-weight:800;color:var(--panel-text);background:var(--panel-row);border-bottom:1px solid var(--panel-border);white-space:nowrap}.scanner-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child, .scanner-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child{width:46px}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]{border-bottom:0}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]:first-child{border-bottom-left-radius:7px}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]:last-child{border-bottom-right-radius:7px}.scanner-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:hover   td[_ngcontent-%COMP%]{background:var(--panel-row-hover)}.price-matrix-row[_ngcontent-%COMP%]{cursor:pointer;outline:none}.price-matrix-row[_ngcontent-%COMP%]:focus-visible   td[_ngcontent-%COMP%]{background:#243247;box-shadow:inset 0 1px #60a5fa,inset 0 -1px #60a5fa}.price-matrix-row.selected[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{background:#10253a;box-shadow:inset 0 1px #2563eb,inset 0 -1px #2563eb}.price-matrix-row.selected[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child{box-shadow:inset 3px 0 #2563eb,inset 0 1px #2563eb,inset 0 -1px #2563eb}.symbol[_ngcontent-%COMP%]{font-weight:900;color:#fff}.value-cell[_ngcontent-%COMP%]{color:#f4f8ff}.base-properties[_ngcontent-%COMP%]{max-width:170px;overflow:hidden;padding:5px;border-radius:2px;margin:5px;color:#fff!important;text-overflow:ellipsis;white-space:nowrap}.positive[_ngcontent-%COMP%]{background-color:var(--up)}.negative[_ngcontent-%COMP%]{background-color:var(--negative)}.price-matrix-pe[_ngcontent-%COMP%]{background-color:#0b18f5}.price-matrix-ce[_ngcontent-%COMP%]{background:#d4007c}.price-matrix-profit[_ngcontent-%COMP%]{color:#22c55e}.scanner-table-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar{height:8px}.scanner-table-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:#0d1520;border-radius:999px}.scanner-table-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:#2a3a4f;border-radius:999px}",Uo=(()=>{let o=class o{constructor(){this.store=D(ae),this.ui=D(he),this.detailsFacade=D(We),this.page=D(de),this.settings=D(ni),this.secondaryId=M(()=>this.page.originId()),this.usesEquityFuturesDeltaRange=M(()=>this.secondaryId()===Ke.id),this.greekSource=M(()=>this.usesEquityFuturesDeltaRange()?"future":this.store.hedgeActiveAssets()==="etf"?"etf":null),this.greekSourceToken=M(()=>this.usesEquityFuturesDeltaRange()?null:this.greekSource()==="etf"?this.store.selectedInstrumentToken():null),this.marketSpotView=M(()=>{let e=this.detailsFacade.spotView(),t=this.store.selectedInstrumentToken(),n=this.store.selectedIndexName(),s=this.store.marketRows().find(p=>p.spot_info.instrument_token===t||p.spot_info.symbol===n);return s?{spot$:()=>({name:s.spot_info.symbol,value:s.spot_info.price,color:s.direction.priceDirection})}:e}),this.nearestDeltaSide=M(()=>this.secondaryId()===Mt.id||this.secondaryId()===ts.id||this.secondaryId()===ut||this.secondaryId()===$e?"call":"put"),this.showNearestDeltaPanel=M(()=>xo(this.secondaryId())),this.showDeltaMetricsViewToggle=M(()=>Ee(this.secondaryId())),this.showDeltaMetricsFlowChart=M(()=>this.showDeltaMetricsViewToggle()&&this.ui.isDeltaFlowChart()),this.showHedgeRatioPanel=M(()=>nn(this.secondaryId())&&bo(this.secondaryId())&&!this.showNearestDeltaPanel())}openSettings(e){return k(this,null,function*(){yield this.settings.open(e)})}toggleDeltaMetricsView(e){this.showDeltaMetricsViewToggle()&&e==="toggle-chart"&&this.ui.toggleDeltaFlowChart()}selectNearestDeltaOption(e){let t=Js(this.page.primaryId(),this.secondaryId(),e);if(Number.isFinite(e.put_lot)){this.store.setSelectedOptionInstrumentTokens([...t],e.put_lot);return}this.store.setSelectedOptionInstrumentTokens([...t])}selectHedgeRatioOption(e){this.store.setSelectedOptionInstrumentTokens([...e.instrumentTokens],e.putLot)}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-board-strategy-panel"]],hostAttrs:[1,"panel-divider"],decls:2,vars:2,consts:[[3,"settingsClick","title"],[3,"optionSelected","name","secondary_id","source","source_token","spotStore"],[3,"title","showSettings","showInfo"],["panel-controls","",3,"flowChartVisible","multiMode","showModeToggle","compact"],[3,"name","side","secondary_id","source","source_token","selectedInstrumentToken","spotStore"],["panel-controls","",3,"action","flowChartVisible","multiMode","showModeToggle","compact"],[3,"optionSelected","name","side","secondary_id","source","source_token","selectedInstrumentToken","spotStore"]],template:function(t,n){t&1&&P(0,rh,2,6)(1,ch,4,5),t&2&&(C(n.showHedgeRatioPanel()?0:-1),c(),C(n.showNearestDeltaPanel()?1:-1))},dependencies:[Ft,Lo,Qi,$a,Ao],styles:[Xa],changeDetection:0});let i=o;return i})(),Ho=(()=>{let o=class o{constructor(){this.store=D(ae),this.page=D(de),this.payoffRepository=D(Rt),this.priceMatrixRealtime=D(Va),this.longBoxBestOpportunityRealtime=D(Yi),this.destroyRef=D(vn),this.numberFormatter=new Intl.NumberFormat("en-IN",{maximumFractionDigits:2}),this.integerFormatter=new Intl.NumberFormat("en-IN",{maximumFractionDigits:0}
16),this.priceMatrixGroups=O([]),this.priceMatrixTitle=O(""),this.priceMatrixEmptyMessage=O(""),this.priceMatrixLoading=O(!1),this.priceMatrixError=O(""),this.priceMatrixSelectionWarning=O(""),this.longBoxBestOpportunityGroups=O([]),this.longBoxBestOpportunityRows=M(()=>this.longBoxBestOpportunityGroups().flatMap(e=>e.snapshots??[])),this.priceMatrixPanelTitle=M(()=>{let e=this.priceMatrixTitle().trim();return this.isIndexOptionsPriceMatrixRoute(this.page.originId())&&e?e:"Price Matrix"}),this.priceMatrixBootstrapComplete=O(!1),this.priceMatrixBootstrapSecondaryId="",this.priceMatrixAutoSelectionSecondaryId="",this.selectionBootstrapSecondaryId="",this.selectionBootstrapRevisionBaseline=0,this.initialPriceMatrixAutoSelectionAttempted=!1,this.hasRenderedLongBoxBestOpportunity=!1,this.priceMatrixRealtime.priceMatrixUpdated$.pipe(Gn(this.destroyRef)).subscribe(e=>{this.isLongBoxBestOpportunity()||this.applyPriceMatrixResponse(e,"realtime")}),this.longBoxBestOpportunityRealtime.bestOpportunityUpdated$.pipe(Gn(this.destroyRef)).subscribe(e=>{this.isLongBoxBestOpportunity()&&this.applyLongBoxBestOpportunityResponse(e)}),this.destroyRef.onDestroy(()=>{this.longBoxBestOpportunityRealtime.cleanup()}),re(()=>{let e=this.page.originId(),t=this.store.selectedOptionInstrumentTokens(),n=this.priceMatr
16ixGroups();if(!fe(e)||t.length!==2)return;let s=this.findPriceMatrixRowByOptionTokens(n,t);s&&Qt(()=>this.selectPriceMatrixRow(s))}),re(e=>{let t=this.page.originId();if(this.preparePriceMatrixBootstrap(t))return;let n=this.priceMatrixBootstrapComplete(),s=this.store.priceMatrixSelectionRevision();this.prepareSelectionBootstrap(t,s);let p=t===j.id||t===ie.id||t===Xt.id,m=p&&s!==this.selectionBootstrapRevisionBaseline,h=p&&!m,x=h?0:Number(this.store.selectedInstrumentToken()),I=this.isIndexOptionsPriceMatrixRoute(t),N=t===j.id,B=N?this.store.equityLongBoxPutLot():null,$=this.isFuturesUnderlyingPriceMatrixRoute(t),K=this.shouldKeepMarketWatchSelectionInactive();if(this.prepareInitialPriceMatrixAutoSelection(t),this.isLongBoxBestOpportunityRoute(t)){if(this.priceMatrixRealtime.unsubscribeCurrentSelection(),N&&B===null){this.resetPriceMatrix(),this.priceMatrixError.set(bt),this.longBoxBestOpportunityRealtime.cleanup();return}if(!h&&(!Number.isFinite(x)||x<=0)){this.resetPriceMatrix(),this.longBoxBestOpportunityRealtime.cleanup();return}let Ce=f({secondary_id:t,instrument_token:h?0:x,segment:t===ee.id||t===Q.id?"index-options":"equity-options"},N?{put_lot:B}:{}),xe=!0,Ie=this.hasRenderedLongBoxBestOpportunity;
16Ie||this.resetPriceMatrix(),this.priceMatrixError.set(""),this.priceMatrixLoading.set(!Ie),this.longBoxBestOpportunityRealtime.initialize(Ce).then(()=>{xe&&this.priceMatrixLoading.set(!1)}).catch(Ze=>{if(!xe)return;let Le=Nn(Ze)?bt:"Unable to load opportunity";Ie?this.priceMatrixSelectionWarning.set(Le):(this.longBoxBestOpportunityGroups.set([]),this.priceMatrixTitle.set(""),this.priceMatrixEmptyMessage.set(""),this.priceMatrixError.set(Le),this.markPreservedSelectionUnavailable()),this.priceMatrixLoading.set(!1)}),e(()=>{xe=!1});return}if(this.longBoxBestOpportunityRealtime.cleanup(),!this.shouldLoadPriceMatrix(t)){this.priceMatrixBootstrapComplete.set(!1),this.resetPriceMatrix(),this.priceMatrixRealtime.unsubscribeCurrentSelection();return}if(!$&&!n){let Ce={secondary_id:t,instrument_token:0,segment:this.resolvePriceMatrixSegment(t)};this.priceMatrixLoading.set(!0),this.priceMatrixError.set(""),this.priceMatrixEmptyMessage.set("");let xe=this.payoffRepository.getBestOpportunity(Ce).subscribe({next:Ie=>{let Ze=this.resolveSpotSelection(Ie);if(!Ze||K){this.applyPriceMatrixResponse(Ie,"http"),this.priceMatr
16ixBootstrapComplete.set(!0);return}this.store.setSelectedIndexName(Ze.spotSymbol,Ze.spotToken),this.priceMatrixBootstrapComplete.set(!0)},error:()=>{this.priceMatrixGroups.set([]),this.priceMatrixTitle.set(""),this.priceMatrixEmptyMessage.set(""),this.priceMatrixError.set("Unable to load opportunity"),this.priceMatrixLoading.set(!1),this.markPreservedSelectionUnavailable(),this.priceMatrixRealtime.unsubscribeCurrentSelection()}});e(()=>{xe.unsubscribe(),this.priceMatrixRealtime.unsubscribeCurrentSelection()});return}if(!I&&!h&&(!Number.isFinite(x)||x<=0)){if(K&&n){this.priceMatrixRealtime.unsubscribeCurrentSelection();return}this.resetPriceMatrix(),this.priceMatrixRealtime.unsubscribeCurrentSelection();return}let oe={secondary_id:t,instrument_token:Number.isFinite(x)&&x>0?x:0,segment:this.resolvePriceMatrixSegment(t)};this.priceMatrixLoading.set(!0),this.priceMatrixError.set(""),this.priceMatrixEmptyMessage.set("");let le=this.payoffRepository.getBestOpportunity(oe).subscribe({next:Ce=>{this.applyPriceMatrixResponse(Ce,"http"),this.priceMatr
16ixRealtime.subscribe(oe)},error:()=>{this.priceMatrixGroups.set([]),this.priceMatrixTitle.set(""),this.priceMatrixEmptyMessage.set(""),this.priceMatrixError.set("Unable to load opportunity"),this.priceMatrixLoading.set(!1),this.markPreservedSelectionUnavailable(),this.priceMatrixRealtime.unsubscribeCurrentSelection()}});e(()=>{le.unsubscribe(),this.priceMatrixRealtime.unsubscribeCurrentSelection()})})}priceMatrixRowKey(e){return`${e.expiry}:${e.pe_token}:${e.ce_token}:${e.strike}`}longBoxBestOpportunityRowKey(e){return[this.resolveLongBoxBestOpportunityOptionTokens(e).join(","),e.box_spread.edge_rupees,e.generation_timestamp].join("|")}selectLongBoxBestOpportunityRow(e){let t=this.toPositiveNumber(e.underlying_token),n=this.resolveLongBoxBestOpportunityOptionTokens(e);t===null||!e.underlying_symbol?.trim()||!e.expiry?.trim()||n.length!==4||(this.store.setSelectedScannerRow({indexName:e.underlying_symbol.trim(),instrumentToken:t,expiryIndex:1,expiry:e.expiry.trim(),rowKey:this.longBoxBestOpportunityRowKey(e),tradeTokens:null,optionInstrumentTokens:n}
16),this.priceMatrixSelectionWarning.set(""))}isLongBoxBestOpportunityRowSelected(e){return this.toPositiveNumber(this.store.selectedInstrumentToken())===this.toPositiveNumber(e.underlying_token)&&this.store.selectedScannerExpiry()===e.expiry&&this.areSameTokens(this.store.selectedOptionInstrumentTokens(),this.resolveLongBoxBestOpportunityOptionTokens(e))}isLongBoxBestOpportunity(){return this.isLongBoxBestOpportunityRoute(this.page.originId())}isIndependentShortBoxBestOpportunity(){return this.page.originId()===ie.id||this.page.originId()===Q.id}selectPriceMatrixRow(e){let t=e.underlying_kind==="future",n=this.resolvePriceMatrixRowSpotSelection(e),s=this.toPositiveNumber(e.pe_token),p=this.toPositiveNumber(e.ce_token),m=t?this.toPositiveNumber(e.underlying_token):null;s===null||p===null||t&&m===null||!t&&!n||(n&&!this.isSelectedSpot(n.spotSymbol,n.spotToken)&&this.store.setSelectedIndexName(n.spotSymbol,n.spotToken),this.store.setSelectedOptionInstrumentTokens(m===null?[s,p]:[m,s,p]),this.priceMatrixSelectionWarning.set(""))}isPriceMatrixRowSelected(e){let t=this.toPositiveNumber(this.store.selectedInstrumentToken()),n=this.toPositiveNumber(e.underlying_token),s=this.toPositiveNumber(e.pe_token),p=this.toPositiveNumber(e.ce_token),m=this.store.selectedOptionInstrumentTokens();return s===null||p===null?!1:e.underlying_kind==="future"?n!==null&&m[0]===n&&m[1]===s&&m[2]===p:e.underlying_kind!=="spot"||t===null?!1:n!==null&&t===n&&m[0]===s&&m[1]===p}formatNumber(e){let t=Number(e);return Number.isFinite(t)?this.numberFormatter.format(t):"-"}formatInteger(e){let t=Number(e);return Number.isFinite(t)?this.integerFormatter.format(t):"-"}formatLongBoxReturn(e){let t=Number(e);return Number.isFinite(t)?`${this.numberFormatter.format(t*100)}%`:"-"}hasPriceMatrixGroupRows(e){return(e.snapshots?.length??0)>0}hasLongBoxBestOpportunityGroupRows(e){return(e.snapshots?.length??0)>0}resetPriceMatrix(){this.hasRenderedLongBoxBestOpportunity=!1,this.priceMatr
16ixGroups.set([]),this.longBoxBestOpportunityGroups.set([]),this.priceMatrixTitle.set(""),this.priceMatrixEmptyMessage.set(""),this.priceMatrixError.set(""),this.priceMatrixLoading.set(!1),this.priceMatrixSelectionWarning.set("")}toPositiveNumber(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:null}toFiniteNumberOrNull(e){if(e==null||e==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}applyPriceMatrixResponse(e,t){this.hasRenderedLongBoxBestOpportunity=!1;let n=this.toPriceMatrixGroups(e.data),s=this.hasPriceMatrixRows(n),p=t==="http"&&this.shouldAutoSelectInitialPriceMatrixRow(this.page.originId())&&(!this.shouldKeepMarketWatchSelectionInactive()||this.isFuturesUnderlyingPriceMatrixRoute(this.page.originId()))&&!this.initialPriceMatrixAutoSelectionAttempted;if(p&&(this.initialPriceMatrixAutoSelectionAttempted=!0),this.priceMatrixGroups.set(n),this.priceMatrixTitle.set(e.title?.trim()??""),this.priceMatrixEmptyMessage.set(n.length>0?"":this.resolvePriceMatrixEmptyMessage(e)),this.priceMatrixError.set(""),this.priceMatr
16ixLoading.set(!1),!s){Qt(()=>this.markPreservedSelectionUnavailable());return}Qt(()=>{if(p&&!this.hasCommittedPayoffSelection()){let m=this.findHighestProfitSelectablePriceMatrixRow(n);if(m){this.selectPriceMatrixRow(m);return}}this.reconcilePreservedSelection(n)})}applyLongBoxBestOpportunityResponse(e){this.hasRenderedLongBoxBestOpportunity=!0;let t=Fo(e.data),n=t.flatMap(s=>s.snapshots??[]);if(this.priceMatrixGroups.set([]),this.longBoxBestOpportunityGroups.set(t),this.priceMatrixTitle.set(e.title?.trim()??""),this.priceMatrixEmptyMessage.set(t.length>0?"":e.message?.trim()||"Results not available"),this.priceMatrixError.set(""),this.priceMatrixLoading.set(!1),this.priceMatrixSelectionWarning.set(""),!n.length){Qt(()=>this.markPreservedSelectionUnavailable());return}Qt(()=>{if(this.shouldAutoSelectIndependentEquityShortBox(this.page.originId())&&!this.shouldKeepMarketWatchSelectionInactive()&&!this.initialPriceMatrixAutoSelectionAttempted&&!this.hasCommittedPayoffSelection()){let s=n.find(p=>this.isLongBoxBestOpportunityRowSelectable(p));s&&(this.initialPriceMatrixAutoSelectionAttempted=!0,this.selectLongBoxBestOpportunityRow(s))}})}isLongBoxBestOpportunityRowSelectable(e){let t=this.resolveLongBoxBestOpportunityOptionTokens(e);return this.toPositiveNumber(e.underlying_token)!==null&&!!e.underlying_symbol?.trim()&&!!e.expiry?.trim()&&t.length===4}resolveLongBoxBestOpportunityOptionTokens(e){let t=(e.processed_legs??[]).slice().sort((n,s)=>Number(n.order)-Number(s.order)).map(n=>this.toPositiveNumber(n.instrument_token)).filter(n=>n!==null).filter((n,s,p)=>p.indexOf(n)===s);return t.length===4?t:(e.processed_instrument_tokens??[]).map(n=>this.toPositiveNumber(n)).filter(n=>n!==null).filter((n,s,p)=>p.indexOf(n)===s)}shouldAutoSelectIndependentEquityShortBox(e){return e===ie.id}shouldKeepMarketWatchSelectionInactive(){return this.page.primaryId()===ht}shouldAutoSelectInitialPriceMatrixRow(e){return e===Et.id||e===Tt.id||e===Xt.id||this.isIndexOptionsPriceMatrixRoute(e)&&e!==mt.id}usesEquityLongBoxLotContract(){return this.page.originId()===j.id}longBoxTotalProfit(e){return this.toFiniteNumberOrNull(e.total_profit)??this.toFiniteNumberOrNull(e.box_spread.total_profit)??this.toFiniteNumberOrNull(e.max_profit)}longBoxProfitPerLot(e){return this.toFiniteNumberOrNull(e.profit_per_lot)??this.toFiniteNumberOrNull(e.box_spread.profit_per_lot)}longBoxLotCount(e){return this.toFiniteNumberOrNull(e.lot_count)??this.toFiniteNumberOrNull(e.box_spread.lot_count)}longBoxMinimumProfitPerLot(e){return this.toFiniteNumberOrNull(e.minimum_profit_per_lot)??this.toFiniteNumberOrNull(e.box_spread.minimum_profit_per_lot)??this.toFiniteNumberOrNull(e.threshold)??this.toFiniteNumberOrNull(e.box_spread.threshold)}longBoxOpportunityLabel(e){let t=e.opportunity_available??e.box_spread.opportunity_available,n=e.threshold_matched??e.box_spread.threshold_matched;return t===!1||n===!1?"Unavailable":t===!0||n===!0?"Available":e.box_spread.is_profitable?"Positive":"Unavailable"}formatCurrency(e){return typeof e=="number"&&Number.isFinite(e)?`\u20B9${this.numberFormatter.format(e)}`:"-"}
16preparePriceMatrixBootstrap(e){return e===this.priceMatrixBootstrapSecondaryId||(this.priceMatrixBootstrapSecondaryId=e,!this.priceMatrixBootstrapComplete())?!1:(this.priceMatrixBootstrapComplete.set(!1),!0)}prepareSelectionBootstrap(e,t){e!==this.selectionBootstrapSecondaryId&&(this.selectionBootstrapSecondaryId=e,this.selectionBootstrapRevisionBaseline=t)}prepareInitialPriceMatrixAutoSelection(e){e!==this.priceMatrixAutoSelectionSecondaryId&&(this.priceMatrixAutoSelectionSecondaryId=e,this.initialPriceMatrixAutoSelectionAttempted=!1)}findHighestProfitSelectablePriceMatrixRow(e){let t=null,n=Number.NEGATIVE_INFINITY;for(let s of e.flatMap(p=>p.snapshots??[])){let p=Number(s.max_profit);!Number.isFinite(p)||!this.isPriceMatrixRowSelectable(s)||p<=n||(t=s,n=p)}return t}isPriceMatrixRowSelectable(e){let t=this.toPositiveNumber(e.pe_token),n=this.toPositiveNumber(e.ce_token);return t===null||n===null?!1:e.underlying_kind==="future"?this.toPositiveNumber(e.underlying_token)!==null:e.underlying_kind==="spot"&&this.resolvePriceMatrixRowSpotSelection(e)!==null}reconcilePreservedSelection(e){if(!this.hasCommittedPayoffSelection()){this.priceMatr
16ixSelectionWarning.set("");return}this.priceMatrixSelectionWarning.set(this.findSelectedPriceMatrixRow(e)?"":"The selected payoff opportunity is no longer available in the latest price matrix. The existing payoff selection has been preserved.")}findSelectedPriceMatrixRow(e){return e.flatMap(t=>t.snapshots??[]).find(t=>this.isPriceMatrixRowSelected(t))??null}findPriceMatrixRowByOptionTokens(e,t){if(t.length!==2)return null;let[n,s]=t;return e.flatMap(p=>p.snapshots??[]).find(p=>{if(p.underlying_kind!=="future")return!1;let m=this.toPositiveNumber(p.pe_token),h=this.toPositiveNumber(p.ce_token);return m!==null&&h!==null&&(m===n&&h===s||m===s&&h===n)})??null}markPreservedSelectionUnavailable(){this.priceMatrixSelectionWarning.set(this.hasCommittedPayoffSelection()?"The price matrix could not confirm the selected payoff opportunity. The existing payoff selection has been preserved.":"")}hasCommittedPayoffSelection(){let e=this.store.selectedOptionInstrumentTokens().length;return fe(this.page.originId())?e===3:e>0}resolvePriceMatrixRowSpotSelection(e){if(e.underlying_kind==="spot"){let t=e.underlying_symbol?.trim(),n=this.toPositiveNumber(e.underlying_token);return t&&n!==null?{spotSymbol:t,spotToken:n}:null}return e.underlying_kind==="future"?this.resolveSelectedSpot():null}resolveSelectedSpot(){let e=this.store.selectedIndexName().trim(),t=this.toPositiveNumber(this.store.selectedInstrumentToken());return e&&t!==null?{spotSymbol:e,spotToken:t}:null}isSelectedSpot(e,t){return this.store.selectedIndexName().trim()===e&&this.toPositiveNumber(this.store.selectedInstrumentToken())===t}hasPriceMatrixRows(e){return e.some(t=>this.hasPriceMatrixGroupRows(t))}toPriceMatrixGroups(e){return Fo(e)}resolveSpotSelection(e){let n=(this.isShortBoxPriceMatrixRoute(this.page.originId())?Object.values(e.data??{}):this.toPriceMatrixGroups(e.data)).flatMap(p=>p.snapshots??[]).filter(p=>p.underlying_kind==="spot"&&this.toPositiveNumber(p.underlying_token)!==null&&!!p.underlying_symbol?.trim()),s=this.isShortBoxPriceMatrixRoute(this.page.originId())?n[0]:n.sort((p,m)=>
16{let h=Number(m.max_profit??0)-Number(p.max_profit??0);return h!==0?h:p.expiry.localeCompare(m.expiry)})[0];return s?{spotSymbol:s.underlying_symbol.trim(),spotToken:Number(s.underlying_token)}:null}shouldLoadPriceMatrix(e){return ot(e)||this.isShortBoxPriceMatrixRoute(e)||this.isFuturesUnderlyingPriceMatrixRoute(e)}isShortBoxPriceMatrixRoute(e){return e===ue.id}isLongBoxBestOpportunityRoute(e){return e===j.id||e===ee.id||e===ie.id||e===Q.id}areSameTokens(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}isFuturesUnderlyingPriceMatrixRoute(e){return e===Xt.id||this.isIndexOptionsPriceMatrixRoute(e)}isIndexOptionsPriceMatrixRoute(e){return fe(e)}resolvePriceMatrixSegment(e){return this.isIndexOptionsPriceMatrixRoute(e)?"index-options":"equity-options"}resolvePriceMatrixEmptyMessage(e){return(this.isIndexOptionsPriceMatrixRoute(this.page.originId())||this.isShortBoxPriceMatrixRoute(this.page.originId()))&&e.message?.trim()||"Results not available"}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-board-secondary-strategy-panel"]],hostAttrs:[1,"panel-divider"],decls:7,vars:3,consts:[[3,"title"],[1,"secondary-strategy-panel","price-matrix-panel"],[1,"panel-status","selection-warning"],[1,"panel-status"],[1,"panel-status","error"],[1,"expiry-table-group"],[1,"expiry-heading"],[1,"snapshot-count"],[1,"scanner-table-wrapper"],[1,"panel-status","expiry-empty-state"],[1,"scanner-table","price-matrix-table"],["role","button","tabindex","0",1,"price-matrix-row","long-box-best-opportunity-row",3,"selected"],["role","button","tabindex","0",1,"price-matrix-row","long-box-best-opportunity-row",3,"click","keydown.enter","keydown.space"],[1,"symbol"],[1,"base-properties"],[1,"value-cell"],[1,"value-cell","price-matrix-profit"],["role","button","tabindex","0",1,"price-matrix-row",3,"selected"],["role","button","tabindex","0",1,"price-matrix-row",3,"click","keydown.enter","keydown.space"],[1,"base-properties","negative"],[1,"base-properties","price-matrix-pe"],[1,"base-properties","price-matrix-ce"]],template:function(t,n){t&1&&(y(0,"app-board-panel-header",0),a(1,"div",1),P(2,uh,2,1,"div",2)(3,mh,2,0,"div",3)(4,hh,2,1,"div",4)(5,gh,2,1,"div",3)(6,Th,3,1),l()),t&2&&(b("title",n.priceMatrixPanelTitle()),c(2),C(n.priceMatr
16ixSelectionWarning()?2:-1),c(),C(n.priceMatrixLoading()?3:n.priceMatrixError()?4:n.priceMatrixEmptyMessage()?5:6))},dependencies:[Ft],styles:[Xa],changeDetection:0});let i=o;return i})();function Wa(i,o,r,e=[],t=null,n=null,s=[]){let p=i?.trim(),m=o.trim();if(!p||!m)return null;if((p===ge.id||p===_e.id)&&s.length>0){let N=s.map(B=>Number(B));return N.every(B=>Number.isFinite(B)&&B>0)?{secondary_id:p,instrument_tokens:N,segment:m}:null}if(gn(p)||fe(p)){let N=e.map($=>Number($)).filter($=>Number.isFinite($)&&$>0).filter(($,K,oe)=>oe.indexOf($)===K);if(N.length===3)return{secondary_id:p,instrument_tokens:N,segment:m};let B=Number(r);return!Number.isFinite(B)||B<=0?null:{secondary_id:p,instrument_tokens:[],segment:m,spot_token:B}}if(ot(p)){let N=Number(r),B=e.map(K=>Number(K)).filter(K=>Number.isFinite(K)&&K>0).filter((K,oe,le)=>le.indexOf(K)===oe),$=Number.isFinite(N)&&N>0&&B.length>=2?[N,...B.slice(0,2)].filter((K,oe,le)=>le.indexOf(K)===oe):[];return{secondary_id:p,instrument_tokens:$.length===3?$:[],segment:m}}if(p===j.id||p===ee.id||p===ie.id||p===Q.id){let N=p===ee.id||p===Q.id,B=Number(r),$=e.map(Le=>Number(Le)).filter(Le=>Number.isFinite(Le)&&Le>0&&Le!==B).filter((Le,ro,li)=>li.indexOf(Le)===ro),K=Number.isFinite(B)&&B>0;if($.length!==4&&!K)return null;let oe=Number(t),le=p===j.id,Ce=le?Dn(t??1):null;if(le&&Ce===null)return null;let xe=n?.trim()??"",Ie=p===ie.id,Ze=p===Q.id;return f({secondary_id:p,instrument_tokens:$.length===4?$:[B],segment:N?"index-options":"equity-options",put_lot:le?Ce:Number.isFinite(oe)&&oe>0?oe:1},Ze?{target_date:null}:Ie?{target_date:/^\d{4}-\d{2}-\d{2}$/.test(xe)?xe:null}:!N&&/^\d{4}-\d{2}-\d{2}$/.test(xe)?{target_date:xe}:{})}if(p===ue.id){let N=Number(r);if(!Number.isFinite(N)||N<=0)return null;let B=e.map(K=>Number(K)).filter(K=>Number.isFinite(K)&&K>0&&K!==N).filter((K,oe,le)=>le.indexOf(K)===oe),$=B.length>=2?[N,...B.slice(0,2)]:[N];return{secondary_id:p,instrument_tokens:$,segment:"equity-options"}}let h=Number(r);if(!Number.isFinite(h)||h<=0)return null;let x=e.map(N=>Number(N)).filter(N=>Number.isFinite(N)&&N>0).filter((N,B,$)=>$.indexOf(N)===B);if(p===pt.id){let N=x.filter(B=>B!==h);return N.length>1?null:{secondary_id:p,instrument_tokens:[h,...N],segment:"equity"}}if(p===Ke.id){let[N,B]=x;return!N||!B?null:{secondary_id:p,instrument_tokens:[B,N],segment:m,spot_token:h,put_lot:1}}let I=[h,...x].filter((N,B,$)=>$.indexOf(N)===B);return{secondary_id:p,instrument_tokens:I,segment:m}}function Za(i){let o=i?.toUpperCase();return o==="EQUITY"||o==="EQ"?"EQ":o==="FUTURES"||o==="FUT"?"FUT":o==="PE"?"PE":o==="CE"?"CE":"EQ"}function Vo(i){return i.position?.toLowerCase()==="short"?-1:1}function Ja(i){return Math.round(i*100)/100}var tl={x_min:0,x_max:0,y_min:0,y_max:0,current_price:0,sd_markers:[],expiry:[],target:[],target_one:[]},el={payoff_chart:tl,strategy_chart:[],pl_rows:[],pl_total:{target_profit_loss:"-",target_price:"-",reference_price:"-",ltp:"-"},greek_rows:[],greek_total:{delta:"-",theta:"-",decay:"-",gamma:"-",vega:"-"},strike_iv_rows:[],greek_metrics:[],standard_deviation_rows:[],theta_decay_columns:[],theta_decay_rows:[],selected_legs:[]},nl=(()=>{let o=class o{buildChartRequest(e,t,n,s=[],p=null,m=null,h=[]){return Wa(e,t,n,s,p,m,h)}buildChartRequestKey(e){return e?JSON.stringify(e):""}buildAnalytics(e,t,n=null,s=null,p={}){if(p.deferFallbackChart&&!t)return el;let m=t??tl,h=Rh(e,s),x=Ih(e,n);return F(f({},el),{payoff_chart:m,pl_rows:h.rows,pl_total:h.total,greek_rows:x.rows,greek_total:x.total})}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();function Ih(i,o){if(!o)return kh();let r=new Map(i.map(t=>[Number(t.trade.instrument_token),t]));return{rows:o.rows.map(t=>{let n=t.instrument_token!=null?r.get(t.instrument_token):void 0,s=t.side??(n?Vo(n.trade)<0?"S":"B":void 0);return{instrument_token:t.instrument_token??void 0,instrument:t.trading_symbol||(n?il(n):"-"),side:s,iv:Fh(t.iv),delta:Lt(t.delta),theta:Lt(t.theta),decay:Lt(t.decay),gamma:Lt(t.gamma),vega:Lt(t.vega)}}),total:{delta:Lt(o.total?.delta??null),theta:Lt(o.total?.theta??null),decay:Lt(o.total?.decay??null),gamma:Lt(o.total?.gamma??null),vega:Lt(o.total?.vega??null)}}}function kh(){return{rows:[],total:{delta:"-",theta:"-",decay:"-",gamma:"-",vega:"-"}}}function Rh(i,o){return i.length?{rows:i.map(Dh),total:{target_profit_loss:sn(o?.projected_pnl),target_price:sn(o?.net_live_value),reference_price:sn(o?.net_reference_value),ltp:sn(o?.net_live_value)}}:{rows:[],total:{target_profit_loss:"-",target_price:"-",reference_price:"-",ltp:"-"}}}function Dh(i){let o=i.trade,r=Vo(o);return{instrument:il(i),side:r<0?"S":"B",target_profit_loss:sn(o.projected_pnl),target_price:sn(o.live_price),reference_price:sn(o.reference_price),ltp:sn(o.live_price)}}function il(i){let o=i.trade,r=o.symbol||i.key,e=Za(o.instrument_type);if(e==="CE"||e==="PE"){let t=typeof o.strike=="number"&&o.strike>0?Nh(o.strike):"";return[r,t,e].filter(Boolean).join(" ")}return e==="FUT"?`${r} FUT`:`${r} Equity`}function Nh(i){return Number.isFinite(i)?Number.isInteger(i)?`${i}`:`${Ja(i)}`:""}function sn(i){return typeof i!="number"||!Number.isFinite(i)?"-":i.toLocaleString("en-IN",{maximumFractionDigits:2})}function Lt(i){return i===null||!Number.isFinite(i)?"-":i.toLocaleString("en-IN",{maximumFractionDigits:4})}function Fh(i){return i===null||!Number.isFinite(i)?"-":`${i.toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}%`}var Bo=(()=>{let o=class o{constructor(){this.payoffRepository=D(Rt)}getPayoff(e){return this.payoffRepository.getPayoff(e)}getSimulatedPayoffChart(e){return this.payoffRepository.simulate(e)}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var qo=(()=>{let o=class o{constructor(){this.greeksRepository=D(kt),this.apiGreeks=O(null),this.apiErrorMessage=O(""),this.settledGreekPayloadKey=O(""),this.latestGreekPayloadKey="",this.greekRequestId=0,this.greeks=this.apiGreeks.asReadonly(),this.errorMessage=this.apiErrorMessage.asReadonly(),this.settledPayloadKey=this.settledGreekPayloadKey.asReadonly()}loadGreeks(e){if(!e){this.reset();return}let t=JSON.stringify(e);if(t===this.latestGreekPayloadKey)return;this.latestGreekPayloadKey=t,this.greekRequestId++,this.apiGreeks.set(null),this.apiErrorMessage.set(""),this.settledGreekPayloadKey.set("");let n=this.greekRequestId;this.greeksRepository.getInstrumentGreeks(e).pipe(dn(s=>(this.isCurrentRequest(n,t)&&(this.apiGreeks.set(null),this.apiErrorMessage.set(this.resolveErrorMessage(s)??"Unable to load Greek data"),this.settledGreekPayloadKey.set(t)),ln))).subscribe(s=>{this.isCurrentRequest(n,t)&&(this.apiGreeks.set({rows:[...s.rows??[]],total:s.total}),this.settledGreekPayloadKey.set(t))})}reset(){this.latestGreekPayloadKey="",this.greekRequestId++,this.apiGreeks.set(null),this.apiErrorMessage.set(""),this.settledGreekPayloadKey.set("")}isCurrentRequest(e,t){return e===this.greekRequestId&&t===this.latestGreekPayloadKey}resolveErrorMessage(e){let t=e.error;return t&&typeof t=="object"&&"message"in t?String(t.message):null}};o.\u0275fac=function(t){return new(t||o)}
16,o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();function Go(i,o){if(o===null||typeof o!="object"||Array.isArray(o))return structuredClone(o);if(Array.isArray(i)){for(let[e,t]of Object.entries(o)){let n=Number(e);if(!Number.isInteger(n)||n<0)throw new Error(`Invalid payoff array index: ${e}`);i[n]=Go(i[n],t)}return i}let r=i!==null&&typeof i=="object"?i:{};for(let[e,t]of Object.entries(o))r[e]=Go(r[e],t);return r}function Lh(i){if(!i.startsWith("/"))throw new Error(`Invalid removed path: ${i}`);return i.slice(1).split("/").map(o=>o.replace(/~1/g,"/").replace(/~0/g,"~"))}function ol(i,o){let r=Number(i);if(!Number.isInteger(r)||r<0)throw new Error(`Invalid payoff array path: ${o}`);return r}function Ah(i,o){let r=Lh(o),e=i;for(let n=0;n<r.length-1;n++){if(e==null)return;let s=r[n];e=Array.isArray(e)?e[ol(s,o)]:e[s]}if(e==null)return;let t=r[r.length-1];Array.isArray(e)?e.splice(ol(t,o),1):typeof e=="object"&&delete e[t]}function rl(i,o){let r=structuredClone(i);r=Go(r,o.changes);for(let e of o.removed_paths)Ah(r,e);return r}var sl="equity-option-payoff-chart-updated",al="equity-option-payoff-chart-patched",ll="equity-option-payoff-chart-state",cl="SubscribeEquityOptionPayoffChart",dl="UnsubscribeEquityOptionPayoffChart",zo=(()=>{let o=class o{constructor(e,t){this.signalR=e,this.zone=t,this.currentRequest=null,this.currentRequestKe
16y="",this.desiredRequest=null,this.desiredRequestKey="",this.subscriptionOperation=Promise.resolve(),this.currentUpdateHandler=null,this.currentSnapshotHandler=null,this.currentPatchHandler=null,this.currentStateHandler=null,this.currentStateConsumer=null,this.currentSnapshot=null,this.currentStreamId="",this.lastUpdateVersion=0,this.pendingUpdateFrame=0,this.pendingState=null,this.pendingStateFrame=0,this.disposed=!1,this.hubConnection=this.signalR.connection,this.hubConnection.onreconnected(()=>{this.resubscribeCurrentRequest()})}configureHandler(e){this.unregisterUpdateHandlers(),this.currentUpdateHandler=e,this.currentSnapshotHandler=t=>{this.applySnapshot(t)},this.hubConnection.on(sl,this.currentSnapshotHandler),this.currentPatchHandler=t=>{this.applyPatch(t)},this.hubConnection.on(al,this.currentPatchHandler)}configureStateHandler(e){this.unregisterStateHandler(),this.currentStateConsumer=e,this.currentStateHandler=t=>{this.pendingState=t,this.scheduleStateEmission()},this.hubConnection.on(ll,this.currentStateHandler)}subscribe(e){return k(this,null,function*(){let t=this.toLiveRequest(e),n=JSON.stringify(t);this.desiredRequestKey!==n&&(this.desiredRequest=t,this.desiredRequestKey=n),yield this.scheduleSubscriptionReconciliation()})}unsubscribeCurrentSelection(){return k(this,null,function*(){this.desiredRequest=null,this.desiredRequestKey="",yield this.scheduleSubscriptionReconciliation()})}destroy(){this.disposed=!0,this.desiredRequest=null,this.desiredRequestKey="",this.unsubscribeCurrentSelection(),this.resetPatchTracking(),this.unregisterUpdateHandlers(),this.unregisterStateHandler()}unregisterUpdateHandlers(){this.currentSnapshotHandler&&(this.hubConnection.off(sl,this.currentSnapshotHandler),this.currentSnapshotHandler=null),this.currentPatchHandler&&(this.hubConnection.off(al,this.currentPatchHandler),this.currentPatchHandler=null),this.currentUpdateHandler=null,this.cancelPendingUpdateEmission()}unregisterStateHandler(){this.currentStateHandler&&(this.hubConnection.off(ll,this.currentStateHandler),this.currentStateHandler=null,this.currentStateConsumer=null,this.cancelPendingStateEmission())}resubscribeCurrentRequest(){return k(this,null,function*(){this.subscriptionOperation=this.subscriptionOperation.then(()=>k(this,null,function*(){this.disposed||!this.currentRequest||this.currentRequestKe
16y!==this.desiredRequestKey||(this.resetPatchTracking(),yield this.invokePayoffMethod(cl,this.currentRequest))})),yield this.subscriptionOperation})}scheduleSubscriptionReconciliation(){return k(this,null,function*(){this.subscriptionOperation=this.subscriptionOperation.then(()=>this.reconcileSubscription()),yield this.subscriptionOperation})}reconcileSubscription(){return k(this,null,function*(){let e=this.desiredRequest,t=this.desiredRequestKey;if(this.currentRequestKey===t)return;let n=this.currentRequest;this.currentRequest=null,this.currentRequestKey="",this.resetPatchTracking(),n&&(yield this.invokePayoffMethod(dl,n)),!(this.disposed||!e||this.desiredRequestKey!==t)&&(yield this.ensureSignalRConnected(),!(this.disposed||this.hubConnection.state!==se.Connected||this.desiredRequestKey!==t)&&(this.currentRequest=e,this.currentRequestKey=t,yield this.invokePayoffMethod(cl,e)))})}invokePayoffMethod(e,t){return k(this,null,function*(){if(this.hubConnection.state===se.Connected)try{yield this.hubConnection.invoke(e,t)}catch(n){if(e===dl&&this.isConnectionClosedInvocationError(n))return;console.error(`${e} failed:`,n)}})}ensureSignalRConnected(){return k(this,null,function*(){this.hubConnection.state!==se.Connected&&(yield this.signalR.Init())})}isConnectionClosedInvocationError(e){let t=e instanceof Error?e.message:typeof e=="string"?e:String(e?.message??"");return t.includes("Invocation canceled")&&t.includes("underlying connection being closed")}
16applySnapshot(e){this.disposed||!this.currentRequest||(this.currentSnapshot=structuredClone(e),this.currentStreamId="",this.lastUpdateVersion=0,this.scheduleUpdateEmission())}applyPatch(e){if(this.disposed||!this.currentRequest)return;if(!this.currentSnapshot){console.warn("Payoff patch received before snapshot.");return}if(!this.isValidPatchVersion(e.update_version)){console.warn("Payoff patch received with an invalid update version.");return}let t=e.update_stream_id?.trim();if(!t){console.warn("Payoff patch received without an update stream ID.");return}if(t!==this.currentStreamId&&(this.currentStreamId=t,this.lastUpdateVersion=0),!(e.update_version<=this.lastUpdateVersion))try{this.currentSnapshot=rl(this.currentSnapshot,e),this.lastUpdateVersion=e.update_version,this.scheduleUpdateEmission()}catch(n){console.error("Unable to apply payoff patch:",n)}}isValidPatchVersion(e){return Number.isSafeInteger(e)&&e>0}resetPatchTracking(){this.cancelPendingUpdateEmission(),this.currentSnapshot=null,this.currentStreamId="",this.lastUpdateVersion=0}scheduleUpdateEmission(){this.pendingUpdateFrame||(this.pendingUpdateFrame=requestAnimationFrame(()=>{this.pendingUpdateFrame=0;let e=this.currentSnapshot;this.disposed||!this.currentRequest||!e||!this.currentUpdateHandler||this.zone.run(()=>this.currentUpdateHandler?.(e))}))}scheduleStateEmission(){this.pendingStateFrame||(this.pendingStateFrame=requestAnimationFrame(()=>{this.pendingStateFrame=0;let e=this.pendingState;this.pendingState=null,!(this.disposed||!e||!this.currentStateConsumer)&&this.zone.run(()=>this.currentStateConsumer?.(e))}))}cancelPendingUpdateEmission(){this.pendingUpdateFrame&&(cancelAnimationFrame(this.pendingUpdateFrame),this.pendingUpdateFrame=0)}cancelPendingStateEmission(){this.pendingState=null,this.pendingStateFrame&&(cancelAnimationFrame(this.pendingStateFrame),this.pendingStateFrame=0)}toLiveRequest(e){return F(f({},e),{instrument_tokens:e.instrument_tokens.filter(Number.isFinite),target_date:e.target_date??null})}};o.\u0275fac=function(t){return new(t||o)(V(Fe),V(qe))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();function pl(i,o){let r=i?.trim();if(!r)return null;let e=Array.from(new Set(o.map(t=>Number(t.trade.instrument_token)).filter(t=>Number.isFinite(t)&&t>0)));return e.length?{secondary_id:r,instrument_tokens:e}:null}var ul=[{label:"Payoff Graph",value:"payoff-graph"},{label:"P&L Table",value:"pl-table"},{label:"Greeks",value:"greeks"},{label:"Strategy Chart",value:"strategy-chart"},{label:"Theta Decay",value:"theta-decay"}],Ji=[],eo=[],ml=[],hl=[],to={target_profit_loss:"-",target_price:"-",reference_price:"-",ltp:"-"},no={delta:"-",theta:"-",decay:"-",gamma:"-",vega:"-"};function gl(i){let o=Sn(i),r=[],e=[];return o.forEach((t,n)=>{let s=o[n-1];if(s&&Hh(s,t)){let p=Vh(s,t);r.push([p,0]),e.push([p,0])}t[1]>=0?(r.push(t),e.push([t[0],null])):(r.push([t[0],null]),e.push(t))}),{profit:r,loss:e}}function yt(i,o){let r=Sn(i);if(!r.length||!Number.isFinite(o))return Number.NaN;let e=r.find(([t])=>t===o);if(e)return e[1];for(let t=1;t<r.length;t+=1){let n=r[t-1],s=r[t];if(o>=n[0]&&o<=s[0])return Uh(n,s,o)}return Number.NaN}function Sn(i){return[...i].filter(([o,r])=>Number.isFinite(o)&&Number.isFinite(r)).sort(([o],[r])=>o-r)}function Uh([i,o],[r,e],t){let n=r-i;return n?o+(t-i)*(e-o)/n:e}function Hh([,i],[,o]){return i<0&&o>0||i>0&&o<0}function Vh([i,o],[r,e]){let t=e-o;return t?i+(0-o)*(r-i)/t:r}function fl(i,o,r){if(!i)return[];let e=Math.round(o/r)*r,t=new Set;for(let n=-300;n<=300;n+=r)t.add(jo(e+n,i.x_min,i.x_max));return t.add(jo(o,i.x_min,i.x_max)),Array.from(t).sort((n,s)=>n-s).map(n=>({target:n,onTargetDate:_l(i.target,n),onExpiry:_l(i.expiry,n),selected:n===jo(o,i.x_min,i.x_max)}))}function Ko(i,o){if(!i||!i.expiry.length&&!i.target.length)return[];let r=Number.isFinite(o)?o:i.current_price,e=i.expiry,n=Sn(i.target).map(([p,m])=>({target:p,percentage:qh(p,r),onTargetDate:m,onExpiry:yt(e,p),selected:!1}));if(!n.length||!Number.isFinite(r))return n;let s=n.reduce((p,m,h)=>{let x=Math.abs(m.target-r),I=Math.abs(n[p].target-r);return x<I?h:p},0);return n[s].selected=!0,n}function xl(i,o){let r=Bh(Ko(i,o),i,o);if(!r.length)return r;let e=r.findIndex(p=>p.selected);if(e<0)return r.slice(0,17);let t=8,n=Math.max(0,e-t),s=Math.min(r.length,e+t+1);return r.slice(n,s)}function Bh(i,o,r){if(!o)return i;let e=Number.isFinite(r)?r:o.current_price;if(!Number.isFinite(e)||e<=0)return i;let t=i.findIndex(m=>Math.abs(m.target-e)<.005);if(i.forEach(m=>{m.selected=!1}),t>=0)return i[t].selected=!0,i[t].percentage=0,i;let n=i.map(m=>[m.target,m.onTargetDate]),s={target:e,percentage:0,onTargetDate:yt(n,e),onExpiry:yt(o.expiry,e),selected:!0},p=i.findIndex(m=>m.target>e);return p<0?[...i,s]:[...i.slice(0,p),s,...i.slice(p)]}function qh(i,o){return!Number.isFinite(i)||!Number.isFinite(o)||!o?Number.NaN:(i-o)/o*100}function jo(i,o,r){return Number.isFinite(i)?Math.min(r,Math.max(o,Math.round(i))):o}function _l(i,o){if(!i.length)return 0;let r=[...i].sort((n,s)=>n[0]-s[0]),e=r[0],t=r[r.length-1];if(o<=e[0])return Math.round(e[1]);if(o>=t[0])return Math.round(t[1]);for(let n=1;n<r.length;n+=1){let s=r[n-1],p=r[n];if(o<=p[0]){let m=p[0]-s[0],h=m===0?0:(o-s[0])/m;return Math.round(s[1]+(p[1]-s[1])*h)}}return Math.round(t[1])}var bl={payoff:!0,target:!0,target_one:!0},ri=(()=>{let o=class o{constructor(){this.default_target_value=25599,this.visible_series_state=O(f({},bl)),this.selected_zoom_preset_percentages_state=O([]),this.show_background_lines_state=O(!0),this.show_current_price_line_state=O(!0),this.active_chart_mode_state=O("payoff-graph"),this.active_payoff_view_state=O("graph"),this.active_summary_view_state=O("summary"),this.target_value_state=O(this.default_target_value),this.visible_series=this.visible_series_state.asReadonly(),this.selected_zoom_preset_percentages=this.selected_zoom_preset_percentages_state.asReadonly(),this.show_background_lines=this.show_background_lines_state.asReadonly(),this.show_current_price_line=this.show_current_price_line_state.asReadonly(),this.active_chart_mode=this.active_chart_mode_state.asReadonly(),this.active_payoff_view=this.active_payoff_view_state.asReadonly(),this.active_summary_view=this.active_summary_view_state.asReadonly(),this.target_value=this.target_value_state.asReadonly()}toggleSeries(e){this.visible_series_state.update(t=>F(f({},t),{[e]:!t[e]}))}
16resetTargetSeriesVisibility(e){this.visible_series_state.set(F(f({},bl),{target:e,target_one:e}))}selectZoomPreset(e){this.selected_zoom_preset_percentages_state.update(t=>t.includes(e)?t.filter(n=>n!==e):[...t,e])}isZoomPresetSelected(e){return this.selected_zoom_preset_percentages().includes(e)}toggleBackgroundLines(){this.show_background_lines_state.update(e=>!e)}toggleCurrentPriceLine(){this.show_current_price_line_state.update(e=>!e)}setChartMode(e){this.active_chart_mode_state.set(e),e==="payoff-graph"&&this.active_payoff_view_state.set("graph")}setPayoffChartView(e){this.active_chart_mode_state.set("payoff-graph"),this.active_payoff_view_state.set(e)}setSummaryView(e){this.active_summary_view_state.set(e)}setTargetValue(e){let t=Number(e);Number.isFinite(t)&&this.target_value_state.set(t)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();function $o(i){let o=Number(i);return Number.isFinite(o)?o.toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2}):`${i}`}function yl(i){return Math.round(i).toLocaleString("en-IN")}function Qo(i){let o=i>=0?"P P":"P L",r=Math.abs(Math.round(i)).toLocaleString("en-IN");return`${o}: ${r}`}function si(i){return i.toLocaleString("en-IN")}function io(i){return i.toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}function Cl(i){return`C P: ${i.toLocaleString("en-IN")}`}function Pl(i,o=!0){return{type:"value",min:i.x_min,max:i.x_max,interval:Gh(i),axisLine:{lineStyle:{color:"#3f4b5c"}},axisTick:{show:!1},axisLabel:{color:"#f3f8ff",fontSize:11,fontWeight:700,hideOverlap:!1,showMinLabel:!0,showMaxLabel:!0,margin:10,formatter:r=>io(zh(r))},splitLine:{show:o,lineStyle:{color:"rgba(223, 225, 226, 0.22)"}}}}function Gh(i){let o=i.x_max-i.x_min;return Number.isFinite(o)&&o>0?o/4:void 0}function zh(i){return Number(i.toFixed(2))}function Sl(i,o,r=!0){return{type:"value",min:i,max:o,splitNumber:6,name:"Profit / loss",nameLocation:"middle",nameGap:50,nameTextStyle:{color:"#92a4bc",fontSize:11,fontWeight:700,align:"center"},axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#f3f8ff",fontSize:11,fontWeight:700,hideOverlap:!0,margin:12,formatter:e=>yl(e)},splitLine:{show:r,lineStyle:{color:"rgba(223, 225, 226, 0.22)"}}}}function wl(i){return{name:"Guide Lines",type:"line",animation:!1,data:[],z:2,markLine:{symbol:"none",silent:!0,lineStyle:{color:"rgba(117, 133, 153, 0.28)",width:1},label:{show:!1,color:"#f5f9ff",fontSize:11,fontWeight:800,distance:8,position:"insideStartTop",backgroundColor:"rgba(17, 24, 33, 0.92)",borderColor:"#526174",borderWidth:1,borderRadius:3,padding:[4,6],shadowBlur:8,shadowColor:"rgba(0, 0, 0, 0.38)"},data:i.map(o=>jh(o))}}}function jh(i){return i.variant==="current-price"?F(f({},i),{lineStyle:{color:"#ffffff",width:2,type:"solid",opacity:1}}):i.variant==="percentage-left"?vl(i,"#ec0000"):i.variant==="percentage-right"?vl(i,"#00ba3c"):i}function vl(i,o){return F(f({},i),{lineStyle:{color:o,width:2,type:"dashed",opacity:1},label:{show:!0,color:"#f5f9ff",fontSize:11,fontWeight:900,backgroundColor:"rgba(7, 16, 27, 0.96)",borderColor:o,borderWidth:1,padding:[5,7],shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.45)"}})}function Ml(i,o,r=!0){return[{name:"-2SD",xAxis:i.sd_markers[0]},{name:"-1SD",xAxis:i.sd_markers[1]},...r?[{name:Cl(i.current_price),xAxis:i.current_price,variant:"current-price"}]:[],{name:"1SD",xAxis:i.sd_markers[2]},{name:"2SD",xAxis:i.sd_markers[3]},...Kh(i,o)].filter(e=>Number.isFinite(e.xAxis))}function Kh(i,o){let r=i.current_price;return Number.isFinite(r)?o.filter(e=>Number.isFinite(e)).flatMap(e=>{let t=r*(e/100);return[{xAxis:r-t,name:Ol("-",e,r-t),variant:"percentage-left"},{xAxis:r+t,name:Ol("+",e,r+t),variant:"percentage-right"}]}):[]}function Ol(i,o,r){return`${i}${o}% ${si(r)}`}function El(i,o,r,e,t,n){let s=i.expiry,p=[wl(Ml(i,t,n))];return o.target_one&&e.length&&p.push(Qh(e)),o.target&&p.push($h(r)),o.payoff&&p.push(...Yh(gl(s))),p}function $h(i){return{name:"T+7 Target",data:i,type:"line",animation:!1,smooth:!1,symbol:"none",z:7,lineStyle:{width:4,color:"#f5b642",opacity:1,shadowBlur:8,shadowColor:"rgba(245, 182, 66, 0.42)"},itemStyle:{color:"#f5b642"}}}function Qh(i){return{name:"T+1 Target",data:i,type:"line",animation:!1,smooth:!1,symbol:"none",z:8,lineStyle:{width:4,color:"#02bcd6",opacity:1,shadowBlur:8,shadowColor:"rgba(2, 188, 214, 0.48)"},itemStyle:{color:"#02bcd6"}}}
16function Yh(i){return[Xh(i),Wh(i)]}function Xh(i){return{name:"On Expiry Loss",data:i.loss,type:"line",animation:!1,smooth:!1,symbol:"none",z:4,lineStyle:{width:6,color:"#ff0095"},itemStyle:{color:"#ff0095"},areaStyle:{origin:0,color:new co.LinearGradient(0,0,0,1,[{offset:1,color:"rgba(255, 0, 149, 0.5)"},{offset:0,color:"rgba(255, 0, 149, 0.25)"}])}}}function Wh(i){return{name:"On Expiry Profit",data:i.profit,type:"line",animation:!1,smooth:!1,symbol:"none",z:4,lineStyle:{width:6,color:"#02c955"},itemStyle:{color:"#02c955"},areaStyle:{origin:0,color:new co.LinearGradient(0,0,0,1,[{offset:0,color:"rgba(2, 201, 85, 0.5)"},{offset:1,color:"rgba(2, 201, 85, 0.25)"}])},markLine:{symbol:"none",silent:!0,lineStyle:{color:"#526070",width:1},label:{show:!1},data:[{yAxis:0}]}}}var Tl=[{key:"payoff",label:"On Expiry",class_name:"payoff"},{key:"target",label:"T+7 Target",class_name:"target"},{key:"target_one",label:"T+0 Target",class_name:"target-one"}],Il={x_min:0,x_max:0,y_min:0,y_max:0,current_price:0,sd_markers:[],expiry:[],target:[],target_one:[]};var Zh={top:54,right:28,bottom:46,left:88};function Rl(i,o,r=[],e=!0,t=!0){let n=i??Il,s=n.expiry,p=n.target,m=n.target_one,h=Sn(p),x=Sn(m);return{animation:!1,animationDuration:0,animationDurationUpdate:0,backgroundColor:"transparent",tooltip:{trigger:"axis",confine:!0,backgroundColor:"#111821",borderColor:"#3b4657",formatter:I=>Jh(I,{expiryPoints:s,targetCurve:h,targetOneCurve:x,visible_series:o}),valueFormatter:I=>$o(I),textStyle:{color:"#f8fbff"}},grid:F(f({},Zh),{containLabel:!1}),xAxis:Pl(n,e),yAxis:Sl(n.y_min,n.y_max,e),series:El(n,o,h,x,r,t)}}function Jh(i,o){let r=tg(i),e=ig(r),t=Number.isFinite(e)?io(e):"",n=eg(e,o).map(s=>`
17        <div style="display:flex;align-items:center;gap:10px;min-width:220px;">
18          <span style="flex:1;display:flex;align-items:center;gap:8px;">
19            <span style="width:10px;height:10px;border-radius:50%;background:${s.color};display:inline-block;"></span>
20            <span>${kl(s.label)}</span>
21          </span>
22          <strong>${$o(s.value)}</strong>
23        </div>
24      `).join("");return`
25    <div>
26      <div style="text-align:center;margin-bottom:8px;font-weight:800;">
27        ${kl(t)}
28      </div>
29      ${n}
30    </div>
31  `}function eg(i,o){if(!Number.isFinite(i))return[];let r=[];if(o.visible_series.payoff){let e=yt(o.expiryPoints,i);Number.isFinite(e)&&r.push({label:"On Expiry",value:e,color:e>=0?"#02c955":"#ff0095"})}if(o.visible_series.target){let e=yt(o.targetCurve,i);Number.isFinite(e)&&r.push({label:"T+7 Target",value:e,color:"#f5b642"})}if(o.visible_series.target_one){let e=yt(o.targetOneCurve,i);Number.isFinite(e)&&r.push({label:"T+0 Target",value:e,color:"#02bcd6"})}return r}function tg(i){return(Array.isArray(i)?i:[i]).filter(ng)}function ng(i){return!!i&&typeof i=="object"}function ig(i){let o=i.find(e=>e.axisValue!==void 0)?.axisValue,r=Number(o);return Number.isFinite(r)?Number(r.toFixed(2)):og(i[0]?.value,0)}function og(i,o){let r=Array.isArray(i)?i[o]:i,e=Number(r);return Number.isFinite(e)?e:Number.NaN}function kl(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var oo=class{constructor(){this.container=null,this.pointerPosition=null,this.handlePointerMove=o=>{let r=this.container?.getBoundingClientRect();r&&(this.pointerPosition={x:o.clientX-r.left,y:o.clientY-r.top})},this.handlePointerLeave=()=>{this.pointerPosition=null}}get position(){return this.pointerPosition}attach(o){this.container=o,o.addEventListener("pointermove",this.handlePointerMove),o.addEventListener("pointerleave",this.handlePointerLeave)}detach(){this.container?.removeEventListener("pointermove",this.handlePointerMove),this.container?.removeEventListener("pointerleave",this.handlePointerLeave),this.container=null,this.pointerPosition=null}};function Dl(i){document.fonts?.ready.then(i)}var rg=["chartContainer"],sg=(i,o)=>o.key;function ag(i,o){if(i&1){let r=R();a(0,"button",20),_("click",function(){S(r);let t=u();return v(t.toggleCurrentPriceLine())}),y(1,"span",21),a(2,"span"),d(3),l()()}if(i&2){let r=u();w("active",r.show_current_price_line),H("aria-pressed",r.show_current_price_line),c(3),T(r.currentPriceLabel)}}function lg(i,o){if(i&1&&(a(0,"span",22),y(1,"span",23),a(2,"span"),d(3),l()()),i&2){let r=u();w("profit",r.projectedPnlClass==="profit")("loss",r.projectedPnlClass==="loss"),c(3),T(r.projectedPnlLabel)}}function cg(i,o){if(i&1){let r=R();a(0,"button",24),_("click",function(){let t=S(r).$implicit,n=u();return v(n.toggleSeries(t.key))}),y(1,"span",25),a(2,"span"),d(3),l()()}if(i&2){let r=o.$implicit,e=u();w("active",e.visible_series[r.key])("payoff-toggle",r.class_name==="payoff")("target-toggle",r.class_name==="target")("target-one-toggle",r.class_name==="target-one"),H("aria-pressed",e.visible_series[r.key]),c(3),T(r.label)}}function dg(i,o){if(i&1){let r=R();a(0,"button",27),_("click",function(){let t=S(r).$implicit,n=u(2);return v(n.selectZoomPreset(t))}),a(1,"span"),d(2),l(),a(3,"span",28),d(4,"\u2713"),l()()}if(i&2){let r=o.$implicit,e=u(2);w("active",e.isZoomPresetSelected(r)),H("aria-selected",e.isZoomPresetSelected(r)),c(2),g("",r,"%")}}function pg(i,o){if(i&1&&(a(0,"div",11),q(1,dg,5,4,"button",26,et),l()),i&2){let r=u();c(),G(r.zoomPresetPercentages)}}function ug(i,o){if(i&1&&(a(0,"option",14),d(1),l()),i&2){let r=o.$implicit;b("ngValue",r),c(),g("",r,"%")}}function mg(i,o){i&1&&y(0,"div",18)}Kr([Xr,Yr,Qr,Wr,$r]);var Nl=(()=>{let o=class o{constructor(){this.data=null,this.loading=!1,this.percent_change=10,this.percentChangeChange=new ce,this.uiStore=D(ri),this.hostElement=D(di),this.seriesToggles=Tl,this.zoomPresetPercentages=[.25,.5,1,2,3,4,5],this.dropdownOptions=[5,10,15,20,25],this.zoomPresetDropdownOpen=!1,this.chart=null,this.destroyed=!1,this.frameRequest=null,this.pointerTracker=new oo,this.resizeObserver=new ResizeObserver(()=>this.handleResize())}get visible_series(){return this.uiStore.visible_series()}get show_background_lines(){return this.uiStore.show_background_lines()}get show_current_price_line(){return this.uiStore.show_current_price_line()}ngAfterViewInit(){this.scheduleRender(),Dl(()=>this.scheduleRender(!0));let e=this.chartContainer.nativeElement;this.pointerTracker.attach(e),this.resizeObserver.observe(e)}ngOnChanges(e){(e.data||e.loading)&&this.chart&&this.scheduleRender(!!e.loading)}ngOnDestroy(){this.destroyed=!0,this.resizeObserver.disconnect(),this.pointerTracker.detach(),this.frameRequest!==null&&cancelAnimationFrame(this.frameRequest),this.chart?.dispose()}toggleSeries(e){this.uiStore.toggleSeries(e),this.scheduleRender(!0)}selectZoomPreset(e){this.uiStore.selectZoomPreset(e),this.scheduleRender(!0)}isZoomPresetSelected(e){return this.uiStore.isZoomPresetSelected(e)}get zoomPresetDropdownLabel(){let e=this.uiStore.selected_zoom_preset_percentages().slice().sort((t,n)=>t-n);return e.length===0?"Percentage":e.length===1?`${e[0]}%`:`${e.length} selected`}toggleZoomPresetDropdown(){this.zoomPresetDropdownOpen=!this.zoomPresetDropdownOpen}closeZoomPresetDropdownOnOutsideClick(e){this.zoomPresetDropdownOpen&&!this.hostElement.nativeElement.contains(e.target)&&(this.zoomPresetDropdownOpen=!1)}closeZoomPresetDropdown(){this.zoomPresetDropdownOpen=!1}
31toggleBackgroundLines(){this.uiStore.toggleBackgroundLines(),this.scheduleRender(!0)}toggleCurrentPriceLine(){this.uiStore.toggleCurrentPriceLine(),this.scheduleRender(!0)}get projectedPnlLabel(){let e=this.getProjectedTargetPnl();return Number.isFinite(e)?Qo(e):""}get projectedPnlClass(){return this.getProjectedTargetPnl()>=0?"profit":"loss"}get hasProjectedPnl(){return Number.isFinite(this.getProjectedTargetPnl())}get currentPriceLabel(){let e=this.data?.current_price;return typeof e=="number"&&Number.isFinite(e)?`C P: ${si(e)}`:""}get hasCurrentPrice(){return!!this.currentPriceLabel}get hasRenderableData(){return!!this.data&&(!!this.data.expiry.length||!!this.data.target.length||!!this.data.target_one.length)}selectPercentChange(e){let t=Number(e);this.dropdownOptions.includes(t)&&this.percentChangeChange.emit(t)}scheduleRender(e=!1){this.destroyed||(this.frameRequest!==null&&cancelAnimationFrame(this.frameRequest),this.frameRequest=requestAnimationFrame(()=>{this.frameRequest=null,this.renderChart(e)}))}renderChart(e=!1){let t=this.chartContainer.nativeElement;if(!t.clientWidth||!t.clientHeight)return;this.chart??=jr(t,"dark"),this.chart.resize();let n=this.hasRenderableData;if(e&&!this.loading&&this.chart.clear(),!n){this.chart.clear();return}this.chart.setOption(Rl(this.data,this.visible_series,this.uiStore.selected_zoom_preset_percentages(),this.show_background_lines,this.show_current_price_line),{lazyUpdate:!1,notMerge:e}),e||this.restoreTooltipAtPointer()}handleResize(){if(!this.destroyed){if(!this.chart){this.scheduleRender();return}this.chart.resize()}}restoreTooltipAtPointer(){let e=this.pointerTracker.position;!this.chart||!e||!this.hasRenderableData||this.chart.dispatchAction({type:"showTip",x:e.x,y:e.y})}getProjectedTargetPnl(){return this.data?yt(this.data.target,this.data.current_price):Number.NaN}};o.\u0275fac=function(t){return new(t||o)}
31,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-payoff-chart"]],viewQuery:function(t,n){if(t&1&&jt(rg,7),t&2){let s;Kt(s=$t())&&(n.chartContainer=s.first)}},hostBindings:function(t,n){t&1&&_("click",function(p){return n.closeZoomPresetDropdownOnOutsideClick(p)},!1,un)("keydown.escape",function(){return n.closeZoomPresetDropdown()},!1,un)},inputs:{data:"data",loading:"loading",percent_change:"percent_change"},outputs:{percentChangeChange:"percentChangeChange"},features:[ve],decls:31,vars:17,consts:[["chartContainer",""],[1,"chart-shell"],[1,"chart-options"],["aria-label","Payoff graph series",1,"series-toggle-bar"],["type","button","aria-label","Toggle current price center line",1,"current-price-chip",3,"active"],[1,"projected-pnl-chip",3,"profit","loss"],["type","button",1,"series-toggle",3,"active","payoff-toggle","target-toggle","target-one-toggle"],[1,"chart-control-buttons"],[1,"zoom-preset-dropdown"],["type","button","aria-haspopup","listbox",1,"zoom-preset-trigger",3,"click"],["aria-hidden","true",1,"dropdown-chevron"],["role","listbox","aria-label","Percentage guide lines","aria-multiselectable","true",1,"zoom-preset-menu"],[1,"chart-range-control"],["aria-label","Chart range",1,"chart-option-select",3,"ngModelChange","ngModel"],[3,"ngValue"],["type","button",1,"chart-grid-button",3,"click"],[1,"chart-frame"],["aria-label","Payoff graph",1,"echart"],["aria-hidden","true",1,"payoff-chart-loading-bar"],["aria-label","Important payoff information",1,"payoff-chart-important-info"],["type","button","aria-label","Toggle current price center line",1,"current-price-chip",3,"click"],["aria-hidden","true",1,"current-price-swatch"],[1,"projected-pnl-chip"],["aria-hidden","true",1,"projected-pnl-swatch"],["type","button",1,"series-toggle",3,"click"],["aria-hidden","true",1,"series-swatch"],["type","button","role","option",1,"zoom-preset-option",3,"active"],["type","button","role","option",1,"zoom-preset-option",3,"click"],["aria-hidden","true",1,"option-check"]],template:function(t,n){if(t&1){let s=R();a(0,"div",1)(1,"section",2)(2,"div",3),P(3,ag,4,4,"button",4)(4,lg,4,5,"span",5),q(5,cg,4,10,"button",6,sg),l(),a(7,"div",7)(8,"div",8)(9,"button",9),_("click",function(){return S(s),v(n.toggleZoomPresetDropdown())}),a(10,"span"),d(11),l(),y(12,"span",10),l(),P(13,pg,3,0,"div",11),l(),a(14,"label",12)(15,"span"),d(16,"Range:"),l(),a(17,"select",13),_("ngModelChange",function(m){return S(s),v(n.selectPercentChange(m))}),q(18,ug,2,2,"option",14,et),l()(),a(20,"button",15),_("click",function(){return S(s),v(n.toggleBackgroun
31dLines())}),d(21),l()()(),a(22,"div",16),y(23,"div",17,0),P(25,mg,1,0,"div",18),l(),a(26,"aside",19)(27,"strong"),d(28,"Important info"),l(),a(29,"p"),d(30," Projected profit and loss figures are indicative estimates only and may vary based on factors including option premium movement, market liquidity, implied volatility (IV), and prevailing market conditions. Actual profit/loss outcomes may differ from the projected values. Past projections or estimates do not guarantee future results. "),l()()()}t&2&&(c(3),C(n.hasCurrentPrice?3:-1),c(),C(n.hasProjectedPnl?4:-1),c(),G(n.seriesToggles),c(3),w("open",n.zoomPresetDropdownOpen),c(),H("aria-expanded",n.zoomPresetDropdownOpen),c(2),T(n.zoomPresetDropdownLabel),c(2),C(n.zoomPresetDropdownOpen?13:-1),c(4),b("ngModel",n.percent_change),c(),G(n.dropdownOptions),c(2),w("active",n.show_background_lines),H("aria-pressed",n.show_background_lines),c(),g(" ",n.show_background_lines?"Hide Grid":"Show Grid"," "),c(),w("loading",n.loading)("loading-empty",n.loading&&!n.hasRenderableData),c(3),C(n.loading?25:-1))},dependencies:[dt,Vr,Br,Hr,ct,Yt],styles:['[_nghost-%COMP%]{display:block;width:100%}.chart-shell[_ngcontent-%COMP%]{width:100%;color:#f5f9ff}.series-toggle-bar[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px;min-height:32px;margin:8px 0}.current-price-chip[_ngcontent-%COMP%], .projected-pnl-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:28px;border:1px solid #3f4b5c;border-radius:5px;background:#141922;color:#dfe1e2;padding:0 12px;font-size:11px;font-weight:800;white-space:nowrap}.current-price-chip[_ngcontent-%COMP%]{border-color:#dfe1e2b8;box-shadow:inset 0 0 0 1px #dfe1e21a;cursor:pointer;font-family:inherit}.current-price-chip[_ngcontent-%COMP%]:not(.active){border-color:#3f4b5c;box-shadow:none;color:#9fb0c7}.current-price-chip[_ngcontent-%COMP%]:hover, .current-price-chip[_ngcontent-%COMP%]:focus-visible{border-color:#fff;color:#fff}.current-price-chip[_ngcontent-%COMP%]:not(.active)   .current-price-swatch[_ngcontent-%COMP%]{opacity:.38}.projected-pnl-chip.profit[_ngcontent-%COMP%]{border-color:#02c955ad;box-shadow:inset 0 0 0 1px #02c95524}.projected-pnl-chip.loss[_ngcontent-%COMP%]{border-color:#ff0095ad;box-shadow:inset 0 0 0 1px #ff009524}.projected-pnl-swatch[_ngcontent-%COMP%]{width:18px;height:9px;border-radius:999px}.current-price-swatch[_ngcontent-%COMP%]{width:18px;height:3px;border-radius:999px;background:#dfe1e2}.projected-pnl-chip.profit[_ngcontent-%COMP%]   .projected-pnl-swatch[_ngcontent-%COMP%]{background:#02c955}.projected-pnl-chip.loss[_ngcontent-%COMP%]   .projected-pnl-swatch[_ngcontent-%COMP%]{background:#ff0095}.series-toggle[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:28px;min-width:92px;border:1px solid #3f4b5c;border-radius:5px;background:#141922;color:#9fb0c7;padding:0 10px;font:inherit;font-size:11px;font-weight:800}.series-toggle.active[_ngcontent-%COMP%]{background:#20252c;color:#dfe1e2}.series-swatch[_ngcontent-%COMP%]{width:9px;height:9px;border-radius:999px;opacity:.38}.series-toggle.active[_ngcontent-%COMP%]   .series-swatch[_ngcontent-%COMP%]{opacity:1}.payoff-toggle[_ngcontent-%COMP%]   .series-swatch[_ngcontent-%COMP%]{width:18px;border-radius:999px;background:linear-gradient(90deg,#ff0095 0 50%,#02c955 50% 100%)}.target-toggle[_ngcontent-%COMP%]   .series-swatch[_ngcontent-%COMP%]{background:#f5b642}.target-one-toggle[_ngcontent-%COMP%]   .series-swatch[_ngcontent-%COMP%]{background:#02bcd6}.legend-strip[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:24px;min-height:36px;margin-top:14px;border-radius:6px;background:#161616;font-size:10px;font-weight:700}.legend-strip[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:7px}.legend-strip[_ngcontent-%COMP%]   i[_ngcontent-%COMP%]{width:16px;height:3px;border-radius:999px}.legend-profit[_ngcontent-%COMP%]{background:#02c955}.legend-target[_ngcontent-%COMP%]{background:#02bcd6}.chart-frame[_ngcontent-%COMP%]{position:relative;width:100%;min-height:310px;max-width:100%;margin:0 auto}.echart[_ngcontent-%COMP%]{display:block;width:100%;height:300px;min-width:0}.payoff-chart-important-info[_ngcontent-%COMP%]{margin-top:10px;border:1px solid rgba(245,182,66,.35);border-radius:6px;background:#f5b64214;color:#c8d2df;padding:10px 12px;font-size:11px;line-height:1.45}.payoff-chart-important-info[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{display:block;margin-bottom:4px;color:#f5b642;font-size:12px}.payoff-chart-important-info[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:0}.chart-frame[_ngcontent-%COMP%]   .loading-empty[_ngcontent-%COMP%]   .echart[_ngcontent-%COMP%]{opacity:0}
31.payoff-chart-loading-bar[_ngcontent-%COMP%]{position:absolute;top:0;right:0;left:0;z-index:3;height:3px;overflow:hidden;pointer-events:none;background:#3b82f614}.payoff-chart-loading-bar[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0 auto 0 -35%;width:35%;background:linear-gradient(90deg,#3b82f600,#60a5faf2 55%,#93c5fd00);animation:_ngcontent-%COMP%_payoff-chart-loading-slide .9s ease-in-out infinite}.chart-control-buttons[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px;min-height:32px;margin:8px 0}.zoom-preset-dropdown[_ngcontent-%COMP%]{position:relative;display:inline-block}.zoom-preset-trigger[_ngcontent-%COMP%], .chart-grid-button[_ngcontent-%COMP%], .chart-option-select[_ngcontent-%COMP%]{height:28px;min-width:45px;border:1px solid #415064;border-radius:6px;background:#252b33;color:#dce8f8;cursor:pointer;font:inherit;font-size:12px;font-weight:800;padding:0 10px}.zoom-preset-trigger[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:space-between;gap:12px;min-width:112px}.dropdown-chevron[_ngcontent-%COMP%]{width:8px;height:8px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:translateY(-2px) rotate(45deg);transition:transform .15s ease}.zoom-preset-dropdown.open[_ngcontent-%COMP%]   .dropdown-chevron[_ngcontent-%COMP%]{transform:translateY(2px) rotate(225deg)}.zoom-preset-menu[_ngcontent-%COMP%]{position:absolute;top:calc(100% + 6px);left:0;z-index:20;display:grid;width:100%;min-width:112px;overflow:hidden;border:1px solid #415064;border-radius:7px;background:#171d26;box-shadow:0 10px 24px #0006;padding:4px}.zoom-preset-option[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:30px;border:0;border-radius:4px;background:transparent;color:#dce8f8;cursor:pointer;font:inherit;font-size:12px;font-weight:700;padding:4px 8px;text-align:left}.zoom-preset-option[_ngcontent-%COMP%]:hover, .zoom-preset-option[_ngcontent-%COMP%]:focus-visible{outline:none;background:#252f3d;color:#fff}.zoom-preset-option.active[_ngcontent-%COMP%]{background:#0043ba;color:#fff}.option-check[_ngcontent-%COMP%]{visibility:hidden;color:#fff}.zoom-preset-option.active[_ngcontent-%COMP%]   .option-check[_ngcontent-%COMP%]{visibility:visible}.chart-option-select[_ngcontent-%COMP%]{min-width:66px;color-scheme:dark}.chart-range-control[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;color:#9fb0c7;font-size:11px;font-weight:700;white-space:nowrap}.zoom-preset-trigger[_ngcontent-%COMP%]:hover, .zoom-preset-trigger[_ngcontent-%COMP%]:focus-visible, .chart-grid-button[_ngcontent-%COMP%]:hover, .chart-grid-button[_ngcontent-%COMP%]:focus-visible, .chart-option-select[_ngcontent-%COMP%]:hover, .chart-option-select[_ngcontent-%COMP%]:focus-visible{border-color:#69aef2;color:#f5f9ff}.zoom-preset-dropdown.open[_ngcontent-%COMP%]   .zoom-preset-trigger[_ngcontent-%COMP%], .chart-grid-button.active[_ngcontent-%COMP%]{border-color:#69aef2;background:#0043ba;color:#dfe1e2}@keyframes _ngcontent-%COMP%_payoff-chart-loading-slide{0%{transform:translate(0)}to{transform:translate(390%)}}@media(max-width:720px){.chart-control-buttons[_ngcontent-%COMP%]{flex-wrap:wrap;justify-content:flex-start}.zoom-preset-menu[_ngcontent-%COMP%]{right:0;left:auto}}.spot-trades-area--detail-full[_nghost-%COMP%]   .chart-options[_ngcontent-%COMP%], .spot-trades-area--detail-full   [_nghost-%COMP%]   .chart-options[_ngcontent-%COMP%]{display:flex;justify-content:center}']});let i=o;return i})();var hg=(i,o)=>o.target;function gg(i,o){i&1&&(a(0,"span",5),d(1,"Current"),l())}function _g(i,o){if(i&1&&(a(0,"tr")(1,"td")(2,"span"),d(3),l(),P(4,gg,2,0,"span",5),l(),a(5,"td"),d(6),l(),a(7,"td"),d(8),l(),a(9,"td"),d(10),l()()),i&2){let r,e,t=o.$implicit,n=u();w("selected-row",t.selected),c(3),T(n.formatTargetValue(t.target)),c(),C(t.selected?4:-1),c(),w("positive-value",((r=t.percentage)!==null&&r!==void 0?r:0)>0)("negative-value",((e=t.percentage)!==null&&e!==void 0?e:0)<0),c(),g(" ",n.formatPercentageValue(t.percentage)," "),c(),w("positive-value",t.onTargetDate>=0)("negative-value",t.onTargetDate<0),c(),g(" ",n.formatPayoffValue(t.onTargetDate)," "),c(),w("positive-value",t.onExpiry>=0)("negative-value",t.onExpiry<0),c(),g(" ",n.formatPayoffValue(t.onExpiry)," ")}}var Fl=(()=>{let o=class o{constructor(){this.rows=[]}
31formatPayoffValue(e){return Number.isFinite(e)?e.toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2}):"-"}formatTargetValue(e){return this.formatPayoffValue(e)}formatPercentageValue(e){return typeof e!="number"||!Number.isFinite(e)?"-":`${e>0?"+":""}${e.toFixed(2)}%`}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-payoff-table"]],inputs:{rows:"rows"},decls:21,vars:1,consts:[["aria-label","Payoff chart data table",1,"payoff-table-panel"],[1,"payoff-table-heading"],[1,"payoff-table-scroll"],[1,"payoff-table"],[3,"selected-row"],[1,"current-row-pill"]],template:function(t,n){t&1&&(a(0,"section",0)(1,"div",1)(2,"h3"),d(3,"Chart Data"),l(),a(4,"span"),d(5),l()(),a(6,"div",2)(7,"table",3)(8,"thead")(9,"tr")(10,"th"),d(11,"Price"),l(),a(12,"th"),d(13,"% Move"),l(),a(14,"th"),d(15,"On Target Date"),l(),a(16,"th"),d(17,"On Expiry"),l()()(),a(18,"tbody"),q(19,_g,11,19,"tr",4,hg),l()()()()),t&2&&(c(5),g("",n.rows.length," points"),c(14),G(n.rows))},styles:[".payoff-table-panel[_ngcontent-%COMP%]{color:#f5f9ff}.payoff-table-heading[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 0 10px;border-top:1px solid #303946}.payoff-table-heading[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin:0;color:#dfe1e2;font-size:12px;font-weight:800}.payoff-table-heading[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{color:#8fa1ba;font-size:10px;font-weight:800;text-transform:uppercase}.payoff-table-scroll[_ngcontent-%COMP%]{max-height:360px;overflow:auto;border:1px solid #303946;border-radius:6px;background:#151b24}.payoff-table[_ngcontent-%COMP%]{width:100%;min-width:680px;border-collapse:collapse;table-layout:fixed;color:#f5f9ff}.payoff-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%], .payoff-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{height:26px;padding:0 14px;border-right:1px solid #303946;border-bottom:1px solid #303946;white-space:nowrap}.payoff-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:last-child, .payoff-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:last-child{border-right:0}.payoff-table[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]{border-bottom:0}.payoff-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{position:sticky;top:0;z-index:1;background:#191d22;color:#f5f9ff;font-size:10px;font-weight:800;text-align:right}.payoff-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child, .payoff-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child{text-align:left}.payoff-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{color:#8fa1ba;font-weight:700}.payoff-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{background:#202428;font-size:10px;font-weight:800;text-align:right}.payoff-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child{display:flex;align-items:center;justify-content:space-between;gap:10px}.payoff-table[_ngcontent-%COMP%]   .selected-row[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{background:#243047}.current-row-pill[_ngcontent-%COMP%]{flex:0 0 auto;border:1px solid rgba(223,225,226,.55);border-radius:999px;color:#dfe1e2;padding:2px 7px;font-size:9px;font-weight:900;line-height:1;text-transform:uppercase}.positive-value[_ngcontent-%COMP%]{color:#02c955}.negative-value[_ngcontent-%COMP%]{color:#ff0095}"]});let i=o;return i})();var fg=(i,o)=>o.target;function xg(i,o){if(i&1){let r=R();a(0,"button",4),_("click",function(t){S(r);let n=u(2);return v(n.openCurrentPricePicker(t))}),a(1,"span"),d(2),l(),a(3,"span",5),d(4,"\u25BE"),l()()}if(i&2){let r=u(2);w("open",r.pricePickerOpen),H("aria-expanded",r.pricePickerOpen),c(2),T(r.formatPriceValue(r.current_price))}}function bg(i,o){if(i&1&&d(0),i&2){let r=u().$implicit,e=u();g(" ",e.formatPriceValue(r.target)," ")}}function yg(i,o){if(i&1&&(a(0,"tr")(1,"td"),P(2,xg,5,4,"button",3)(3,bg,1,1),l(),a(4,"td"),d(5),l(),a(6,"td"),d(7),l(),a(8,"td"),d(9),l()()),i&2){let r=o.$implicit,e=u();w("selected-row",r.selected),c(2),C(r.selected?2:3),c(3),T(e.formatTargetPercent(r.target)),c(),w("positive-value",r.onTargetDate>=0)("negative-value",r.onTargetDate<0),c(),g(" ",e.formatPayoffPercent(r.onTargetDate)," "),c(),w("positive-value",r.onExpiry>=0)("negative-value",r.onExpiry<0),c(),g(" ",e.formatPayoffPercent(r.onExpiry)," ")}}function Cg(i,o){if(i&1){let r=R();a(0,"button",18),_("click",function(){let t=S(r).$implicit,n=u(2);return v(n.selectCurrentPrice(t))}),d(1),l()}if(i&2){let r=o.$implicit,e=u(2);w("active",e.isSelectedPriceOption(r)),c(),g(" ",e.formatPriceOption(r)," ")}}function Pg(i,o){if(i&1){let r=R();a(0,"button",19),_("click",function(){let t=S(r).$implicit,n=u(2);return v(n.setPriceInterval(t))}),d(1),l()}if(i&2){let r=o.$implicit,e=u(2);w("active",e.selectedPriceInterval===r),c(),g(" ",r," ")}}function Sg(i,o){if(i&1){let r=R();a(0,"button",6),_("click",function(){S(r);let t=u();return v(t.closeCurrentPricePicker())}),l(),a(1,"div",7),_("click",function(t){return S(r),v(t.stopPropagation())})("keydown.escape",function(){S(r);let t=u();return v(t.closeCurrentPricePicker())}),a(2,"label",8),d(3," Select Target Price "),l(),a(4,"input",9),_("input",function(t){S(r);let n=u();return v(n.handleCurrentPriceInput(t.target.value))})("blur",function(){S(r);let t=u();return v(t.handleCurrentPriceBlur())})("keydown.enter",function(){S(r);let t=u();return v(t.handleCurrentPriceBlur())}),l(),y(5,"div",10),a(6,"div",11),q(7,Cg,2,3,"button",12,et),l(),y(9,"div",10),a(10,"span",13),d(11,"Select Target Interval"),l(),a(12,"div",14),q(13,Pg,2,3,"button",15,et),l(),a(15,"div",16)(16,"button",17),_("click",function(){S(r);let t=u();return v(t.saveCurrentPricePicker())}),d(17," Save "),l()()()}if(i&2){let r=u();c(),Se("top",r.pricePickerTop,"px")("left",r.pricePickerLeft,"px"),c(3),b("value",r.currentPriceInputValue),c(3),G(r.currentPriceOptions),c(6),G(r.priceIntervals)}}var Ll=(()=>{let o=class o{constructor(){this.currentPriceChange=new ce,this.rows=[],this.current_price=0,this.targetDateLabel="",this.expiryDateLabel="",this.priceIntervals=[10,25,50,100,200],this.currentPriceInputValue="",this.selectedPriceInterval=25,this.pricePickerOpen=!1,this.pricePickerTop=0,this.pricePickerLeft=0}ngOnChanges(e){e.current_price&&(this.currentPriceInputValue=this.formatEditablePrice(this.current_price),this.pricePickerOpen||(this.selectedPriceInterval=this.resolveDefaultPriceInterval(this.current_price)))}get currentPriceOptions(){let e=this.selectedPriceInterval,t=Number(this.currentPriceInputValue),n=Number.isFinite(t)&&t>0?t:this.current_price,s=Math.floor(n/e)*e,p=Math.max(e,s-e*8),m=new Set;for(let h=0;h<20;h+=1){let x=p+h*e;x>0&&m.add(x)}return Array.from(m)}openCurrentPricePicker(e){e.stopPropagation();let n=e.currentTarget?.getBoundingClientRect();n&&(this.pricePickerLeft=Math.max(8,Math.min(n.left,window.innerWidth-340-8)),this.pricePickerTop=Math.max(8,Math.min(n.top-
31500,window.innerHeight-430-8))),this.pricePickerOpen=!0}closeCurrentPricePicker(){this.pricePickerOpen=!1,this.currentPriceInputValue=this.formatEditablePrice(this.current_price)}handleCurrentPriceInput(e){this.currentPriceInputValue=e}handleCurrentPriceBlur(){let e=Number(this.currentPriceInputValue);if(!Number.isFinite(e)||e<=0){this.currentPriceInputValue=this.formatEditablePrice(this.current_price);return}this.currentPriceInputValue=this.formatEditablePrice(e)}saveCurrentPricePicker(){let e=Number(this.currentPriceInputValue);if(!Number.isFinite(e)||e<=0){this.currentPriceInputValue=this.formatEditablePrice(this.current_price);return}this.currentPriceInputValue=this.formatEditablePrice(e),this.emitCurrentPriceChange(e),this.pricePickerOpen=!1}selectCurrentPrice(e){this.currentPriceInputValue=this.formatEditablePrice(e)}setPriceInterval(e){this.selectedPriceInterval=e}formatPriceValue(e){return Number.isFinite(e)?e.toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2}):"-"}formatPriceOption(e){return Number.isInteger(e)?e.toLocaleString("en-IN"):e.toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}isSelectedPriceOption(e){let t=Number(this.currentPriceInputValue),n=Number.isFinite(t)&&t>0?t:this.current_price;return Math.abs(e-n)<.005}formatTargetPercent(e){if(!this.current_price)return"0.0%";let t=(e-this.current_price)/this.current_price*100;return this.formatSignedPercent(t)}formatPayoffPercent(e){return this.current_price?this.formatSignedPercent(e/this.current_price*100):"0.0%"}formatSignedPercent(e){return`${e>0?"+":""}${e.toFixed(1)}%`}formatEditablePrice(e){return Number.isFinite(e)&&e>0?e.toFixed(2):""}emitCurrentPriceChange(e){Math.abs(e-this.current_price)<.005||this.currentPriceChange.emit(e)}resolveDefaultPriceInterval(e){if(!Number.isFinite(e)||e<=0)return 25;let t=e/60;return this.priceIntervals.reduce((n,s)=>{let p=Math.abs(s-t),m=Math.abs(n-t);return p<m?s:n},this.priceIntervals[0])}};o.\u0275fac=function(t){return new(t||o)}
31,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-payoff-up-down-flow"]],inputs:{rows:"rows",current_price:"current_price",targetDateLabel:"targetDateLabel",expiryDateLabel:"expiryDateLabel"},outputs:{currentPriceChange:"currentPriceChange"},features:[ve],decls:20,vars:3,consts:[["aria-label","Up-down flow table",1,"flow-table-wrap"],[1,"flow-table"],[3,"selected-row"],["type","button","aria-haspopup","dialog",1,"current-price-trigger",3,"open"],["type","button","aria-haspopup","dialog",1,"current-price-trigger",3,"click"],["aria-hidden","true",1,"trigger-caret"],["type","button","aria-label","Close price picker",1,"price-picker-backdrop",3,"click"],["role","dialog","aria-label","Select target price",1,"price-picker-popover",3,"click","keydown.escape"],["for","move-analysis-current-price",1,"picker-label"],["id","move-analysis-current-price","type","number","min","0.01","step","0.01","inputmode","decimal",1,"price-picker-input",3,"input","blur","keydown.enter","value"],["aria-hidden","true",1,"picker-divider"],["aria-label","Target price options",1,"price-option-grid"],["type","button",1,"price-option",3,"active"],[1,"picker-label"],["aria-label","Target price intervals",1,"price-interval-grid"],["type","button",1,"price-interval",3,"active"],[1,"price-picker-actions"],["type","button",1,"price-save-button",3,"click"],["type","button",1,"price-option",3,"click"],["type","button",1,"price-interval",3,"click"]],template:function(t,n){t&1&&(a(0,"div",0)(1,"table",1)(2,"thead")(3,"tr")(4,"th"),d(5,"Price"),l(),a(6,"th"),d(7,"% Move"),l(),a(8,"th"),d(9,"On Target Date: "),a(10,"span"),d(11),l()(),a(12,"th"),d(13,"On Expiry: "),a(14,"span"),d(15),l()()()(),a(16,"tbody"),q(17,yg,10,14,"tr",2,fg),l()()(),P(19,Sg,18,5)),t&2&&(c(11),T(n.targetDateLabel),c(4),T(n.expiryDateLabel),c(2),G(n.rows),c(2),C(n.pricePickerOpen?19:-1))},styles:["[_nghost-%COMP%]{display:block}.flow-table-wrap[_ngcontent-%COMP%]{max-height:310px;overflow:auto;border:1px solid #303946;border-radius:6px;background:#151b24;scrollbar-color:#3d4652 #151b24;scrollbar-width:thin}.flow-table[_ngcontent-%COMP%]{width:100%;min-width:760px;border-collapse:collapse;table-layout:fixed;color:#f5f9ff}.flow-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%], .flow-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{height:28px;padding:0 14px;border-right:1px solid #303946;border-bottom:1px solid #303946;white-space:nowrap}.flow-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:last-child, .flow-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:last-child{border-right:0}.flow-table[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:last-child   td[_ngcontent-%COMP%]{border-bottom:0}.flow-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{position:sticky;top:0;z-index:1;background:#191d22;color:#f5f9ff;font-size:10px;font-weight:800;text-align:right}.flow-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child, .flow-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child{text-align:left}.flow-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{color:#8fa1ba;font-weight:700}.flow-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{background:#202428;font-size:11px;font-weight:800;text-align:right}.flow-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:hover   td[_ngcontent-%COMP%]{background:#242b35}.flow-table[_ngcontent-%COMP%]   .selected-row[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{background:#243047;color:#f5f9ff}.flow-table[_ngcontent-%COMP%]   .selected-row[_ngcontent-%COMP%]:hover   td[_ngcontent-%COMP%]{background:#283653}.current-price-trigger[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:space-between;width:150px;max-width:100%;height:24px;padding:0 8px;border:1px solid #536172;border-radius:5px;outline:0;background:#10151c;color:#f5f9ff;font:inherit;font-weight:800;text-align:left;cursor:pointer}.current-price-trigger.open[_ngcontent-%COMP%], .current-price-trigger[_ngcontent-%COMP%]:focus-visible{border-color:#7ab5ff;box-shadow:0 0 0 2px #206fd459}.trigger-caret[_ngcontent-%COMP%]{color:#b9c4d2;font-size:10px;line-height:1}.price-picker-backdrop[_ngcontent-%COMP%]{position:fixed;inset:0;z-index:900;border:0;background:transparent;cursor:default}.price-picker-popover[_ngcontent-%COMP%]{position:fixed;z-index:901;width:340px;padding:18px 20px;border:1px solid #222b36;border-radius:4px;background:#1f2328;box-shadow:0 18px 40px #0000006b;color:#d7dbe1}.picker-label[_ngcontent-%COMP%]{display:block;margin-bottom:10px;color:#d7dbe1;font-size:13px;font-weight:800}.price-picker-input[_ngcontent-%COMP%]{width:100%;height:48px;padding:0 14px;border:1px solid #3b4653;border-radius:6px;outline:0;background:#1b2026;color:#dfe4eb;font:inherit;font-size:18px;font-weight:700}.price-picker-input[_ngcontent-%COMP%]:focus{border-color:#4d8fe8;box-shadow:0 0 0 2px #206fd452}.price-picker-input[_ngcontent-%COMP%]::-webkit-inner-spin-button, .price-picker-input[_ngcontent-%COMP%]::-webkit-outer-spin-button{margin:0;appearance:none}.picker-divider[_ngcontent-%COMP%]{height:1px;margin:20px 0;background:#303742}
31.price-option-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.price-option[_ngcontent-%COMP%], .price-interval[_ngcontent-%COMP%]{height:36px;border:1px solid #394552;border-radius:7px;background:#20252b;color:#d5d9df;font:inherit;font-size:16px;font-weight:700;cursor:pointer}.price-option[_ngcontent-%COMP%]:hover, .price-interval[_ngcontent-%COMP%]:hover, .price-option[_ngcontent-%COMP%]:focus-visible, .price-interval[_ngcontent-%COMP%]:focus-visible{border-color:#5f9ce8;color:#f5f9ff;outline:0}.price-option.active[_ngcontent-%COMP%], .price-interval.active[_ngcontent-%COMP%]{border-color:#6fb4ff;background:#284362;color:#74b4ff}.price-interval-grid[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:12px}.price-interval[_ngcontent-%COMP%]{min-width:56px;padding:0 14px}.price-picker-actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end;margin-top:18px}.price-save-button[_ngcontent-%COMP%]{min-width:88px;height:36px;border:1px solid #2f82e6;border-radius:7px;background:#0f58c8;color:#f5f9ff;font:inherit;font-size:14px;font-weight:800;cursor:pointer}.price-save-button[_ngcontent-%COMP%]:hover, .price-save-button[_ngcontent-%COMP%]:focus-visible{border-color:#78b4ff;background:#1667dc;outline:0}.positive-value[_ngcontent-%COMP%]{color:#02c955}.negative-value[_ngcontent-%COMP%]{color:#ff0095}"]});let i=o;return i})();function vg(i,o){if(i&1&&(a(0,"tr")(1,"td")(2,"div",6)(3,"span",9),d(4),l(),a(5,"strong",10),d(6),l()()(),a(7,"td"),d(8),l(),a(9,"td"),d(10),l(),a(11,"td"),d(12),l(),a(13,"td"),d(14),l()()),i&2){let r,e=o.$implicit;c(3),w("side-badge--buy",e.side==="B")("side-badge--sell",e.side==="S"),c(),g(" ",(r=e.side)!==null&&r!==void 0?r:"-"," "),c(),b("title",e.instrument),c(),g(" ",e.instrument," "),c(2),T(e.ltp),c(2),T(e.reference_price),c(2),T(e.target_price),c(2),T(e.target_profit_loss)}}var Al=(()=>{let o=class o{constructor(){this.rows=Ji,this.total=to}};o.\u0275fac=function(t){return new(t||o)}
31,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-payoff-pl-table-panel"]],inputs:{rows:"rows",total:"total"},decls:42,vars:4,consts:[["aria-label","Profit and loss table",1,"pl-table-panel"],[1,"pl-toggles"],["aria-hidden","true",1,"toggle"],[1,"table-wrap"],[1,"pl-table"],[1,"total-row"],[1,"instrument-cell"],[1,"projected-badge"],[1,"help-icon"],[1,"side-badge"],[1,"instrument-label",3,"title"]],template:function(t,n){t&1&&(a(0,"section",0)(1,"div",1)(2,"label"),y(3,"span",2),d(4," Multiply by Lot Size "),l(),a(5,"label"),y(6,"span",2),d(7," Multiply by Number of Lots "),l()(),a(8,"div",3)(9,"table",4)(10,"thead")(11,"tr")(12,"th"),d(13,"Instrument"),l(),a(14,"th"),d(15,"LTP"),l(),a(16,"th"),d(17,"Reference Price"),l(),a(18,"th"),d(19,"Target Price"),l(),a(20,"th"),d(21,"Target P&L"),l()()(),a(22,"tbody"),q(23,vg,15,11,"tr",null,He),a(25,"tr",5)(26,"td")(27,"div",6)(28,"strong"),d(29,"Total"),l(),a(30,"span",7),d(31,"Projected "),a(32,"span",8),d(33,"?"),l()()()(),a(34,"td"),d(35),l(),a(36,"td"),d(37),l(),a(38,"td"),d(39),l(),a(40,"td"),d(41),l()()()()()()),t&2&&(c(23),G(n.rows),c(12),T(n.total.ltp),c(2),T(n.total.reference_price),c(2),T(n.total.target_price),c(2),T(n.total.target_profit_loss))},styles:['[_nghost-%COMP%]{display:block}.pl-table-panel[_ngcontent-%COMP%]{display:grid;gap:14px;border-top:1px solid #343d4a;padding-top:14px;color:#f5f9ff;font-size:12px;min-width:0}.pl-toggles[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:22px;border-radius:6px;background:#161616;padding:9px 12px}.pl-toggles[_ngcontent-%COMP%]   label[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px;min-height:16px;font-weight:700}.toggle[_ngcontent-%COMP%]{position:relative;width:25px;height:14px;flex:0 0 auto;border-radius:999px;background:#354153}.toggle[_ngcontent-%COMP%]:after{content:"";position:absolute;top:3px;left:4px;width:8px;height:8px;border-radius:50%;background:#111820}.table-wrap[_ngcontent-%COMP%]{overflow-x:auto;border:1px solid #2f3d4f;border-radius:6px;background:#111821}.pl-table[_ngcontent-%COMP%]{width:100%;min-width:560px;border-collapse:collapse;table-layout:fixed}.pl-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%], .pl-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{height:42px;padding:0 10px;border-bottom:1px solid #343d4a;white-space:nowrap}.pl-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{background:#252b34;color:#8fa1ba;font-size:11px;font-weight:700;text-align:right}.pl-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child{text-align:left}.pl-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{color:#f5f9ff;font-weight:700;text-align:right}.pl-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child{text-align:left}.pl-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:nth-child(1), .pl-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:nth-child(1){width:38%}.pl-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:nth-child(2), .pl-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:nth-child(2){width:15%}.pl-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:nth-child(3), .pl-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:nth-child(3), .pl-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:nth-child(4), .pl-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:nth-child(4){width:15%}.pl-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:nth-child(5), .pl-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:nth-child(5){width:17%}.pl-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:nth-child(2n):not(.total-row)   td[_ngcontent-%COMP%]{background:#ffffff04}.instrument-cell[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;min-width:0}.instrument-label[_ngcontent-%COMP%]{min-width:0;overflow:hidden;text-overflow:ellipsis}.side-badge[_ngcontent-%COMP%], .projected-badge[_ngcontent-%COMP%]{display:inline-grid;place-items:center;border-radius:3px;font-weight:800}.side-badge[_ngcontent-%COMP%]{width:18px;height:18px;flex:0 0 auto;background:#6c798c3d;color:#9badc3;font-size:11px}.side-badge--buy[_ngcontent-%COMP%]{background:#0e9f403d;color:#38d477}.side-badge--sell[_ngcontent-%COMP%]{background:#d3432b3d;color:#ff6b4f}.projected-badge[_ngcontent-%COMP%]{grid-auto-flow:column;gap:4px;min-height:24px;padding:0 8px;background:#d3432b3d;color:#ff6b4f}.total-row[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{border-bottom:0}.help-icon[_ngcontent-%COMP%]{display:inline-grid;place-items:center;width:13px;height:13px;border:1px solid #6c798c;border-radius:50%;color:#9badc3;font-size:9px;line-height:1}']});let i=o;return i})();function wg(i,o){if(i&1&&(a(0,"tr")(1,"td")(2,"div",6)(3,"span",7),d(4),l(),a(5,"strong",8),d(6),l()()(),a(7,"td"),d(8),l(),a(9,"td"),d(10),l(),a(11,"td"),d(12),l(),a(13,"td"),d(14),l(),a(15,"td"),d(16),l(),a(17,"td"),d(18),l()()),i&2){let r,e=o.$implicit;c(3),w("side-badge--buy",e.side==="B")("side-badge--sell",e.side==="S"),c(),g(" ",(r=e.side)!==null&&r!==void 0?r:"-"," "),c(),b("title",e.instrument),c(),g(" ",e.instrument," "),c(2),T(e.iv),c(2),T(e.delta),c(2),T(e.theta),c(2),T(e.decay),c(2),T(e.gamma),c(2),T(e.vega)}}var Ul=(()=>{let o=class o{constructor(){this.rows=eo,this.total=no}};o.\u0275fac=function(t){return new(t||o)}
31,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-payoff-greeks-table-panel"]],inputs:{rows:"rows",total:"total"},decls:45,vars:5,consts:[["aria-label","Greeks table",1,"greeks-table-panel"],[1,"greeks-toggles"],["aria-hidden","true",1,"toggle"],[1,"table-wrap"],[1,"greeks-table"],[1,"total-row"],[1,"instrument-cell"],[1,"side-badge"],[1,"instrument-label",3,"title"]],template:function(t,n){t&1&&(a(0,"section",0)(1,"div",1)(2,"label"),y(3,"span",2),d(4," Multiply by Lot Size "),l(),a(5,"label"),y(6,"span",2),d(7," Multiply by Number of Lots "),l()(),a(8,"div",3)(9,"table",4)(10,"thead")(11,"tr")(12,"th"),d(13,"Instrument"),l(),a(14,"th"),d(15,"IV"),l(),a(16,"th"),d(17,"Delta"),l(),a(18,"th"),d(19,"Theta"),l(),a(20,"th"),d(21,"Decay"),l(),a(22,"th"),d(23,"Gamma"),l(),a(24,"th"),d(25,"Vega"),l()()(),a(26,"tbody"),q(27,wg,19,13,"tr",null,He),a(29,"tr",5)(30,"td")(31,"strong"),d(32,"Total"),l()(),a(33,"td"),d(34,"-"),l(),a(35,"td"),d(36),l(),a(37,"td"),d(38),l(),a(39,"td"),d(40),l(),a(41,"td"),d(42),l(),a(43,"td"),d(44),l()()()()()()),t&2&&(c(27),G(n.rows),c(9),T(n.total.delta),c(2),T(n.total.theta),c(2),T(n.total.decay),c(2),T(n.total.gamma),c(2),T(n.total.vega))},styles:['[_nghost-%COMP%]{display:block}.greeks-table-panel[_ngcontent-%COMP%]{display:grid;gap:14px;border-top:1px solid #343d4a;padding-top:14px;color:#f5f9ff;font-size:12px;min-width:0}.greeks-toggles[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:22px;border-radius:6px;background:#161616;padding:9px 12px}.greeks-toggles[_ngcontent-%COMP%]   label[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px;min-height:16px;font-weight:700}.toggle[_ngcontent-%COMP%]{position:relative;width:25px;height:14px;flex:0 0 auto;border-radius:999px;background:#354153}.toggle[_ngcontent-%COMP%]:after{content:"";position:absolute;top:3px;left:4px;width:8px;height:8px;border-radius:50%;background:#111820}.table-wrap[_ngcontent-%COMP%]{overflow-x:auto;border:1px solid #2f3d4f;border-radius:6px;background:#111821}.greeks-table[_ngcontent-%COMP%]{width:100%;min-width:620px;border-collapse:collapse;table-layout:fixed}.greeks-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%], .greeks-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{height:42px;padding:0 10px;border-bottom:1px solid #343d4a;white-space:nowrap}.greeks-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{background:#252b34;color:#8fa1ba;font-size:11px;font-weight:700;text-align:right}.greeks-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child{text-align:left}.greeks-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{color:#f5f9ff;font-weight:700;text-align:right}.greeks-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child{text-align:left}.greeks-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:nth-child(1), .greeks-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:nth-child(1){width:34%}.greeks-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:nth-child(n+2), .greeks-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:nth-child(n+2){width:13.2%}.greeks-table[_ngcontent-%COMP%]   tbody[_ngcontent-%COMP%]   tr[_ngcontent-%COMP%]:nth-child(2n):not(.total-row)   td[_ngcontent-%COMP%]{background:#ffffff04}.instrument-cell[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;min-width:0}.instrument-label[_ngcontent-%COMP%]{min-width:0;overflow:hidden;text-overflow:ellipsis}.side-badge[_ngcontent-%COMP%]{display:inline-grid;place-items:center;width:18px;height:18px;flex:0 0 auto;border-radius:3px;background:#6c798c3d;color:#9badc3;font-size:11px;font-weight:800}.side-badge--buy[_ngcontent-%COMP%]{background:#0e9f403d;color:#38d477}.side-badge--sell[_ngcontent-%COMP%]{background:#d3432b3d;color:#ff6b4f}.total-row[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{border-bottom:0}.help-icon[_ngcontent-%COMP%]{display:inline-grid;place-items:center;width:13px;height:13px;border:1px solid #6c798c;border-radius:50%;color:#9badc3;font-size:9px;line-height:1}']});let i=o;return i})();var Og=(i,o)=>o.symbol;function Mg(i,o){i&1&&y(0,"col",6)}function Eg(i,o){if(i&1&&(a(0,"th"),d(1),l()),i&2){let r=o.$implicit;c(),T(r)}}function Tg(i,o){if(i&1&&(a(0,"td"),d(1),l()),i&2){let r=o.$implicit;c(),T(r)}}function Ig(i,o){if(i&1&&(a(0,"tr")(1,"td"),d(2),l(),a(3,"td")(4,"strong"),d(5),l()(),q(6,Tg,2,1,"td",null,He),l()),i&2){let r=o.$implicit;c(2),T(r.strike),c(3),T(r.symbol),c(),G(r.values)}}function kg(i,o){if(i&1&&(a(0,"td"),d(1),l()),i&2){let r=o.$implicit;c(),T(r)}}var Hl=(()=>{let o=class o{constructor(){this.dayColumns=ml,this.rows=hl}get totals(){return this.dayColumns.map((e,t)=>t===0?"":this.rows.reduce((s,p)=>{let m=Number(String(p.values[t]??"0").replace(/,/g,""));return s+(Number.isFinite(m)?m:0)}
31,0).toLocaleString("en-IN"))}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-payoff-theta-decay-table-panel"]],inputs:{dayColumns:"dayColumns",rows:"rows"},decls:26,vars:0,consts:[["aria-label","Theta decay table",1,"theta-decay-panel"],[1,"theta-table-actions"],[1,"table-wrap"],[1,"theta-table"],[1,"strike-col"],[1,"symbol-col"],[1,"day-col"],[1,"total-row"],["colspan","2",1,"total-label-cell"]],template:function(t,n){t&1&&(a(0,"section",0),y(1,"div",1),a(2,"div",2)(3,"table",3)(4,"colgroup"),y(5,"col",4)(6,"col",5),q(7,Mg,1,0,"col",6,et),l(),a(9,"thead")(10,"tr")(11,"th"),d(12,"Strike"),l(),a(13,"th"),d(14,"Symbol"),l(),q(15,Eg,2,1,"th",null,et),l()(),a(17,"tbody"),q(18,Ig,8,2,"tr",null,Og),a(20,"tr",7)(21,"td",8)(22,"strong"),d(23,"Total Theta Decay"),l()(),q(24,kg,2,1,"td",null,He),l()()()()()),t&2&&(c(7),G(n.dayColumns),c(8),G(n.dayColumns),c(3),G(n.rows),c(6),G(n.totals))},styles:["[_nghost-%COMP%]{display:block}.theta-decay-panel[_ngcontent-%COMP%]{display:grid;gap:12px;border-top:1px solid #343d4a;padding-top:14px;color:#f5f9ff;font-size:12px;min-width:0}.theta-table-actions[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.theta-table-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{height:30px;border:1px solid #416792;border-radius:5px;background:#416792;color:#dfe1e2;font:inherit;font-size:12px;font-weight:800;padding:0 14px;cursor:pointer}.theta-table-actions[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]:hover{background:#4e7daf}.table-wrap[_ngcontent-%COMP%]{overflow-x:auto}.theta-table[_ngcontent-%COMP%]{width:100%;min-width:1154px;border-collapse:collapse;table-layout:fixed}.strike-col[_ngcontent-%COMP%]{width:78px}.symbol-col[_ngcontent-%COMP%]{width:180px}.day-col[_ngcontent-%COMP%]{width:64px}.theta-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%], .theta-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{height:40px;padding:0 8px;border-bottom:1px solid #343d4a;white-space:nowrap}.theta-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{background:#252a31;color:#8fa1ba;font-size:11px;font-weight:600;text-align:right}.theta-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{color:#f5f9ff;font-weight:700;text-align:right}.theta-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:first-child, .theta-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:first-child, .theta-table[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]:nth-child(2), .theta-table[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]:nth-child(2){text-align:left}.total-row[_ngcontent-%COMP%]   td[_ngcontent-%COMP%]{border-bottom:0;background:#111}.total-row[_ngcontent-%COMP%]   .total-label-cell[_ngcontent-%COMP%]{overflow:hidden;text-align:left;text-overflow:ellipsis}.projected-badge[_ngcontent-%COMP%]{display:inline-grid;grid-auto-flow:column;place-items:center;gap:4px;min-height:24px;border-radius:3px;background:#d3432b3d;color:#ff6b4f;font-weight:800;padding:0 8px}.help-icon[_ngcontent-%COMP%]{display:inline-grid;place-items:center;width:13px;height:13px;border:1px solid #6c798c;border-radius:50%;color:#9badc3;font-size:9px;line-height:1}"]});let i=o;return i})();var Vl=()=>[],Rg=(i,o)=>o.label,Dg=(i,o)=>o.id,Ng=(i,o)=>o.value;function Fg(i,o){if(i&1){let r=R();a(0,"div",3)(1,"h2",5),d(2),l(),a(3,"div",6)(4,"button",7),_("click",function(){S(r);let t=u(2);return v(t.setSummaryView("summary"))}),d(5," Summary "),l(),a(6,"button",7),_("click",function(){S(r);let t=u(2);return v(t.setSummaryView("legs"))}),d(7," Legs "),l()()()}if(i&2){let r=u(2);c(2),g(" ",r.active_summary_view==="summary"?"Summary":"Legs"," "),c(2),w("active",r.active_summary_view==="summary"),H("aria-pressed",r.active_summary_view==="summary"),c(2),w("active",r.active_summary_view==="legs"),H("aria-pressed",r.active_summary_view==="legs")}}function Lg(i,o){i&1&&(a(0,"div",8),d(1,"Loading payoff metrics\u2026"),l())}function Ag(i,o){if(i&1&&(a(0,"div",9),d(1),l()),i&2){let r=u(3);c(),g(" ",r.payoff_details_error," ")}}function Ug(i,o){i&1&&(a(0,"span",13),d(1,"?"),l())}function Hg(i,o){if(i&1&&(a(0,"div",11)(1,"span",12),d(2),P(3,Ug,2,0,"span",13),l(),a(4,"strong",14),d(5),l()()),i&2){let r=o.$implicit;b("ngClass",r.tileClass),H("title",r.helpText||null),c(2),g(" ",r.label," "),c(),C(r.showHelp?3:-1),c(),b("ngClass",r.valueClass),c(),g(" ",r.displayValue," ")}}function Vg(i,o){if(i&1&&(a(0,"div",10),q(1,Hg,6,6,"div",11,Rg),l()),i&2){let r=u(3);c(),G(r.summaryMetrics)}}function Bg(i,o){if(i&1&&P(0,Lg,2,0,"div",8)(1,Ag,2,1,"div",9)(2,Vg,3,0,"div",10),i&2){let r=u(2);C(r.payoff_details_loading?0:r.payoff_details_error?1:2)}}function qg(i,o){if(i&1){let r=R();a(0,"div",19)(1,"span",20),d(2),l(),a(3,"span",20)(4,"i",21),d(5),l()(),a(6,"span",20),d(7),l(),a(8,"span",20),d(9),l(),a(10,"span",20),d(11),l(),a(12,"span",20),d(13),l(),a(14,"strong",20),d(15),l(),a(16,"span",22)(17,"button",23),_("click",function(t){let n=S(r).$implicit,s=u(4);return v(s.editSavedStrategyLeg(t,n))}),y(18,"ion-icon",24),l()()()}if(i&2){let r=o.$implicit,e=o.$index;c(2),T(e+1),c(2),w("sell",r.side==="S"),c(),g(" ",r.side," "),c(2),T(r.expiry),c(2),T(r.strike),c(2),T(r.type),c(2),T(r.lots),c(2),T(r.price)}}function Gg(i,o){if(i&1&&(a(0,"div",15)(1,"div",17)(2,"span",18),d(3,"S.No"),l(),a(4,"span",18),d(5,"B/S"),l(),a(6,"span",18),d(7,"Expiry"),l(),a(8,"span",18),d(9,"Strike"),l(),a(10,"span",18),d(11,"Type"),l(),a(12,"span",18),d(13,"Lots"),l(),a(14,"span",18),d(15,"Price"),l(),a(16,"span",18),d(17,"Edit"),l()(),q(18,qg,19,9,"div",19,Dg),l()),i&2){let r=u(3);c(18),G(r.selected_legs)}}function zg(i,o){i&1&&(a(0,"div",16)(1,"strong"),d(2,"No legs available"),l(),a(3,"span"),d(4,"Select or open a strategy to see legs here."),l()())}function jg(i,o){if(i&1&&(a(0,"div",4),P(1,Gg,20,0,"div",15)(2,zg,5,0,"div",16),l()),i&2){let r=u(2);c(),C(r.selected_legs.length?1:2)}}function Kg(i,o){if(i&1&&(a(0,"section",1),P(1,Fg,8,7,"div",3)(2,Bg,3,1)(3,jg,3,1,"div",4),l()),i&2){let r=u();c(),C(r.enableSummaryLegsToggle?1:-1),c(),C(!r.enableSummaryLegsToggle||r.active_summary_view==="summary"?2:3)}}function $g(i,o){if(i&1){let r=R();a(0,"button",7),_("click",function(){let t=S(r).$implicit,n=u(2);return v(n.setChartMode(t.value))}),d(1),l()}if(i&2){let r=o.$implicit,e=u(2);w("active",e.active_chart_mode===r.value&&(r.value!=="payoff-graph"||e.active_payoff_view==="graph")),H("aria-pressed",e.active_chart_mode===r.value&&(r.value!=="payoff-graph"||e.active_payoff_view==="graph")),c(),g(" ",r.label," ")}}function Qg(i,o){i&1&&(a(0,"div",32)(1,"strong"),d(2,"No payoff chart data"),l(),a(3,"span"),d(4),l()()),i&2&&(c(4),T(o))}function Yg(i,o){if(i&1){let r=R();
31a(0,"app-hedge-protection-payoff-chart",36),_("percentChangeChange",function(t){S(r);let n=u(3);return v(n.payoffChartPercentChangeChanged.emit(t))}),l()}if(i&2){let r,e=u(3);b("data",(r=e.strategyData==null?null:e.strategyData.payoff_chart)!==null&&r!==void 0?r:null)("loading",e.isPayoffChartLoading)("percent_change",e.payoffChartPercentChange)}}function Xg(i,o){if(i&1&&(a(0,"div",34),y(1,"app-hedge-protection-payoff-table",37),l()),i&2){let r=u(3);c(),b("rows",r.payoffChartDataRows)}}function Wg(i,o){if(i&1){let r=R();a(0,"app-hedge-protection-payoff-up-down-flow",38),_("currentPriceChange",function(t){S(r);let n=u(3);return v(n.setMoveAnalysisCurrentPrice(t))}),l()}if(i&2){let r=u(3);b("rows",r.moveAnalysisRows)("current_price",r.moveAnalysisCurrentPrice)("targetDateLabel",r.targetDateHeaderLabel)("expiryDateLabel",r.expiryDateLabel)}}function Zg(i,o){if(i&1&&P(0,Qg,5,1,"div",32)(1,Yg,1,3,"app-hedge-protection-payoff-chart",33)(2,Xg,2,1,"div",34)(3,Wg,1,4,"app-hedge-protection-payoff-up-down-flow",35),i&2){let r,e=u(2);C((r=e.payoffChartUnavailableMessage)?0:e.active_payoff_view==="graph"?1:e.active_payoff_view==="table"?2:3,r)}}function Jg(i,o){if(i&1&&y(0,"app-hedge-protection-payoff-pl-table-panel",29),i&2){let r=u(2);b("rows",r.pl_rows)("total",r.pl_total)}}function e0(i,o){if(i&1&&y(0,"app-hedge-protection-payoff-greeks-table-panel",29),i&2){let r=u(2);b("rows",r.greek_rows)("total",r.greek_total)}}function t0(i,o){if(i&1&&y(0,"app-hedge-protection-payoff-theta-decay-table-panel",30),i&2){let r,e,t=u(2);b("dayColumns",(r=t.strategyData==null?null:t.strategyData.theta_decay_columns)!==null&&r!==void 0?r:ao(2,Vl))("rows",(e=t.strategyData==null?null:t.strategyData.theta_decay_rows)!==null&&e!==void 0?e:ao(3,Vl))}}function n0(i,o){if(i&1&&(a(0,"div",31)(1,"strong"),d(2),l()()),i&2){let r=u(2);c(2),T(r.activeChartModeLabel)}}function i0(i,o){if(i&1){let r=R();a(0,"section",2)(1,"h2",5),d(2,"Charts and Graphs"),l(),a(3,"div",25)(4,"div",26)(5,"div",27),q(6,$g,2,4,"button",28,Ng),a(8,"button",7),_("click",function(){S(r);let t=u();return v(t.setPayoffChartView("table"))}),d(9," Payoff Table "),l(),a(10,"button",7),_("click",function(){S(r);let t=u();return v(t.setPayoffChartView("flow"))}),d(11," Move Analysis "),l()()(),P(12,Zg,4,1)(13,Jg,1,2,"app-hedge-protection-payoff-pl-table-panel",29)(14,e0,1,2,"app-hedge-protection-payoff-greeks-table-panel",29)(15,t0,1,4,"app-hedge-protection-payoff-theta-decay-table-panel",30)(16,n0,3,1,"div",31),l()()}if(i&2){let r=u();c(6),G(r.chartModes),c(2),w("active",r.active_chart_mode==="payoff-graph"&&r.active_payoff_view==="table"),H("aria-pressed",r.active_chart_mode==="payoff-graph"&&r.active_payoff_view==="table"),c(2),w("active",r.active_chart_mode==="payoff-graph"&&r.active_payoff_view==="flow"),H("aria-pressed",r.active_chart_mode==="payoff-graph"&&r.active_payoff_view==="flow"),c(2),C(r.active_chart_mode==="payoff-graph"?12:r.active_chart_mode==="pl-table"?13:r.active_chart_mode==="greeks"?14:r.active_chart_mode==="theta-decay"?15:16)}}var Bl=(()=>{let o=class o{constructor(){this.uiStore=D(ri),this.savedStrategyLegEdit=new ce,this.moveAnalysisRequested=new ce,this.moveAnalysisCurrentPriceChanged=new ce,this.payoffChartPercentChangeChanged=new ce,this.chartModeChanged=new ce,this.selectedStrategyName=null,this.payoff_details=null,this.payoff_details_loading=!1,this.payoff_details_error="",this.payoffChartEmptyMessage="",this.strategyData=null,this.moveAnalysisData=null,this.editableMoveAnalysisCurrentPrice=null,this.isPayoffChartLoading=!1,this.payoffChartPercentChange=10,this.targetStep=50,this.expiryDateLabel="Tue, 19 May",this.targetDateHeaderLabel="Mon, 11 May",this.chartModes=ul,this.summaryLegsToggleEnabled=!1,this.visibleSeriesSecondaryId=null}set secondaryId(e){let t=e.trim();t!==this.visibleSeriesSecondaryId&&(this.visibleSeriesSecondaryId=t,this.uiStore.resetTargetSeriesVisibility(!ds(t)))}set enableSummaryLegsToggle(e){this.summaryLegsToggleEnabled=e,e||this.uiStore.setSummaryView("summary")}get enableSummaryLegsToggle(){return this.summaryLegsToggleEnabled}get active_chart_mode(){return this.uiStore.active_chart_mode()}get active_payoff_view(){return this.uiStore.active_payoff_view()}get active_summary_view(){return this.uiStore.active_summary_view()}get target_value(){return this.uiStore.target_value()}get pl_rows(){return this.strategyData?.pl_rows??Ji}get selected_legs(){return this.strategyData?.selected_legs??[]}get pl_total(){return this.strategyData?.pl_total??to}get greek_rows(){return this.strategyData?.greek_rows??eo}get greek_total(){return this.strategyData?.greek_total??no}get activeChartModeLabel(){return this.chartModes.find(e=>e.value===this.active_chart_mode)?.label??""}get payoffTableRows(){return fl(this.strategyData?.payoff_chart??null,this.target_value,this.targetStep)}get payoffChartDataRows(){return Ko(this.strategyData?.payoff_chart??null)}get payoffChartUnavailableMessage(){return this.payoffChartEmptyMessage?this.payoffChartEmptyMessage:this.isPayoffChartLoading||this.hasRenderablePayoffChart?"":"No payoff chart data is available for this selection."}get moveAnalysisRows(){return xl(this.moveAnalysisSourceData?.payoff_chart??null,this.moveAnalysisCurrentPrice)}get moveAnalysisCurrentPrice(){return this.editableMoveAnalysisCurrentPrice??this.moveAnalysisSourceData?.payoff_chart.current_price??0}get summaryMetrics(){if(this.hasEmptyPayoffState)return this.emptySummaryMetrics();let e=this.payoff_details;if(!e)return[];if(this.isLongBoxSummary){let t=this.visibleSeriesSecondaryId===j.id?e.total_profit??e.max_profit:e.max_profit;return[{label:"Max Profit",value:this.formatLongBoxMaximumProfit(t,e.max_profit_is_unlimited),displayValue:this.formatLongBoxMaximumProfit(t,e.max_profit_is_unlimited),tileClass:"metric-tile--featured",valueClass:"profit-value"},{label:"Max Loss",value:this.formatMaximumLoss(e.max_loss,e.max_loss_is_unlimited),displayValue:this.formatMaximumLoss(e.max_loss,e.max_loss_is_unlimited),tileClass:"metric-tile--featured",valueClass:"loss-value"},{label:"Locked Expiry P&L",value:this.formatPrice(e.locked_expiry_pnl),displayValue:this.formatPrice(e.locked_expiry_pnl),tileClass:"metric-tile--wide"},{label:"Target Profit",value:this.formatPrice(e.target_profit),displayValue:this.formatPrice(e.target_profit),tileClass:"metric-tile--wide"},F(f({},this.createSummaryMetric("Core POP",e.core_pop,!0)),{tileClass:"metric-tile--wide",valueClass:["pop-value",this.popValueClass].filter(
31Boolean).join(" ")}),F(f({},this.createSummaryMetric("Expiry POP",e.expiry_pop,!0)),{tileClass:"metric-tile--wide",valueClass:["pop-value",this.popValueClass].filter(Boolean).join(" ")}),F(f({},this.createSummaryMetric("Target Date POP",e.target_date_pop,!0)),{tileClass:"metric-tile--wide",valueClass:["pop-value",this.popValueClass].filter(Boolean).join(" "),helpText:e.target_date_pop_reason?.trim()||void 0}),this.createSummaryMetric("Days to Expiry",e.days_to_expiry)]}return[{label:"Max Profit",value:this.formatMaximumProfit(e.max_profit,e.max_profit_is_unlimited),displayValue:this.formatMaximumProfit(e.max_profit,e.max_profit_is_unlimited),tileClass:"metric-tile--featured",valueClass:"profit-value"},{label:"Max Loss",value:this.formatMaximumLoss(e.max_loss,e.max_loss_is_unlimited),displayValue:this.formatMaximumLoss(e.max_loss,e.max_loss_is_unlimited),tileClass:"metric-tile--featured",valueClass:"loss-value"},{label:"Downside Move",value:this.formatSignedPercent(e.one_percent_downside_move),displayValue:this.formatSignedPercent(e.one_percent_downside_move),tileClass:"metric-tile--wide",valueClass:this.getMoveValueClass(e.one_percent_downside_move)},{label:"Upside Move",value:this.formatSignedPercent(e.one_percent_upside_move),displayValue:this.formatSignedPercent(e.one_percent_upside_move),tileClass:"metric-tile--wide",valueClass:this.getMoveValueClass(e.one_percent_upside_move)},{label:"Downside Breakeven",value:this.formatNumber(e.downside_breakeven),displayValue:this.formatNumber(e.downside_breakeven),tileClass:"metric-tile--wide"},{label:"Upside Breakeven",value:this.formatNumber(e.upside_breakeven),displayValue:this.formatNumber(e.upside_breakeven),tileClass:"metric-tile--wide"},{label:"Target Profit",value:this.formatPrice(e.target_profit),displayValue:this.formatPrice(e.target_profit),tileClass:"metric-tile--wide"},{label:"Matrix - 2",value:this.formatNumber(e.matrix_2),displayValue:this.formatNumber(e.matrix_2),tileClass:"metric-tile--wide"},{label:"Reward / Risk",value:this.formatRatio(e.reward_to_risk),displayValue:this.formatRatio(e.reward_to_risk),tileClass:"metric-tile--wide",valueClass:"ratio-pill"},{label:"Loss / Profit",value:this.formatPercent(e.loss_to_profit),displayValue:this.formatPercent(e.loss_to_profit),tileClass:"metric-tile--wide",valueClass:"ratio-pill"},{label:"Core POP",value:this.formatPercent(e.core_pop),tileClass:"metric-tile--wide",displayValue:this.formatPercent(e.core_pop),valueClass:["pop-value",this.popValueClass].filter(Boolean).join(" "),showHelp:!0},F(f({},this.createSummaryMetric("Expiry POP",e.expiry_pop,!0)),{tileClass:"metric-tile--wide",valueClass:["pop-value",this.popValueClass].filter(Boolean).join(" ")}),F(f({},this.createSummaryMetric("Target Date POP",e.target_date_pop,!0)),{tileClass:"metric-tile--wide",valueClass:["pop-value",this.popValueClass].filter(Boolean).join(" "),helpText:e.target_date_pop_reason?.trim()||void 0}),this.createSummaryMetric("Days to Expiry",e.days_to_expiry)]}get popValueClass(){let e=this.payoff_details?.core_pop;return typeof e!="number"||!Number.isFinite(e)?"":e<70?"pop-value-low":"pop-value-high"}get isLongBoxSummary(){return this.visibleSeriesSecondaryId===j.id||this.visibleSeriesSecondaryId===ee.id||this.visibleSeriesSecondaryId===ie.id||this.visibleSeriesSecondaryId===Q.id}setChartMode(e){this.uiStore.setChartMode(e),this.chartModeChanged.emit(e)}setSummaryView(e){this.uiStore.setSummaryView(e)}editSavedStrategyLeg(e,t){e.stopPropagation(),this.enableSummaryLegsToggle&&this.savedStrategyLegEdit.emit(t)}get payoffCurrentPrice(){return this.strategyData?.payoff_chart.current_price??0}setPayoffChartView(e){this.uiStore.setPayoffChartView(e),this.chartModeChanged.emit("payoff-graph"),e==="flow"&&this.moveAnalysisRequested.emit()}setTargetValue(e){this.uiStore.setTargetValue(e)}setMoveAnalysisCurrentPrice(e){!Number.isFinite(e)||e<=0||this.moveAnalysisCurrentPriceChanged.emit(e)}createSummaryMetric(e,t,n=!1){let s=n?this.formatPercent(t):this.formatNumber(t);return{label:e,value:s,displayValue:s}}get moveAnalysisSourceData(){return this.moveAnalysisData??this.strategyData}get hasEmptyPayoffState(){return!!this.payoffChartUnavailableMessage&&!this.payoff_details_error&&!this.payoff_details_loading}get hasRenderablePayoffChart(){return o0(this.strategyData?.payoff_chart)}emptySummaryMetrics(){return[{label:"Max Profit",value:"N/A",displayValue:"N/A",tileClass:"metric-tile--featured"},{label:"Max Loss",value:"N/A",displayValue:"N/A",tileClass:"metric-tile--featured"},{label:"Downside Move",value:"N/A",displayValue:"N/A",tileClass:"metric-tile--wide"},{label:"Upside Move",value:"N/A",displayValue:"N/A",tileClass:"metric-tile--wide"},...["Downside Breakeven","Upside Breakeven","Target Profit","Matrix - 2","Reward / Risk","Loss / Profit","Core POP","Expiry POP","Target Date POP","Days to Expiry"].map(e=>({label:e,value:"N/A",displayValue:"N/A",tileClass:"metric-tile--wide"}))]}formatNumber(e){return typeof e=="number"&&Number.isFinite(e)?e.toLocaleStr
31ing("en-IN",{maximumFractionDigits:2}):"-"}formatMaximumProfit(e,t=!1){return t?"Unlimited":typeof e!="number"||!Number.isFinite(e)?"-":this.formatNumber(e)}formatLongBoxMaximumProfit(e,t=!1){return t?"Unlimited":this.formatNumber(e)}formatMaximumLoss(e,t=!1){return t?"Unlimited":this.formatNumber(e)}formatPercent(e){let t=this.formatNumber(e);return t==="-"?"N/A":`${t}%`}formatRatio(e){let t=this.formatNumber(e);return t==="-"?"N/A":`${t}:1`}formatPrice(e){return typeof e=="number"&&Number.isFinite(e)?`\u20B9${e.toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2})}`:"\u2014"}formatSignedPercent(e){return typeof e!="number"||!Number.isFinite(e)?"\u2014":`${e>0?"+":""}${e.toFixed(2)}%`}getMoveValueClass(e){return typeof e!="number"||!Number.isFinite(e)||e===0?"move-value":e>0?"move-value move-value--positive":"move-value move-value--negative"}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-payoff-summary-panel"]],inputs:{selectedStrategyName:"selectedStrategyName",payoff_details:"payoff_details",payoff_details_loading:"payoff_details_loading",payoff_details_error:"payoff_details_error",payoffChartEmptyMessage:"payoffChartEmptyMessage",strategyData:"strategyData",moveAnalysisData:"moveAnalysisData",editableMoveAnalysisCurrentPrice:"editableMoveAnalysisCurrentPrice",isPayoffChartLoading:"isPayoffChartLoading",payoffChartPercentChange:"payoffChartPercentChange",secondaryId:"secondaryId",enableSummaryLegsToggle:"enableSummaryLegsToggle"},outputs:{savedStrategyLegEdit:"savedStrategyLegEdit",moveAnalysisRequested:"moveAnalysisRequested",moveAnalysisCurrentPriceChanged:"moveAnalysisCurrentPriceChanged",payoffChartPercentChangeChanged:"payoffChartPercentChangeChanged",chartModeChanged:"chartModeChanged"},features:[Ct([ri])],decls:3,vars:2,consts:[["aria-label","Strategy analytics",1,"summary-stack"],[1,"summary-panel","metrics-panel"],[1,"summary-panel","chart-panel"],[1,"panel-heading-row"],["aria-label","Selected legs table",1,"legs-table-wrap"],[1,"panel-heading"],["aria-label","Summary views",1,"summary-view-tabs"],["type","button",3,"click"],[1,"summary-status"],[1,"summary-status","summary-status--error"],[1,"metrics-grid"],[1,"metric-tile",3,"ngClass"],[1,"metric-label"],[1,"help-icon"],[3,"ngClass"],["role","table",1,"legs-table"],[1,"legs-empty-state"],["role","row",1,"legs-row","legs-head"],["role","columnheader"],["role","row",1,"legs-row"],["role","cell"],[1,"leg-side-pill"],["role","cell",1,"leg-edit-cell"],["type","button","aria-label","Edit leg",3,"click"],["name","create"],[1,"chart-card"],[1,"chart-toolbar"],["aria-label","Chart modes",1,"chart-mode-tabs"],["type","button",3,"active"],[3,"rows","total"],[3,"dayColumns","rows"],[1,"chart-placeholder"],[1,"chart-placeholder","chart-placeholder--empty"],[3,"data","loading","percent_change"],["aria-label","Payoff table",1,"payoff-table-wrap"],[3,"rows","current_price","targetDateLabel","expiryDateLabel"],[3,"percentChangeChange","data","loading","percent_change"],[3,"rows"],[3,"currentPriceChange","rows","current_price","targetDateLabel","expiryDateLabel"]],template:function(t,n){t&1&&(a(0,"aside",0),P(1,Kg,4,2,"section",1)(2,i0,17,7,"section",2),l()),t&2&&(c(),C(n.payoff_details||n.payoff_details_loading||n.payoff_details_error||n.payoffChartEmptyMessage?1:-1),c(),C(!n.payoff_details_error||n.payoffChartEmptyMessage?2:-1))},dependencies:[Ge,ne,te,Nl,Fl,Ll,Al,Ul,Hl],styles:["[_nghost-%COMP%]{display:block}.summary-stack[_ngcontent-%COMP%]{display:grid;gap:10px}.summary-panel[_ngcontent-%COMP%]{border:1px solid #283546;border-radius:6px;background:#141a23;color:#f5f9ff;box-sizing:border-box}.metrics-panel[_ngcontent-%COMP%]{overflow:hidden}.chart-panel[_ngcontent-%COMP%]{padding:12px}.panel-heading[_ngcontent-%COMP%]{margin:0;color:#dfe1e2;font-size:13px;font-weight:700}.panel-heading-row[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px 12px}.summary-view-tabs[_ngcontent-%COMP%], .chart-mode-tabs[_ngcontent-%COMP%]{display:inline-grid;overflow:hidden;border:1px solid #415064;border-radius:5px}.summary-view-tabs[_ngcontent-%COMP%]{grid-template-columns:repeat(2,minmax(72px,auto))}.chart-mode-tabs[_ngcontent-%COMP%]{grid-template-columns:repeat(7,minmax(80px,auto))}.summary-view-tabs[_ngcontent-%COMP%]   button[_ngcontent-%COMP%], .chart
31-mode-tabs[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{height:26px;border:0;background:transparent;color:#f5f9ff;cursor:pointer;font:inherit;font-size:12px;font-weight:700}.summary-view-tabs[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{padding:0 14px}.chart-mode-tabs[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{padding:0 20px}.summary-view-tabs[_ngcontent-%COMP%]   button.active[_ngcontent-%COMP%], .chart-mode-tabs[_ngcontent-%COMP%]   button.active[_ngcontent-%COMP%]{background:#0043ba;color:#dfe1e2}.chart-card[_ngcontent-%COMP%]{border-top:1px solid #343d4a;color:#f5f9ff;font-size:12px}.chart-toolbar[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 0}.chart-placeholder[_ngcontent-%COMP%]{display:grid;gap:6px;min-height:220px;place-items:center;border-top:1px solid #343d4a;color:#dce8f8;text-align:center}.chart-placeholder[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{max-width:560px;color:#9aa4b2;line-height:1.4}.metrics-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px;padding:14px}.metric-tile[_ngcontent-%COMP%]{display:grid;min-width:0;min-height:78px;align-content:center;justify-items:center;gap:9px;padding:12px 10px;border:1px solid #283546;border-radius:6px;background:#101720;text-align:center;box-sizing:border-box}.metric-tile--featured[_ngcontent-%COMP%], .metric-tile--wide[_ngcontent-%COMP%]{grid-column:span 1}.metric-label[_ngcontent-%COMP%]{color:#d6dce6;font-size:11px;font-weight:700;line-height:1.2;max-width:100%;white-space:normal}.metric-tile[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{width:100%;min-width:0;max-width:100%;color:#eef4ff;font-size:13px;font-weight:800;line-height:1.15;overflow-wrap:anywhere;white-space:normal}.help-icon[_ngcontent-%COMP%]{display:inline-grid;place-items:center;width:13px;height:13px;margin-left:3px;border:1px solid #6c798c;border-radius:50%;color:#9badc3;font-size:9px;line-height:1}.profit-value[_ngcontent-%COMP%], .loss-value[_ngcontent-%COMP%], .pop-value[_ngcontent-%COMP%]{display:inline-grid;place-items:center;width:100%;min-width:0;max-width:100%;border-radius:4px;padding:7px 8px;color:#dfe1e2;box-sizing:border-box}.profit-value[_ngcontent-%COMP%], .pop-value-high[_ngcontent-%COMP%]{background:#00f}.loss-value[_ngcontent-%COMP%], .pop-value-low[_ngcontent-%COMP%]{background:#c90076}.ratio-pill[_ngcontent-%COMP%]{display:inline-grid;place-items:center;min-width:0;max-width:100%;border:1px solid #526174;border-radius:5px;padding:6px 10px;background:#11161d;white-space:normal}.move-value[_ngcontent-%COMP%]{color:#d6dce6}.move-value--positive[_ngcontent-%COMP%]{color:#2ecc71}.move-value--negative[_ngcontent-%COMP%]{color:#ff4d67}.summary-status[_ngcontent-%COMP%]{display:grid;min-height:78px;place-items:center;color:#9badc3;font-size:13px;font-weight:700}.summary-status--error[_ngcontent-%COMP%]{color:#ff6b7d}.legs-table-wrap[_ngcontent-%COMP%]{overflow-x:auto;border-top:1px solid #343d4a}.legs-table[_ngcontent-%COMP%]{display:grid;min-width:680px}.legs-row[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(46px,.36fr) minmax(54px,.42fr) minmax(120px,1fr) minmax(86px,.68fr) minmax(62px,.48fr) minmax(62px,.48fr) minmax(90px,.7fr) minmax(58px,.44fr);align-items:center;gap:10px;min-height:38px;border-bottom:1px solid #303946;color:#f5f9ff;font-size:12px;font-weight:800;padding:0 16px}.legs-head[_ngcontent-%COMP%]{min-height:34px;background:#191d22;color:#9fb6d3;font-size:11px;font-weight:900}.legs-row[_ngcontent-%COMP%]:last-child{border-bottom:0}.legs-row[_ngcontent-%COMP%]   span[_ngcontent-%COMP%], .legs-row[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.leg-side-pill[_ngcontent-%COMP%]{display:inline-grid;place-items:center;width:26px;height:24px;border-radius:4px;background:#2f6bbf;color:#dfe1e2;font-style:normal;font-weight:900}.leg-side-pill.sell[_ngcontent-%COMP%]{background:#b84b3d}.leg-edit-cell[_ngcontent-%COMP%]{display:inline-flex;align-items:center}.leg-edit-cell[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{display:inline-grid;place-items:center;width:28px;height:28px;border:0;border-radius:4px;background:transparent;color:#fff;cursor:pointer;padding:0}.leg-edit-cell[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]:hover{background:#76b7ff1f}.leg-edit-cell[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:16px}.legs-empty-state[_ngcontent-%COMP%]{display:grid;place-content:center;gap:6px;min-height:92px;color:#8fa4c0;text-align:center}.legs-empty-state[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{color:#dfe1e2;font-size:12px;font-weight:900}.legs-empty-state[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{font-size:10px;font-weight:800}
31app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .summary-panel[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .summary-panel[_ngcontent-%COMP%]{overflow:hidden}app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .metrics-grid[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .metrics-grid[_ngcontent-%COMP%]{grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:8px;padding:10px}app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .metric-tile[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .metric-tile[_ngcontent-%COMP%]{min-height:70px;gap:8px;padding:10px 8px}app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .metric-label[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .metric-label[_ngcontent-%COMP%]{max-width:100%;font-size:10px;line-height:1.15;white-space:normal}app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .metric-tile[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .metric-tile[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{font-size:12px}app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .profit-value[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .profit-value[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .loss-value[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .loss-value[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .pop-value[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .pop-value[_ngcontent-%COMP%]{width:100%;min-width:0;padding:6px}app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .chart-card[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .chart-card[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .chart-toolbar[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .chart-toolbar[_ngcontent-%COMP%]{min-width:0;overflow:hidden}app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .chart-mode-tabs[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .chart-mode-tabs[_ngcontent-%COMP%]{width:100%;grid-template-columns:repeat(7,minmax(0,1fr))}app-hedge-protection-payoff.embedded[_nghost-%COMP%]   .chart-mode-tabs[_ngcontent-%COMP%]   button[_ngcontent-%COMP%], app-hedge-protection-payoff.embedded   [_nghost-%COMP%]   .chart-mode-tabs[_ngcontent-%COMP%]   button[_ngcontent-%COMP%]{min-width:0;padding:0 6px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media(max-width:900px){.metrics-grid[_ngcontent-%COMP%]{grid-template-columns:repeat(auto-fill,minmax(145px,1fr));padding:10px}}@media(max-width:420px){.metrics-grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}@media(max-width:760px){.chart-toolbar[_ngcontent-%COMP%]{align-items:flex-start;flex-direction:column}.chart-mode-tabs[_ngcontent-%COMP%]{grid-template-columns:repeat(2,minmax(120px,1fr));width:100%}}@container payoff-page (max-width: 1000px){.metrics-grid[_ngcontent-%COMP%]{display:flex;gap:10px;padding:14px;overflow-x:auto;overflow-y:hidden}.metric-tile[_ngcontent-%COMP%]{flex:0 0 150px;min-width:150px}.metric-tile[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}"]});let i=o;return i})();function o0(i){return[i?.expiry,i?.target,i?.target_one].some(o=>Array.isArray(o)&&o.length>0)}function r0(i,o){if(i&1&&(a(0,"div",1),d(1),l()),i&2){let r=u();c(),g(" ",r.detailsFacade.tradesPendingMessage()," ")}}function s0(i,o){i&1&&d(0," (showing cached trades) ")}function a0(i,o){if(i&1&&(a(0,"div",2),d(1),P(2,s0,1,0),l()),i&2){let r=u();c(),g(" ",r.detailsFacade.tradesErrorMessage()," "),c(),C(r.detailsFacade.tradesStale()?2:-1)}}function l0(i,o){if(i&1&&(a(0,"div",6),d(1),l()),i&2){let r=o;w("payoff-live-state--error",r.status!=="accepted"),c(),g(" ",r.message," ")}}function c0(i,o){if(i&1&&(a(0,"strong"),d(1),l(),a(2,"span"),d(3,"Waiting for complete executable market data."),l()),i&2){let r=u(2);c(),g("Loading ",r.boxSpreadPayoffName()," payoff")}}function d0(i,o){if(i&1&&(a(0,"strong"),d(1),l(),a(2,"span"),d(3),l()),i&2){let r=u(2);c(),g("Unable to load ",r.boxSpreadPayoffName()," payoff"),c(2),T(r.payoff_details_error())}}function p0(i,o){if(i&1&&(a(0,"strong"),d(1),l(),a(2,"span"),d(3),l()),i&2){let r=u(2);c(),g("No ",r.boxSpreadPayoffName()," payoff available"),c(2),T(r.payoffChartEmptyMessage()||"A complete four-leg payoff could not be loaded.")}}function u0(i,o){if(i&1&&(a(0,"section",5),P(1,c0,4,1)(2,d0,4,2)(3,p0,4,2),l()),i&2){let r=u();c(),C(r.payoff_details_loading()?1:r.payoff_details_error()?2:3)}}function m0(i,o){if(i&1&&(a(0,"div")(1,"span"),d(2,"Total Profit"),l(),a(3,"strong"),d(4),z(5,"number"),l()(),a(6,"div")(7,"span"),d(8,"Profit / Lot"),l(),a(9,"strong"),d(10),z(11,"number"),l()(),a(12,"div")(13,"span"),d(14,"Lots"),l(),a(15,"strong"),d(16),z(17,"number"),l()(),a(18,"div")(19,"span"),d(20,"Minimum / Lot"),l(),a(21,"strong"),d(22),z(23,"number"),l()()),i&2){let r=u(3);c(4),g("\u20B9",W(5,4,r.longBoxTotalProfit(),"1.0-2"),""),c(6),g("\u20B9",W(11,7,r.longBoxProfitPerLot(),"1.0-2"),""),c(6),T(W(17,10,r.longBoxLotCount(),"1.0-0")),c(6),g("\u20B9",W(23,13,r.longBoxMinimumProfitPerLot(),"1.0-2"),"")}}function h0(i,o){if(i&1&&(a(0,"section",8)(1,"header",10)(2,"div")(3,"span"),d(4,"Long-box status"),l()(),a(5,"span",11),d(6," Signal "),l()(),a(7,"div",12)(8,"div")(9,"span"),d(10,"Lower Strike"),l(),a(11,"strong"),d(12),z(13,"number"),l()(),a(14,"div")(15,"span"),d(16,"Upper Str
31ike"),l(),a(17,"strong"),d(18),z(19,"number"),l()(),a(20,"div")(21,"span"),d(22,"Width"),l(),a(23,"strong"),d(24),z(25,"number"),l()(),a(26,"div")(27,"span"),d(28),l(),a(29,"strong"),d(30),z(31,"number"),l()(),a(32,"div")(33,"span"),d(34,"Edge Points"),l(),a(35,"strong"),d(36),z(37,"number"),l()(),a(38,"div")(39,"span"),d(40,"Edge Rupees"),l(),a(41,"strong"),d(42),z(43,"number"),l()(),a(44,"div")(45,"span"),d(46,"Return"),l(),a(47,"strong"),d(48),z(49,"number"),l()(),a(50,"div")(51,"span"),d(52,"Lot Size"),l(),a(53,"strong"),d(54),z(55,"number"),l()(),P(56,m0,24,16),a(57,"div")(58,"span"),d(59,"Locked Expiry P&L"),l(),a(60,"strong"),d(61),z(62,"number"),l()()()()),i&2){let r,e=o,t=u(2);c(5),w("long-box-status--actionable",t.longBoxOpportunityState()==="actionable")("long-box-status--positive",t.longBoxOpportunityState()==="positive")("long-box-status--unprofitable",t.longBoxOpportunityState()==="unprofitable"),c(7),T(W(13,17,e.lower_strike,"1.0-2")),c(6),T(W(19,20,e.upper_strike,"1.0-2")),c(6),T(W(25,23,e.width,"1.0-2")),c(4),T(e.side==="short"?"Net Credit":"Net Debit"),c(2),T(W(31,26,e.side==="short"?e.net_credit:e.net_debit,"1.0-2")),c(6),T(W(37,29,e.edge_points,"1.0-2")),c(6),g("\u20B9",W(43,32,e.edge_rupees,"1.0-2"),""),c(6),g("",W(49,35,e.return*100,"1.2-2"),"%"),c(6),T(W(55,38,e.lot_size,"1.0-0")),c(2),C(t.usesEquityLongBoxLotContract()?56:-1),c(5),g("\u20B9",W(62,41,(r=t.payoff_details())==null?null:r.locked_expiry_pnl,"1.0-2"),"")}}function g0(i,o){if(i&1){let r=R();y(0,"app-trade-table",7),P(1,h0,63,44,"section",8),a(2,"app-hedge-protection-payoff-summary-panel",9),_("moveAnalysisRequested",function(){S(r);let t=u();return v(t.loadMoveAnalysisSimulation())})("moveAnalysisCurrentPriceChanged",function(t){S(r);let n=u();return v(n.updateMoveAnalysisCurrentPrice(t))})("payoffChartPercentChangeChanged",function(t){S(r);let n=u();return v(n.updatePayoffChartPercentChange(t))})("chartModeChanged",function(t){S(r);let n=u();return v(n.updateChartMode(t))}),l()}if(i&2){let r,e=u();b("secondary_id",e.origin())("tradeRows",e.displayTradeRows()),c(),C((r=e.isLongBoxPayoff()&&e.longBoxSpread())?1:-1,r),c(),b("enableSummaryLegsToggle",!1)("isPayoffChartLoading",e.isPayoffChartLoading())("payoffChartPercentChange",e.payoffChartPercentChange())("secondaryId",e.productId())("editableMoveAnalysisCurrentPrice",e.editableMoveAnalysisCurrentPrice())("moveAnalysisData",e.selectedMoveAnalysisData())("strategyData",e.selectedAnalyticsData())("selectedStrategyName",e.selectedStrategyName())("payoff_details",e.payoff_details())("payoff_details_loading",e.payoff_details_loading())("payoff_details_error",e.payoff_details_error())("payoffChartEmptyMessage",e.payoffChartEmptyMessage())}}var ql=(()=>{let o=class o{constructor(){this.detailsFacade=D(We),this.payoffAnalytics=D(nl),this.payoffApi=D(Bo),this.payoffGreeksApi=D(qo),this.payoffLive=D(zo),this.manualMoveAnalysisCurrentPrice=O(null),this.payoffSnapshot=O(null),this.apiPayoffChart=M(()=>this.payoffSnapshot()?.payoff_chart??null),this.payoff_details=M(()=>this.payoffSnapshot()?.payoff_details??null),this.payoff_details_loading=O(!1),this.payoff_details_error=O(""),this.payoffChartEmptyMessage=O(""),this.payoffLiveState=O(null),this.longBoxSpread=M(()=>this.payoffSnapshot()?.box_spread??null),this.usesEquityLongBoxLotContract=M(()=>this.productId()===j.id),this.longBoxTotalProfit=M(()=>{let e=this.payoffSnapshot(),t=e?.payoff_details,n=e?.box_spread;return this.firstFiniteNumber(e?.total_profit,t?.total_profit,n?.total_profit,t?.max_profit)}),this.longBoxProfitPerLot=M(()=>{let e=this.payoffSnapshot();return this.firstFiniteNumber(e?.profit_per_lot,e?.payoff_details?.profit_per_lot,e?.box_spread?.profit_per_lot)}),this.longBoxLotCount=M(()=>{let e=this.payoffSnapshot();return this.firstFiniteNumber(e?.lot_count,e?.payoff_details?.lot_count,e?.box_spread?.lot_count)}),this.longBoxMinimumProfitPerLot=M(()=>{let e=this.payoffSnapshot();return this.firstFiniteNumber(e?.minimum_profit_per_lot,e?.payoff_details?.minimum_profit_per_lot,e?.box_spread?.minimum_profit_per_lot,e?.threshold,e?.payoff_details?.threshold,e?.box_spread?.threshold)}),this.simulatedApiPayoffChart=O(null),this.settledPayoffPayloadKey=O(""),this.successfulPayoffPayloadKey=O(""),this.settledSimulatedPayoffChartPayloadKey=O(""),this.payoffResponseSubscription=be.EMPTY,this.simulatedPayoffChartResponseSubscription=be.EMPTY,this.latestPayoffPayloadKey="",this.latestPayoffSourceKey="",this.latestLivePayoffPayloadKey="",this.latestSimulatedPayoffChartPayloadKey="",this.payoffRequestId=0,this.simulatedPayoffChartRequestId=0,this.origin=E(""),this.primaryId=E(""),this.segment=E(""),this.selectedIndex=E(""),this.selectedInstrumentToken=E(null),this.selectedOptionInstrumentToken=E(null),this.selectedOptionInstrumentTokens=E([]),this.scannerPayoffInstrumentTokens=E([]),this.selectedOptionPutLot=E(null),this.targetDate=E(null),this.productId=E(""),this.initialExpiryIndex=E(1),this.payoffChartPercentChange=O(10),this.activeChartMode=O("payoff-graph"),this.tradeRows=this.detailsFacade.tradeRows,this.payoffChartRequest=M(()=>
31this.payoffAnalytics.buildChartRequest(this.productId(),this.segment(),this.selectedInstrumentToken(),this.selectedOptionInstrumentTokens(),this.selectedOptionPutLot(),this.targetDate(),this.scannerPayoffInstrumentTokens())),this.payoffChartRequestKey=M(()=>this.payoffAnalytics.buildChartRequestKey(this.payoffChartRequest())),this.payoffChartSourceKey=M(()=>JSON.stringify({request:this.payoffChartRequest(),selectedIndex:this.selectedIndex(),selectedInstrumentToken:this.selectedInstrumentToken(),selectedOptionInstrumentTokens:this.selectedOptionInstrumentTokens(),scannerPayoffInstrumentTokens:this.scannerPayoffInstrumentTokens(),selectedOptionPutLot:this.selectedOptionPutLot(),targetDate:this.targetDate()})),this.payoffChartRangeRequest=M(()=>{let e=this.payoffChartRequest();return e?F(f({},e),{percent_change:this.payoffChartPercentChange()}):null}),this.payoffChartRangeRequestKey=M(()=>{let e=this.payoffChartRangeRequest();return e?JSON.stringify(e):""}),this.committedIndexBoxSpreadLiveRequest=O(null),this.committedIndexConversionLiveRequest=O(null),this.activePayoffLiveRequest=M(()=>{let e=this.payoffChartRangeRequest();return fn(this.productId())?this.isCompleteIndexBoxSpreadPayoffRequest(e)?e:this.committedIndexBoxSpreadLiveRequest():this.isIndexConversionPayoffRoute()?this.isCompleteIndexConversionPayoffRequest(e)?e:this.committedIndexConversionLiveRequest():e}),this.shouldFreezeIndexBoxSpreadPayoff=M(()=>{if(!fn(this.productId()))return!1;let e=this.payoffChartRequest();return!e||e.instrument_tokens.length!==4}),this.shouldFreezeIndexConversionPayoff=M(()=>this.isIndexConversionPayoffRoute()?!this.isCompleteIndexConversionPayoffRequest(this.payoffChartRangeRequest()):!1),this.shouldFreezePayoffSelection=M(()=>this.shouldFreezeIndexBoxSpreadPayoff()||this.shouldFreezeIndexConversionPayoff()),this.greekTableRequest=M(()=>pl(this.productId(),this.displayTradeRows())),this.moveAnalysisSimulationRequest=M(()=>{let e=this.payoffChartRequest();if(!e||this.productId()===j.id)return null;let t=this.manualMoveAnalysisCurrentPrice()??this.apiPayoffChart()?.current_price??this.selectedAnalyticsData().payoff_chart.current_price;
31return!Number.isFinite(t)||t<=0?null:this.productId()===ee.id?{secondary_id:e.secondary_id,instrument_tokens:e.instrument_tokens,segment:"index-options",current_price:t}:{secondary_id:e.secondary_id,instrument_tokens:e.instrument_tokens,segment:e.segment,spot_token:e.spot_token,put_lot:e.put_lot,target_date:this.resolveSimulationTargetDate(),current_price:t}}),this.moveAnalysisSimulationRequestKey=M(()=>{let e=this.moveAnalysisSimulationRequest();return e?JSON.stringify(e):""}),this.isPayoffChartPending=M(()=>{let e=this.isIndexConversionPayoffRoute()?this.resolveActivePayoffRequestKey():this.payoffChartRangeRequestKey();return!!e&&e!==this.settledPayoffPayloadKey()}),this.isPayoffChartLoading=M(()=>!this.apiPayoffChart()&&(this.detailsFacade.isTradesLoading()||this.isPayoffChartPending())),this.displayTradeRows=M(()=>{let e=this.payoffSnapshot();return e?Object.entries(e.trades).map(([t,n])=>({key:t,trade:n})).sort((t,n)=>t.trade.order-n.trade.order):this.tradeRows()}),this.currentAnalyticsData=M(()=>this.payoffAnalytics.buildAnalytics(this.displayTradeRows(),this.apiPayoffChart(),this.payoffGreeksApi.greeks(),this.payoffSnapshot()?.trade_totals??null,{deferFallbackChart:!0})),this.selectedAnalyticsData=M(()=>this.currentAnalyticsData()),this.selectedMoveAnalysisData=M(()=>{let e=this.moveAnalysisSimulationRequestKey(),t=this.simulatedApiPayoffChart();return!e||!t||this.settledSimulatedPayoffChartPayloadKey()!==e?null:this.payoffAnalytics.buildAnalytics(this.displayTradeRows(),t,this.payoffGreeksApi.greeks(),this.payoffSnapshot()?.trade_totals??null)}),this.editableMoveAnalysisCurrentPrice=M(()=>this.manualMoveAnalysisCurrentPrice()??this.selectedMoveAnalysisData()?.payoff_chart.current_price??this.selectedAnalyticsData().payoff_chart.current_price),this.selectedStrategyName=M(()=>this.displayTradeRows()[0]?.trade.symbol??"Selected Legs"),this.isLongBoxPayoff=M(()=>
31this.productId()===j.id||this.productId()===ee.id||this.productId()===ie.id||this.productId()===Q.id),this.boxSpreadPayoffName=M(()=>this.productId()===ie.id||this.productId()===Q.id?"short-box":"long-box"),this.hasCompleteLongBoxPayoff=M(()=>!this.isLongBoxPayoff()||!!this.longBoxSpread()&&this.displayTradeRows().length===4&&(this.shouldFreezeIndexBoxSpreadPayoff()||this.payoffChartRangeRequestKey()===this.successfulPayoffPayloadKey())),this.longBoxOpportunityState=M(()=>{if(this.usesEquityLongBoxLotContract()){let e=this.payoffSnapshot(),t=e?.opportunity_available??e?.payoff_details?.opportunity_available??e?.box_spread?.opportunity_available;if(t===!1)return this.longBoxSpread()?.is_profitable===!0?"positive":"unprofitable";if(t===!0)return"actionable"}return this.payoff_details()?.opportunity_available===!0?"actionable":this.longBoxSpread()?.is_profitable===!0?"positive":"unprofitable"}),this.longBoxOpportunityLabel=M(()=>{switch(this.longBoxOpportunityState()){case"actionable":return"Passed opportunity";case"positive":return this.usesEquityLongBoxLotContract()&&this.longBoxMinimumProfitPerLot()!==null?`Positive edge \u2014 below \u20B9${this.longBoxMinimumProfitPerLot()} per-lot minimum`:"Positive edge \u2014 below configured threshold";default:return"No profitable opportunity"}}),this.payoffLive.configureHandler(e=>{this.applyLivePayoffUpdate(e)}),this.payoffLive.configureStateHandler(e=>{this.applyLivePayoffState(e)}),re(()=>{let e=this.payoffChartRangeRequest(),t=this.productId();fn(t)?this.isCompleteIndexBoxSpreadPayoffRequest(e)&&this.committedIndexBoxSpreadLiveRequest.set(e):this.committedIndexBoxSpreadLiveRequest.set(null),this.isIndexConversionPayoffRoute(t)?this.isCompleteIndexConversionPayoffRequest(e)&&this.committedIndexConversionLiveRequest.set(e):this.committedIndexConversionLiveRequest.set(null)}),re(()=>{let e={origin:this.origin(),segment:this.segment(),selectedIndex:this.selectedIndex(),selectedInstrumentToken:this.selectedInstrumentToken(),selectedOptionInstrumentToken:this.selectedOptionInstrumentToken(),selectedOptionInstrumentTokens:this.selectedOptionInstrumentTokens(),selectedOptionPutLot:this.selectedOptionPutLot(),productId:this.productId(),initialExpiryIndex:this.initialExpiryIndex(),primaryId:this.primaryId()};this.shouldFreezePayoffSelection()||Qt(()=>this.detailsFacade.loadTradesIndex(e.origin,e.segment,e.selectedIndex,e.selectedInstrumentToken,e.selectedOptionInstrumentToken,e.selectedOptionInstrumentTokens,e.selectedOptionPutLot,e.productId,e.initialExpiryIndex,e.primaryId))}),re(()=>{let e=this.payoffChartRangeRequest();this.shouldFreezePayoffSelection()||this.loadPayoff(e)}),re(()=>{this.syncPayoffLiveSubscription(this.activePayoffLiveRequest())}),re(()=>{this.activeChartMode()==="greeks"&&(this.shouldFreezePayoffSelection()||this.payoffGreeksApi.loadGreeks(this.greekTableRequest()))}),re(()=>{this.payoffChartSourceKey(),!this.shouldFreezePayoffSelection()&&this.manualMoveAnalysisCurrentPrice.set(null)})}ngOnInit(){this.detailsFacade.attachView()}ngOnDestroy(){this.payoffResponseSubscription.unsubscribe(),this.simulatedPayoffChartResponseSubscription.unsubscribe(),this.payoffLive.destroy(),this.detailsFacade.detachView()}loadMoveAnalysisSimulation(){this.loadSimulatedPayoffChart(this.moveAnalysisSimulationRequest())}updateMoveAnalysisCurrentPrice(e){!Number.isFinite(e)||e<=0||(this.manualMoveAnalysisCurrentPrice.set(e),this.loadMoveAnalysisSimulation())}updatePayoffChartPercentChange(e){!Number.isInteger(e)||e<5||e>25||this.payoffChartPercentChange.set(e)}updateChartMode(e){this.activeChartMode.set(e)}loadPayoff(e){if(!e){this.resetPayoff();return}let t=JSON.stringify(e),n=this.payoffChartSourceKey(),s=n!==this.latestPayoffSourceKey,p=t===this.latestPayoffPayloadKey;if(this.isEmptySpotOptionParityPayoffPayload(e)){this.applyEmptyPayoffState(t,n);return}if(p){this.latestPayoffSourceKey=n;return}this.latestPayoffPayloadKey=t,this.latestPayoffSourceKey=n,this.latestLivePayoffPayloadKey="",this.payoffLiveState.set(null),this.payoffRequestId++,this.payoffResponseSubscription.unsubscribe(),s&&this.clearPayoffSnapshot(),this.payoff_details_loading.set(!this.payoff_details()),this.payoff_details_error.set(""),this.payoffChartEmptyMessage.set(""),this.settledPayoffPayloadKey.set(""),this.successfulPayoffPayloadKey.set(""),this.fetchPayoff(e,t,this.payoffRequestId)}applyEmptyPayoffState(e,t){this.latestPayoffPayloadKey=e,this.latestPayoffSourceKey=t,this.latestLivePayoffPayloadKey="",this.payoffLiveState.set(null),this.payoffRequestId++,this.payoffResponseSubscription.unsubscribe(),this.clearPayoffSnapshot(),this.payoff_details_loading.set(!1),this.payoff_details_error.set(""),this.payoffChartEmptyMessage.set(this.resolveEmptyPayoffMessage()),this.detailsFacade.clearDeferredPayoffTrades(),this.settledPayoffPayloadKey.set(e),this.successfulPayoffPayloadKey.set(""),this.resetSimulatedPayoffChart()}fetchPayoff(e,t,n){this.payoffResponseSubscription=this.payoffApi.getPayoff(e).pipe(dn(s=>
31{if(this.isCurrentPayoffRequest(n,t)){let p=this.resolvePayoffError(s),m=this.isEmptyPayoffResult(s,e.secondary_id);this.latestLivePayoffPayloadKey===t||(this.clearPayoffSnapshot(),this.payoff_details_loading.set(!1),this.payoff_details_error.set(m?"":p),this.payoffChartEmptyMessage.set(this.resolvePayoffChartEmptyMessage(s,p,e.secondary_id)),this.detailsFacade.clearDeferredPayoffTrades(),this.settledPayoffPayloadKey.set(t),this.successfulPayoffPayloadKey.set(""),this.resetSimulatedPayoffChart())}return ln})).subscribe(s=>{this.applyPayoffResult(s,t,n)})}syncPayoffLiveSubscription(e){if(!e||this.shouldSkipPayoffChartLiveSubscription(e)){this.payoffLive.unsubscribeCurrentSelection();return}this.payoffLive.subscribe(e)}shouldSkipPayoffChartLiveSubscription(e){return this.isEmptySpotOptionParityPayoffPayload(e)}isEmptySpotOptionParityPayoffPayload(e){return ot(e.secondary_id)&&e.instrument_tokens.length===0}loadSimulatedPayoffChart(e){if(!e){this.resetSimulatedPayoffChart();return}let t=JSON.stringify(e);if(t===this.latestSimulatedPayoffChartPayloadKey)return;this.latestSimulatedPayoffChartPayloadKey=t,this.simulatedPayoffChartRequestId++,this.simulatedPayoffChartResponseSubscription.unsubscribe(),this.simulatedApiPayoffChart.set(null),this.settledSimulatedPayoffChartPayloadKey.set("");let n=this.simulatedPayoffChartRequestId;this.simulatedPayoffChartResponseSubscription=this.payoffApi.getSimulatedPayoffChart(e).pipe(dn(()=>(this.isCurrentSimulatedPayoffRequest(n,t)&&(this.simulatedApiPayoffChart.set(null),this.settledSimulatedPayoffChartPayloadKey.set(t)),ln))).subscribe(s=>{this.applySimulatedPayoffChartResult(s,t,n)})}applyPayoffResult(e,t,n){if(this.isCurrentPayoffRequest(n,t)&&this.latestLivePayoffPayloadKey!==t){if(!this.isCompletePayoffResult(e)){this.applyIncompletePayoffResult(t);return}this.applySuccessfulPayoffResult(e,t)}}applyIncompletePayoffResult(e){if(this.payoff_details_loading.set(!1),this.payoff_details_error.set(""),this.payoffSnapshot()){this.payoffChartEmptyMessage.set(""),this.settledPayoffPayloadKey.set(e);return}this.clearPayoffSnapshot(),this.payoffChartEmptyMessage.set(this.resolveEmptyPayoffMessage()),this.detailsFacade.clearDeferredPayoffTrades(),this.settledPayoffPayloadKey.set(e),this.successfulPayoffPayloadKey.set(""),this.manualMoveAnalysisCurrentPrice.set(null),this.resetSimulatedPayoffChart()}applyLivePayoffUpdate(e){let t=this.resolveActiveLivePayloadKey();if(t){if(this.payoffLiveState.set(null),!this.isCompletePayoffResult(e)){this.applyIncompletePayoffResult(t);return}this.latestLivePayoffPayloadKey=t,this.applySuccessfulPayoffResult(e,t)}}applyLivePayoffState(e){let t=this.resolveActiveLivePayloadKey();if(!t)return;if(e.status==="ok"){this.payoffLiveState.set(null);return}let n=e.message?.trim()||this.resolveLivePayoffStateMessage(e.status);if(this.payoffLiveState.set(F(f({},e),{message:n})),this.payoffSnapshot()){this.payoff_details_loading.set(!1),this.payoff_details_error.set(""),this.payoffChartEmptyMessage.set("");return}if(this.clearPayoffSnapshot(),this.detailsFacade.clearDeferredPayoffTrades(),this.successfulPayoffPayloadKey.set(""),this.manualMoveAnalysisCurrentPrice.set(null),this.resetSimulatedPayoffChart(),e.status==="accepted"){this.payoff_details_loading.set(!0),this.payoff_details_error.set(""),this.payoffChartEmptyMessage.set(""),this.settledPayoffPayloadKey.set("");return}if(this.payoff_details_loading.set(!1),this.settledPayoffPayloadKey.set(t),e.status==="not_found"){this.payoff_details_error.set(""),this.payoffChartEmptyMessage.set(n);return}this.payoff_details_error.set(n),this.payoffChartEmptyMessage.set("")}resolveActiveLivePayloadKey(){let e=this.activePayoffLiveRequest(),t=this.resolveActivePayoffRequestKey();return e&&t&&t===this.latestPayoffPayloadKey&&!this.shouldSkipPayoffChartLiveSubscription(e)?t:""}resolveActivePayoffRequestKey(){let e=this.activePayoffLiveRequest();return e?JSON.stringify(e):""}isCompleteIndexBoxSpreadPayoffRequest(e){return!!e&&fn(e.secondary_id)&&e.instrument_tokens.length===4}isIndexConversionPayoffRoute(e=this.productId()){return e===mt.id}
31isCompleteIndexConversionPayoffRequest(e){return!!e&&this.isIndexConversionPayoffRoute(e.secondary_id)&&e.instrument_tokens.length===3}applySuccessfulPayoffResult(e,t){this.detailsFacade.applyPayoffTrades({selected_expiry:e.selected_expiry,generated_at_utc:e.generated_at_utc,trades:e.trades}),this.payoffSnapshot.set(e),this.payoff_details_loading.set(!1),this.payoff_details_error.set(""),this.payoffChartEmptyMessage.set(""),this.settledPayoffPayloadKey.set(t),this.successfulPayoffPayloadKey.set(t)}isCompletePayoffResult(e){return"payoff_chart"in e&&!!e.payoff_chart&&"payoff_details"in e&&!!e.payoff_details&&"trades"in e&&!!e.trades&&typeof e.trades=="object"&&!Array.isArray(e.trades)}resolveLivePayoffStateMessage(e){switch(e){case"not_found":return"Payoff data is unavailable.";case"bad_request":return"Invalid payoff request.";default:return"Unable to load payoff data."}}applySimulatedPayoffChartResult(e,t,n){this.isCurrentSimulatedPayoffRequest(n,t)&&(this.simulatedApiPayoffChart.set(e.payoff_chart),this.settledSimulatedPayoffChartPayloadKey.set(t))}resetPayoff(){this.latestPayoffPayloadKey="",this.latestPayoffSourceKey="",this.latestLivePayoffPayloadKey="",this.payoffLiveState.set(null),this.payoffRequestId++,this.payoffResponseSubscription.unsubscribe(),this.clearPayoffSnapshot(),this.payoff_details_loading.set(!1),this.payoff_details_error.set(""),this.payoffChartEmptyMessage.set(""),this.settledPayoffPayloadKey.set(""),this.successfulPayoffPayloadKey.set(""),this.resetSimulatedPayoffChart()}clearPayoffSnapshot(){this.payoffSnapshot.set(null)}firstFiniteNumber(...e){for(let t of e){if(t==null||t==="")continue;let n=Number(t);if(Number.isFinite(n))return n}return null}resolvePayoffError(e){if(Nn(e))return bt;if(!(e instanceof lt))return"Unable to load payoff data.";let n=e.error?.message?.trim();return n||(e.status===400?"Invalid payoff request.":e.status===404?"Required live price is unavailable.":"Unable to load payoff data.")}resolvePayoffChartEmptyMessage(e,t,n){return this.isLongBoxNotFoundError(e,n)?"No complete long-box candidate could be constructed.":this.isShortBoxNotFoundError(e,n)?"No profitable conversion available.":this.isNoDetailDataFoundError(e)?t||"No payoff chart data is available for this selection.":""}isEmptyPayoffResult(e,t){return this.isNoDetailDataFoundError(e)||this.isLongBoxNotFoundError(e,t)||this.isShortBoxNotFoundError(e,t)}isShortBoxNotFoundError(e,t){return e instanceof lt&&e.status===404&&t===ue.id}isLongBoxNotFoundError(e,t){return e instanceof lt&&e.status===404&&(t===j.id||t===ee.id||t===ie.id||t===Q.id)}resolveEmptyPayoffMessage(){let e=this.selectedIndex().trim();return e?`No payoff data is available for ${e}.`:"No payoff data is available for this selection."}isNoDetailDataFoundError(e){if(!(e instanceof lt))return!1;let t=e.error;return e.status===404&&t?.code==="NO_DETAIL_DATA_FOUND"}resetSimulatedPayoffChart(){this.latestSimulatedPayoffChartPayloadKey="",this.simulatedPayoffChartRequestId++,this.simulatedPayoffChartResponseSubscription.unsubscribe(),this.simulatedApiPayoffChart.set(null),this.settledSimulatedPayoffChartPayloadKey.set("")}isCurrentPayoffRequest(e,t){return e===this.payoffRequestId&&t===this.latestPayoffPayloadKey}isCurrentSimulatedPayoffRequest(e,t){return e===this.simulatedPayoffChartRequestId&&t===this.latestSimulatedPayoffChartPayloadKey}resolveSimulationTargetDate(){let e=this.detailsFacade.selectedExpiry();return/^\d{4}-\d{2}-\d{2}$/.test(e)?e:new Date().toISOString().slice(0,10)}};o.\u0275fac=function(t){return new(t||o)}
31,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-payoff"]],inputs:{origin:[1,"origin"],primaryId:[1,"primaryId"],segment:[1,"segment"],selectedIndex:[1,"selectedIndex"],selectedInstrumentToken:[1,"selectedInstrumentToken"],selectedOptionInstrumentToken:[1,"selectedOptionInstrumentToken"],selectedOptionInstrumentTokens:[1,"selectedOptionInstrumentTokens"],scannerPayoffInstrumentTokens:[1,"scannerPayoffInstrumentTokens"],selectedOptionPutLot:[1,"selectedOptionPutLot"],targetDate:[1,"targetDate"],productId:[1,"productId"],initialExpiryIndex:[1,"initialExpiryIndex"]},features:[Ct([Bo,qo,zo])],decls:7,vars:4,consts:[[1,"payoff-page"],[1,"details-pending-message"],[1,"details-error-message"],["aria-live","polite",1,"payoff-live-state",3,"payoff-live-state--error"],[1,"payoff-content"],["aria-live","polite",1,"long-box-payoff-state"],["aria-live","polite",1,"payoff-live-state"],["variant","payoff",3,"secondary_id","tradeRows"],["aria-label","Long box payoff",1,"long-box-payoff-summary"],[3,"moveAnalysisRequested","moveAnalysisCurrentPriceChanged","payoffChartPercentChangeChanged","chartModeChanged","enableSummaryLegsToggle","isPayoffChartLoading","payoffChartPercentChange","secondaryId","editableMoveAnalysisCurrentPrice","moveAnalysisData","strategyData","selectedStrategyName","payoff_details","payoff_details_loading","payoff_details_error","payoffChartEmptyMessage"],[1,"long-box-payoff-summary__header"],[1,"long-box-status"],[1,"long-box-metrics"]],template:function(t,n){if(t&1&&(a(0,"main",0),P(1,r0,2,1,"div",1)(2,a0,3,2,"div",2)(3,l0,2,3,"div",3),a(4,"div",4),P(5,u0,4,1,"section",5)(6,g0,3,15),l()()),t&2){let s;c(),C(n.detailsFacade.isTradesPending()?1:-1),c(),C(n.detailsFacade.tradesErrorMessage()?2:-1),c(),C((s=n.payoffLiveState())?3:-1,s),c(2),C(n.isLongBoxPayoff()&&!n.hasCompleteLongBoxPayoff()?5:6)}},dependencies:[fs,Bl,St],styles:['[_nghost-%COMP%]{display:block;min-height:100vh;background:#0b1118;color:#e5edf8}.embedded[_nghost-%COMP%]{min-height:auto;max-height:90vh;overflow:auto}.payoff-page[_ngcontent-%COMP%]{container-name:payoff-page;container-type:inline-size;min-height:100vh;background:#0b1118;padding:10px;box-sizing:border-box}.embedded[_nghost-%COMP%]   .payoff-page[_ngcontent-%COMP%]{min-height:auto;background:transparent;padding:0 0 8px}.payoff-content[_ngcontent-%COMP%]{position:relative;width:min(100%,2028px);margin:0 auto}.long-box-payoff-state[_ngcontent-%COMP%], .long-box-payoff-summary[_ngcontent-%COMP%]{margin-bottom:10px;border:1px solid #2d3b4f;border-radius:8px;background:#141a23}.long-box-payoff-state[_ngcontent-%COMP%]{display:grid;gap:5px;min-height:120px;place-content:center;padding:20px;text-align:center;color:#94a3b8}.long-box-payoff-state[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{color:#e2e8f0;font-size:15px}.long-box-payoff-summary[_ngcontent-%COMP%]{padding:12px}.long-box-payoff-summary__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}.long-box-payoff-summary__header[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{display:grid;gap:3px}.long-box-payoff-summary__header[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{color:#94a3b8;font-size:11px;font-weight:700;text-transform:uppercase}.long-box-payoff-summary__header[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{color:#e2e8f0;font-size:14px}.long-box-status[_ngcontent-%COMP%]{padding:5px 9px;border:1px solid #64748b;border-radius:999px;color:#cbd5e1!important;text-transform:none!important}.long-box-status--actionable[_ngcontent-%COMP%]{border-color:#22c55e;color:#86efac!important;background:#22c55e1a}.long-box-status--positive[_ngcontent-%COMP%]{border-color:#eab308;color:#fde047!important;background:#eab3081a}.long-box-status--unprofitable[_ngcontent-%COMP%]{border-color:#f43f5e;color:#fda4af!important;background:#f43f5e1a}.long-box-metrics[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(5,minmax(120px,1fr));gap:8px}.long-box-metrics[_ngcontent-%COMP%]   div[_ngcontent-%COMP%]{display:grid;gap:4px;min-width:0;padding:9px;border:1px solid #273548;border-radius:6px;background:#101720}.long-box-metrics[_ngcontent-%COMP%]   span[_ngcontent-%COMP%]{color:#94a3b8;font-size:10px;font-weight:700;text-transform:uppercase}.long-box-metrics[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{overflow:hidden;color:#e2e8f0;font-size:13px;text-overflow:ellipsis}
31@media(max-width:900px){.long-box-metrics[_ngcontent-%COMP%]{grid-template-columns:repeat(2,minmax(120px,1fr))}}@media(max-width:520px){.long-box-payoff-summary__header[_ngcontent-%COMP%]{align-items:flex-start;flex-direction:column}.long-box-metrics[_ngcontent-%COMP%]{grid-template-columns:1fr}}.details-error-message[_ngcontent-%COMP%], .details-pending-message[_ngcontent-%COMP%], .payoff-live-state[_ngcontent-%COMP%]{margin:0 auto 8px;padding:8px 10px;border:1px solid rgba(96,165,250,.35);border-radius:6px;color:#bfdbfe;background:#1e40af33;font-size:12px;font-weight:800}.details-error-message[_ngcontent-%COMP%], .payoff-live-state--error[_ngcontent-%COMP%]{border-color:#ff9faf59;color:#ffb4c0;background:#7f1d1d3d}.embedded[_nghost-%COMP%]   .payoff-content[_ngcontent-%COMP%]{width:100%}.payoff-loading-bar[_ngcontent-%COMP%]{position:absolute;top:0;right:0;left:0;z-index:30;height:3px;overflow:hidden;pointer-events:none;background:#3b82f614}.payoff-loading-bar[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0 auto 0 -35%;width:35%;background:linear-gradient(90deg,#3b82f600,#60a5faf2 55%,#93c5fd00);animation:_ngcontent-%COMP%_payoff-loading-slide .9s ease-in-out infinite}@keyframes _ngcontent-%COMP%_payoff-loading-slide{0%{transform:translate(0)}to{transform:translate(390%)}}']});let i=o;return i})();var Yo=["M - F - 1","M - F - 2","M - F - 3"];var _2={[ge.id]:Yo,[_e.id]:Yo,[je.id]:Yo,"equity-protection-analysis-protective-put":[],"equity-futures-protection-analysis-futures-protective-put":[],"equity-protection-analysis-funded-protective-put":[],"equity-futures-protection-analysis-futures-funded-protective-put":[],"equity-protection-analysis-layered-protective-put":[],"equity-protection-analysis-funded-layered-protective-put":[],"equity-protection-analysis-double-atm-protective-put":[],"equity-protection-analysis-funded-double-atm-protective-put":[],"equity-protection-analysis-options-delta-neutral":[],"equity-protection-analysis-synthetic-futures":[],"":[]},Gl={[ge.id]:{is_greeks:!1},[_e.id]:{is_greeks:!1},"equity-protection-analysis-protective-put":{is_greeks:!0},"equity-futures-protection-analysis-futures-protective-put":{is_greeks:!0},"equity-protection-analysis-funded-protective-put":{is_greeks:!0},"equity-futures-protection-analysis-futures-funded-protective-put":{is_greeks:!0},"equity-protection-analysis-layered-protective-put":{is_greeks:!0},"equity-protection-analysis-funded-layered-protective-put":{is_greeks:!0},"equity-protection-analysis-double-atm-protective-put":{is_greeks:!0},"equity-protection-analysis-funded-double-atm-protective-put":{is_greeks:!0},"equity-protection-analysis-options-delta-neutral":{is_greeks:!0},"equity-protection-analysis-synthetic-futures":{is_greeks:!0}};function _0(i,o){i&1&&y(0,"div",0)}function f0(i,o){if(i&1&&(a(0,"div",1),d(1),l()),i&2){let r=u();c(),g(" ",r.facade.errorMessage()," ")}}function x0(i,o){if(i&1&&(a(0,"div",2),d(1),l()),i&2){let r=u();c(),g(" ",r.facade.detailPendingMessage()," ")}}function b0(i,o){if(i&1&&(a(0,"div",2),d(1),l()),i&2){let r=u();c(),g(" ",r.facade.tradesPendingMessage()," ")}}function y0(i,o){i&1&&d(0," (showing cached trades) ")}function C0(i,o){if(i&1&&(a(0,"div",1),d(1),P(2,y0,1,0),l()),i&2){let r=u();c(),g(" ",r.facade.tradesErrorMessage()," "),c(),C(r.facade.tradesStale()?2:-1)}}function P0(i,o){i&1&&(a(0,"div",5),y(1,"app-greek-table"),l())}var zl=(()=>{let o=class o{constructor(){this.origin="",this.primaryId="",this.segment="",this.selectedIndex="",this.selectedInstrumentToken=null,this.selectedOptionInstrumentToken=null,this.selectedOptionInstrumentTokens=[],this.selectedOptionPutLot=null,this.selectedExpiry=null,this.productId=ps[0].id,this.initialExpiryIndex=1,this.showChart=!0,this.activeAnalysis=E(null),this.facade=D(We),this.futuresIndexes=this.facade.futuresIndexes}get showGreeks(){return Gl[this.origin]?.is_greeks??!1}ngOnInit(){this.facade.attachView()}ngOnChanges(e){if((e.selectedIndex||e.selectedInstrumentToken||e.selectedOptionInstrumentToken||e.selectedOptionInstrumentTokens||e.selectedOptionPutLot||e.selectedExpiry||e.productId||e.primaryId||e.origin||e.segment)&&this.selectedIndex){this.facade.loadIndex(this.origin,this.segment,this.selectedIndex,this.selectedInstrumentToken,this.selectedOptionInstrumentToken,this.selectedOptionInstrumentTokens,this.selectedOptionPutLot,this.productId,this.initialExpiryIndex,this.primaryId,!0,this.selectedExpiry);return}if(e.initialExpiryIndex&&this.selectedIndex){let t=this.facade.expiries()[this.initialExpiryIndex-1];if(!t)return;this.facade.onExpiryChange(t,this.initialExpiryIndex)}}ngOnDestroy(){this.facade.detachView()}};o.\u0275fac=function(t){return new(t||o)}
31,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-details"]],inputs:{origin:"origin",primaryId:"primaryId",segment:"segment",selectedIndex:"selectedIndex",selectedInstrumentToken:"selectedInstrumentToken",selectedOptionInstrumentToken:"selectedOptionInstrumentToken",selectedOptionInstrumentTokens:"selectedOptionInstrumentTokens",selectedOptionPutLot:"selectedOptionPutLot",selectedExpiry:"selectedExpiry",productId:"productId",initialExpiryIndex:"initialExpiryIndex",showChart:"showChart",activeAnalysis:[1,"activeAnalysis"]},features:[ve],decls:11,vars:20,consts:[["aria-hidden","true",1,"details-loading-bar"],[1,"details-error-message"],[1,"details-pending-message"],[1,"main-section"],[3,"showChart","activeAnalysis","expiryIndex","expiries","marketWatchList","tradeRows","depthView","lines","protectionMetrics","boxSpread"],[1,"greek-table"],[3,"priceMatrix"],[3,"futuresIndexes","futuresMatrix","spotStore"]],template:function(t,n){t&1&&(a(0,"main"),P(1,_0,1,0,"div",0)(2,f0,2,1,"div",1)(3,x0,2,1,"div",2)(4,b0,2,1,"div",2)(5,C0,3,2,"div",1),a(6,"section",3),y(7,"app-hedge-protection-details-idea",4),P(8,P0,2,0,"div",5),y(9,"app-price-matrix-section",6)(10,"app-futures-matrix-section",7),l()()),t&2&&(c(),C(n.facade.isLoading()?1:-1),c(),C(n.facade.errorMessage()?2:-1),c(),C(n.facade.isDetailPending()?3:-1),c(),C(n.facade.isTradesPending()?4:-1),c(),C(n.facade.tradesErrorMessage()?5:-1),c(2),b("showChart",n.showChart)("activeAnalysis",n.activeAnalysis())("expiryIndex",n.facade.expiryIndex())("expiries",n.facade.expiries())("marketWatchList",n.facade.marketWatchRows())("tradeRows",n.facade.tradeRows())("depthView",n.facade.depthView())("lines",n.facade.lines())("protectionMetrics",n.facade.protectionMetrics())("boxSpread",n.facade.boxSpread()),c(),C(n.showGreeks?8:-1),c(),b("priceMatr
31ix",n.facade.priceMatrix()),c(),b("futuresIndexes",n.futuresIndexes())("futuresMatrix",n.facade.futuresMatrix())("spotStore",n.facade.spotView()))},dependencies:[xs,bs,ys,Cs],styles:['main[_ngcontent-%COMP%]{padding:5px 24px;background-color:#131820;max-height:90vh;overflow:auto;position:relative}main[_ngcontent-%COMP%]   .main-section[_ngcontent-%COMP%]{display:flex;flex-direction:column}app-hedge-protection-board-details[_nghost-%COMP%]   main[_ngcontent-%COMP%], app-hedge-protection-board-details   [_nghost-%COMP%]   main[_ngcontent-%COMP%]{max-height:none;overflow:visible}.details-loading-bar[_ngcontent-%COMP%]{position:absolute;top:0;left:0;right:0;height:3px;z-index:30;overflow:hidden;pointer-events:none;background:#3b82f614}.details-loading-bar[_ngcontent-%COMP%]:before{content:"";position:absolute;inset:0 auto 0 -35%;width:35%;background:linear-gradient(90deg,#3b82f600,#60a5faf2 55%,#93c5fd00);animation:_ngcontent-%COMP%_details-loading-slide .9s ease-in-out infinite}.details-error-message[_ngcontent-%COMP%]{margin:8px 0;padding:10px 12px;border:1px solid rgba(255,159,175,.35);border-radius:6px;background:#7f1d1d3d;color:#ffb4c0;font-size:12px;font-weight:800}.details-pending-message[_ngcontent-%COMP%]{margin:8px 0;padding:10px 12px;border:1px solid rgba(96,165,250,.35);border-radius:6px;background:#1e40af33;color:#bfdbfe;font-size:12px;font-weight:800}@keyframes _ngcontent-%COMP%_details-loading-slide{0%{transform:translate(0)}to{transform:translate(390%)}}.header-container[_ngcontent-%COMP%]{position:sticky;z-index:10;width:100%;top:-5px}.greek-table[_ngcontent-%COMP%]{margin:25px 0}'],changeDetection:0});let i=o;return i})();function S0(i,o){if(i&1&&y(0,"app-hedge-protection-details",0),i&2){let r=u();b("origin",r.page.originId())("primaryId",r.page.primaryId())("segment",r.page.primarySection())("selectedIndex",r.store.selectedIndexName())("selectedInstrumentToken",r.store.selectedInstrumentToken())("selectedOptionInstrumentToken",r.store.selectedOptionInstrumentToken())("selectedOptionInstrumentTokens",r.store.selectedOptionInstrumentTokens())("selectedOptionPutLot",r.store.selectedOptionPutLot())("selectedExpiry",r.store.selectedScannerExpiry())("productId",r.productId())("initialExpiryIndex",r.store.selectedExpiryIndex())("activeAnalysis",r.page.activeAnalysis())("showChart",!0)}}var Xo=(()=>{let o=class o{constructor(){this.store=D(ae),this.page=D(de),this.ui=D(he)}productId(){return Y(this.page.originId())??""}};o.\u0275fac=function(t){return new(t||o)}
31,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-board-details"]],decls:1,vars:1,consts:[[3,"origin","primaryId","segment","selectedIndex","selectedInstrumentToken","selectedOptionInstrumentToken","selectedOptionInstrumentTokens","selectedOptionPutLot","selectedExpiry","productId","initialExpiryIndex","activeAnalysis","showChart"]],template:function(t,n){t&1&&P(0,S0,1,13,"app-hedge-protection-details",0),t&2&&C(n.store.selectedIndexName()?0:-1)},dependencies:[zl],encapsulation:2,changeDetection:0});let i=o;return i})();function v0(i,o){if(i&1){let r=R();a(0,"app-hedge-protection-details-header",3),_("payoffClick",function(){S(r);let t=u();return v(t.togglePayoff())}),l()}if(i&2){let r=u();b("compact",!0)("selectedIndex",r.store.selectedIndexName())("selectedExpiry",r.detailsFacade.selectedExpiry())("expiries",r.detailsFacade.expiries())("payoffActive",r.payoffVisible())}}function w0(i,o){if(i&1&&y(0,"app-hedge-protection-payoff",2),i&2){let r=u();b("origin",r.page.originId())("primaryId",r.page.primaryId())("segment",r.page.primarySection())("selectedIndex",r.store.selectedIndexName())("selectedInstrumentToken",r.store.selectedInstrumentToken())("selectedOptionInstrumentToken",r.store.selectedOptionInstrumentToken())("selectedOptionInstrumentTokens",r.store.selectedOptionInstrumentTokens())("scannerPayoffInstrumentTokens",r.store.selectedScannerPayoffInstrumentTokens())("selectedOptionPutLot",r.store.payoffPutLot())("targetDate",r.payoffTargetDate())("productId",r.productId())("initialExpiryIndex",r.store.selectedExpiryIndex())}}function O0(i,o){i&1&&y(0,"app-hedge-protection-board-details")}var Wo=(()=>{let o=class o{constructor(){this.store=D(ae),this.page=D(de),this.detailsFacade=D(We),this.mispricingSettings=D(Nt),this.settingsRequested=X(),this.payoffVisible=O(!0),this.payoffTargetDate=this.mispricingSettings.selectedDate,this.showDetail
31sHeader=M(()=>!!this.store.selectedIndexName()),this.productId=M(()=>Y(this.page.originId())??"")}openSettings(){this.settingsRequested.emit("detail")}togglePayoff(){this.payoffVisible.update(e=>!e)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-board-detail-panel"]],outputs:{settingsRequested:"settingsRequested"},decls:4,vars:3,consts:[[3,"settingsClick","title"],["panel-controls","",1,"details-inline-header",3,"compact","selectedIndex","selectedExpiry","expiries","payoffActive"],[1,"detail-payoff-view","embedded",3,"origin","primaryId","segment","selectedIndex","selectedInstrumentToken","selectedOptionInstrumentToken","selectedOptionInstrumentTokens","scannerPayoffInstrumentTokens","selectedOptionPutLot","targetDate","productId","initialExpiryIndex"],["panel-controls","",1,"details-inline-header",3,"payoffClick","compact","selectedIndex","selectedExpiry","expiries","payoffActive"]],template:function(t,n){t&1&&(a(0,"app-board-panel-header",0),_("settingsClick",function(){return n.openSettings()}),P(1,v0,1,5,"app-hedge-protection-details-header",1),l(),P(2,w0,1,12,"app-hedge-protection-payoff",2)(3,O0,1,0,"app-hedge-protection-board-details")),t&2&&(b("title","Details"),c(),C(n.showDetail
31sHeader()?1:-1),c(),C(n.payoffVisible()?2:3))},dependencies:[Ft,_s,ql,Xo],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;max-height:90vh;min-width:0;overflow:hidden}[_nghost-%COMP%] > app-board-panel-header[_ngcontent-%COMP%]{flex:0 0 auto}[_nghost-%COMP%] > app-hedge-protection-payoff[_ngcontent-%COMP%], [_nghost-%COMP%] > app-hedge-protection-board-details[_ngcontent-%COMP%]{flex:1 1 auto;max-height:100%;overflow:auto}.details-inline-header[_ngcontent-%COMP%]{flex:1 1 auto;min-width:0}"],changeDetection:0});let i=o;return i})();var M0=["*"],Zo=(()=>{let o=class o{};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-board-popup-shell"]],ngContentSelectors:M0,decls:3,vars:0,consts:[[1,"board-popup-shell"],[1,"board-popup-shell__frame"]],template:function(t,n){t&1&&(pi(),a(0,"div",0)(1,"div",1),ui(2),l()())},styles:[".board-popup-shell[_ngcontent-%COMP%]{min-height:100vh;box-sizing:border-box;padding:12px;background:#090d12}.board-popup-shell__frame[_ngcontent-%COMP%]{min-height:calc(100vh - 24px);border:1px solid #1f2937;border-radius:18px;background:linear-gradient(180deg,#151b24,#11161e);box-shadow:0 10px 24px #0000002e,inset 0 1px #ffffff08;overflow:hidden}"],changeDetection:0});let i=o;return i})();var E0=["marketPopupTemplate"],T0=["scannerPopupTemplate"],I0=["deltaPopupTemplate"],k0=["matrixPopupTemplate"],R0=["detailPopupTemplate"];function D0(i,o){if(i&1){let r=R();a(0,"div",6)(1,"app-hedge-protection-board-market-panel",8),_("settingsRequested",function(t){S(r);let n=u();return v(n.openSettings(t))}),l()()}}function N0(i,o){if(i&1){let r=R();a(0,"div",6)(1,"app-hedge-protection-board-scanner-panel",8),_("settingsRequested",function(t){S(r);let n=u();return v(n.openSettings(t))}),l()()}if(i&2){let r=u();w("panel-divider--scanner-split",r.ui.isScannerSplitView())}}function F0(i,o){i&1&&y(0,"app-hedge-protection-board-strategy-panel")}function L0(i,o){i&1&&y(0,"app-hedge-protection-board-secondary-strategy-panel")}function A0(i,o){if(i&1){let r=R();a(0,"div",6)(1,"app-hedge-protection-board-detail-panel",8),_("settingsRequested",function(t){S(r);let n=u();return v(n.openSettings(t))}),l()()}}function U0(i,o){if(i&1){let r=R();a(0,"app-hedge-protection-board-popup-shell")(1,"app-hedge-protection-board-market-panel",8),_("settingsRequested",function(t){S(r);let n=u();return v(n.openSettings(t))}),l()()}}function H0(i,o){if(i&1){let r=R();a(0,"app-hedge-protection-board-popup-shell")(1,"app-hedge-protection-board-scanner-panel",8),_("settingsRequested",function(t){S(r);let n=u();return v(n.openSettings(t))}),l()()}}function V0(i,o){i&1&&y(0,"app-hedge-protection-board-strategy-panel")}function B0(i,o){if(i&1&&(a(0,"app-hedge-protection-board-popup-shell"),P(1,V0,1,0,"app-hedge-protection-board-strategy-panel"),l()),i&2){let r=u();c(),C(r.showDeltaPanel()?1:-1)}}function q0(i,o){i&1&&y(0,"app-hedge-protection-board-secondary-strategy-panel")}function G0(i,o){if(i&1&&(a(0,"app-hedge-protection-board-popup-shell"),P(1,q0,1,0,"app-hedge-protection-board-secondary-strategy-panel"),l()),i&2){let r=u();c(),C(r.showSecondaryStrategyPanel()?1:-1)}}function z0(i,o){if(i&1){let r=R();a(0,"app-hedge-protection-board-popup-shell")(1,"app-hedge-protection-board-detail-panel",8),_("settingsRequested",function(t){S(r);let n=u();return v(n.openSettings(t))}),l()()}}var Jo=(()=>{let o=class o{constructor(){this.ui=D(he),this.store=D(ae),this.detailsFacade=D(We),this.settings=D(ni),this.page=D(de),this.pictureInPicture=D(Jr),this.marketPopupId=`hedge-protection-market-panel-${crypto.randomUUID()}`,this.scannerPopupId=`hedge-protection-scanner-panel-${crypto.randomUUID()}`,this.deltaPopupId=`hedge-protection-delta-panel-${crypto.randomUUID()}`,this.matrixPopupId=`hedge-protection-matrix-panel-${crypto.randomUUID()}`,this.detailPopupId=`hedge-protection-detail-panel-${crypto.randomUUID()}`,this.marketPopupTemplate=wn.required("marketPopupTemplate"),this.scannerPopupTemplate=wn.required("scannerPopupTemplate"),this.deltaPopupTemplate=wn.required("deltaPopupTemplate"),this.matrixPopupTemplate=wn.required("matrixPopupTemplate"),this.detailPo
31pupTemplate=wn.required("detailPopupTemplate"),this.boardLayoutClasses=M(()=>wa({showMarket:this.ui.showMarketPanel(),showScanner:this.ui.showScannerPanel(),showStrategyPanel:this.showDeltaPanel(),showSecondaryStrategyPanel:this.showSecondaryStrategyPanel(),showDetail:this.ui.showDetailPanel(),isMarketFullView:this.ui.isMarketFullView(),isScannerFullView:this.ui.isScannerFullView(),isDeltaFullView:this.ui.isDeltaFullView(),isMatrixFullView:this.ui.isMatrixFullView(),isDetailFullView:this.ui.isDetailFullView(),isMarketCompact:this.ui.hideColumns(),isScannerCompact:this.ui.hideScannerColumns()})),this.showStrategyPanel=M(()=>nn(this.page.originId())),this.showDeltaPanel=M(()=>this.showStrategyPanel()&&this.ui.showDeltaPanel()),this.hasSecondaryStrategyPanel=M(()=>Bn(this.page.primaryId(),this.page.originId())),this.showSecondaryStrategyPanel=M(()=>this.hasSecondaryStrategyPanel()&&this.ui.showMatrixPanel()),this.popupDefinitions={market:{id:this.marketPopupId,template:this.marketPopupTemplate,width:720,height:620,requestCount:()=>this.ui.marketPopupRequest(),resetRequest:()=>this.ui.resetMarketPopupRequest()},scanner:{id:this.scannerPopupId,template:this.scannerPopupTemplate,width:860,height:680,requestCount:()=>this.ui.scannerPopupRequest(),resetRequest:()=>this.ui.resetScannerPopupRequest()},delta:{id:this.deltaPopupId,template:this.deltaPopupTemplate,width:900,height:680,requestCount:()=>this.ui.deltaPopupRequest(),resetRequest:()=>this.ui.resetDeltaPopupRequest()},matrix:{id:this.matrixPopupId,template:this.matrixPopupTemplate,width:980,height:720,requestCount:()=>this.ui.matrixPopupRequest(),resetRequest:()=>this.ui.resetMatrixPopupRequest()},detail:{id:this.detailPopupId,template:this.detailPopupTemplate,width:980,height:720,requestCount:()=>this.ui.detailPopupRequest(),resetRequest:()=>this.ui.resetDetailPopupRequest()}},this.bindPopupRequests()}openSettings(e){return k(this,null,function*(){yield this.settings.open(e)})}ngOnDestroy(){this.pictureInPicture.close(this.marketPopupId),this.pictureInPicture.close(this.scannerPopupId),this.pictureInPicture.close(this.deltaPopupId),this.pictureInPicture.close(this.matrixPopupId),this.pictureInPicture.close(this.detailPopupId),this.detailsFacade.destroy()}bindPopupRequests(){Object.keys(this.popupDefinitions).forEach(e=>{this.bindPopupRequest(e)})}bindPopupRequest(e){re(()=>{let t=this.popupDefinitions[e];t.requestCount()!==0&&(t.resetRequest(),this.openPopup(e))})}openPopup(e){return k(this,null,function*(){let t=this.popupDefinitions[e];yield this.pictureInPicture.openTemplate(t.template(),{},{id:t.id,width:t.width,height:t.height,autoRefresh:!0,refreshMs:500})})}};o.\u0275fac=function(t){return new(t||o)}
31,o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-list-board"]],viewQuery:function(t,n){t&1&&(On(n.marketPopupTemplate,E0,5),On(n.scannerPopupTemplate,T0,5),On(n.deltaPopupTemplate,I0,5),On(n.matrixPopupTemplate,k0,5),On(n.detailPopupTemplate,R0,5)),t&2&&Pr(5)},features:[Ct([We,ti,ei,rn,ni,Vi])],decls:16,vars:6,consts:[["marketPopupTemplate",""],["scannerPopupTemplate",""],["deltaPopupTemplate",""],["matrixPopupTemplate",""],["detailPopupTemplate",""],[1,"spot-trades-area",3,"ngClass"],[1,"panel-divider"],[1,"panel-divider",3,"panel-divider--scanner-split"],[3,"settingsRequested"]],template:function(t,n){t&1&&(a(0,"div",5),P(1,D0,2,0,"div",6)(2,N0,2,2,"div",7)(3,F0,1,0,"app-hedge-protection-board-strategy-panel")(4,L0,1,0,"app-hedge-protection-board-secondary-strategy-panel")(5,A0,2,0,"div",6),l(),P(6,U0,2,0,"ng-template",null,0,it)(8,H0,2,0,"ng-template",null,1,it)(10,B0,2,1,"ng-template",null,2,it)(12,G0,2,1,"ng-template",null,3,it)(14,z0,2,0,"ng-template",null,4,it)),t&2&&(b("ngClass",n.boardLayoutClasses()),c(),C(n.ui.showMarketPanel()?1:-1),c(),C(n.ui.showScannerPanel()?2:-1),c(),C(n.showDeltaPanel()?3:-1),c(),C(n.showSecondaryStrategyPanel()?4:-1),c(),C(n.ui.showDetailPanel()?5:-1))},dependencies:[Ge,Io,No,Uo,Ho,Wo,Zo],styles:[".spot-trades-area[_ngcontent-%COMP%]{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);column-gap:10px}.spot-trades-area--market-full[_ngcontent-%COMP%], .spot-trades-area--scanner-full[_ngcontent-%COMP%], .spot-trades-area--delta-full[_ngcontent-%COMP%], .spot-trades-area--matrix-full[_ngcontent-%COMP%], .spot-trades-area--detail-full[_ngcontent-%COMP%], .spot-trades-area--1-panels[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr)}.spot-trades-area--2-panels[_ngcontent-%COMP%]{grid-template-columns:repeat(2,minmax(0,1fr))}.spot-trades-area--3-panels[_ngcontent-%COMP%]{grid-template-columns:repeat(3,minmax(0,1fr))}.spot-trades-area--4-panels[_ngcontent-%COMP%]{grid-template-columns:repeat(4,minmax(0,1fr))}.spot-trades-area--5-panels[_ngcontent-%COMP%]{grid-template-columns:repeat(5,minmax(0,1fr))}.spot-trades-area--strategy-panel[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--double-strategy-panel[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--market-full[_ngcontent-%COMP%] > .panel-divider[_ngcontent-%COMP%], .spot-trades-area--scanner-full[_ngcontent-%COMP%] > .panel-divider[_ngcontent-%COMP%], .spot-trades-area--delta-full[_ngcontent-%COMP%] > .panel-divider[_ngcontent-%COMP%], .spot-trades-area--matrix-full[_ngcontent-%COMP%] > .panel-divider[_ngcontent-%COMP%], .spot-trades-area--detail-full[_ngcontent-%COMP%] > .panel-divider[_ngcontent-%COMP%], .spot-trades-area--1-panels[_ngcontent-%COMP%] > .panel-divider[_ngcontent-%COMP%], .spot-trades-area--1-panels[_ngcontent-%COMP%] > app-hedge-protection-board-strategy-panel[_ngcontent-%COMP%], .spot-trades-area--1-panels[_ngcontent-%COMP%] > app-hedge-protection-board-secondary-strategy-panel[_ngcontent-%COMP%]{width:min(100%,1300px);justify-self:center}.spot-trades-area--market-hidden[_ngcontent-%COMP%], .spot-trades-area--scanner-hidden[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--both-side-panels-hidden[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr)}.spot-trades-area--detail-hidden[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--market-hidden-detail-hidden[_ngcontent-%COMP%], .spot-trades-area--scanner-hidden-detail-hidden[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr)}.spot-trades-area--market-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--scanner-compact[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}.spot-trades-area--market-hidden-scanner-compact[_ngcontent-%COMP%], .spot-trades-area--scanner-hidden-market-compact[_ngcontent-%COMP%], .spot-trades-area--detail-hidden-market-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr)}
31.spot-trades-area--detail-hidden-scanner-compact[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) auto}.spot-trades-area--dual-compact[_ngcontent-%COMP%]{grid-template-columns:auto auto minmax(0,1fr)}.spot-trades-area--strategy-panel-market-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--double-strategy-panel-market-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--strategy-panel-scanner-compact[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--double-strategy-panel-scanner-compact[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--strategy-panel-dual-compact[_ngcontent-%COMP%]{grid-template-columns:auto auto minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--double-strategy-panel-dual-compact[_ngcontent-%COMP%]{grid-template-columns:auto auto minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--detail-hidden-strategy-panel[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--detail-hidden-double-strategy-panel[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--detail-hidden-strategy-panel-market-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--detail-hidden-double-strategy-panel-market-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--detail-hidden-strategy-panel-scanner-compact[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr)}.spot-trades-area--detail-hidden-double-strategy-panel-scanner-compact[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--detail-hidden-strategy-panel-dual-compact[_ngcontent-%COMP%]{grid-template-columns:auto auto minmax(0,1fr)}.spot-trades-area--detail-hidden-double-strategy-panel-dual-compact[_ngcontent-%COMP%]{grid-template-columns:auto auto minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--market-hidden-strategy-panel[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--market-hidden-double-strategy-panel[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--scanner-hidden-strategy-panel[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--scanner-hidden-double-strategy-panel[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--market-hidden-strategy-panel-scanner-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--market-hidden-double-strategy-panel-scanner-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--scanner-hidden-strategy-panel-market-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr)}.spot-trades-area--scanner-hidden-double-strategy-panel-market-compact[_ngcontent-%COMP%]{grid-template-columns:auto minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.spot-trades-area[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{min-width:0}.panel-divider[_ngcontent-%COMP%]{display:flex;flex-direction:column;min-width:0}.spot-trades-area--scanner-full[_ngcontent-%COMP%] > .panel-divider.panel-divider--scanner-split[_ngcontent-%COMP%]{width:min(100%,1600px)}@media(max-width:900px){.spot-trades-area--2-panels[_ngcontent-%COMP%], .spot-trades-area--3-panels[_ngcontent-%COMP%], .spot-trades-area--4-panels[_ngcontent-%COMP%], .spot-trades-area--5-panels[_ngcontent-%COMP%]{grid-template-columns:minmax(0,1fr)}}"],changeDetection:0});let i=o;return i})();function j0(i,o){i&1&&(y(0,"ion-icon",12),a(1,"span"),d(2,"Turn On Beep"),l())}function K0(i,o){i&1&&(y(0,"ion-icon",13),a(1,"span"),d(2,"Turn Off Beep"),l(
31))}function $0(i,o){if(i&1){let r=R();a(0,"div",0)(1,"div",1)(2,"div",2)(3,"h2"),d(4,"Internet Connection Lost"),l(),a(5,"button",3),_("click",function(){S(r);let t=u();return v(t.browser.closeDisconnectPopup())}),y(6,"ion-icon",4),l()(),a(7,"div",5)(8,"div",6),y(9,"ion-icon",7),l(),a(10,"p",8),d(11," Your internet connection has been lost. The beep sound is enabled to alert you. "),l()(),a(12,"div",9)(13,"button",10),_("click",function(){S(r);let t=u();return v(t.browser.toggleBeepSound())}),P(14,j0,3,0)(15,K0,3,0),l(),a(16,"button",11),_("click",function(){S(r);let t=u();return v(t.browser.closeDisconnectPopup())}),d(17," Close "),l()()()()}if(i&2){let r=u();c(13),w("muted",r.browser.isMuted()),c(),C(r.browser.isMuted()?14:15)}}var er=(()=>{let o=class o{constructor(){this.browser=D(Dt)}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-internet-disconnect-popup"]],decls:1,vars:1,consts:[[1,"internet-disconnect-overlay"],[1,"internet-disconnect-popup"],[1,"popup-header"],["type","button",1,"close-btn",3,"click"],["name","close"],[1,"popup-body"],[1,"warning-icon"],["name","wifi-outline"],[1,"warning-message"],[1,"popup-footer"],["type","button",1,"beep-toggle-btn",3,"click"],["type","button",1,"close-popup-btn",3,"click"],["name","volume-mute"],["name","volume-high"]],template:function(t,n){t&1&&P(0,$0,18,3,"div",0),t&2&&C(n.browser.showInternetDisconnectPopup()?0:-1)},dependencies:[ne,te],styles:["[_nghost-%COMP%]{display:contents}.internet-disconnect-overlay[_ngcontent-%COMP%]{position:fixed;top:0;left:0;z-index:9999;display:flex;align-items:center;justify-content:center;width:100%;height:100%;background:#0009;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.internet-disconnect-popup[_ngcontent-%COMP%]{width:90%;max-width:400px;padding:24px;border:1px solid #2a2f3a;border-radius:12px;background:linear-gradient(135deg,#1f2733,#0c1016);box-shadow:0 8px 32px #0000004d;animation:_ngcontent-%COMP%_slideUp .3s ease-out}@keyframes _ngcontent-%COMP%_slideUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.popup-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid #2a2f3a}.popup-header[_ngcontent-%COMP%]   h2[_ngcontent-%COMP%]{margin:0;color:#fff;font-size:18px;font-weight:600}.popup-header[_ngcontent-%COMP%]   .close-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:#fff;font-size:24px;cursor:pointer;transition:color .2s ease}.popup-header[_ngcontent-%COMP%]   .close-btn[_ngcontent-%COMP%]:hover{color:#d4af37}.popup-body[_ngcontent-%COMP%]{margin-bottom:24px;text-align:center}.popup-body[_ngcontent-%COMP%]   .warning-icon[_ngcontent-%COMP%]{display:flex;justify-content:center;margin-bottom:16px}.popup-body[_ngcontent-%COMP%]   .warning-icon[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{color:#ff6b6b;font-size:48px}.popup-body[_ngcontent-%COMP%]   .warning-message[_ngcontent-%COMP%]{margin:0;color:#fff;font-size:14px;line-height:1.5}.popup-footer[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:12px}.popup-footer[_ngcontent-%COMP%]   .beep-toggle-btn[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;gap:8px;padding:12px 20px;border:none;border-radius:8px;background:linear-gradient(135deg,#d4af37,#b8941e);color:#000;font-size:14px;font-weight:600;cursor:pointer;transition:all .3s ease}.popup-footer[_ngcontent-%COMP%]   .beep-toggle-btn[_ngcontent-%COMP%]   ion-icon[_ngcontent-%COMP%]{font-size:18px}.popup-footer[_ngcontent-%COMP%]   .beep-toggle-btn[_ngcontent-%COMP%]:hover{transform:translateY(-2px);box-shadow:0 4px 12px #d4af374d}.popup-footer[_ngcontent-%COMP%]   .beep-toggle-btn.muted[_ngcontent-%COMP%]{background:linear-gradient(135deg,#4a4a4a,#2a2a2a);color:#fff}.popup-footer[_ngcontent-%COMP%]   .beep-toggle-btn.muted[_ngcontent-%COMP%]:hover{background:linear-gradient(135deg,#5a5a5a,#3a3a3a)}.popup-footer[_ngcontent-%COMP%]   .close-popup-btn[_ngcontent-%COMP%]{padding:12px 20px;border:1px solid #2a2f3a;border-radius:8px;background:transparent;color:#fff;font-size:14px;font-weight:600;cursor:pointer;transition:all .3s ease}.popup-footer[_ngcontent-%COMP%]   .close-popup-btn[_ngcontent-%COMP%]:hover{background:#2a2f3a;border-color:#3a3f4a}"],changeDetection:0});let i=o;return i})();var tr=(()=>{let o=class o{constructor(){this.ui=D(he),this.store=D(ae),this.sync=D(Xe),this.browser=D(Dt),this.userState=D(Oe),this.page=D(de),this.signalR=D(Fe),this.greekDeltaRangeRealtime=D(Li),this.nearestDeltaRealtime=D(Ai),this.realtimeReady=this.initializeRealtimeConnections(),this.isDestroyed=!1,this._=re(()=>{this.ui.setDeltaPanelAvailable(nn(this.page.originId())),this.ui.setMatrixPanelAvailable(Bn(this.page.primaryId(),this.page.originId()))})}ngOnInit(){this.browser.init(),this.loadUserSettings(),this.startLiveData()}ngOnDestroy(){this.isDestroyed=!0,this.browser.destroy(),this.store.destroy(),this.sync.destroy()}loadUserSettings(){this.userState.loadCurrentUserState().pipe(ci(1)).subscribe({next:e=>{e&&this.applyUserSettings(e)},error:e=>{console.error("Unable to load hedge protection user settings",e)}})}applyUserSettings(e){this.ui.showMarketPanel.set(!e.hide_market_panel),this.ui.hideColumns.set(e.compact_market_view),this.ui.isMarketFullView.set(e.expand_market_panel),this.ui.showScannerPanel.set(!e.hide_scanner_panel),this.ui.hideScannerColumns.set(e.compact_scanner_view),this.ui.isScannerFullView.set(e.expand_scanner_panel),this.ui.showDeltaPanel.set(!e.hide_delta_panel),this.ui.isDeltaFullView.set(!!e.expand_delta_panel),this.ui.showDetailPanel.set(!e.hide_detail_panel),this.ui.isDetailFullView.set(e.expand_detail_panel),this.ui.isProtected.set(e.is_enable_protection_opened),this.ui.screenZoom.set(100+e.zoom_in-e.zoom_out),this.store.setSelectedMarketSymbols(e.market_watch_settings.favorite_symbols),this.store.setSelectedScannerSymbols(e.scanner_settings.favorite_symbols)}startLiveData(){return k(this,null,function*(){yield this.realtimeReady,!this.isDestroyed&&(this.sync.bindLiveUpdates(),yield this.sync.init())})}initializeRealtimeConnections(){return k(this,null,function*(){let e=["market ticks","greek delta range","nearest delta"];(yield Promise.allSettled([this.signalR.Init(),this.greekDeltaRangeRealtime.Init(),this.nearestDeltaRealtime.Init()])).forEac
31h((n,s)=>{n.status==="rejected"&&console.warn(`Unable to initialize hedge protection ${e[s]} realtime connection.`,n.reason)})})}};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedge-protection-list"]],features:[Ct([ae,Xn,yn,Xe,he,Dt,de])],decls:4,vars:2,consts:[[1,"zoomx-section"]],template:function(t,n){t&1&&(a(0,"div",0),y(1,"app-hedge-protection-list-header")(2,"app-hedge-protection-list-board"),l(),y(3,"app-hedge-protection-internet-disconnect-popup")),t&2&&Se("zoom",n.ui.screenZoom(),"%")},dependencies:[Po,Jo,er],styles:[`.zoomx-section{display:flex;flex-direction:column;background:#0c1016;padding:15px}
32`],encapsulation:2,changeDetection:0});let i=o;return i})();var jl=(()=>{let o=class o{};o.\u0275fac=function(t){return new(t||o)},o.\u0275cmp=L({type:o,selectors:[["app-hedging-protection"]],decls:2,vars:0,consts:[[1,"hedging-protection-section"]],template:function(t,n){t&1&&(a(0,"section",0),y(1,"router-outlet"),l())},dependencies:[Tr],styles:[`:root{--negative: #cc0000;--up: #025802}:host{display:block;min-height:100%;background-color:#0c1016}.hedging-protection-section{display:block;min-height:100%;background-color:#0c1016}.equity-table{background:#161b22;border-radius:8px;box-shadow:0 0 0 1px #2d3748;border-collapse:separate;border-spacing:0}.equity-table thead{background:#1f2633}.equity-table thead th{padding:14px 16px;text-align:left;font-size:13px;letter-spacing:.5px;text-transform:uppercase;color:#9aa4b2;border-bottom:1px solid #2d3748;position:sticky;top:-2px;z-index:10;background:#1f2633;white-space:nowrap;text-align:center}.equity-table thead th:first-child{border-top-left-radius:3px}.equity-table thead th:last-child{border-top-right-radius:3px}.tbody-background{background-color:#161b22}tr{transition:background .2s ease}tr:hover,tr.selected{background:#1e252e}tr:last-child td{border-bottom:none}.price{font-weight:600}.price.up{color:#00c853}.price.down{color:#ff5252}.base-properties{color:#fff!important;padding:6px;border-radius:2px;margin:4px auto}.positive{background-color:var(--up)}.negative{background-color:var(--negative)}.up{background-color:var(--up)}.down{background-color:#00f}.equity-values{max-width:1153px;overflow:auto}.low{background-color:green}.mid{background-color:#00f}.high{background-color:purple}.symbol{text-align:left}
33`],encapsulation:2});let i=o;return i})();var Kl=i=>{let o=D(Ir),r=i.paramMap.get("primary")??"",e=i.paramMap.get("secondary")??"",t=Y(e)??e;if(qs(r)&&Gs(r,t))return e===t?!0:o.createUrlTree(["/client/hedging-protection",r,t]);let n=zs(t);return n?o.createUrlTree(["/client/hedging-protection",n,t]):o.createUrlTree(["/client/hedging-protection"])};var Q0=5,Y0=3e4,X0=8e3,zt=class extends Error{constructor(o){super(`${o} remained pending for too long.`),this.name="PendingRequestTimeoutError"}};function ai(i,o,r){if(i>=Q0)return null;let e=Math.min(r*2**i,X0);return Date.now()-o+e<=Y0?e:null}function an(i){return dr(()=>typeof document>"u"?i():pr(document,"visibilitychange").pipe(_r(null),Ue(()=>document.visibilityState==="visible"),mr(),Je(o=>o?i():ur),ci(1)))}var W0=500,Z0=15e3,nr=(()=>{let o=class o{constructor(e){this.http=e,this.baseUrl=we.base_url}getSnapshot(e,t){let n=vi(e);return an(()=>this.requestWithPendingRetry(`${this.baseUrl}/api/market-quote-details`,n,"Detail snapshot",t)).pipe(Ue(s=>this.normalizeSnapshot(s)))}getTrades(e,t){let n=vi(e);return an(()=>this.requestWithPendingRetry(`${this.baseUrl}/api/market-quote-details`,n,"Market quote trades",t)).pipe(Ue(s=>this.normalizeSnapshot(s)),Ue(s=>this.toTradesResponse(s)))}requestWithPendingRetry(e,t,n,s,p=Date.now(),m){return this.http.post(e,t,{observe:"response"}).pipe(Je(h=>{let x=h.body;if(h.status!==202)return x?At(x):Ae(()=>new Error(`${n} response is empty`));if(!x||!this.isPendingResponse(x))return Ae(()=>new Error(`${n} pending response is invalid`));s?.(this.toPendingContext(x));let I=this.pendingNumber(x.details?.retry_after_ms,W0),N=m??this.pendingNumber(x.details?.retry_timeout_ms,Z0);return Date.now()-p+I>N?Ae(()=>new zt(n)):cn(I).pipe(Je(()=>this.requestWithPendingRetry(e,t,n,s,p,N)))}))}normalizeSnapshot(e){return F(f({},e),{market_watch_info:e.market_watch_info??{},expiry_payloads:e.expiry_payloads??{},trades:f({},e.trades??{})})}toTradesResponse(e){let{selected_expiry:t,generated_at_utc:n,trades:s}=e;return{selected_expiry:t,generated_at_utc:n,trades:s}}isPendingResponse(e){return!!e&&typeof e=="object"&&"code"in e&&e.code==="DETAIL_DATA_PENDING"}toPendingContext(e){return{message:e.message??e.code,missing_trading_symbol:(e.details?.missing_trading_symbol??e.details?.missing_trading_symbols?.[0]??"").trim()}}pendingNumber(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>=0?e:t}};o.\u0275fac=function(t){return new(t||o)(V(Ne))}
33,o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var ir=(()=>{let o=class o{constructor(e){this.http=e,this.baseUrl=we.base_url}getFlowChart(e){let t=e.mode==="multi"?"":e.name?.trim(),n=new at({fromObject:f(f(f({secondary_id:e.secondary_id,mode:e.mode},t?{name:t}:{}),e.limit!=null?{limit:e.limit.toString()}:{}),e.cursor?{cursor:e.cursor}:{})});for(let s of e.expiries??[])n=n.append("expiries",s);return this.http.get(`${this.baseUrl}/api/flow-chart`,{params:n})}getDeltaMetricsFlowChart(e){let t=new at({fromObject:f(f(f(f({secondary_id:e.secondary_id,equity_trading_symbol:e.equity_trading_symbol},e.limit!=null?{limit:e.limit.toString()}:{}),e.cursor_near?{cursor_near:e.cursor_near}:{}),e.cursor_next?{cursor_next:e.cursor_next}:{}),e.cursor_far?{cursor_far:e.cursor_far}:{})});return this.http.get(`${this.baseUrl}/api/flow-chart/delta-metrics`,{params:t})}};o.\u0275fac=function(t){return new(t||o)(V(Ne))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var $l=(()=>{let o=class o{resolveSide(e){return this.isForcedCallRoute(e.secondary_id)?"call":e.side}shouldIncludeSource(e){return!this.isForcedCallRoute(e.secondary_id)&&!!e.source}isForcedCallRoute(e){return e===ut||e===$e}};o.\u0275fac=function(t){return new(t||o)}
33,o.\u0275prov=U({token:o,factory:o.\u0275fac,providedIn:"root"});let i=o;return i})();var or=(()=>{let o=class o{constructor(e,t){this.http=e,this.nearestDeltaPolicy=t,this.apiUrl=`${we.base_url}/api/greeks`}getInstrumentGreeks(e){return this.http.post(`${this.apiUrl}/greek-instrument-data`,e)}getDeltaRange(e,t){let n=new at({fromObject:f(f(f({name:e.name.trim(),side:e.side,min_delta:e.min_delta.toString(),max_delta:e.max_delta.toString()},e.secondary_id?{secondary_id:e.secondary_id}:{}),e.source?{source:e.source}:{}),e.source_token!=null?{source_token:e.source_token.toString()}:{})});return an(()=>this.requestDeltaRange(n,0,Date.now(),t))}requestDeltaRange(e,t=0,n=Date.now(),s){return this.http.get(`${this.apiUrl}/delta-range`,{params:e,observe:"response"}).pipe(Je(p=>{if(p.status===202){p.body&&s?.(p.body);let m=ai(t,n,1500);return m===null?Ae(()=>new zt("Delta range")):cn(m).pipe(Je(()=>this.requestDeltaRange(e,t+1,n,s)))}return p.body?At(p.body):Ae(()=>new Error("Delta range response is empty."))}))}getNearestDelta(e){let t=new at({fromObject:f(f(f({name:e.name.trim(),side:this.nearestDeltaPolicy.resolveSide(e)},e.secondary_id?{secondary_id:e.secondary_id}:{}),this.nearestDeltaPolicy.shouldIncludeSource(e)?{source:e.source}:{}),e.source_token!=null?{source_token:e.source_token.toString()}:{})});return an(()=>this.requestNearestDelta(t,0,Date.now()))}requestNearestDelta(e,t=0,n=Date.now()){return this.http.get(`${this.apiUrl}/nearest-deltas`,{params:e,observe:"response"}).pipe(Je(s=>{if(s.status===202){let p=ai(t,n,1500);return p===null?Ae(()=>new zt("Nearest delta")):cn(p).pipe(Je(()=>this.requestNearestDelta(e,t+1,n)))}return s.body?At(s.body):Ae(()=>new Error("Nearest delta response is empty."))}))}};o.\u0275fac=function(t){return new(t||o)(V(Ne),V($l))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var rr=(()=>{let o=class o{constructor(e){this.http=e,this.baseUrl=we.base_url}getSpotQuotes(e){return this.http.post(`${this.baseUrl}/api/market-watch-list`,e)}};o.\u0275fac=function(t){return new(t||o)(V(Ne))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var e_=new Set([ee.id,Q.id,mt.id,It.id]),t_=new Set([ft.id]),sr=(()=>{let o=class o{constructor(e){this.http=e,this.baseUrl=we.base_url,this.pendingRetryDelayMs=1e3}getPayoff(e){return e_.has(e.secondary_id)?this.requestPayoff(e,0,Date.now(),!1):t_.has(e.secondary_id)?this.requestPayoff(e,0,Date.now(),!0,1):an(()=>this.requestPayoff(e,0,Date.now()))}requestPayoff(e,t=0,n=Date.now(),s=!0,p=null){return this.http.post(`${this.baseUrl}/api/payoff`,e,{observe:"response"}).pipe(Je(m=>{if(m.status===202){if(!s||p!==null&&t>=p)return ln;let h=ai(t,n,this.pendingRetryDelayMs);return h===null?Ae(()=>new zt("Payoff")):cn(h).pipe(Je(()=>this.requestPayoff(e,t+1,n,s,p)))}return!m.body||!("payoff_chart"in m.body)||!m.body.payoff_chart||!("payoff_details"in m.body)||!m.body.payoff_details||!("selected_expiry"in m.body)||typeof m.body.selected_expiry!="string"||!("generated_at_utc"in m.body)||typeof m.body.generated_at_utc!="string"||!("trades"in m.body)||!m.body.trades||typeof m.body.trades!="object"||Array.isArray(m.body.trades)?Ae(()=>new Error("Combined payoff response is incomplete.")):(e.secondary_id===j.id||e.secondary_id===ee.id||e.secondary_id===ie.id||e.secondary_id===Q.id)&&(!("box_spread"in m.body)||!m.body.box_spread||Object.keys(m.body.trades).length!==4)?Ae(()=>new Error("Box-spread payoff response is incomplete.")):At(m.body)}))}simulate(e){return this.http.post(`${this.baseUrl}/api/equity-option-payoff-chart/simulate`,e)}getBestOpportunity(e){return this.http.post(`${this.baseUrl}/api/option-strategies/best-opportunity`,e)}};o.\u0275fac=function(t){return new(t||o)(V(Ne))},o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var ar=(()=>{let o=class o{constructor(e){this.http=e,this.baseUrl=we.base_url}getScanner(e){let{origin:t}=e,n=new at;return e.type&&(n=n.set("type",e.type)),e.spot_token!=null&&(n=n.set("spot_token",e.spot_token.toString())),e.target_date&&(n=n.set("target_date",e.target_date)),e.put_lot!=null&&(n=n.set("put_lot",e.put_lot.toString())),this.http.get(`${this.baseUrl}/api/${t}/get-scanner`,{params:n})}};o.\u0275fac=function(t){return new(t||o)(V(Ne))}
33,o.\u0275prov=U({token:o,factory:o.\u0275fac});let i=o;return i})();var ZM=[{path:"",component:jl,providers:[nr,ir,or,rr,sr,ar,Oi,Xi,Zi,Yi,ji,{provide:Fn,useExisting:nr},{provide:Zt,useExisting:ir},{provide:kt,useExisting:or},{provide:Ln,useExisting:rr},{provide:Rt,useExisting:sr},{provide:An,useExisting:ar}],children:[{path:"",pathMatch:"full",redirectTo:"/hedging-protection-dashboard/equity-protection-analysis"},{path:":primary/:secondary",component:tr,canActivate:[Kl]}]}];export{ZM as HEDGING_PROTECTION_ROUTES};

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.