PageSourceSearch

https://www.icicipruamc.com/static/js/index.Bs_AVSjX.js

js icicipruamc.com collected 2026-10-02 07:35:04 UTC 55,673 bytes, 1 lines download raw bytes

1import{aH as ua,ao as ca,u as yt,r as S,j6 as _t,j as e,br as P,h0 as da,R as St,bQ as pa}from"./index.DCDHF-AL.js";import{g as ma,r as ha,v as fa,s as ya,e as _a,f as Sa,p as Na}from"./nfoLaunchAutomation.service.C-3nDGw0.js";const f=[{label:"Y",value:"Y"},{label:"N",value:"N"}],ga=[{label:"Normal NFO",value:"NORMAL"},{label:"ETF NFO",value:"ETF"}],bt=["BF","DF","EF","OT","SO"].map(n=>({label:n,value:n})),Ta=["Open","Close","ETF"].map(n=>({label:n,value:n})),Oa=["OPEN","CLOSE","ETF"].map(n=>({label:n,value:n})),Da=["Growth","IDCW"].map(n=>({label:n,value:n})),Aa=["R","D"].map(n=>({label:n,value:n})),ba=["S","Y","P","N","0"].map(n=>({label:n,value:n})),xa=[{label:"FMP NFO",value:"FMP NFO"},{label:"Subscription",value:"Subscription"}],Ea=[{key:"nfoType",label:"NFO Type",group:"metadata",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:ga,defaultValue:"NORMAL",remarks:"Normal or ETF."},{key:"configurationVersion",label:"Configuration Version",group:"metadata",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"v1",remarks:"Draft snapshot version."}],xt=[{key:"fundCode",label:"FUND_CODE",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!0},{key:"fundName",label:"FUND_NAME",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!0},{key:"fundPeerCode",label:"FUND_PEER_CODE",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!1},{key:"fundSubType",label:"FUND_SUBTYPE",group:"fund",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:Ta,remarks:"Predefined values (Open, Close, ETF)."},{key:"fundType",label:"FUND_TYPE",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!0},{key:"allowMaf",label:"ALLOW_MAF",group:"fund",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"allowRollOver",label:"ALLOW_ROLLOVER",group:"fund",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"roMaturityDate",label:"RO_MATURITY_DATE",group:"fund",inputType:"date",inputMethod:"USER_INPUT",required:!1},{key:"allowImps",label:"ALLOW_IMPS",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:""},{key:"schGrpCode",label:"SCH_GRP_CODE",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!0},{key:"matDate",label:"MAT_DATE",group:"fund",inputType:"date",inputMethod:"USER_INPUT",required:!1},{key:"rerollMaturityDate",label:"REROLL_MATURITY_DATE",group:"fund",inputType:"date",inputMethod:"USER_INPUT",required:!1},{key:"fundCategory",label:"FUND_CATEGORY",group:"fund",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:bt},{key:"isTriggerAllowed",label:"IS_TRIGGER_ALLOWED",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:""},{key:"subCategoryId",label:"SUB_CATEGORY_ID",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!1},{key:"ilAllowTrxn",label:"IL_ALLOW_TRXN",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!1},{key:"ilFundShortDesc",label:"IL_FUND_SHORT_DESC",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!1},{key:"ilFundSubCategory",label:"IL_FUND_SUB_CATEGORY",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!1},{key:"ilFundPriority",label:"IL_FUND_PRIORITY",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!1},{key:"ilTrendingFunds",label:"IL_TRENDING_FUNDS",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!1},{key:"subNature",label:"SUB_NATURE",group:"fund",inputType:"text",inputMethod:"USER_INPUT",required:!0}],Et=[{key:"schCode",label:"SCH_CODE",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!0},{key:"schName",label:"SCH_NAME",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!0},{key:"launchDt",label:"LAUNCH_DT",group:"scheme",inputType:"date",inputMethod:"USER_INPUT",required:!0},{key:"schType",label:"SCH_TYPE",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:bt},{key:"allowTrxn",label:"ALLOW_TRXN",group:"scheme",inputType:"select",inputMethod:"DEFAULT",required:!0,options:f,defaultValue:"N",remarks:"Default N while configuring NFO. Later launch flow switches it to Y."},{key:"dailyDiv",label:"DAILY_DIV",group:"scheme",inputType:"select",inputMethod:"DEFAULT",required:!0,options:["D","N","P","Y"].map(n=>({label:n,value:n})),defaultValue:"N"},{key:"cutOff",label:"CUT_OFF",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"0"},{key:"pCutOff",label:"P_CUT_OFF",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"0"},{key:"unitDesc",label:"UNIT_DEC",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"3"},{key:"amountDesc",label:"AMOUNT_DEC",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"2"},{key:"navDec",label:"NAV_DEC",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"4"},{key:"schShortName",label:"SCH_SHORT_NAME",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:Da},{key:"status",label:"STATUS",group:"scheme",inputType:"text",inputMethod:"DERIVED",required:!0,defaultValue:"N",readOnly:!0,remarks:"Derived: N when SCH_SHORT_NAME=Growth, Y when SCH_SHORT_NAME=IDCW."},{key:"nipoAmt",label:"NIPO_AMT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!0,defaultValue:"1000"},{key:"mredAmt",label:"MRED_AMT",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"1"},{key:"nipoAddnAmt",label:"NIPO_ADDN_AMT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!0,defaultValue:"1000"},{key:"ipo",label:"IPO",group:"scheme",inputType:"select",inputMethod:"DEFAULT",required:!0,options:f,defaultValue:"N"},{key:"taxBasedScheme",label:"TAX_BASED_SCHEME",group:"scheme",inputType:"select",inputMethod:"DEFAULT",required:!0,options:f,defaultValue:"N"},{key:"mustReinvest",label:"MUST_REINVEST",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:ba,defaultValue:"N",remarks:"Used when SCH_SHORT_NAME=IDCW."},{key:"isSip",label:"IS_SIP",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"monthSipAmount",label:"MONTH_SIP_AMOUNT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"100"},{key:"quarterSipAmount",label:"QUARTER_SIP_AMOUNT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"1000"},{key:"showPerformance",label:"SHOW_PERFORMANCE",group:"scheme",inputType:"select",inputMethod:"DEFAULT",required:!0,options:f,defaultValue:"Y"},{key:"retGreater",label:"RET_GREATER",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"CAGR"},{key:"retLesser",label:"RET_LESSER",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"ABS"},{key:"fromStpAllowed",label:"FROM_STP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"ToStpAllowed",label:"TO_STP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"swpAllowed",label:"SWP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"minStpAmt",label:"MIN_STP_AMT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"0"},{key:"minSwpAmt",label:"MIN_SWP_AMT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"1"},{key:"noOfStpInst",label:"NO_OF_STP_INST",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"0"},{key:"noOfSwpInst",label:"NO_OF_SWP_INST",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"2"},{key:"tScheme",label:"T_SCHEME",group:"scheme",inputType:"select",inputMethod:"DEFAULT",required:!0,options:f,defaultValue:"N"},{key:"isLiquid",label:"IS_LIQUID",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"noOfCheques",label:"NO_OF_CHEQUES",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"0"},{key:"sipAllowed",label:"SIP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"isIndex",label:"IS_INDEX",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"allowFp",label:"ALLOW_FP",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"allowAp",label:"ALLOW_AP",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"allowRedeem",label:"ALLOW_REDEEM",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"allowSwitchIn",label:"ALLOW_SWITCHIN",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"allowSwitchOut",label:"ALLOW_SWITCHOUT",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"allowDivoptch",label:"ALLOW_DIVOPTCH",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"allowTrigger",label:"ALLOW_TRIGGER",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"allowCorp",label:"ALLOW_CORP",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"dematRequired",label:"DEMAT_REQUIRED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"faceValue",label:"FACE_VALUE",group:"scheme",inputType:"text",inputMethod:"DEFAULT",required:!0,defaultValue:"0"},{key:"isGSip",label:"IS_GSIP",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"fromFlexStpAllowed",label:"FROM_FLEX_STP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"toFlexStpAllowed",label:"TO_FLEX_STP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"fromLiquityAllowed",label:"FROM_LIQUITY_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"ToLiquityAllowed",label:"TO_LIQUITY_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"schBrokType",label:"SCH_BROK_TYPE",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:Aa},{key:"minDailyStpAmt",label:"MIN_DAILY_STP_AMT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"0"},{key:"fromDailyStpAllowed",label:"FROM_DAILY_STP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f},{key:"toDailyStpAllowed",label:"TO_DAILY_STP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"fromValueStpAllowed",label:"FROM_VALUE_STP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"toValueStpAllowed",label:"TO_VALUE_STP_ALLOWED",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"isNfoSwitch",label:"IS_NFO_SWITCH",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"allowSipPlus",label:"ALLOW_SIP_PLUS",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"schCategory",label:"SCH_CATEGORY",group:"scheme",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:Oa},{key:"dailySipAmount",label:"DAILY_SIP_AMOUNT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"100"},{key:"weeklySipAmount",label:"WEEKLY_SIP_AMOUNT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"100"},{key:"fortNightlySipAmount",label:"FORTNIGHTLY_SIP_AMOUNT",group:"scheme",inputType:"text",inputMethod:"USER_INPUT",required:!1,defaultValue:"100"}],Ft=[{key:"purFromDate",label:"PUR_FROM_DATE",group:"nfo",inputType:"date",inputMethod:"USER_INPUT",required:!0},{key:"purToDate",label:"PUR_TO_DATE",group:"nfo",inputType:"date",inputMethod:"USER_INPUT",required:!0},{key:"redFromDate",label:"RED_FROM_DATE",group:"nfo",inputType:"date",inputMethod:"USER_INPUT",required:!0},{key:"redToDate",label:"RED_TO_DATE",group:"nfo",inputType:"date",inputMethod:"USER_INPUT",required:!0},{key:"isOpen",label:"IS_OPEN",group:"nfo",inputType:"select",inputMethod:"DEFAULT",required:!0,options:f,defaultValue:"N"},{key:"subsType",label:"SUBS_TYPE",group:"nfo",inputType:"select",inputMethod:"DROPDOWN",required:!1,options:xa,defaultValue:"Subscription"},{key:"isNfo",label:"IS_NFO",group:"nfo",inputType:"select",inputMethod:"DEFAULT",required:!0,options:f,defaultValue:"Y"},{key:"isMicr",label:"IS_MICR",group:"nfo",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"},{key:"micrDate",label:"MICR_DATE",group:"nfo",inputType:"date",inputMethod:"USER_INPUT",required:!1},{key:"nfoIsNfoSwitch",label:"NFO_IS_NFO_SWITCH",group:"nfo",inputType:"select",inputMethod:"DROPDOWN",required:!1,options:f,defaultValue:"N"},{key:"nfoSwitchDate",label:"NFO_SWITCH_DATE",group:"nfo",inputType:"date",inputMethod:"USER_INPUT",required:!1},{key:"etfNfo",label:"ETF_NFO",group:"nfo",inputType:"select",inputMethod:"DROPDOWN",required:!0,options:f,defaultValue:"N"}],De=[...Ea,...xt,...Et,...Ft],Fa=["unitDesc","amountDesc","navDec","nipoAmt","mredAmt","nipoAddnAmt","monthSipAmount","quarterSipAmount","minStpAmt","minSwpAmt","noOfStpInst","noOfSwpInst","noOfCheques","faceValue","minDailyStpAmt","dailySipAmount","weeklySipAmount","fortNightlySipAmount","subCategoryId","ilFundPriority","ilTrendingFunds"],vt=()=>De.reduce((n,s)=>{const d=Object.prototype.hasOwnProperty.call(s,"defaultValue")?String(s.defaultValue??""):s.inputType==="select"&&s.options&&s.options.length>0?s.options[0].value:"";return n[s.key]=d,n},{}),ue=n=>n.trim(),va=(n,s)=>n.key==="mustReinvest"?ue(s.schShortName||"")==="IDCW":!0,Ia=n=>De.filter(s=>va(s,n)),Pa=n=>
1{const s=ue(n.schShortName||"");return{...n,status:s==="IDCW"?"Y":"N"}};function pe(n){const s=vt();return Pa({...s,...n})}const ja=n=>{const s=pe(n),m=[],d=Ia(s);return d.filter(y=>y.required).forEach(y=>{const p=s[y.key];typeof p=="string"&&!ue(p)&&m.push(`${y.label} is required`)}),d.filter(y=>y.inputType==="select"&&y.options&&y.options.length>0).forEach(y=>{const p=ue(s[y.key]||"");if(!p)return;(y.options||[]).map(w=>w.value).includes(p)||m.push(`${y.label} has invalid value`)}),Fa.forEach(y=>{const p=ue(s[y]||"");p&&Number.isNaN(Number(p))&&m.push(`${y} must be numeric`)}),s.purFromDate&&s.purToDate&&s.purFromDate>s.purToDate&&m.push("PUR_TO_DATE must be on or after PUR_FROM_DATE"),s.redFromDate&&s.redToDate&&s.redFromDate>s.redToDate&&m.push("RED_TO_DATE must be on or after RED_FROM_DATE"),m},Ze=(n,s)=>s.reduce((m,d)=>(m[d.key]=ue(n[d.key]||""),m),{}),Nt=(n,s,m,d,y)=>{const p=m.trim(),O=d.trim(),w=pe(s),z=n.map(v=>{const A=pe({...w,...v.metadataValues||{}}),Z=A.nfoType,F=Z==="ETF",$=pe({...A,...v.fundValues}),q=pe({...A,...v.nfoValues}),Q=Ze($,xt),b=v.schemeValues.map(X=>{const j=pe({...A,...$,...q,...X}),W=Ze(j,Et);return W.fundCode=Q.fundCode,W}),ee=b.map(X=>{const j=Ze(q,Ft);return delete j.nfoIsNfoSwitch,{...j,schCode:ue(X.schCode||""),isNfoSwitch:ue(q.nfoIsNfoSwitch||""),nfoType:Z,isEtf:F}});return{fund:Q,schemes:b,nfo:ee}}),x={draftId:p,idempotencyKey:O,nfos:z,initiatedBy:y?.trim()||"nfo-launch-ui"};return{draftPayload:{...x},provisionPayload:{...x}}},Ra=(n,s)=>n?.success?.data?.draftId||n?.data?.draftId||n?.draftId||s,La=()=>`DRAFT-${Date.now()}`,Le=()=>`IDEMP-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,J=n=>pe(n),We=2,Te=4,Ma=/^[A-Z0-9._%+-]+@(icicipruamc\.com|ext\.icicipruamc\.com)$/i,at="nfoLaunchAccessIdentity",Me=De.filter(n=>n.group==="metadata"),me=De.filter(n=>n.group==="fund"),Oe=De.filter(n=>n.group==="nfo"),re=De.filter(n=>n.group==="scheme"),et=["schCode","schType","schName","launchDt","status","mustReinvest","schBrokType","schCategory","schShortName"],Ca=["dailyDiv","cutOff","pCutOff","unitDesc","amountDesc","navDec","mredAmt","ipo","taxBasedScheme","showPerformance","retGreater","retLesser","tScheme","noOfCheques","faceValue"],wa=["allowTrxn","nipoAmt","nipoAddnAmt","isSip","isLiquid","isIndex","allowFp","allowAp","allowRedeem","allowSwitchIn","allowSwitchOut","allowDivoptch","allowTrigger","allowCorp","dematRequired"],Va=["sipAllowed","monthSipAmount","quarterSipAmount","dailySipAmount","weeklySipAmount","fortNightlySipAmount","fromStpAllowed","ToStpAllowed","swpAllowed","minStpAmt","minSwpAmt","noOfStpInst","noOfSwpInst","isGSip","fromFlexStpAllowed","toFlexStpAllowed","fromLiquityAllowed","ToLiquityAllowed","minDailyStpAmt","fromDailyStpAllowed","toDailyStpAllowed","fromValueStpAllowed","toValueStpAllowed","isNfoSwitch","allowSipPlus"],Ua=["isSip","sipAllowed","monthSipAmount","quarterSipAmount","dailySipAmount","weeklySipAmount","fortNightlySipAmount","isGSip","allowSipPlus"],ka=["swpAllowed","minSwpAmt","noOfSwpInst"],qa=["fromStpAllowed","ToStpAllowed","minStpAmt","noOfStpInst","fromFlexStpAllowed","toFlexStpAllowed","fromLiquityAllowed","ToLiquityAllowed","minDailyStpAmt","fromDailyStpAllowed","toDailyStpAllowed","fromValueStpAllowed","toValueStpAllowed","isNfoSwitch"],$a=["nfoType","configurationVersion"],Wa=["fundCode","fundName","fundSubType","fundType","fundCategory","schGrpCode","subNature"],Ha=["allowMaf","allowRollOver"],Ba=["fundPeerCode","subCategoryId","allowImps","isTriggerAllowed","roMaturityDate","matDate","rerollMaturityDate","ilAllowTrxn","ilFundShortDesc","ilFundSubCategory","ilFundPriority","ilTrendingFunds"],Ya=["purFromDate","purToDate","redFromDate","redToDate","isOpen"],Ka=["subsType","isNfo","isMicr","micrDate","nfoIsNfoSwitch","nfoSwitchDate","etfNfo"],Ae=(n,s)=>{const m=new Map(n.map(d=>[d.key,d]));return s.map(d=>m.get(d)).filter(d=>!!d)},Ga=n=>n.replace(/_/g," ").toLowerCase().replace(/\b\w/g,s=>s.toUpperCase()).replace(/\bNfo\b/g,"NFO").replace(/\bEtf\b/g,"ETF").replace(/\bSip\b/g,"SIP").replace(/\bMicr\b/g,"MICR").replace(/\bIl\b/g,"IL").replace(/\bIdcw\b/g,"IDCW"),za=n=>n.replace(/_/g," ").toLowerCase().replace(/\b\w/g,s=>
1s.toUpperCase()),Qa=Ae(Me,$a),Xa=Ae(me,Wa),Ja=Ae(me,Ha),gt=Ae(me,Ba),Za=Ae(Oe,Ya),Tt=Ae(Oe,Ka),k=(n,s)=>s.reduce((m,d)=>(m[d.key]=n[d.key]||"",m),{}),en=()=>{if(typeof window>"u")return{email:"",userName:""};try{const n=window.sessionStorage.getItem(at);if(!n)return{email:"",userName:""};const s=JSON.parse(n);return{email:String(s?.email||"").trim(),userName:String(s?.userName||"").trim()}}catch{return{email:"",userName:""}}},Ot=n=>{typeof window>"u"||window.sessionStorage.setItem(at,JSON.stringify({email:n.email.trim(),userName:n.userName.trim()}))},Dt=()=>{typeof window>"u"||window.sessionStorage.removeItem(at)},tn=n=>({metadataValues:k(n,Me),fundValues:k(n,me),nfoValues:k(n,Oe),schemeValues:[k(n,re),k(n,re)]}),an=n=>({metadataValues:{...n.metadataValues||{}},fundValues:{...n.fundValues},nfoValues:{...n.nfoValues},schemeValues:n.schemeValues.map(s=>({...s}))}),nn=n=>{if(n==null)return"";if(n instanceof Date)return n.toISOString().slice(0,10);const s=String(n).trim();if(!s)return"";const m=s.match(/^(\d{4}-\d{2}-\d{2})/);if(m)return m[1];const d=new Date(s.replace(" ","T"));return Number.isNaN(d.getTime())?s:d.toISOString().slice(0,10)},At=(n,s)=>s==null?"":n.inputType==="date"?nn(s):String(s),tt=(n,s,m)=>s.reduce((d,y)=>{const p=n[y.key],O=m[y.key];return d[y.key]=p==null?At(y,O||""):At(y,p),d},{}),sn=n=>{const s=[n?.success?.data,n?.data,n];for(const m of s){const d=m?.nfoLaunch?.drafts??m?.drafts??m;if(Array.isArray(d))return d;if(d&&typeof d=="object")return Object.values(d)}return[]},on=(n,s)=>{const m=k(s,Me),d=k(s,me),y=k(s,Oe),p=k(s,re),O=[];return n.forEach(w=>{(Array.isArray(w?.nfos)?w.nfos:[]).forEach(x=>{const v=x?.fund||{},A=Array.isArray(x?.schemes)?x.schemes:[],F=(Array.isArray(x?.nfo)?x.nfo:[])[0]||{},$=J({...m,nfoType:String(F.nfoType||m.nfoType||"NORMAL")}),q=J({...tt(F,Oe,y),nfoIsNfoSwitch:String(F.isNfoSwitch||y.nfoIsNfoSwitch||"")}),Q=A.length>0?A.map(b=>J(tt(b,re,p))):[J({...p}),J({...p})];O.push({metadataValues:$,fundValues:J(tt(v,me,d)),nfoValues:q,schemeValues:Q})})}),O},nt=n=>{const s=n.trim().toLowerCase();return s.includes("live")?"live":s.includes("ready")?"ready":s.includes("setup")||s.includes("set up")?"setup":"draft"},st=n=>{const s=n.trim().toLowerCase();return s.includes("fail")?"failed":s.includes("live")?"live":s.includes("ready")?"ready":s.includes("setup")||s.includes("set up")?"setup":"draft"},ln=n=>{const s=[];let m=0;const d=p=>{if(typeof p=="boolean")return p;const O=String(p||"").trim().toLowerCase();return O==="true"||O==="yes"||O==="y"||O==="1"},y=p=>{const O=p.trim().toUpperCase().replace(/\s+/g,"_");return O==="READY"?"READY_TO_LAUNCH":O==="SETUP_DONE"?"SETUP_SUCCESS":O||"DRAFT"};return n.forEach(p=>{const O=String(p?.draftId||"").trim(),w=String(p?.idempotencyKey||"").trim(),z=y(String(p?.lifecycleStatus||"")),x=String(p?.provisioningStatus||"").trim(),v=String(p?.statusReason||"").trim(),A=String(p?.primaryAction||"").trim(),Z=d(p?.launchEnabled),F=d(p?.isStale),$=Array.isArray(p?.warnings)?p.warnings.map(b=>String(b||"").trim()).filter(Boolean):[],q=Array.isArray(p?.steps)?p.steps:[];(Array.isArray(p?.nfos)?p.nfos:[]).forEach(b=>{const ee=y(String(b.lifecycleStatus||b.lifecycleStage||b.provisionStatus||"DRAFT")),X=z!=="DRAFT"||x||v?z:ee,j=String(z||x||b.provisionStatus||b.lifecycleStage||"DRAFT"),W=String(v||b.statusReason||b.statusMessage||"").trim(),he=String(A||b.primaryAction||"Set up").trim(),fe=(q.length>0?q:Array.isArray(b.stepDetails)?b.stepDetails:[]).map(E=>{const ne=String(E.stepStatus||E.status||"PENDING").toLowerCase(),ce=ne.includes("fail")?"failed":ne.includes("success")?"success":"pending";return{label:String(E.label||E.stepName||"Step"),status:ce}});s.push({sourceIndex:m,draftId:O||void 0,idempotencyKey:w||void 0,lifecycle:nt(X),statusLabel:j,statusTone:st(j),statusMessage:W,primaryActionLabel:he,launchEnabled:X==="READY_TO_LAUNCH"?Z:!1,isStale:F,warnings:$,steps:fe}),m+=1})}),s},rn=({nfoBlocks:n,cardRows:s,isBusy:m,isLoadingDrafts:d,getNfoStatusLabel:y,authenticatedEmail:p,onSwitchEmail:O,onCreate:w,onEdit:z,onPrimaryAction:x,onOpenCollaterals:v,onDuplicate:A,onRemove:Z})=>{const[F,$]=S.useState("all"),q=l=>{if(!l)return"-";const g=new Date(l);return Number.isNaN(g.getTime())?l:g.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"})},Q=l=>l.replace(/_/g," ").toUpperCase(),b=l=>String(l||"").trim().toUpperCase().replace(/\s+/g,"_")==="VALIDATION_FAILED",ee=l=>{const g=String(l||"").trim();if(!g)return[];const T=g.split(";").map(B=>
1B.trim()).filter(Boolean);return Array.from(new Set(T))},X=l=>l==="failed"?"Retry set up":l==="setup"?"Validate":l==="ready"?"Launch":l==="live"?"View":"Set up",j=n.map((l,g)=>{const T=s.find(ye=>ye.sourceIndex===g),B=y(g),I=st(B);return{sourceIndex:g,draftId:T?.draftId,idempotencyKey:T?.idempotencyKey,block:l,lifecycle:T?.lifecycle||nt(B),statusTone:T?.statusTone||I,statusLabel:Q(T?.statusLabel||B),statusMessage:T?.statusMessage||(I==="draft"?"Not saved to DB yet":I==="failed"?"Set up failed. Retry required.":I==="setup"?"Saved to database":I==="ready"?"Validation passed":"Launch activated and visible on dashboard"),primaryActionLabel:T?.primaryActionLabel||X(I),launchEnabled:T?.launchEnabled||!1,isStale:T?.isStale||!1,warnings:T?.warnings||[],steps:T?.steps||[]}}),W={all:j.length,draft:j.filter(l=>l.lifecycle==="draft").length,setup:j.filter(l=>l.lifecycle==="setup").length,ready:j.filter(l=>l.lifecycle==="ready").length,live:j.filter(l=>l.lifecycle==="live").length},he=j.filter(l=>F==="all"?!0:l.lifecycle===F),ae=l=>()=>{$(l)},fe=l=>()=>{z(l)},E=(l,g)=>()=>{x(l,g)},ne=l=>()=>{Z(l)},ce=l=>()=>{A(l)},be=(l,g)=>()=>{v(l,g)};return e.jsxs("section",{className:"nfo-launch-automation__list-view",children:[e.jsxs("section",{className:"nfo-launch-automation__access-session",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Session active"}),e.jsx("span",{children:`${p||"-"}  ·  Corporate workspace`})]}),e.jsx(P,{className:"nfo-launch-automation__switch-email-btn",variant:"text",color:"primary",disable:m,onClick:O,children:"Switch email"})]}),e.jsxs("div",{className:"nfo-launch-automation__workspace-head",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"NFO workspace"}),e.jsx("p",{children:`${j.length} NFOs across lifecycle`}),e.jsxs("div",{className:"nfo-launch-automation__lifecycle-pills",role:"tablist","aria-label":"NFO lifecycle filters",children:[e.jsx("button",{type:"button",className:`nfo-launch-automation__lifecycle-pill ${F==="all"?"is-active":""}`,onClick:ae("all"),children:`All ${W.all}`}),e.jsx("button",{type:"button",className:`nfo-launch-automation__lifecycle-pill ${F==="draft"?"is-active":""}`,onClick:ae("draft"),children:`Draft ${W.draft}`}),e.jsx("button",{type:"button",className:`nfo-launch-automation__lifecycle-pill ${F==="setup"?"is-active":""}`,onClick:ae("setup"),children:`Set up ${W.setup}`}),e.jsx("button",{type:"button",className:`nfo-launch-automation__lifecycle-pill ${F==="ready"?"is-active":""}`,onClick:ae("ready"),children:`Ready ${W.ready}`}),e.jsx("button",{type:"button",className:`nfo-launch-automation__lifecycle-pill ${F==="live"?"is-active":""}`,onClick:ae("live"),children:`Live ${W.live}`})]})]}),e.jsx(P,{className:"nfo-launch-automation__create-nfo-btn",variant:"contained",color:"primary",disable:m||d,onClick:w,children:"+ Create NFO"})]}),d?e.jsx("p",{children:"Loading existing NFO drafts..."}):null,he.map(l=>{const g=l.block,T=l.sourceIndex,B=b(l.statusLabel),I=B?ee(l.statusMessage):[],ye=B?"Validation did not pass":l.statusMessage,_e=l.statusTone==="live",Se=new Date(g.nfoValues.purFromDate||""),se=Number.isNaN(Se.getTime())?null:new Date(Se.getFullYear(),Se.getMonth(),Se.getDate(),9,28,0,0),He=se?Date.now()<se.getTime():!1,Ne=l.statusLabel==="READY TO LAUNCH"&&l.primaryActionLabel.toLowerCase()==="launch"&&(!l.launchEnabled||He),Ce=q(g.nfoValues.purFromDate||""),xe=q(g.nfoValues.purToDate||""),te=g.metadataValues||{};return e.jsxs("article",{className:`nfo-launch-automation__summary-card nfo-launch-automation__summary-card--${l.statusTone}`,children:[e.jsxs("div",{className:"nfo-launch-automation__summary-top",children:[e.jsxs("div",{children:[e.jsx("h2",{children:`NFO ${T+1} - ${g.fundValues.fundName||"Untitled Fund"}`}),e.jsx("p",{children:`${te.nfoType||"Normal NFO"}  ·  Config ${te.configurationVersion||"v1"}  ·  ${ye}`})]}),e.jsx("span",{className:`nfo-launch-automation__status-badge nfo-launch-automation__status-badge--${l.statusTone}`,children:l.statusLabel})]}),e.jsxs("div",{className:"nfo-launch-automation__summary-metrics",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Fund code"}),e.jsx("span",{children:g.fundValues.fundCode||"-"})]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Fund"}),e.jsx("span",{children:g.fundValues.fundName||"-"})]}),e.jsxs("p",{children:[e.jsx("strong",{children:"NFO window"}),e.jsx("span",{children:`${Ce} - ${xe}`})]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Schemes"}),e.jsx("span",{children:`${g.schemeValues.length} of ${Te}`})]})]}),l.steps.length>0?e.jsxs("div",{className:"nfo-launch-automation__summary-step-strip",children:[e.jsx("p",{children:"Dataset setup"}),e.jsx("div",{className:"nfo-launch-automation__summary-step-pills",children:l.steps.map(M=>e.jsx("span",{className:`nfo-launch-automation__summary-step-pill is-${M.status}`,children:`${M.status==="failed"?"x":M.status==="success"?"✓":"•"} ${M.label}`},`${T}-${M.label}`))})]}):null,l.warnings.length>0?e.jsxs("div",{className:"nfo-launch-automation__summary-validation-panel",children:[e.jsx("p",{className:"nfo-launch-automation__summary-validation-title",children:`${l.warnings.length} launch ${l.warnings.length===1?"warning":"warnings"}`}),e.jsx("div",{className:"nfo-launch-automation__summary-validation-grid",children:l.warnings.map(M=>e.jsx("p",{className:"nfo-launch-automation__summary-validation-item",children:M},`${T}-${M}`))})]}):null,B&&I.length>0?e.jsxs("div",{className:"nfo-launch-automation__summary-validation-panel",children:[e.jsx("p",{className:"nfo-launch-automation__summary-validation-title",children:`${I.length} validation ${I.length===1?"issue":"issues"}`}),e.jsx("div",{className:"nfo-launch-automation__summary-validation-grid",children:I.map(M=>e.jsx("p",{className:"nfo-launch-automation__summary-validation-item",children:M},`${T}-${M}`))})]}):null,e.jsxs("div",{className:"nfo-launch-automation__summary-actions",children:[_e?null:e.jsx(P,{className:"nfo-launch-automation__summary-action-edit",variant:"outlined",color:"primary",disable:m,onClick:fe(T),children:"Edit"}),e.jsx(P,{className:`nfo-launch-automation__summary-primary-action nfo-launch-automation__summary-primary-action--${l.statusTone}`,variant:"contained",color:"primary",disable:m||Ne,onClick:E(T,l),children:_e?"Closure":l.primaryActionLabel}),_e?null:e.jsx(P,{className:"nfo-launch-automation__summary-action-delete",variant:"text",color:"secondary",disable:m,onClick:ne(T),children:"Delete"}),e.jsx(P,{className:"nfo-launch-automation__summary-action-duplicate",variant:"text",color:"primary",disable:m,onClick:ce(T),children:"Duplicate"}),e.jsx(P,{className:"nfo-launch-automation__summary-action-collaterals",variant:"text",color:"primary",disable:m,onClick:be(T,l),children:"Collaterals"})]}),l.statusTone==="failed"?e.jsx("p",{className:"nfo-launch-automation__summary-retry-note",children:"Failed steps stay marked until retry succeeds"}):null,l.isStale?e.jsx("p",{className:"nfo-launch-automation__summary-retry-note",children:"Draft changed after last setup run. Run Set up again."}):null,Ne?e.jsx("p",{className:"nfo-launch-automation__summary-retry-note",children:"Launch disabled for this NFO right now."}):null]},`nfo-summary-${T}`)}),n.length>0?e.jsx("section",{className:"nfo-launch-automation__tip-card",children:e.jsxs("p",{children:[e.jsx("strong",{children:"Tip"})," Use Duplicate to clone NFO config, then change fund code and dates. Submit only when required scheme fields are complete."]})}):null]})},dn=()=>{const n=ua(),s=ca(),m=yt(t=>t?.signIn),d=yt(t=>t?.crypto?.preLoginInvestorSession),y=m,p=y.userId||y.email||y.userName||"nfo-launch-ui",O=(y.email||"").trim(),w=(y.userName||y.userId||"").trim(),z=S.useMemo(()=>en(),[]),x=S.useMemo(()=>vt(),[]),[v,A]=S.useState([]),[Z,F]=S.useState([]),[$,q]=S.useState(O),[Q,b]=S.useState(""),[ee,X]=S.useState(""),[j,W]=S.useState(!1),[he,ae]=S.useState(!1),[fe,E]=S.useState(""),[ne,ce]=S.useState(z.email||O),[be,l]=S.useState(z.userName||w),[g,T]=S.useState(!!d),[B,I]=S.useState([]),[ye,_e]=S.useState(!1),[Se,se]=S.useState(!1),[He,Ne]=S.useState(!0),[Ce,xe]=S.useState(""),[te,M]=S.useState(""),[Ee,we]=S.useState(""),[ot,Be]=S.useState(""),[Ye,V]=S.useState(""),[It,Ve]=S.useState("list"),[_,Ke]=S.useState(0),[Y,Fe]=S.useState("fund"),[it,Ge]=S.useState(!1),[lt,Ue]=S.useState(!1),[Pt,ve]=S.useState(0),[jt,Ie]=S.useState({}),[Rt,ze]=S.useState(!1),K=ye||Se,ke=j||he,qe=(be||ne||p).trim();S.useEffect(()=>(n(_t(!0)),()=>{n(_t(!1))}),[n]),S.useEffect(()=>{T(!!d),d||(Dt(),ce(O),l(w))},[d]),S.useEffect(()=>{if(!g)return;const t=ne.trim(),a=be.trim();!t&&!a||Ot({email:t,userName:a})},[ne,be,g]),S.useEffect(()=>{if(!g){A([]),F([]),Ne(!1);return}let t=!0;return(async()=>{Ne(!0),xe("");try{const o=await ma(),i=sn(o),u=on(i,x),r=ln(i);if(!t)return;A(u),F(r)}catch(o){if(!t)return;A([]),F([]),xe(o?.message||"Failed to load existing drafts.")}finally{t&&Ne(!1)}})(),()=>{t=!1}},[x,g]);const rt=t=>Ma.test(t.trim()),Lt=async()=>{const t=$.trim().toLowerCase();if(E(""),!t){E("Email is required.");return}
1if(!rt(t)){E("Only icicipruamc.com or ext.icicipruamc.com email is allowed.");return}W(!0);try{const a=await ha(t),o=a?.success?.data?.otpReferenceKey||a?.data?.otpReferenceKey||"";if(!o){E("OTP generated but reference key missing. Please try again.");return}q(t),b(""),X(o),E("OTP sent to email. Enter OTP to continue.")}catch(a){E(a?.message||"Failed to generate OTP.")}finally{W(!1)}},Mt=async()=>{const t=$.trim().toLowerCase(),a=Q.trim();if(E(""),!t||!rt(t)){E("Enter valid corporate email first.");return}if(!ee){E("Generate OTP first.");return}if(!a){E("OTP is required.");return}ae(!0);try{const o=await fa(t,a,ee),i=o?.success?.data?.sessionToken||o?.data?.sessionToken||"",u=o?.success?.data?.aesKey||o?.data?.aesKey||"";if(!i){E("OTP verified but session token missing.");return}if(!u){E("OTP verified but AES key missing.");return}const r=String(o?.success?.data?.userName||o?.data?.userName||w||"").trim(),h=String(o?.success?.data?.email||o?.data?.email||t||"").trim();n(da({aesKey:u,session:i,timestamp:Date.now().toString()})),ce(h),l(r),Ot({email:h,userName:r}),T(!0),E("OTP verified. Loading NFO launch dashboard."),xe("")}catch(o){E(o?.message||"OTP verification failed.")}finally{ae(!1)}},Ct=()=>{n(pa()),Dt(),ce(O),l(w),T(!1),b(""),X(""),E("Access session cleared. Verify email again.")},ie=()=>{ze(!1),Ye&&V("")},wt=(t,a,o)=>{ie(),A(i=>i.map((u,r)=>r!==t?u:{...u,metadataValues:{...J({...u.metadataValues||k(x,Me),[a]:o})}}))},Pe=(t,a,o,i)=>{ie(),A(u=>u.map((r,h)=>{if(h!==t)return r;const N=J({...r[a],[o]:i});if(a==="fundValues"&&o==="fundCategory"){const D=(i||"").trim();return{...r,[a]:{...N},schemeValues:r.schemeValues.map(C=>{const oe=(C.schType||"").trim();return!D||oe?C:J({...C,schType:D})})}}return{...r,[a]:{...N}}}))},de=(t,a,o,i)=>{ie(),A(u=>u.map((r,h)=>h!==t?r:{...r,schemeValues:r.schemeValues.map((N,D)=>D!==a?N:{...J({...N,[o]:i})})}))},Vt=()=>{ie(),A(t=>{const a=[...t,tn(x)],o=a.length-1;return Ke(o),Fe("fund"),Ge(!1),Ue(!1),ve(0),Ie({0:"basic"}),Ve("editor"),a})},Ut=t=>{ie(),A(a=>{if(a.length<=1)return a;const o=a.filter((i,u)=>u!==t);return _>=o.length&&Ke(o.length-1),o.length===0&&Ve("list"),o})},kt=t=>{ie(),A(a=>{const o=a[t];return o?[...a,an(o)]:a})},ut=t=>{const a=Z.find(u=>u.sourceIndex===t),o=String(a?.draftId||"").trim(),i=String(a?.idempotencyKey||"").trim();o?(M(o),we(i||Le())):(M(""),we("")),Ke(t),Fe("fund"),Ge(!1),Ue(!1),ve(0),Ie({0:"basic"}),Ve("editor")},ct=()=>{Ve("list")},Qe=(t,a,o,i)=>{const u=t,r=u?.success?.data||u?.data||u,h=String(r?.lifecycleStatus||r?.overallStatus||"DRAFT"),N=String(r?.primaryAction||"Set up"),D=String(r?.statusReason||"Provisioning request submitted successfully."),C=!!r?.launchEnabled,oe=!!r?.isStale,ge=Array.isArray(r?.warnings)?r.warnings.map(L=>String(L||"").trim()).filter(L=>!!L):[],je=Array.isArray(r?.steps)?r.steps.map(L=>{const Re=String(L.stepStatus||"PENDING").toLowerCase(),le=Re.includes("fail")?"failed":Re.includes("success")?"success":"pending";return{label:String(L.stepName||"Step"),status:le}}):[],G={sourceIndex:a,draftId:o,idempotencyKey:i,lifecycle:nt(h),statusLabel:h,statusTone:st(h),statusMessage:D,primaryActionLabel:N,launchEnabled:C,isStale:oe,warnings:ge,steps:je};F(L=>L.findIndex(le=>le.sourceIndex===a)<0?[...L,G]:L.map(le=>le.sourceIndex===a?G:le)),M(o),we(i),ze(!0),V(D)},qt=async(t,a,o)=>{V("");const i=v[t];if(!i){I(["No active NFO selected for provisioning."]);return}const u=Xe([i],[t]);if(I(u),u.length>0)return;const r=(a||te||"").trim(),h=(o||Ee||Le()).trim();if(!r){V("Save draft before provisioning.");return}const{provisionPayload:N}=Nt([i],x,r,h,qe);se(!0);try{const D=await Na(N);Qe(D,t,r,h)}catch(D){V(D?.message||"Failed to provision NFO.")}finally{se(!1)}},$t=async(t,a,o)=>{V("");const i=v[t];if(!i){I(["No active NFO selected for validation."]);return}const u=Xe([i],[t]);if(I(u),u.length>0)return;const r=(a||te||"").trim(),h=(o||Ee||Le()).trim(),N=String(i.fundValues.fundCode||"").trim();if(!r){V("Save draft before validation.");return}if(!N){V("Fund code is required before validation.");return}se(!0);try{const D=await Sa({fundCode:N,draftId:r,idempotencyKey:h,initiatedBy:qe});Qe(D,t,r,h)}catch(D){V(D?.message||"Failed to validate NFO.")}finally{se(!1)}},Wt=async(t,a,o)=>{V("");const i=v[t];if(!i){I(["No active NFO selected for launch."]);return}
1const u=(a||te||"").trim(),r=(o||Ee||Le()).trim(),h=String(i.fundValues.fundCode||"").trim();if(!u){V("Save draft before launch.");return}if(!h){V("Fund code is required before launch.");return}se(!0);try{const N=await _a({fundCode:h,draftId:u,idempotencyKey:r,initiatedBy:qe});Qe(N,t,u,r)}catch(N){V(N?.message||"Failed to launch NFO.")}finally{se(!1)}},Ht=async(t,a)=>{const o=String(a.primaryActionLabel||"").trim().toLowerCase(),i=o.includes("launch"),u=o.includes("validate"),r=o.includes("set up")||o.includes("setup")||o.includes("retry");if(i){await Wt(t,a.draftId,a.idempotencyKey);return}if(u){await $t(t,a.draftId,a.idempotencyKey);return}if(r){await qt(t,a.draftId,a.idempotencyKey);return}ut(t)},Bt=(t,a)=>{const o=v[t],i=String(a.draftId||"").trim();if(!i){V("Save draft before opening collaterals.");return}const r=String(St.NFO_LAUNCH_AUTOMATION_COLLATERAL||"").replace(":draftId",encodeURIComponent(i)),h=String(a.idempotencyKey||Ee||"").trim(),N=String(o?.fundValues?.fundName||"").trim(),D=String(o?.fundValues?.fundCode||"").trim();s.push({pathname:r,state:{draftId:i,idempotencyKey:h,fundName:N,fundCode:D}})},Yt=t=>{ie(),A(a=>a.map((o,i)=>{if(i!==t||o.schemeValues.length>=Te)return o;const u=J({...k(x,re),schType:(o.fundValues.fundCategory||"").trim()}),r=[...o.schemeValues,u];if(i===_){const h=r.length-1;ve(h),Ie(N=>({...N,[h]:"basic"}))}return{...o,schemeValues:r}}))},Kt=(t,a)=>{ie(),A(o=>o.map((i,u)=>{if(u!==t||i.schemeValues.length<=We)return i;const r=i.schemeValues.filter((h,N)=>N!==a);return u===_&&(ve(h=>r.length===0?-1:h===a?Math.max(0,a-1):h>a?h-1:h),Ie(h=>{const N={};return r.forEach((D,C)=>{const oe=C>=a?C+1:C;N[C]=h[oe]||"basic"}),N})),{...i,schemeValues:r}}))},Gt=t=>(t.schShortName||"").trim()==="IDCW"?re:re.filter(a=>a.key!=="mustReinvest"),Xe=(t,a)=>{const o=[];return t.forEach((i,u)=>{const r=a?.[u]??u;(i.schemeValues.length<We||i.schemeValues.length>Te)&&o.push(`NFO ${r+1}: schemes must be between ${We} and ${Te}`),i.schemeValues.forEach((h,N)=>{const D=k(i.metadataValues||{},Me),C=k(i.fundValues||{},me),oe=k(i.nfoValues||{},Oe),ge=k(h||{},re),je={...x,...D,...C,...oe,...ge};ja(je).forEach(L=>{o.push(`NFO ${r+1} / Scheme ${N+1}: ${L}`)})})}),o},zt=async()=>{Be(""),V("");const t=v[_];if(!t){I(["No active NFO selected for save."]);return}const a=Xe([t],[_]);if(I(a),a.length>0)return;const o=te||La(),i=Ee||Le(),{draftPayload:u}=Nt([t],x,o,i,qe);_e(!0);try{const r=await ya(u),h=Ra(r,o);M(h),we(i),ze(!1),Be(`Draft saved successfully. Draft ID: ${h}`),window.location.assign(St.NFO_LAUNCH_AUTOMATION)}catch(r){Be(r?.message||"Failed to save draft. Please try again.")}finally{_e(!1)}},Qt=(t,a,o,i)=>{const u={id:`${t.key}-${i}`,name:t.key,value:a,onChange:o,disabled:K||t.readOnly};return t.inputType==="select"?e.jsx("select",{...u,children:(t.options||[]).map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))}):e.jsx("input",{type:t.inputType,...u})},H=(t,a,o,i)=>e.jsx("div",{className:"nfo-launch-automation__form-grid",children:e.jsx("div",{className:"nfo-launch-automation__grid",children:t.map(u=>e.jsxs("label",{htmlFor:`${u.key}-${i}`,className:"nfo-launch-automation__field",children:[e.jsxs("span",{children:[Ga(u.label),u.required?" *":""]}),Qt(u,a[u.key]||"",r=>o(u.key,r.target.value),i),e.jsxs("small",{children:[za(u.inputMethod),u.remarks?` - ${u.remarks}`:""]})]},`${i}-${u.key}`))})}),Xt=(t,a)=>{const o=Gt(t),i=new Map(o.map(c=>[c.key,c])),u=et.map(c=>i.get(c)).filter(c=>!!c),r=wa.map(c=>i.get(c)).filter(c=>!!c),h=Va.map(c=>i.get(c)).filter(c=>!!c),N=Ua.map(c=>i.get(c)).filter(c=>!!c),D=ka.map(c=>i.get(c)).filter(c=>!!c),C=qa.map(c=>i.get(c)).filter(c=>!!c),oe=new Set([...N,...D,...C].map(c=>c.key)),ge=h.filter(c=>!oe.has(c.key)),je=Ca.map(c=>i.get(c)).filter(c=>!!c),G=jt[a]||"basic",L=c=>{Ie(U=>({...U,[a]:c}))},Re=()=>L("basic"),le=()=>L("transactions"),la=()=>L("sipStpSwp"),ra=()=>L("otherDefaults");return e.jsxs("div",{className:"nfo-launch-automation__scheme-grouped-fields",children:[e.jsxs("div",{className:"nfo-launch-automation__scheme-tabs-row",children:[e.jsxs("section",{className:"nfo-launch-automation__scheme-tabs",role:"tablist","aria-label":"Scheme editor tabs",children:[e.jsx("button",{type:"button",role:"tab",className:`nfo-launch-automation__scheme-tab ${G==="basic"?"is-active":""}`,onClick:Re,children:"Basic details *"}),e.jsx("button",{type:"button",role:"tab",className:`nfo-launch-automation__scheme-tab ${G==="transactions"?"is-active":""}`,onClick:le,children:"Transaction rules"}),e.jsx("button",{type:"button",role:"tab",className:`nfo-launch-automation__scheme-tab ${G==="sipStpSwp"?"is-active":""}`,onClick:la,children:"SIP/STP/SWP rules"}),e.jsx("button",{type:"button",role:"tab",className:`nfo-launch-automation__scheme-tab ${G==="otherDefaults"?"is-active":""}`,onClick:ra,children:"System defaults"})]}),e.jsx("p",{className:"nfo-launch-automation__scheme-tabs-note",children:"Fields grouped for faster entry. Start with Basic details, then review rules and defaults."})]}),G==="basic"?e.jsxs("section",{className:"nfo-launch-automation__scheme-field-section",children:[e.jsx("h5",{children:"Required identity"}),e.jsx("p",{className:"nfo-launch-automation__scheme-field-note",children:"Fund code inherited from master"}),e.jsx("div",{className:"nfo-launch-automation__form-grid",children:e.jsx("div",{className:"nfo-launch-automation__grid",children:e.jsxs("label",{className:"nfo-launch-automation__field",children:[e.jsx("span",{children:"Fund code"}),e.jsx("input",{type:"text",value:R.fundValues.fundCode||"",disabled:!0}),e.jsx("small",{children:"Auto-filled from Fund Master. Edit in Step 2 if needed."})]})})}),e.jsx("p",{className:"nfo-launch-automation__scheme-field-note",children:"* marks required fields. Must Reinvest appears and becomes required when Scheme Short Name is IDCW."}),H(u,t,(c,U)=>de(_,a,c,U),`scheme-basic-${_}-${a}`),e.jsxs("div",{className:"nfo-launch-automation__scheme-why-tabs",children:[e.jsx("h6",{children:"What each tab contains"}),e.jsx("p",{children:"Transaction rules: purchase, switch, redemption, and eligibility controls."}),e.jsx("p",{children:"SIP/STP/SWP rules: periodic transaction permissions and minimum amounts."}),e.jsx("p",{children:"System defaults: technical defaults; change only for approved exceptions."})]})]}):null,G==="transactions"?e.jsxs("section",{className:"nfo-launch-automation__scheme-field-section",children:[e.jsx("h5",{children:"Transaction behavior"}),e.jsx("p",{className:"nfo-launch-automation__scheme-field-note",children:"Switches that control purchase, redeem, switch and operational behavior during NFO."}),H(r,t,(c,U)=>de(_,a,c,U),`scheme-transaction-${_}-${a}`)]}):null,G==="sipStpSwp"?e.jsxs("section",{className:"nfo-launch-automation__scheme-field-section nfo-launch-automation__scheme-field-section--soft",children:[e.jsx("h5",{children:"SIP / STP / SWP grouped fields"}),e.jsx("p",{className:"nfo-launch-automation__scheme-field-note",children:"Grouped for faster entry: SIP, SWP, STP, then remaining fields."}),N.length>0?e.jsxs("div",{className:"nfo-launch-automation__scheme-subgroup",children:[e.jsx("h6",{children:"SIP related"}),H(N,t,(c,U)=>de(_,a,c,U),`scheme-sip-${_}-${a}`)]}):null,D.length>0?e.jsxs("div",{className:"nfo-launch-automation__scheme-subgroup",children:[e.jsx("h6",{children:"SWP related"}),H(D,t,(c,U)=>de(_,a,c,U),`scheme-swp-${_}-${a}`)]}):null,C.length>0?e.jsxs("div",{className:"nfo-launch-automation__scheme-subgroup",children:[e.jsx("h6",{children:"STP related"}),H(C,t,(c,U)=>de(_,a,c,U),`scheme-stp-${_}-${a}`)]}):null,ge.length>0?e.jsxs("div",{className:"nfo-launch-automation__scheme-subgroup",children:[e.jsx("h6",{children:"Other transaction settings"}),H(ge,t,(c,U)=>de(_,a,c,U),`scheme-rest-${_}-${a}`)]}):null]}):null,G==="otherDefaults"?e.jsxs("section",{className:"nfo-launch-automation__scheme-field-section nfo-launch-automation__scheme-field-section--success",children:[e.jsx("h5",{children:"System defaults"}),e.jsx("p",{className:"nfo-launch-automation__scheme-field-note",children:"Pre-filled system values. Update only when documented business exception applies."}),H(je,t,(c,U)=>de(_,a,c,U),`scheme-other-${_}-${a}`)]}):null]})},R=v[_],dt=t=>Rt?"Submitted":te?"Draft Saved":"Draft",pt=R?.metadataValues||{},Jt=dt(),mt=Y==="fund"?2:Y==="nfo"?3:4,$e=t=>{const a=["nfo-launch-automation__editor-stepper-item"];return t===mt?a.push("is-active"):t<mt&&a.push("is-complete"),a.join(" ")};[R?.fundValues.fundCode||"-",R?.fundValues.fundName||"-",R?.fundValues.fundSubType||"-",R?.fundValues.fundType||"-"].join(" | ");const ht=()=>{Fe("fund")},Je=()=>{Ue(!1),Fe("nfo")},ft=()=>{Fe("schemes")},Zt=()=>{if(Y==="fund"){ct();return}if(Y==="nfo"){ht();return}Je()},ea=()=>{Yt(_)},ta=t=>()=>{ve(a=>a===t?-1:t)},aa=t=>()=>{Kt(_,t)},na=t=>{q(t.target.value)},sa=t=>{b(t.target.value.replace(/\D/g,""))},oa=()=>{Ge(t=>!t)},ia=()=>{Ue(t=>!t)};return e.jsxs("div",{className:"nfo-launch-automation",children:[null,g?e.jsxs(e.Fragment,{children:[It==="list"?e.jsx(rn,{nfoBlocks:v,cardRows:Z,isBusy:K,isLoadingDrafts:He,getNfoStatusLabel:dt,authenticatedEmail:ne,onSwitchEmail:Ct,onCreate:Vt,onEdit:ut,onPrimaryAction:Ht,onOpenCollaterals:Bt,onDuplicate:kt,onRemove:Ut}):R?e.jsxs("section",{className:"nfo-launch-automation__editor-view",children:[e.jsx("div",{className:"nfo-launch-automation__editor-back",children:e.jsx(P,{className:"nfo-launch-automation__back-link",variant:"text",color:"primary",disable:K,onClick:ct,children:"Back to NFO list"})}),e.jsxs("section",{className:"nfo-launch-automation__editor-top",children:[e.jsxs("div",{children:[e.jsx("h2",{children:`NFO ${_+1}`}),e.jsx("p",{className:"nfo-launch-automation__editor-subhead",children:`${R.fundValues.fundName||"-"}  ·  Code ${R.fundValues.fundCode||"-"}  ·  ${pt.nfoType||"NORMAL"} NFO`})]}),e.jsx("span",{className:"nfo-launch-automation__status-badge nfo-launch-automation__status-badge--draft",children:Jt})]}),e.jsxs("section",{className:"nfo-launch-automation__editor-stepper","aria-label":"NFO launch steps",children:[e.jsxs("p",{className:$e(1),children:[e.jsx("span",{children:"1"}),"Launch"]}
1),e.jsxs("p",{className:$e(2),onClick:ht,children:[e.jsx("span",{children:"2"}),"Fund master"]}),e.jsxs("p",{className:$e(3),onClick:Je,children:[e.jsx("span",{children:"3"}),"NFO dates"]}),e.jsxs("p",{className:$e(4),onClick:ft,children:[e.jsx("span",{children:"4"}),"Schemes"]})]}),Y==="fund"?e.jsxs("section",{className:"nfo-launch-automation__section",children:[e.jsx("div",{className:"nfo-launch-automation__section-head",children:e.jsxs("div",{children:[e.jsx("h3",{children:"Fund master"}),e.jsx("p",{children:"Enter mandatory Fund Master details first. Advanced IL and marketing fields are optional."})]})}),e.jsx("div",{className:"nfo-launch-automation__section-split",children:e.jsx("h4",{children:"Launch metadata"})}),H(Qa,pt,(t,a)=>wt(_,t,a),`metadata-${_}`),e.jsx("div",{className:"nfo-launch-automation__section-split",children:e.jsx("h4",{children:"Identity"})}),H(Xa,R.fundValues,(t,a)=>Pe(_,"fundValues",t,a),`fund-identity-${_}`),e.jsx("div",{className:"nfo-launch-automation__section-split",children:e.jsx("h4",{children:"Permissions"})}),H(Ja,R.fundValues,(t,a)=>Pe(_,"fundValues",t,a),`fund-permissions-${_}`),e.jsxs("div",{className:"nfo-launch-automation__fund-extra-box",children:[e.jsx("p",{children:"Advanced Fund fields (optional)"}),e.jsx("small",{children:"Includes peer mapping, maturity dates, trigger controls, and IL metadata."}),e.jsx(P,{className:"nfo-launch-automation__fund-extra-toggle",variant:"text",color:"primary",disable:K,onClick:oa,children:it?"Hide advanced fields":`Show advanced fields (${gt.length})`}),it?H(gt,R.fundValues,(t,a)=>Pe(_,"fundValues",t,a),`fund-extra-${_}`):null]})]}):null,Y==="nfo"?e.jsxs("section",{className:"nfo-launch-automation__section",children:[e.jsx("div",{className:"nfo-launch-automation__section-head",children:e.jsxs("div",{children:[e.jsx("h3",{children:"NFO window"}),e.jsx("p",{children:"These NFO dates and flags apply to every scheme in this NFO."})]})}),e.jsx("div",{className:"nfo-launch-automation__section-split",children:e.jsx("h4",{children:"Subscription window"})}),H(Za,R.nfoValues,(t,a)=>Pe(_,"nfoValues",t,a),`nfo-window-${_}`),e.jsx("div",{className:"nfo-launch-automation__section-split",children:e.jsx("h4",{children:"NFO flags"})}),e.jsxs("div",{className:"nfo-launch-automation__fund-extra-box",children:[e.jsx("p",{children:"Advanced NFO flags (optional)"}),e.jsx("small",{children:"Includes subscription type, MICR setup, switch settings, and ETF flag."}),e.jsx(P,{className:"nfo-launch-automation__fund-extra-toggle",variant:"text",color:"primary",disable:K,onClick:ia,children:lt?"Hide advanced NFO flags":`Show advanced NFO flags (${Tt.length})`}),lt?H(Tt,R.nfoValues,(t,a)=>Pe(_,"nfoValues",t,a),`nfo-flags-${_}`):null]}),e.jsxs("div",{className:"nfo-launch-automation__note-panel",children:[e.jsx("p",{children:"Launch button on dashboard uses Purchase from as start date."}),e.jsx("small",{children:"Closure uses Purchase to as end date. These dates drive disabled / enabled states on list cards."})]})]}):null,Y==="schemes"?e.jsxs("section",{className:"nfo-launch-automation__section",children:[e.jsxs("div",{className:"nfo-launch-automation__section-head nfo-launch-automation__scheme-section-head",children:[e.jsxs("div",{children:[e.jsx("h3",{children:"Schemes"}),e.jsx("p",{className:"nfo-launch-automation__scheme-section-subhead",children:`${R.schemeValues.length} of ${Te} schemes configured. Open one scheme to edit details.`})]}),e.jsx(P,{className:"nfo-launch-automation__scheme-add-btn",variant:"contained",color:"primary",disable:K||R.schemeValues.length>=Te,onClick:ea,children:"+ ADD SCHEME"})]}),e.jsx("div",{className:"nfo-launch-automation__scheme-list",children:R.schemeValues.map((t,a)=>{const o=Pt===a,i=et.filter(h=>!!(t[h]||"").trim()).length,u=Math.max(10,Math.round(i/et.length*100)),r=[t.schCode||"-",t.schName||"-"].join(" · ");return e.jsxs("article",{className:`nfo-launch-automation__scheme-card ${o?"is-expanded":""}`,children:[e.jsxs("div",{className:"nfo-launch-automation__scheme-head",children:[e.jsxs("div",{className:"nfo-launch-automation__scheme-head-main",children:[e.jsx("h4",{children:`Sc
1heme ${a+1}`}),e.jsx("p",{className:"nfo-launch-automation__scheme-meta-line",children:o?`${r} · Basic ${u}%`:r}),e.jsxs("div",{className:`nfo-launch-automation__scheme-progress ${o?"is-expanded":"is-collapsed"}`,children:[e.jsx("span",{className:"nfo-launch-automation__scheme-progress-bar",style:{width:`${u}%`}}),o?e.jsx("small",{className:"nfo-launch-automation__scheme-progress-text",children:`Basic info ${u}% complete`}):null]})]}),e.jsxs("div",{className:"nfo-launch-automation__scheme-actions",children:[e.jsx(P,{className:"nfo-launch-automation__scheme-action-toggle",variant:"text",color:"primary",disable:K,onClick:ta(a),children:o?"Close details":"Open details"}),e.jsx(P,{className:"nfo-launch-automation__scheme-action-remove",variant:"text",color:"secondary",disable:K||R.schemeValues.length<=We,onClick:aa(a),children:"Remove"})]})]}),o?Xt(t,a):null]},`nfo-${_}-scheme-${a}`)})})]}):null,e.jsxs("section",{className:"nfo-launch-automation__editor-actions",children:[e.jsx(P,{variant:"text",color:"primary",disable:K,onClick:Zt,children:Y==="fund"?"Back":Y==="nfo"?"Back to Fund master":"Back to NFO window"}),e.jsxs("div",{className:"nfo-launch-automation__editor-actions-right",children:[Y==="schemes"?e.jsx(P,{className:"nfo-launch-automation__action-save",variant:"contained",color:"primary",disable:K,onClick:zt,children:ye?"Saving Draft...":"Save draft"}):null,Y==="fund"?e.jsx(P,{className:"nfo-launch-automation__action-continue",variant:"contained",color:"primary",disable:K,onClick:Je,children:"Continue"}):null,Y==="nfo"?e.jsx(P,{className:"nfo-launch-automation__action-continue",variant:"contained",color:"primary",disable:K,onClick:ft,children:"Continue to schemes"}):null]})]})]}):null,e.jsxs("section",{className:"nfo-launch-automation__status","aria-live":"polite",children:[Ce?e.jsx("p",{children:Ce}):null,te?e.jsxs("p",{children:["Current Draft ID: ",te]}):null,ot?e.jsx("p",{children:ot}):null,Ye?e.jsx("p",{children:Ye}):null,B.length>0?e.jsx("ul",{children:B.map(t=>e.jsx("li",{children:t},t))}):null]})]}):e.jsxs("section",{className:"nfo-launch-automation__auth-shell",children:[e.jsx("p",{className:"nfo-launch-automation__auth-kicker",children:"NFO Launch Automation"}),e.jsx("h2",{className:"nfo-launch-automation__auth-title",children:"Verify your workspace access"}),e.jsx("p",{className:"nfo-launch-automation__auth-subtitle",children:"Corporate email only. Used to open an NFO launch session."}),e.jsxs("div",{className:"nfo-launch-automation__auth-grid",children:[e.jsxs("section",{className:"nfo-launch-automation__auth-card nfo-launch-automation__auth-card--form",children:[e.jsx("h3",{children:"Email verification required"}),e.jsx("p",{className:"nfo-launch-automation__auth-domain",children:"Allowed domains: icicipruamc.com · ext.icicipruamc.com"}),e.jsxs("label",{className:"nfo-launch-automation__field",htmlFor:"nfo-launch-access-email",children:[e.jsx("span",{children:"Corporate email *"}),e.jsxs("div",{className:"nfo-launch-automation__access-inline-row",children:[e.jsx("input",{id:"nfo-launch-access-email",name:"nfoLaunchAccessEmail",type:"email",placeholder:"[email protected]",value:$,onChange:na,disabled:ke}),e.jsx(P,{className:"nfo-launch-automation__access-btn nfo-launch-automation__access-btn--send",variant:"contained",color:"primary",disable:ke||!$.trim(),onClick:Lt,children:j?"Sending OTP...":"Send OTP"})]})]}),e.jsxs("label",{className:"nfo-launch-automation__field",htmlFor:"nfo-launch-access-otp",children:[e.jsx("span",{children:"One-time password *"}),e.jsxs("div",{className:"nfo-launch-automation__access-inline-row",children:[e.jsx("input",{id:"nfo-launch-access-otp",name:"nfoLaunchAccessOtp",type:"text",maxLength:6,placeholder:"6-digit code",value:Q,onChange:sa,disabled:ke||!ee}),e.jsx(P,{className:"nfo-launch-automation__access-btn nfo-launch-automation__access-btn--verify",variant:"contained",color:"primary",disable:ke||!ee||!Q.trim(),onClick:Mt,children:he?"Verifying OTP...":"Verify OTP"})]})]}),fe?e.jsx("p",{className:"nfo-launch-automation__access-message",children:fe}):null,e.jsx("p",{className:"nfo-launch-automation__auth-hint",children:"OTP expires in 10 minutes. Need a new code? Use Send OTP."})]}),e.jsxs("section",{className:"nfo-launch-automation__auth-card nfo-launch-automation__auth-card--guide",children:[e.jsx("h3",{children:"How this works"}),e.jsxs("ol",{className:"nfo-launch-automation__auth-steps",children:[e.jsxs("li",{children:[e.jsx("span",{children:"1"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Verify corporate email"}),e.jsx("p",{children:"OTP opens a launch session for your user."})]})]}),e.jsxs("li",{children:[e.jsx("span",{children:"2"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Create or pick an NFO"}),e.jsx("p",{children:"Drafts stay local until you submit / provision."})]})]}),e.jsxs("li",{children:[e.jsx("span",{children:"3"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Fill fund + schemes"}),e.jsx("p",{children:"Guided sections instead of one long form."})]})]}),e.jsxs("li",{children:[e.jsx("span",{children:"4"}),e.jsxs("div",{children:[e.jsx("strong",{children:"Save draft or submit"}),e.jsx("p",{children:"Validation runs before provisioning."})]})]})]})]})]})]})]})};export{dn as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.