1import{a as ve,b as _e,c as an}from"./chunk-V6NU42B4.js";import{a as nn}from"./chunk-MTKOKRIO.js";import{a as tn}from"./chunk-OOAEVIIF.js";import{a as Oe}from"./chunk-624ISSIA.js";import{a as Zt,b as en}from"./chunk-SFMKHTND.js";import"./chunk-L6WNG7LJ.js";import{a as Ne,b as Le}from"./chunk-TCXN5L7I.js";import{a as Ut,c as zt,d as Jt,e as Ht,f as Kt}from"./chunk-JQ4GJTWP.js";import{e as Yt}from"./chunk-YL777IP6.js";import"./chunk-O3MMWH3O.js";import"./chunk-IBJQ3K6D.js";import{c as Xt}from"./chunk-LSQWVQJA.js";import"./chunk-2CME5SUD.js";import"./chunk-6BG7YWXY.js";import"./chunk-VHV6T43N.js";import"./chunk-VNQ2GQSS.js";import"./chunk-ASABS3EH.js";import"./chunk-4VRBJ25J.js";import"./chunk-IUGDBXVF.js";import{a as Se}from"./chunk-B6JXAZZB.js";import"./chunk-GGHIIEWN.js";import"./chunk-P27EZV6R.js";import{a as Wt,b as Qt}from"./chunk-E2K7TFPX.js";import"./chunk-XQAVRGWP.js";import"./chunk-7L24DMUC.js";import"./chunk-VIKWZXG2.js";import"./chunk-YJ4YWEN2.js";import"./chunk-T7RNMABY.js";import"./chunk-ACG7E2BJ.js";import{a as $t}from"./chunk-OFVLK2M3.js";import"./chunk-YQL5FFTO.js";import"./chunk-H2IU5JFL.js";import"./chunk-A2WUJBR7.js";import"./chunk-MH5QZ4SX.js";import"./chunk-CEVYAK5L.js";import"./chunk-CUHUSL33.js";import"./chunk-DSORYZXG.js";import"./chunk-KJRIWETL.js";import"./chunk-YEFZRL2F.js";import"./chunk-EDJVIWX5.js";import"./chunk-JCQFH6QF.js";import"./chunk-ZSOF7VXM.js";import"./chunk-MIAGPMNS.js";import"./chunk-BVGMNJ7W.js";import"./chunk-M3NNTDBH.js";import"./chunk-PO3646VN.js";import"./chunk-ZZDYLYXE.js";import"./chunk-SGXAIVAR.js";import"./chunk-VQ7W6FMD.js";import"./chunk-ZF4NJAUK.js";import"./chunk-7SFAMLS7.js";import"./chunk-VBAXCFWQ.js";import"./chunk-DXWWYHC4.js";import"./chunk-2QMXUOUE.js";import"./chunk-V3IEEV3P.js";import"./chunk-GBRQETIY.js";import"./chunk-ZI4OYVC7.js";import"./chunk-OTXCUKU3.js";import"./chunk-PCCX4IQR.js";import"./chunk-2FJN4FM2.js";import"./chunk-BFBZPJZR.js";import{a as jt}from"./chunk-6CSHM4UZ.js";import"./chunk-6UTUZVPH.js";import"./chunk-3B3UTJDO.js";import"./chunk-673UGEUU.js";import"./chunk-7OEBO4AL.js";import"./chunk-VE3IBX4N.js";import"./chunk-TAEHD63O.js";import"./chunk-Y73HVNVP.js";import"./chunk-6AAMFY4L.js";import"./chunk-GGNP75W2.js";import"./chunk-364S35SX.js";import"./chunk-BHMYMEGL.js";import"./chunk-Y4CVWR7V.js";import"./chunk-ILR5NSPW.js";import"./chunk-RW3YAKX6.js";import"./chunk-DIWA3KTE.js";import{a as Gt}from"./chunk-YXRW2JPO.js";import{a as Rt}from"./chunk-IBZUL5VK.js";import"./chunk-VAF2VUKD.js";import"./chunk-JXIQXW4B.js";import"./chunk-3NA46IKM.js";import"./chunk-O3A7YTII.js";import"./chunk-DCB5OECK.js";import"./chunk-CFAB2B5H.js";import"./chunk-I2YW5RAI.js";import"./chunk-KCC3C77P.js";import{b as qt}from"./chunk-HQP6ML4F.js";import{a as Bt}from"./chunk-G2CDJQPO.js";import"./chunk-TAUQ6TSZ.js";import"./chunk-LPDOUWUJ.js";import"./chunk-T6DKQZTE.js";import"./chunk-S323LQLZ.js";import{a as fe}from"./chunk-NV5QFERD.js";import"./chunk-MX5FWW4J.js";import"./chunk-LMB7ZAMN.js";import{ba as ut,ha as _t,ia as yt}from"./chunk-WY5XABWZ.js";import{a as dt,g as Ct,t as wt}from"./chunk-F4PKFOOE.js";import"./chunk-SM3DZJS3.js";import"./chunk-HTEIC6RZ.js";import"./chunk-RMVYWPMI.js";import{c as me}from"./chunk-XG6QV45F.js";import"./chunk-KTEOH7Y7.js";import{A as vt,Aa as kt,Ba as Ft,C as xt,M as I,N as Pe,O as bt,Oa as j,Pa as Ae,Sa as M,Ua as ge,Ya as he,ba as Tt,d as et,ia as It,q as ht,x as St,ya as Dt}from"./chunk-2KRBQ3SR.js";import"./chunk-WN3ZAQF5.js";import"./chunk-IPVEFQFN.js";import{Jg as Mt,Mg as Et,Nf as ft,Tg as Lt,Ug as Vt,Ye as Me,Ze as Ee,df as gt,e as k,fb as pt,s as b,t as T,y as x}from"./chunk-52FSHN75.js";import{c as pe,d as ue}from"./chunk-YN4YCH77.js";import{a as Pt}from"./chunk-2RK6SJXQ.js";import{B as Fe,C as At,b as ee,g as F}from"./chunk-3TCE2LYO.js";import{D as st,I as lt,J as ct,K as re,N as se,U as le,X as ce,d as ie,f as De,i as ae,j as nt,n as it,p as G,r as at,t as oe,u as ot,x as rt}from"./chunk-G6VVL35Z.js";import{c as Ot,e as Nt}from"./chunk-T3BMQYZC.js";import{c as mt,g as ke}from"./chunk-EJNNBLYG.js";import"./chunk-U5SRG6Q4.js";import"./chunk-HHY3WPN3.js";import"./chunk-ZOG2HQU6.js";import"./chunk-RGEO6OP5.js";import"./chunk-2K5RLH2Q.js";import{b as Ze,d as de}from"./chunk-HD3WRD6Z.js";import"./chunk-6FPE2YWO.js";import{X as Z}from"./chunk-NILZN6KJ.js";import{b as ne}from"./chunk-S4XGWF7M.js";import{q as Ye,s as Y}from"./chunk-OZCTXXXT.js";import"./chunk-DFC3MBAV.js";import{k as tt,n as te}from"./chunk-XR3IT3VM.js";import{C as Xe,m as Ue,r as ze,t as Je,u as N,v as He,w as Ke}from"./chunk-T34FQ5AI.js";import{$b as P,$c as B,A as qe,Ac as a,Bc as s,Bd as Qe,Cc as y,Dc as A,Ec as O,Gc as w,Kb as r,Lc as h,Mc as p,Pc as Ge,Qa as g,Ra as f,Rb as d,Tc as z,Uc as J,Vc as H,Zc as je,_a as U,_c as c,ad as q,e as $,fc as u,gb as Ie,h as V,jd as K,kd as X,ld as $e,na as Re,oa as _,pc as o,q as W,r as Q,rd as D,sd as R,td as We,w as Be}from"./chunk-JY76UC3K.js";import{a as Ve,i as v}from"./chunk-L7QJJRMI.js";var ye=class{constructor(n,e,l,i){this.statements=n,this.statementsPreferences=e,this.currencyDict=l,this.userAvailablePermissions=i,this.snackCarousel=new Me([],null,null,Ee.large),this.statementsListItems=[],this.statementsDict=new Map,this.statements.forEac
1h(m=>{this.statementsDict[m.statementId]=m}),this.createStatementCarousel(),this.createStatementsList()}createStatementCarousel(){let n=[];this.statementsPreferences?.favorites?.forEach(e=>{if(this.statementsDict[e]?.statementId){let l=this.statementsDict[e];n.push(new Xt(l,this.currencyDict,this.userAvailablePermissions))}}),this.snackCarousel=new Me(n,null,null,Ee.large)}createStatementsList(){this.statements.forEach(n=>{let e=this.statementsPreferences?.favorites?.includes(n.statementId.toString())||!1;this.statementsListItems.push(new kt(n,this.userAvailablePermissions,e))}),this.statementsListViewModel=new Ft(this.statementsListItems,!1)}};var hn=["stepper"],Sn=(t,n)=>({"balances-sources-no-selection":t,"no-overflow":n}),vn=t=>({"step-active":t}),_n=()=>({height:60,borderRadius:3,margin:"0 0 20px 0"}),yn=t=>({"red-D5255B":t}),Cn=t=>({"button-spinner-hide-text":t});function wn(t,n){if(t&1&&(a(0,"span",36),c(1,"Basic Info"),s()),t&2){let e=p();o("ngClass",X(1,vn,e.selectedStepIndex===0))}}function xn(t,n){if(t&1){let e=w();A(0),a(1,"div",37)(2,"trovata-date-range-picker",38),h("selectedCalendarSettings",function(i){g(e);let m=p();return f(m.dateRangeChange(i))}),s()(),O()}if(t&2){let e=p();r(2),o("calendarType",e.calendarType.Statement)("hideLabel",!1)("fullWidth",!0)("datesNotRequired",!1)("calendarSettings",e.calendarSettings)}}function bn(t,n){if(t&1&&(a(0,"mat-option",44),c(1),D(2,"titlecase"),s()),t&2){let e=n.$implicit;o("value",e),r(),q(" ",R(2,2,e)," ")}}function Tn(t,n){if(t&1&&(a(0,"mat-option",44),c(1),D(2,"titlecase"),s()),t&2){let e=n.$implicit;o("value",e),r(),q(" ",R(2,2,e)," ")}}function In(t,n){if(t&1&&(a(0,"mat-form-field",39)(1,"mat-label"),c(2,"Last day of week"),s(),a(3,"mat-select",45),u(4,Tn,3,4,"mat-option",41),s()()),t&2){let e=p(2);r(4),o("ngForOf",e.dayOfWeekOptions)}}function Dn(t,n){t&1&&(a(0,"mat-slide-toggle",46),c(1," Include Weekends "),s()),t&2&&o("labelPosition","before")}function kn(t,n){if(t&1&&(A(0),a(1,"form",16)(2,"mat-form-field",39)(3,"mat-label"),c(4,"Generate Statement"),s(),a(5,"mat-select",40),u(6,bn,3,4,"mat-option",41),s()(),u(7,In,5,1,"mat-form-field",42)(8,Dn,2,1,"mat-slide-toggle",43),s(),O()),t&2){let e=p();r(),o("formGroup",e.statementTypeFormGroup),r(5),o("ngForOf",e.cadenceOptions),r(),o("ngIf",(e.statementTypeFormGroup==null||e.statementTypeFormGroup.controls==null||e.statementTypeFormGroup.controls.statementCadence==null?null:e.statementTypeFormGroup.controls.statementCadence.value)==="weekly"),r(),o("ngIf",(e.statementTypeFormGroup==null||e.statementTypeFormGroup.controls==null||e.statementTypeFormGroup.controls.statementCadence==null?null:e.statementTypeFormGroup.controls.statementCadence.value)==="daily")}}function Fn(t,n){t&1&&(a(0,"span"),c(1,"Balances Source"),s())}function Mn(t,n){t&1&&(a(0,"div",47)(1,"p",48),c(2,"No accounts have been added"),s()())}function En(t,n){t&1&&y(0,"div",49),t&2&&o("skeletonLoader",!0)("loaderOptions",K(2,_n))}function Pn(t,n){if(t&1){let e=w();a(0,"mat-card",52)(1,"app-paginated-table",53),h("menuOptionClicked",function(i){g(e);let m=p(2);return f(m.menuAccountBalancePropertiesSelected(i))}),s()()}if(t&2){let e=p(2);r(),o("viewModel",e.accountSettingsViewModel.table)("columns",e.accountSettingsViewModel.tableColumns)("rowHover",!1)}}function An(t,n){if(t&1&&(a(0,"div",50),u(1,Pn,2,3,"mat-card",51),s()),t&2){let e=p();r(),o("ngIf",(e.accountSettingsViewModel==null||e.accountSettingsViewModel.table==null?null:e.accountSettingsViewModel.table.dataLength)>0)}}function On(t,n){t&1&&(a(0,"span"),c(1,"Transactions Source"),s())}function Nn(t,n){t&1&&(a(0,"p",56),c(1," Transactions and balances may not match if different sources are used. "),s())}function Ln(t,n){if(t&1&&(a(0,"div",57),y(1,"trovata-tql-search-bar",58),s()),t&2){let e=p(2);r(),o("tqlJSON",e.transactionsSourceFormGroup.controls.transactionsTqlExpression.value)("hideIsRolling",!0)("context",e.trxTqlContext)("disableQueryInput",!0)("multiSelectDisplayLimit",e.multiSelectDisplayLimit)}}function Vn(t,n){if(t&1&&(A(0),u(1,Nn,2,0,"p",54)(2,Ln,2,5,"div",55),y(3,"mat-divider"),O()),t&2){let e=p();r(),o("ngIf",!e.transactionsSourceFormGroup.controls.transactionsTqlExpression.value),r(),o("ngIf",e.transactionsSourceFormGroup.controls.transactionsTqlExpression.value)}}function Bn(t,n){t&1&&(a(0,"mat-chip-set",59)(1,"mat-chip",60)(2,"div",61),c(3,"Default"),s()()())}function qn(t,n){if(t&1&&(a(0,"span",36),c(1,"Finalize"),s()),t&2){let e=p();o("ngClass",X(1,yn,e.tooManyTrxns))}}function Rn(t,n){t&1&&c(0,"Name")}function Gn(t,n){if(t&1){let e=w();a(0,"trovata-currency-select",68),h("currencySelected",function(i){g(e);let m=p(2);return f(m.onCurrencySelected(i))}),s()}if(t&2){let e=p(2);o("defaultCurrencyCode",e.defaultCurrencyCode)("includeDefault",!0)("customAppearance","outline")}}function jn(t,n){if(t&1&&(a(0,"mat-option",44),c(1),s()),t&2){let e=n.$implicit;o("value",e),r(),q(" ",e.name," ")}}function $n(t,n){t&1&&(a(0,"div",74),c(1,"One-time Statement"),s())}function Wn(t,n){t&1&&(a(0,"div",74),c(1,"Automated Statement"),s())}function Qn(t,n){if(t&1&&(a(0,"div",83)(1,"span",84),c(2,"Cadence"),s(),a(3,"span",85),c(4),D(5,"titlecase"),s()()),t&2){let e=p(3);r(4),B(R(5,1,e.statementTypeFormGroup==null||e.statementTypeFormGroup.controls==null||e.statementTypeFormGroup.controls.statementCadence==null?null:e.statementTypeFormGroup.controls.statementCadence.value))}}function Un(t,n){if(t&1&&(a(0,"div",83)(1,"span",84),c(2,"End of week"),s(),a(3,"span",85),c(4),D(5,"titlecase"),s()()),t&2){let e=p(3);r(4),B(R(5,1,e.statementTypeFormGroup==null||e.statementTypeFormGroup.controls==null||e.statementTypeFormGroup.controls.lastDayOfWeek==null?null:e.statementTypeFormGroup.controls.lastDayOfWeek.value))}}function zn(t,n){if(t&1&&(a(0,"div",83)(1,"span",84),c(2,"Include weekends"),s(),a(3,"span",85),c(4),s()()),t&2){let e=p(3);r(4),B(!(e.statementTypeFormGroup==null||e.statementTypeFormGroup.controls==null||e.statementTypeFormGroup.controls.includeWeekends==null)&&e.statementTypeFormGroup.controls.includeWeekends.value?"On":"Off")}}function Jn(t,n){if(t&1&&(a(0,"div",83)(1,"span",84),c(2,"Date Range"),s(),a(3,"span",85),c(4),s()()),t&2){let e=p(3);r(4),B(e.startDate+" - "+e.endDate)}}function Hn(t,n){if(t&1&&(a(0,"p",86),c(1),s()),t&2){let e=n.$implicit;r(),q(" ",e.accountNumber+" - "+e.name," ")}}function Kn(t,n){t&1&&(a(0,"p",86),c(1,"Same as Balances"),s())}function Xn(t,n){t&1&&(a(0,"p",86),c(1,"Custom selection"),s())}function Yn(t,n){t&1&&(a(0,"div",87),y(1,"mat-spinner",88),s()),t&2&&(r(),o("diameter",20))}function Zn(t,n){if(t&1){let e=w();a(0,"div",69)(1,"div",70),u(2,$n,2,0,"div",71)(3,Wn,2,0,"div",71)(4,Qn,6,3,"div",72)(5,Un,6,3,"div",72)(6,zn,5,1,"div",72)(7,Jn,5,1,"div",72),y(8,"mat-divider",73),a(9,"div",74),c(10,"Balances Source"),s(),a(11,"div")(12,"div",75),u(13,Hn,2,1,"p",76),s()(),y(14,"mat-divider",73),a(15,"div",74),c(16,"Transaction Source"),s(),a(17,"div")(18,"div",77),u(19,Kn,2,0,"p",78)(20,Xn,2,0,"p",78),s()()(),a(21,"div",79)(22,"button",8
10),c(23,"Back"),s(),a(24,"button",81),h("click",function(){g(e);let i=p(2);return f(i.submitNewStatement())}),a(25,"span",36),c(26,"Create Statement"),s(),u(27,Yn,2,1,"div",82),s()()()}if(t&2){let e=p(2);r(2),o("ngIf",e.statementRepeatControl.value==="one-time"),r(),o("ngIf",e.statementRepeatControl.value==="recurring"),r(),o("ngIf",e.statementRepeatControl.value==="recurring"),r(),o("ngIf",e.statementRepeatControl.value==="recurring"&&(e.statementTypeFormGroup==null||e.statementTypeFormGroup.controls==null||e.statementTypeFormGroup.controls.statementCadence==null?null:e.statementTypeFormGroup.controls.statementCadence.value)==="weekly"),r(),o("ngIf",e.statementRepeatControl.value==="recurring"&&(e.statementTypeFormGroup==null||e.statementTypeFormGroup.controls==null||e.statementTypeFormGroup.controls.statementCadence==null?null:e.statementTypeFormGroup.controls.statementCadence.value)==="daily"),r(),o("ngIf",e.statementRepeatControl.value==="one-time"),r(6),o("ngForOf",e.selectedBalancesAccounts),r(6),o("ngIf",e.trxSameAsBalancesSource.value===!0),r(),o("ngIf",e.trxSameAsBalancesSource.value===!1),r(2),o("disabled",e.isLoading),r(2),o("disabled",e.isLoading||e.selectedBalancesAccounts.length===0||!e.statementInfoFormGroup.valid),r(),o("ngClass",X(13,Cn,e.isLoading)),r(2),o("ngIf",e.isLoading)}}function ei(t,n){if(t&1&&(A(0),a(1,"form",16),u(2,Rn,1,0,"ng-template",7),a(3,"mat-form-field",62)(4,"mat-label"),c(5,"Statement Name"),s(),y(6,"input",63),s(),u(7,Gn,1,3,"trovata-currency-select",64),a(8,"mat-form-field",65)(9,"mat-label"),c(10,"Rounding"),s(),a(11,"mat-select",66),u(12,jn,2,2,"mat-option",41),s()()(),u(13,Zn,28,15,"div",67),O()),t&2){let e=p();r(),o("formGroup",e.statementInfoFormGroup),r(2),o("floatLabel","always")("skeletonLoader",e.trxnSummaryLoading),r(3),o("placeholder","Statement Name"),r(),o("ngIf",!e.trxnSummaryLoading),r(),o("skeletonLoader",e.trxnSummaryLoading),r(4),o("ngForOf",e.roundingOptions),r(),o("ngIf",!e.trxnSummaryLoading)}}function ti(t,n){if(t&1&&(A(0),a(1,"div",69)(2,"div",89)(3,"div",90)(4,"mat-icon"),c(5,"error_outline"),s(),a(6,"span",91),c(7,"Large Statement"),s()(),a(8,"div",92),c(9," The selected date range and TQL filters exceed two million transactions."),y(10,"br"),c(11," Please go back and refine your inputs to narrow the results. "),s()(),a(12,"div",79)(13,"button",80),c(14,"Back"),s()()(),O()),t&2){let e=p();r(13),o("disabled",e.isLoading)}}var ni=2e6,rn=(()=>{class t{constructor(e,l,i,m,S,C,L,Ce,we,xe,be){this.dialogRef=e,this.accountsService=l,this.dialogAnimation=i,this._formBuilder=m,this.statementsFacadeService=S,this.router=C,this.snackBar=L,this.currencyFacadeService=Ce,this.transactionsSummarySocketService=we,this.tqlService=xe,this.store=be,this.calendarType=Ct,this.identityState$=this.store.select(Te=>Te.identity),this.accountsApiInFlight=!1,this.destroyed$=new V,this.calendarSettings=wt(),this.balancePropertyOverrides={},this.selectedBalancesAccounts=[],this.selectedStepIndex=0,this.isRecurring=!1,this.multiSelectDisplayLimit=2,this.transactionTqlSameAsBalances=!0,this.cadenceOptions=[x.daily,x.weekly,x.monthly],this.dayOfWeekOptions=[I.monday,I.tuesday,I.wednesday,I.thursday,I.friday,I.saturday,I.sunday],this.roundingOptions=gt,this.trxTqlContext=pt.transactions,this.setFormGroups(),this.loadPreferences(),this.setSummarySub()}ngOnDestroy(){this.destroyed$.next(!0),this.destroyed$.complete()}setSummarySub(){this.trxnSummarySearch$=new V,this.trxnSummarySearch$.pipe(_(this.destroyed$),Re(({searchParams:e,tqlExpression:l})=>{this.trxnSummaryLoading=!0;let i=yt({params:e,ast:l},this.tqlService);return this.transactionsSummarySocketService.createSummaryJobAndWaitForResponse(i)})).subscribe({next:e=>{this.tooManyTrxns=e.payload?.body?.totalTransactions>ni,this.trxnSummaryLoading=!1}})}setFormGroups(){this.statementRepeatControl=new G("one-time"),this.statementRepeatControl.setValue("one-time",{emitEvent:!0}),this.statementTypeFormGroup=this._formBuilder.group({statementCadence:[x.monthly],lastDayOfWeek:[I.sunday],includeWeekends:[!1]}),this.statementTypeFormGroup.get("statementCadence")?.valueChanges.pipe(_(this.destroyed$)).subscribe(()=>{this.getTqlTransactionsSummary()}),this.balancesSourceFormGroup=this._formBuilder.group({balanceAccounts:[[],De.required],balancesTqlExpression:[null]}),this.transactionsSourceFormGroup=this._formBuilder.group({transactionsTqlExpression:[null]}),this.trxSameAsBalancesSource=new G(!0),this.statementInfoFormGroup=this._formBuilder.group({statementName:["",De.required],convertedCurrency:[null],roundingSelection:[this.roundingOptions[0]]})}loadPreferences(){return v(this,null,function*(){try{let e=yield this.currencyF
1acadeService.getDefaultCurrency();this.defaultCurrencyCode=e.code,this.onCurrencySelected(e),this.identityState$.pipe(_(this.destroyed$)).subscribe(l=>{this.currentUser=l.currentUser})}catch(e){throw this.snackBar.open(F.tryAgainMsg,null,{duration:6e3}),new Error(e)}})}openAccountSelectionDialog(){let e={type:Ne.accounts,customTitle:"Balances Data Sources",searchTip:"Create a TQL search statement to filter specific accounts you want to include in your statement."};this.balancesTqlExpression&&(e.initialTqlJSONExpression=this.balancesTqlExpression);let l=this.dialogAnimation.open(Le,{data:e,autoFocus:!1,disableClose:!0,minWidth:"550px",width:"85%",position:{top:"0",right:"0"},height:"100%",panelClass:"side-dialog-container",animation:{to:"left",incomingOptions:{keyframeAnimationOptions:{easing:"ease-in-out",duration:200}},outgoingOptions:{keyframeAnimationOptions:{easing:"ease-in-out",duration:200}}}});l.componentInstance.submitTQLSelection.pipe(_(this.destroyed$)).pipe(_(l.componentInstance.destroyed$)).subscribe(i=>v(this,null,function*(){this.balancesTqlExpression=i.expression,this.balancesSourceFormGroup.patchValue({balancesTqlExpression:i.expression}),this.balancesTqlSelected=!0,this.getTqlTransactionsSummary(),l.close(),this.selectedBalancesAccounts=yield this.getAccounts(this.balancesTqlExpression),this.setAccountSettingsTableViewModel(),this.trxBalancesSourceChanged()}))}setAccountSettingsTableViewModel(){this.selectedBalancesAccounts.length>0&&(this.accountSettingsViewModel=new an(this.selectedBalancesAccounts,this.balancePropertyOverrides),this.balancesSourceFormGroup.patchValue({balanceAccounts:this.selectedBalancesAccounts}))}openTransactionSelectionDialog(){let e={type:Ne.transactions,customTitle:"Transactions Data Sources",initialTqlJSONExpression:this.transactionsTqlExpression||this.balancesTqlExpression},l=this.dialogAnimation.open(Le,{data:e,autoFocus:!1,disableClose:!0,minWidth:"550px",width:"85%",position:{top:"0",right:"0"},height:"100%",panelClass:"side-dialog-container",animation:{to:"left",incomingOptions:{keyframeAnimationOptions:{easing:"ease-in-out",duration:200}},outgoingOptions:{keyframeAnimationOptions:{easing:"ease-in-out",duration:200}}}});l.componentInstance.submitTQLSelection.pipe(_(this.destroyed$)).pipe(_(l.componentInstance.destroyed$)).subscribe(i=>v(this,null,function*(){this.transactionsTqlExpression=i.expression,this.getTqlTransactionsSummary(),this.transactionsSourceFormGroup.patchValue({transactionsTqlExpression:i.expression}),l.close()}))}getTqlTransactionsSummary(){if(this.balancesTqlSelected){let e=[];
1if(!this.isRecurring)e=[new T(b.startDate,"",this.startDate),new T(b.endDate,"",this.endDate)];else{let m=this.statementTypeFormGroup.controls.statementCadence.value;m===x.daily?e=[new T(b.startDate,"",k.now().minus({day:1}).toFormat("yyyy-MM-dd")),new T(b.endDate,"",k.now().minus({day:1}).toFormat("yyyy-MM-dd"))]:m===x.weekly?e=[new T(b.startDate,"",k.now().minus({week:1}).toFormat("yyyy-MM-dd")),new T(b.endDate,"",k.now().toFormat("yyyy-MM-dd"))]:m===x.monthly&&(e=[new T(b.startDate,"",k.now().minus({month:1}).toFormat("yyyy-MM-dd")),new T(b.endDate,"",k.now().toFormat("yyyy-MM-dd"))])}let l=this.transactionsTqlExpression||this.balancesTqlExpression,i=JSON.stringify(e)+JSON.stringify(l);this.previousTrxnSummarySearch!==i&&(this.previousTrxnSummarySearch=i,this.trxnSummarySearch$.next({searchParams:e,tqlExpression:l}))}}onCurrencySelected(e){this.statementInfoFormGroup.patchValue({convertedCurrency:e.code})}onStepChange(e){this.selectedStepIndex=e.selectedIndex}dateRangeChange(e){this.calendarSettings=e,this.startDate=e.startDate,this.endDate=e.endDate,this.getTqlTransactionsSummary()}menuAccountBalancePropertiesSelected(e){this.balancePropertyOverrides[e.row.account.accountId]||(this.balancePropertyOverrides[e.row.account.accountId]={}),e.option.optionId in ve&&(this.balancePropertyOverrides[e.row.account.accountId].opening=ve[e.option.optionId]),e.option.optionId in _e&&(this.balancePropertyOverrides[e.row.account.accountId].closing=_e[e.option.optionId]),this.balancePropertyOverrides[e.row.account.accountId]?.opening||(this.balancePropertyOverrides[e.row.account.accountId].opening=ve.bankOpeningLedger),this.balancePropertyOverrides[e.row.account.accountId]?.closing||(this.balancePropertyOverrides[e.row.account.accountId].closing=_e.bankClosingLedger),setTimeout(()=>{this.setAccountSettingsTableViewModel()},200)}getAccounts(e){return this.accountsApiInFlight=!0,new Promise((l,i)=>v(this,null,function*(){try{let m=yield qe(this.accountsService.getAccountsV5(null,null,null,null,null,null,null,!1,null,null,null,e));this.accountsApiInFlight=!1,l(m.body.accounts)}catch(m){this.accountsApiInFlight=!1,i(m)}}))}trxBalancesSourceChanged(e){this.trxSameAsBalancesSource.value&&(this.transactionsTqlExpression=this.balancesTqlExpression,this.transactionsSourceFormGroup.patchValue({transactionsTqlExpression:this.balancesTqlExpression})),this.transactionTqlSameAsBalances=this.trxSameAsBalancesSource.value,e&&this.getTqlTransactionsSummary()}statementRepeatChanged(){this.isRecurring=this.statementRepeatControl.value==="recurring",this.getTqlTransactionsSummary()}submitNewStatement(){return v(this,null,function*(){try{let e={type:"AST",expression:this.balancesTqlExpression},l=this.balancesTqlExpression?e:null,i={type:"AST",expression:this.transactionsTqlExpression},m=this.statementInfoFormGroup.controls.convertedCurrency.value,S=m==="default"?this.defaultCurrencyCode:m,C=this.statementRepeatControl.value==="recurring",L={statementId:void 0,name:this.statementInfoFormGroup.controls.statementName.value,balanceTql:l,transactionTql:!this.transactionTqlSameAsBalances&&this.transactionsTqlExpression?i:l,currency:S,recurring:C,rounding:this.statementInfoFormGroup.controls.roundingSelection.value.rounding,includeWeekends:this.statementTypeFormGroup.controls.statementCadence.value===x.daily?this.statementTypeFormGroup.controls.includeWeekends.value:null,cadence:C?this.statementTypeFormGroup.controls.statementCadence.value:null,startDate:C?null:this.startDate,endDate:C?null:this.endDate,lastDayOfWeek:this.statementTypeFormGroup.controls.statementCadence.value===x.weekly?this.statementTypeFormGroup.controls.lastDayOfWeek.value:null,lastUpdated:void 0,preferences:{grouping:null,columns:Tt.constructMenu(S),balancePropertyOverrides:this.balancePropertyOverrides,transactionsSameAsBalances:this.trxSameAsBalancesSource.value},createdBy:this.currentUser.userId};this.isLoading=!0,yield this.statementsFacadeService.createStatement(L),this.router.navigate(["statements"]),this.isLoading=!1,this.dialogRef.close(!0)}catch(e){throw this.snackBar.open(F.tryAgainMsg,null,{duration:6e3}),this.isLoading=!1,new Error(e)}})}static{this.\u0275fac=function(l){return new(l||t)(d(Ot),d(ut),d(ge),d(lt),d(Se),d(Y),d(ee),d(me),d(_t),d(vt),d(tt))}}static{this.\u0275cmp=P({type:t,selectors:[["trovata-new-statement-dialog"]],viewQuery:function(l,i){if(l&1&&z(hn,5),l&2){let m;J(m=H())&&(i.stepper=m.first)}},decls:64,vars:30,consts:[["stepper",""],["data-heap-feature","statements",1,"statement-settings-container","dialog-theme"],[1,"pl-10"],[3,"navigationEvent","isDoneLoading","isSmallDialog","navigationButton","title"],[1,"dialog-theme-inner","mw-490"],["linear","","color","primary",1,"vertical-step-header-padding",3,"selectionChange"],[3,"completed"],["matStepLabel",""],["value","one-time",1,"w-100","mb-24",3,"formControl"],["value","one-time","matTooltip","One
1-time","matTooltipShowDelay","500","aria-label","One-time",1,"w-50",3,"click"],["value","recurring","matTooltip","Recurring","matTooltipShowDelay","500","aria-label","Recurringe",1,"w-50",3,"click"],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"footer-button-container"],["color","primary","mat-flat-button","","matStepperNext","",3,"disabled"],[3,"stepControl"],[3,"formGroup"],[1,"flex","flex-ai-c"],[1,"step1-description","flex-grow-2"],[1,"step1-desc"],[1,"step1-button","flex-grow-1"],["mat-flat-button","","color","primary","aria-label","Configure Sources",1,"submit-button","first-step-button",3,"click"],["class","balances-sources-container sources-empty",4,"ngIf"],[3,"skeletonLoader","loaderOptions",4,"ngIf"],["class","account-settings-table-container",4,"ngIf"],["mat-stroked-button","","color","primary","matStepperPrevious","",1,"first-button"],["mat-flat-button","","matStepperNext","","color","primary",3,"disabled"],[3,"formControl"],["mat-flat-button","","color","primary","aria-label","Configure Sources",1,"submit-button","first-step-button",3,"click","disabled"],[1,"balances-sources-container","sources-empty",3,"ngClass"],[4,"ngIf"],[1,"transactions-source-toggle"],[1,"menu-opt"],[3,"click","formControl"],[1,"menu-checkbox","w-100"],["class","v2-chip default-select-chip",4,"ngIf"],[3,"ngClass"],[1,"mb-20"],[3,"selectedCalendarSettings","calendarType","hideLabel","fullWidth","datesNotRequired","calendarSettings"],["appearance","outline","color","primary",1,"form-field"],["required","","formControlName","statementCadence",1,"final-entry"],[3,"value",4,"ngFor","ngForOf"],["appearance","outline","class","form-field","color","primary",4,"ngIf"],["class","form-field statement-include-weekends-toggle","color","primary","formControlName","includeWeekends",3,"labelPosition",4,"ngIf"],[3,"value"],["required","","formControlName","lastDayOfWeek",1,"final-entry"],["color","primary","formControlName","includeWeekends",1,"form-field","statement-include-weekends-toggle",3,"labelPosition"],[1,"balances-sources-container","sources-empty"],[1,"account-text","font-400-14-24","black-alpha-56"],[3,"skeletonLoader","loaderOptions"],[1,"account-settings-table-container"],["appearance","outlined","class","flat table-card",4,"ngIf"],["appearance","outlined",1,"flat","table-card"],[3,"menuOptionClicked","viewModel","columns","rowHover"],["class","same-source-text-info font-400-14-24 black-alpha-56",4,"ngIf"],["class","tql-expression-stepper-container",4,"ngIf"],[1,"same-source-text-info","font-400-14-24","black-alpha-56"],[1,"tql-expression-stepper-container"],[3,"tqlJSON","hideIsRolling","context","disableQueryInput","multiSelectDisplayLimit"],[1,"v2-chip","default-select-chip"],[1,"flat"],[1,"font-400-12-12"],["appearance","outline","color","primary",1,"form-field",3,"floatLabel","skeletonLoader"],["matInput","","formControlName","statementName","required","",3,"placeholder"],[3,"defaultCurrencyCode","includeDefault","customAppearance","currencySelected",4,"ngIf"],["appearance","outline","color","primary",1,"form-field",3,"skeletonLoader"],["required","","formControlName","roundingSelection",1,"final-entry"],["class","review-container",4,"ngIf"],[3,"currencySelected","defaultCurrencyCode","includeDefault","customAppearance"],[1,"review-container"],[1,"review-item","pb-5"],["class","step-review-header",4,"ngIf"],["class","flex flex-ai-c flex-jc-sb",4,"ngIf"],[1,"mt-20","mb-10"],[1,"step-review-header"],[1,"balances-sources-review","no-margin-top"],["class","font-400-14-24 m-0",4,"ngFor","ngForOf"],[1,"balances-sources-review","sources-review-transactions","no-margin-top"],["class","font-400-14-24 m-0",4,"ngIf"],[1,"review-button-container"],["mat-stroked-button","","color","primary","matStepperPrevious","",1,"first-button",3,"disabled"],["mat-flat-button","","matStepperNext","","color","primary",3,"click","disabled"],["class","button-spinner-container",4,"ngIf"],[1,"flex","flex-ai-c","flex-jc-sb"],[1,"font-400-14-24","black-alpha-56"],[1,"step-review-value"],[1,"font-400-14-24","m-0"],[1,"button-spinner-container"],[1,"white-spinner",3,"diameter"],[1,"flex","flex-ai-c","flex-column","review-item"],[1,"font-400-20-24","red-text","mb-20","flex","flex-ai-c"],[1,"ml-5"],[1,"font-400-14-24","mb-20","text-center"]],template:function(l,i){if(l&1){let m=w();a(0,"div",1)(1,"div",2)(2,"trovata-sticky-page-header",3),h("navigationEvent",function(){return g(m),f(i.dialogRef.close())}),s()(),a(3,"div",4)(4,"mat-vertical-stepper",5,0),h("selectionChange",function(C){return g(m),f(i.onStepChange(C))}),a(6,"mat-step",6),u(7,wn,2,3,"ng-template",7),a(8,"mat-button-toggle-group",8)(9,"mat-button-toggle",9),h("click",function(){return g(m),f(i.statementRepeatChanged())}),c(10," One-time "),s(),a(11,"mat-button-toggle",10),h("click",function(){return g(m),f(i.statementRepeatChanged())}),c(12," Recurring "),s()(),a(13,"div",11),u(14,xn,3,5,"ng-container",12)(15,kn,9,4,"ng-container",12),s(),a(16,"div",13)(17,"button",14),c(18,"Next"),s()()(),a(19,"mat-step",15),u(20,Fn,2,0,"ng-template",7),a(21,"form",16)(22,"div",17)(23,"div",18)(24,"p",19),c(25,"Add data sources to be used for this statement"),s()(),a(26,"div",20)(27,"button",21),h("click",function(){return g(m),f(i.openAccountSelectionDialog())}),c(28," Configure Sources "),s()()(),u(29,Mn,3,0,"div",22)(30,En,1,3,"div",23)(31,An,2,1,"div",24),a(32,"div",13)(33,"button",25),c(34,"Back"),s(),a(35,"button",26),c(36,"Next"),s()()()(),a(37,"mat-step",15),u(38,On,2,0,"ng-template",7),a(39,"form",27)(40,"div",17)(41,"div",18)(42,"p",19),c(43,"Add data sources to be used for this statement"),s()(),a(44,"div",20)(45,"button",28),h("click",function(){return g(m),f(i.openTransactionSelectionDialog())}),c(46," Configure Source "),s()()(),a(47,"div",29),u(48,Vn,4,2,"ng-container",30),a(49,"div",31)(50,"div",32)(51,"mat-checkbox",33),h("click",function(C){return g(m),C.stopPropagation(),f(i.trxBalancesSourceChanged(!0))}),a(52,"div",34),c(53,"Same as balances source"),s()()(),u(54,Bn,4,0,"mat-chip-set",35),s()(),a(55,"div",13)(56,"button",25),c(57,"Back"),s(),a(58,"button",26),c(59," Next "),s()()()(),a(60,"mat-step",15),u(61,qn,2,3,"ng-template",7)(62,ei,14,8,"ng-container",30)(63,ti,15,1,"ng-container",30),s()()()()}l&2&&(r(2),o("isDoneLoading",!0)("isSmallDialog",!0)("navigationButton","close")("title","New Statement"),r(4),o("completed",!(i.isRecurring===!1&&!i.startDate&&!i.endDate)),r(2),o("formControl",i.statementRepeatControl),r(5),o("ngSwitch",i.statementRepeatControl.value),r(),o("ngSwitchCase","one-time"),r(),o("ngSwitchCase","recurring"),r(2),o("disabled",i.isRecurring===!1&&!i.startDate&&!i.endDate),r(2),o("stepControl",i.balancesSourceFormGroup),r(2),o("formGroup",i.balancesSourceFormGroup),r(8),o("ngIf",(i.selectedBalancesAccounts==null?null:i.selectedBalancesAccounts.length)===0&&!i.accountsApiInFlight),r(),o("ngIf",i.accountsApiInFlight),r(),o("ngIf",(i.selectedBalancesAccounts==null?null:i.selectedBalancesAccounts.length)>0&&!i.accountsApiInFlight),r(4),o("disabled",i.selectedBalancesAccounts.length===0),r(2),o("stepControl",i.transactionsSourceFormGroup),r(2),o("formControl",i.trxSameAsBalancesSource),r(6),o("disabled",i.trxSameAsBalancesSource==null?null:i.trxSameAsBalancesSource.value),r(2),o("ngClass",$e(27,Sn,i.trxSameAsBalancesSource.value,i.transactionsSourceFormGroup.controls.transactionsTqlExpression.value)),r(),o("ngIf",!i.trxSameAsBalancesSource.value),r(3),o("formControl",i.trxSameAsBalancesSource),r(3),o("ngIf",i.trxSameAsBalancesSource.value),r(4),o("disabled",i.trxSameAsBalancesSource.value===!1&&!i.transactionsSourceFormGroup.controls.transactionsTqlExpression.value),r(2),o("stepControl",i.statementInfoFormGroup),r(2),o("ngIf",!i.tooManyTrxns),r(),o("ngIf",i.tooManyTrxns))}
1,dependencies:[fe,Jt,zt,Ut,ze,Wt,re,at,ie,ae,nt,st,oe,ot,rt,Qt,de,He,Ke,Bt,le,se,It,Je,et,N,Dt,Z,Ht,pe,ue,he,Kt,ct,it,qt,Pt,xt,Et,Mt,ce,$t,At,Ze,Xe],styles:["mat-vertical-stepper[_ngcontent-%COMP%]{margin:0 -24px}.form-field[_ngcontent-%COMP%]{width:100%}.flex-grow-1[_ngcontent-%COMP%]{flex-grow:1}.flex-grow-2[_ngcontent-%COMP%]{flex-grow:2}.step1-button[_ngcontent-%COMP%]{min-width:180px}.balances-sources-container[_ngcontent-%COMP%]{border:1px solid #d6d6d6;text-align:center;min-height:90px;max-height:350px;margin-bottom:20px;overflow-y:scroll;border-radius:3px}.balances-sources-container[_ngcontent-%COMP%] .menu-opt[_ngcontent-%COMP%]{text-align:left;margin:10px 16px}.balances-sources-review[_ngcontent-%COMP%]{min-height:60px;max-height:350px;margin-bottom:20px;overflow-y:auto}.sources-review-transactions[_ngcontent-%COMP%]{min-height:0px}.balances-sources-no-selection[_ngcontent-%COMP%]{min-height:48px!important}.account-text[_ngcontent-%COMP%], .same-source-text-info[_ngcontent-%COMP%]{margin:34px}.account-settings-table-container[_ngcontent-%COMP%]{max-height:700px;overflow-y:auto;margin-bottom:20px}.transactions-source-toggle[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.transactions-source-toggle[_ngcontent-%COMP%] .default-select-chip.v2-chip[_ngcontent-%COMP%] mat-chip.mat-mdc-standard-chip[_ngcontent-%COMP%]{height:24px;min-height:24px;margin-right:16px}.no-overflow[_ngcontent-%COMP%]{overflow:hidden}"]})}}return t})();var ii=()=>({height:738,width:"100%"});function ai(t,n){if(t&1){let e=w();a(0,"mat-card",5)(1,"app-paginated-table",6),h("clickRow",function(i){g(e);let m=p();return f(m.onRowClicked(i))})("menuOptionClicked",function(i){g(e);let m=p();return f(m.menuOptionClicked.emit(i))}),s()()}if(t&2){let e=p();r(),o("viewModel",e.viewModel.table)("loadingTableData",e.isLoading)("paginatorLoading",e.isLoading)("columns",e.viewModel.tableColumns)("pageSizeOptions",e.pageSizeOptions)}}var sn=(()=>{class t{constructor(e){this.vitallyService=e,this.searchControl=new G,this.pageSizeOptions=[25,50,100],this.rowClicked=new U,this.rowsSelected=new U,this.menuOptionClicked=new U}ngOnInit(){this.subscribeToTextFilterChanges()}ngAfterViewInit(){this.vitallyService.userAction(ht.statementsListView)}onRowClicked(e){this.rowClicked.emit(e)}subscribeToTextFilterChanges(){this.searchControl.valueChanges.subscribe(e=>{this.viewModel.setFilteredStatementRows(e)})}static{this.\u0275fac=function(l){return new(l||t)(d(St))}}static{this.\u0275cmp=P({type:t,selectors:[["trovata-statements-list"]],inputs:{viewModel:"viewModel",isLoading:"isLoading"},outputs:{rowClicked:"rowClicked",rowsSelected:"rowsSelected",menuOptionClicked:"menuOptionClicked"},decls:7,vars:6,consts:[[1,"statement-search-container"],["appearance","outline","color","primary",1,"search-bar",3,"floatLabel"],["matInput","",1,"search-input",3,"formControl"],[1,"list-container","mb-55",3,"skeletonLoader","loaderOptions"],["appearance","outlined","class","flat statements-list-table",4,"ngIf"],["appearance","outlined",1,"flat","statements-list-table"],[3,"clickRow","menuOptionClicked","viewModel","loadingTableData","paginatorLoading","columns","pageSizeOptions"]],template:function(l,i){l&1&&(a(0,"div",0)(1,"mat-form-field",1)(2,"mat-label"),c(3,"Search Statements"),s(),y(4,"input",2),s()(),a(5,"div",3),u(6,ai,2,5,"mat-card",4),s()),l&2&&(r(),o("floatLabel","always"),r(3),o("formControl",i.searchControl),r(),o("skeletonLoader",!i.viewModel)("loaderOptions",K(5,ii)),r(),o("ngIf",i.viewModel))},dependencies:[le,se,ce,re,ie,ae,oe,pe,N,ue,he],styles:[".search-bar[_ngcontent-%COMP%]{margin:24px 0;width:100%;min-width:50%;display:block;position:relative;color:#1d242e}.search-input[_ngcontent-%COMP%]{width:calc(100% - 170px);display:inline}"]})}}return t})();var oi=["statementSnackComponent"];function ri(t,n){if(t&1){let e=w();a(0,"button",8),h("click",function(){g(e);let i=p();return f(i.createStatement())}),c(1," New Statement "),s()}if(t&2){let e=p();o("disabled",!(e.userAvailablePermissions!=null&&e.userAvailablePermissions.has(e.permissionId.createStatements)))}}function si(t,n){t&1&&(a(0,"div",9),y(1,"trovata-ai-insights-button",10),s()),t&2&&(r(),o("showDivider",!0))}function li(t,n){if(t&1){let e=w();a(0,"app-snack-carousel",11),h("dropped",function(i){g(e);let m=p();return f(m.changeOrder(i))})("delete",function(i){g(e);let m=p();return f(m.deleteSnack(i))}),s()}if(t&2){let e=p(),l=je(7);o("viewModel",e.viewModel==null?null:e.viewModel.snackCarousel)("dragAndDrop",!0)("showMenu",e.showMenu)("containerWidth",l.offsetWidth)}}var E=class t{constructor(n,e,l,i,m,S,C,L,Ce,we,xe,be,Te){this.preferencesFacadeService=n,this.statementsFacadeService=e,this.statementsEventsService=l,this.cancelPollRequestService=i,this.currencyF
1acadeService=m,this.dialogAnimation=S,this.dialog=C,this.router=L,this.snackbar=Ce,this.activatedRoute=we,this.location=xe,this.locale=be,this.insightsEventsService=Te,this.destroyed$=new V,this.hasReadInsightsPermission=Ie(!1),this.sidePanelOpen=Ie(!0),this.insightsEventsService.sidePanelOpen$.pipe(_(this.destroyed$)).subscribe(ln=>{this.sidePanelOpen.set(ln)}),this.statements=[],this.hasError=!1,this.isLoading=!0,this.showMenu=!0,this.permissionId=ke,j(M.onlyLeftMedium),j(M.noBottom),setTimeout(()=>{j(M.onlyLeftMedium),j(M.noBottom)}),this.setupQueryParamsSubscription()}ngOnInit(){this.getAvailablePermissions(),this.loadComponentData(),this.pollGeneratingStatements()}ngOnDestroy(){this.destroyed$.next(!0),this.destroyed$.complete(),this.stopPolling(),Ae(M.onlyLeftMedium),Ae(M.noBottom)}ngAfterViewInit(){this.statementsEventsService.getStatementDialogSubscriber().pipe(_(this.destroyed$)).subscribe(n=>{switch(n.dialog){case Pe.delete:this.openDeleteStatementDialog(n.statement);break;case Pe.settings:this.setSelectedStatement(n.statement.statementId,{queryParams:{viewSettings:!0}});break}}),this.statementsState$.pipe(_(this.destroyed$)).subscribe(n=>{n&&(this.loadComponentData(),this.pollGeneratingStatements())})}pollGeneratingStatements(){this.statements.filter(e=>e.numberOfVersions===0).forEach(e=>{this.statementsFacadeService.startPollingStatementsById(e.statementId)})}stopPolling(){this.cancelPollRequestService.stopAllPolling()}loadComponentData(){return v(this,null,function*(){try{yield this.getStatements(),yield this.loadStatementsPreferences(),this.currencyDict=yield this.currencyFacadeService.getCurrencyDict(),this.initStatementsViewModel(),this.isLoading=!1}catch(n){throw this.hasError=!0,this.isLoading=!1,this.snackbar.open(F.tryAgainMsg,null,{duration:6e3}),new Error(n)}})}getStatements(n){return v(this,null,function*(){try{let e=(yield this.statementsFacadeService.getStatements(n))||[];this.statements=e}catch{this.hasError=!0,this.isLoading=!1,this.snackbar.open(F.tryAgainMsg,null,{duration:6e3})}})}initStatementsViewModel(){try{this.viewModel=new ye(this.statements||[],this.statementsPreferences,this.currencyDict,this.userAvailablePermissions)}catch(n){throw new Error(n)}}loadStatementsPreferences(){return v(this,null,function*(){try{let n=yield this.preferencesFacadeService.getPreferenceByKey("statementsPreferences");n?this.statementsPreferences=n:this.statementsPreferences={favorites:[]}}catch(n){throw new Error(n)}})}postStatementsPagePreferences(){return v(this,null,function*(){try{let n=this.statementsPreferences;yield this.preferencesFacadeService.updatePreferencesByKey("statementsPreferences",n)}catch(n){throw new Error(n)}})}aiInsightsPanelToggle(){this.insightsEventsService.togglePanel()}getAvailablePermissions(){this.userAvailablePermissions$.pipe(_(this.destroyed$)).subscribe(n=>{this.userAvailablePermissions=n,this.hasReadInsightsPermission.set(n?.has(ke.readInsights)??!1)})}setupQueryParamsSubscription(){this.activatedRoute.queryParamMap.pipe(_(this.destroyed$)).subscribe(n=>{n.get("action")==="create"&&(this.createStatement(),this.clearCreateActionQueryParam())})}canDeactivate(){return Be(!0)}createStatement(){this.dialogAnimation.open(rn,{autoFocus:!1,disableClose:!0,width:"550px",position:{top:"0",right:"0"},height:"100%",id:"createStatementDialog",panelClass:"side-dialog-container",restoreFocus:!1,animation:{to:"left",incomingOptions:{keyframeAnimationOptions:{easing:"ease-in-out",duration:200}},outgoingOptions:{keyframeAnimationOptions:{easing:"ease-in-out",duration:200}}}}).afterClosed().subscribe(e=>v(this,null,function*(){e&&(yield this.getStatements(!0),this.initStatementsViewModel(),this.pollGeneratingStatements())}))}clearCreateActionQueryParam(){let n=Ve({},this.activatedRoute.snapshot.queryParams);delete n.action;let e=this.router.createUrlTree([],{relativeTo:this.activatedRoute,queryParams:n}),l=this.router.serializeUrl(e);this.location.replaceState(l)}deleteSnack(n){this.toggleFavorite(n.id)}toggleFavorite(n){this.statementsPreferences.favorites.includes(n)?this.removeFromFavorites(n):this.addFavorites(n),this.postStatementsPagePreferences(),this.initStatementsViewModel()}changeOrder(n){if(n.currentIndex!==n.previousIndex){let e=this.viewModel.snackCarousel.snacks.splice(n.previousIndex,1)[0];this.viewModel.snackCarousel.snacks.splice(n.currentIndex,0,e);let l=this.statementsPreferences.favorites.findIndex(i=>e.id===i);this.statementsPreferences.favorites.splice(l,1),this.statementsPreferences.favorites.splice(n.currentIndex,0,e.id),this.postStatementsPagePreferences()}}removeFromFavorites(n){this.statementsPreferences.favorites=this.statementsPreferences.favorites.filter(e=>e!==n)}addFavorites(n){this.statementsPreferences.favorites.push(n)}onRowClicked(n){n.eventClickedViewVersion?this.setSelectedStatement
1(n.itemId,{queryParams:{viewVersion:!0}}):this.setSelectedStatement(n.itemId)}setSelectedStatement(n,e){this.router.navigate([`/statements/statement/${n}`],e)}menuOptionClicked({option:n,row:e}){switch(n.optionId){case"favorite":this.toggleFavorite(e.statement.statementId);break;case"settings":this.setSelectedStatement(e.statement.statementId,{queryParams:{viewSettings:!0}});break;case"delete":this.openDeleteStatementDialog(e.statement);break}}deleteStatement(n){return v(this,null,function*(){try{yield this.statementsFacadeService.deleteStatement(n)}catch{this.snackbar.open(F.tryAgainMsg,null,{duration:6e3}),this.isLoading=!1}yield this.getStatements(!0),this.initStatementsViewModel()})}openDeleteStatementDialog(n){let e=this.dialog.open(Lt,{data:{crudDialogViewModel:{objectType:"statement",objectFields:[{title:n.name,value:null,type:"statement"}],includePermanentWarning:!0,onConfirmAction:()=>v(this,null,function*(){yield this.deleteStatement(n.statementId),e.close()})}}})}static{this.\u0275fac=function(e){return new(e||t)(d(ft),d(Se),d(bt),d(dt),d(me),d(ge),d(Nt),d(Y),d(ee),d(Ye),d(Ue),d(Qe),d(Rt))}}static{this.\u0275cmp=P({type:t,selectors:[["trovata-statements-page"]],viewQuery:function(e,l){if(e&1&&z(oi,5),e&2){let i;J(i=H())&&(l.statementSnackComponent=i.first)}},decls:10,vars:12,consts:[["container",""],["data-heap-feature","statements",1,"statements-page-container"],[3,"isDoneLoading","noHeaderDivider","title"],["cta-projection","","matTooltipShowDelay","700",3,"matTooltip"],["class","new-statement-button","mat-flat-button","","color","primary",3,"disabled","click",4,"ngIf"],["expand-projection","",4,"ngIf"],[3,"viewModel","dragAndDrop","showMenu","containerWidth","dropped","delete",4,"ngIf"],[3,"rowClicked","menuOptionClicked","isLoading","viewModel"],["mat-flat-button","","color","primary",1,"new-statement-button",3,"click","disabled"],["expand-projection",""],[3,"showDivider"],[3,"dropped","delete","viewModel","dragAndDrop","showMenu","containerWidth"]],template:function(e,l){if(e&1){let i=w();a(0,"div",1)(1,"trovata-sticky-page-header",2)(2,"div",3),D(3,"utilityText"),u(4,ri,2,1,"button",4),s(),u(5,si,2,1,"div",5),s(),a(6,"div",null,0),u(8,li,1,4,"app-snack-carousel",6),s(),a(9,"trovata-statements-list",7),h("rowClicked",function(S){return g(i),f(l.onRowClicked(S))})("menuOptionClicked",function(S){return g(i),f(l.menuOptionClicked(S))}),s()()}e&2&&(r(),o("isDoneLoading",!0)("noHeaderDivider",!0)("title","Statements (beta)"),r(),Ge("matTooltip",We(3,9,"permissionTooltip",!(l.userAvailablePermissions!=null&&l.userAvailablePermissions.has(l.permissionId.createStatements)))),r(2),o("ngIf",l.userAvailablePermissions),r(),o("ngIf",l.hasReadInsightsPermission()),r(3),o("ngIf",!l.isLoading),r(),o("isLoading",l.isLoading)("viewModel",l.viewModel==null?null:l.viewModel.statementsListViewModel))},dependencies:[fe,de,N,Z,Yt,sn,Vt,Gt],styles:[".statements-page-container[_ngcontent-%COMP%]{padding-right:48px}.new-statement-button[_ngcontent-%COMP%]{margin:0}"]})}};W([te(jt),Q("design:type",$)],E.prototype,"statementsState$",void 0);W([te(Fe.permissionIds),Q("design:type",$)],E.prototype,"userAvailablePermissions$",void 0);W([te(Fe.hasPermission(mt.statements)),Q("design:type",$)],E.prototype,"shouldSeeStatements$",void 0);var Ao=[{path:"",component:E,canActivate:[ne,Oe],canDeactivate:[nn],runGuardsAndResolvers:"always"},{path:"statement/:statementId",loadComponent:()=>import("./chunk-MKYRTLBU.js").then(t=>t.StatementViewComponent),canActivate:[ne,Oe]},{path:"ad",loadComponent:()=>import("./chunk-NLZOGZCM.js").then(t=>t.AdvertisementPageComponent),canActivate:[ne,tn],data:en.get(Zt.statements)}];export{Ao as statementsRoutes};
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.