1"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[4576],{1942(Ee,te,h){h.d(te,{G:()=>l});class l{}},4997(Ee,te,h){h.d(te,{y:()=>H});var l=h(3664),f=h(2615),g=h(2200),ne=h(7798);function re(P,T){if(1&P&&(l.j41(0,"div",4),l.EFF(1),l.k0s()),2&P){const C=T.$implicit;l.R7$(),l.JRh(C)}}function u(P,T){if(1&P&&(l.j41(0,"ion-avatar",18),l.nrm(1,"ion-img",19),l.k0s()),2&P){const C=l.XpG().$implicit;l.R7$(),l.Y8G("src",C.imageUrl)}}function ee(P,T){if(1&P&&l.nrm(0,"ion-icon",20),2&P){const C=l.XpG().$implicit;l.Y8G("name",C.iconName)}}function X(P,T){if(1&P&&(l.j41(0,"span",21),l.EFF(1),l.k0s()),2&P){const C=l.XpG().$implicit;l.R7$(),l.JRh(C.summary)}}function ie(P,T){if(1&P){const C=l.RV6();l.j41(0,"div",12),l.bIt("click",function(){const c=f.eBV(C).$implicit,V=l.XpG(4);return f.Njj(V.onEventClick(c))}),l.DNE(1,u,2,1,"ion-avatar",13)(2,ee,1,1,"ion-icon",14),l.j41(3,"div",15)(4,"span",16),l.EFF(5),l.k0s(),l.DNE(6,X,2,1,"span",17),l.k0s()()}if(2&P){const C=T.$implicit;l.AVh("cal-event--birthday","Birthday"===C.typeLabel)("cal-event--custom","Custom"===C.typeLabel)("cal-event--global","Global"===C.typeLabel&&!C.isHoliday)("cal-event--holiday",C.isHoliday)("cal-event--gift-exchange","Event"===C.typeLabel&&C.isGiftExchange)("cal-event--spoyla","Event"===C.typeLabel&&!C.isGiftExchange)("cal-event--clickable",C.isNavigable),l.R7$(),l.Y8G("ngIf",C.imageUrl),l.R7$(),l.Y8G("ngIf",!C.imageUrl),l.R7$(3),l.JRh(C.title),l.R7$(),l.Y8G("ngIf","Birthday"===C.typeLabel&&C.summary)}}function e(P,T){if(1&P&&(l.j41(0,"div",10),l.DNE(1,ie,7,18,"div",11),l.k0s()),2&P){const C=l.XpG().$implicit;l.R7$(),l.Y8G("ngForOf",C.events)}}function ae(P,T){if(1&P&&(l.j41(0,"div",7)(1,"div",8),l.EFF(2),l.k0s(),l.DNE(3,e,2,1,"div",9),l.k0s()),2&P){const C=T.$implicit;l.AVh("cal-day--outside",!C.isCurrentMonth)("cal-day--today",C.isToday)("cal-day--has-events",C.events.length>0),l.R7$(2),l.JRh(C.dayNumber),l.R7$(),l.Y8G("ngIf",C.isCurrentMonth&&C.events.length>0)}}function O(P,T){if(1&P&&(l.j41(0,"div",5),l.DNE(1,ae,4,8,"div",6),l.k0s()),2&P){const C=T.$implicit;l.R7$(),l.Y8G("ngForOf",C.days)}}let H=(()=>{var P;class T{constructor(){this.weeks=[],this.weekdayHeaders=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],this.eventClicked=new l.bkB,this.spoylaEventClicked=new l.bkB}onEventClick(q){q.actionEventId?this.spoylaEventClicked.emit(q):q.actionUserId&&this.eventClicked.emit(q.actionUserName||q.actionUserId)}static#e=P=()=>(this.\u0275fac=function(c){return new(c||T)},this.\u0275cmp=l.VBU({type:T,selectors:[["app-calendar-grid"]],inputs:{weeks:"weeks",weekdayHeaders:"weekdayHeaders"},outputs:{eventClicked:"eventClicked",spoylaEventClicked:"spoylaEventClicked"},standalone:!1,decls:4,vars:2,consts:[[1,"cal-grid"],[1,"cal-header"],["class","cal-header-cell",4,"ngFor","ngForOf"],["class","cal-week",4,"ngFor","ngForOf"],[1,"cal-header-cell"],[1,"cal-week"],["class","cal-day",3,"cal-day--outside","cal-day--today","cal-day--has-events",4,"ngFor","ngForOf"],[1,"cal-day"],[1,"cal-day-number"],["class","cal-day-events",4,"ngIf"],[1,"cal-day-events"],["class","cal-event",3,"cal-event--birthday","cal-event--custom","cal-event--global","cal-event--holiday","cal-event--gift-exchange","cal-event--spoyla","cal-event--clickable","click",4,"ngFor","ngForOf"],[1,"cal-event",3,"click"],["class","cal-event-avatar",4,"ngIf"],["class","cal-event-icon",3,"name",4,"ngIf"],[1,"cal-event-copy"],[1,"cal-event-title"],["class","cal-event-summary",4,"ngIf"],[1,"cal-event-avatar"],[3,"src"],[1,"cal-event-icon",3,"name"],[1,"cal-event-summary"]],template:function(c,V){1&c&&(l.j41(0,"div",0)(1,"div",1),l.DNE(2,re,2,1,"div",2),l.k0s(),l.DNE(3,O,2,1,"div",3),l.k0s()),2&c&&(l.R7$(2),l.Y8G("ngForOf",V.weekdayHeaders),l.R7$(),l.Y8G("ngForOf",V.weeks))},dependencies:[g.Sq,g.bT,ne.mC,ne.iq,ne.KW],styles:["[_nghost-%COMP%]{display:block}.cal-grid[_ngcontent-%COMP%]{background:var(--spoyla-porcelain);border-radius:20px;border:1px solid var(--border-soft);box-shadow:var(--shadow-card);overflow:hidden}.cal-header[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border-bottom:1px solid var(--spoyla-line-cool)}.cal-header-cell[_ngcontent-%COMP%]{padding:12px 4px 10px;text-align:center;font-family:var(--spoyla-font-body);font-size:12px;font-weight:600;color:var(--spoyla-text-muted);text-transform:uppercase;letter-spacing:.04em}.cal-week[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}.cal-week[_ngcontent-%COMP%] + .cal-week[_ngcontent-%COMP%]{border-top:1px solid rgba(var(--spoyla-line-cool-rgb),.5)}.cal-day[_ngcontent-%COMP%]{min-height:135px;padding:8px 6px 6px;display:flex;flex-direction:column;gap:3px;position:relative;border-right:1px solid rgba(var(--spoyla-line-cool-rgb),.35);box-sizing:border-box;overflow:hidden;min-width:0}
1.cal-day[_ngcontent-%COMP%]:last-child{border-right:none}.cal-day--outside[_ngcontent-%COMP%]{background:rgba(var(--spoyla-line-cool-rgb),.12)}.cal-day--outside[_ngcontent-%COMP%] .cal-day-number[_ngcontent-%COMP%]{color:rgba(var(--ion-color-medium-rgb),.35)}.cal-day--today[_ngcontent-%COMP%] .cal-day-number[_ngcontent-%COMP%]{background:var(--ion-color-primary);color:#fff;border-radius:50%;width:26px;height:26px;display:flex;align-items:center;justify-content:center;font-weight:700}.cal-day--has-events[_ngcontent-%COMP%]{background:rgba(var(--event-legend-personal-rgb),.06)}.cal-day-number[_ngcontent-%COMP%]{font-family:var(--spoyla-font-body);font-size:13px;font-weight:500;color:var(--spoyla-text-strong);line-height:1;padding:2px 0;margin-bottom:2px;text-align:center;flex-shrink:0}.cal-day-events[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:4px;flex:1;min-height:0;overflow:hidden}.cal-event[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:6px;min-height:38px;cursor:default;transition:opacity .15s ease;overflow:hidden}.cal-event[_ngcontent-%COMP%]:hover{opacity:.85}.cal-event--clickable[_ngcontent-%COMP%]{cursor:pointer}.cal-event--birthday[_ngcontent-%COMP%]{min-height:50px;background:rgba(var(--event-legend-birthday-rgb),.18);border-left:3px solid var(--event-legend-birthday)}.cal-event--custom[_ngcontent-%COMP%]{background:rgba(var(--event-legend-personal-rgb),.18);border-left:3px solid var(--event-legend-personal)}.cal-event--global[_ngcontent-%COMP%]{background:rgba(var(--spoyla-action-champagne-rgb),.3);border-left:3px solid var(--spoyla-action-champagne)}.cal-event--holiday[_ngcontent-%COMP%]{background:var(--spoyla-holiday-tint);border-left:3px solid var(--spoyla-holiday-ink)}.cal-event--spoyla[_ngcontent-%COMP%]{background:rgba(var(--event-legend-event-rgb),.18);border-left:3px solid var(--event-legend-event)}.cal-event--gift-exchange[_ngcontent-%COMP%]{background:rgba(var(--event-legend-giftexchange-rgb),.18);border-left:3px solid var(--event-legend-giftexchange)}.cal-event-avatar[_ngcontent-%COMP%]{width:22px;height:22px;flex-shrink:0}.cal-event-icon[_ngcontent-%COMP%]{font-size:16px;flex-shrink:0;color:var(--spoyla-text-muted)}.cal-event-copy[_ngcontent-%COMP%]{display:flex;flex:1;flex-direction:column;min-width:0;overflow:hidden}.cal-event-title[_ngcontent-%COMP%]{font-size:11px;font-weight:600;color:var(--spoyla-text-strong);display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.2}.cal-event-summary[_ngcontent-%COMP%]{display:block;margin-top:1px;font-size:10px;font-weight:500;color:var(--spoyla-text-subtle);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.15}.cal-event--birthday[_ngcontent-%COMP%] .cal-event-avatar[_ngcontent-%COMP%]{width:30px;height:30px}.cal-event--birthday[_ngcontent-%COMP%] .cal-event-icon[_ngcontent-%COMP%]{font-size:22px}@media (min-width: 1200px){.cal-day[_ngcontent-%COMP%]{min-height:165px;padding:8px;gap:4px}.cal-day-number[_ngcontent-%COMP%]{font-size:14px}.cal-event[_ngcontent-%COMP%]{padding:7px 10px;min-height:42px;gap:8px;border-radius:8px}.cal-event-title[_ngcontent-%COMP%]{font-size:12px}.cal-event-summary[_ngcontent-%COMP%]{font-size:11px}.cal-event-avatar[_ngcontent-%COMP%]{width:24px;height:24px}.cal-event-icon[_ngcontent-%COMP%]{font-size:18px}.cal-event--birthday[_ngcontent-%COMP%]{min-height:56px}.cal-event--birthday[_ngcontent-%COMP%] .cal-event-avatar[_ngcontent-%COMP%]{width:34px;height:34px}.cal-event--birthday[_ngcontent-%COMP%] .cal-event-icon[_ngcontent-%COMP%]{font-size:24px}}"]}))}return P(),T})()},5945(Ee,te,h){h.d(te,{g:()=>me});var l=h(3664),f=h(2615),g=h(2200),ne=h(7798);function re(b,S){if(1&b&&(l.j41(0,"div",11),l.EFF(1),l.k0s()),2&b){const m=S.$implicit;l.R7$(),l.JRh(m)}}function u(b,S){if(1&b&&(l.j41(0,"div",12)(1,"span",13),l.EFF(2),l.k0s()()),2&b){const m=S.$implicit;l.AVh("mini-cal-cell--outside",!m.isCurrentMonth)("mini-cal-cell--today",m.isToday)("mini-cal-cell--has-event",m.hasBirthday&&!m.isToday)("mini-cal-cell--gifting",(m.hasCu
1stom||m.hasGlobal)&&!m.hasBirthday&&!m.hasHoliday&&!m.isToday)("mini-cal-cell--holiday",m.hasHoliday&&!m.isToday)("mini-cal-cell--spoyla",m.hasSpoylaEvent&&!m.hasBirthday&&!m.hasHoliday&&!m.isToday),l.R7$(2),l.JRh(m.dayNumber)}}function ee(b,S){if(1&b&&(l.qex(0),l.EFF(1),l.bVm()),2&b){const m=l.XpG();l.R7$(),l.SpI(" No events in ",m.monthLabel," ")}}function X(b,S){if(1&b&&(l.EFF(0),l.j41(1,"span",14),l.EFF(2),l.k0s()),2&b){const m=l.XpG();l.SpI(" ",m.monthLabel," "),l.R7$(2),l.JRh(m.events.length)}}function ie(b,S){if(1&b&&l.nrm(0,"img",32),2&b){const m=l.XpG(2).$implicit;l.Y8G("src",m.imageUrl,l.B4B)}}function e(b,S){if(1&b&&l.nrm(0,"ion-icon",33),2&b){const m=l.XpG(2).$implicit;l.Y8G("name",m.iconName)}}function ae(b,S){1&b&&(l.j41(0,"span",34),l.EFF(1,"Draft"),l.k0s())}function O(b,S){1&b&&(l.j41(0,"span",35),l.nrm(1,"ion-icon",36),l.EFF(2," Not published yet "),l.k0s())}function H(b,S){if(1&b&&(l.j41(0,"span",35),l.nrm(1,"ion-icon",37),l.EFF(2),l.k0s()),2&b){const m=l.XpG(2).$implicit;l.R7$(2),l.SpI(" ",m.goingCount," going ")}}function P(b,S){if(1&b){const m=l.RV6();l.j41(0,"div",17),l.bIt("click",function(){f.eBV(m);const N=l.XpG().$implicit,$=l.XpG();return f.Njj($.onEventClick(N))}),l.j41(1,"div",18),l.DNE(2,ie,1,1,"img",19)(3,e,1,1,"ion-icon",20),l.nrm(4,"span",21),l.j41(5,"span",22),l.nrm(6,"ion-icon",23),l.EFF(7),l.k0s(),l.DNE(8,ae,2,0,"span",24),l.j41(9,"div",25)(10,"div",26),l.EFF(11),l.k0s(),l.j41(12,"div",27),l.EFF(13),l.k0s()()(),l.j41(14,"div",28),l.DNE(15,O,3,0,"span",29)(16,H,3,1,"span",29),l.j41(17,"button",30),l.bIt("click",function(N){f.eBV(m);const $=l.XpG().$implicit,K=l.XpG();return N.stopPropagation(),f.Njj(K.onEventClick($))}),l.nrm(18,"ion-icon",31),l.EFF(19," RSVP "),l.k0s()()()}if(2&b){const m=l.XpG().$implicit;l.R7$(),l.AVh("fev__cover--fallback",!m.imageUrl&&"event"===m.chipKind)("fev__cover--fallback-santa",!m.imageUrl&&"giftExchange"===m.chipKind),l.R7$(),l.Y8G("ngIf",m.imageUrl),l.R7$(),l.Y8G("ngIf",!m.imageUrl),l.R7$(3),l.Y8G("name",m.iconName),l.R7$(),l.SpI(" ",m.chipLabel," "),l.R7$(),l.Y8G("ngIf",m.isDraft),l.R7$(3),l.JRh(m.title),l.R7$(2),l.E5c("",m.weekdayText,", ",m.dayNumberText," ",m.monthText),l.R7$(2),l.Y8G("ngIf",m.isDraft),l.R7$(),l.Y8G("ngIf",!m.isDraft&&m.goingCount)}}function T(b,S){if(1&b&&l.nrm(0,"img",48),2&b){const m=l.XpG(2).$implicit;l.Y8G("src",m.imageUrl,l.B4B)}}function C(b,S){if(1&b&&l.nrm(0,"ion-icon",23),2&b){const m=l.XpG(2).$implicit;l.Y8G("name",m.iconName)}}function q(b,S){if(1&b&&(l.j41(0,"span",49),l.EFF(1),l.k0s()),2&b){const m=l.XpG(2).$implicit;l.AVh("evrow__tag--holiday","holiday"===m.chipKind)("evrow__tag--personal","personal"===m.chipKind),l.R7$(),l.JRh(m.chipLabel)}}function c(b,S){if(1&b&&(l.qex(0),l.EFF(1),l.bVm()),2&b){const m=l.XpG(2).$implicit;l.R7$(),l.SpI(" \xb7 ",m.summary)}}function V(b,S){1&b&&l.nrm(0,"ion-icon",50)}function se(b,S){if(1&b){const m=l.RV6();l.j41(0,"div",38),l.bIt("click",function(){f.eBV(m);const N=l.XpG().$implicit,$=l.XpG();return f.Njj($.onEventClick(N))}),l.j41(1,"div",39),l.DNE(2,T,1,1,"img",40)(3,C,1,1,"ion-icon",41),l.k0s(),l.j41(4,"div",42)(5,"div",43),l.EFF(6),l.k0s(),l.j41(7,"div",44),l.DNE(8,q,2,5,"span",45),l.EFF(9),l.DNE(10,c,2,1,"ng-container",46),l.k0s()(),l.DNE(11,V,1,0,"ion-icon",47),l.k0s()}if(2&b){const m=l.XpG().$implicit;l.AVh("evrow--not-navigable",!m.isNavigable),l.R7$(2),l.Y8G("ngIf",m.imageUrl),l.R7$(),l.Y8G("ngIf",!m.imageUrl),l.R7$(3),l.JRh(m.title),l.R7$(2),l.Y8G("ngIf",m.chipKind),l.R7$(),l.E5c(" ",m.weekdayText,", ",m.dayNumberText," ",m.monthText),l.R7$(),l.Y8G("ngIf",m.summary),l.R7$(),l.Y8G("ngIf",m.isNavigable)}}function pe(b,S){if(1&b&&(l.qex(0),l.DNE(1,P,20,15,"div",15)(2,se,12,11,"div",16),l.bVm()),2&b){const m=S.$implicit;l.R7$(),l.Y8G("ngIf","event"===m.chipKind||"giftExchange"===m.chipKind),l.R7$(),l.Y8G("ngIf","event"!==m.chipKind&&"giftExchange"!==m.chipKind)}}let me=(()=>{var b;class S{constructor(){this.events=[],this.currentYear=(new Date).getFullYear(),this.currentMonth=(new Date).getMonth(),this.monthLabel="",this.eventClicked=new l.bkB,this.spoylaEventClicked=new l.bkB,this.weekdayHeaders=["M","T","W","T","F","S","S"],this.miniDays=[]}ngOnChanges(F){(F.events||F.currentYear||F.currentMonth)&&this.buildMiniCalendar(
1)}onEventClick(F){F.actionEventId?this.spoylaEventClicked.emit(F):F.actionUserId&&this.eventClicked.emit(F.actionUserName||F.actionUserId)}buildMiniCalendar(){const F=new Date(this.currentYear,this.currentMonth,1),N=new Date(this.currentYear,this.currentMonth+1,0).getDate(),$=new Date(this.currentYear,this.currentMonth,0).getDate();let K=F.getDay()-1;K<0&&(K=6);const ve=new Date,Ue=ve.getFullYear()===this.currentYear&&ve.getMonth()===this.currentMonth,Ae=ve.getDate(),ue=new Map,ke=new Set,Ce=new Set;for(const J of this.events){const Q=J.day;ue.has(Q)||ue.set(Q,new Set),ue.get(Q).add(J.typeLabel),"holiday"===J.chipKind&&ke.add(Q),J.actionEventId&&Ce.add(Q)}const ge=[],je=7*Math.ceil((K+N)/7);let oe=1,Ge=1;for(let J=0;J<je;J++)if(J<K)ge.push({dayNumber:$-K+J+1,isCurrentMonth:!1,isToday:!1,hasBirthday:!1,hasCustom:!1,hasGlobal:!1,hasHoliday:!1,hasSpoylaEvent:!1});else if(oe<=N){const Q=ue.get(oe);ge.push({dayNumber:oe,isCurrentMonth:!0,isToday:Ue&&oe===Ae,hasBirthday:Q?.has("Birthday")??!1,hasCustom:Q?.has("Custom")??!1,hasGlobal:Q?.has("Global")??!1,hasHoliday:ke.has(oe),hasSpoylaEvent:Ce.has(oe)}),oe++}else ge.push({dayNumber:Ge,isCurrentMonth:!1,isToday:!1,hasBirthday:!1,hasCustom:!1,hasGlobal:!1,hasHoliday:!1,hasSpoylaEvent:!1}),Ge++;this.miniDays=ge}static#e=b=()=>(this.\u0275fac=function(N){return new(N||S)},this.\u0275cmp=l.VBU({type:S,selectors:[["app-calendar-list"]],inputs:{events:"events",currentYear:"currentYear",currentMonth:"currentMonth",monthLabel:"monthLabel"},outputs:{eventClicked:"eventClicked",spoylaEventClicked:"spoylaEventClicked"},standalone:!1,features:[l.OA$],decls:12,vars:7,consts:[["eventCount",""],[1,"mini-cal"],[1,"mini-cal-header"],["class","mini-cal-header-cell",4,"ngFor","ngForOf"],[1,"mini-cal-grid"],["class","mini-cal-cell",3,"mini-cal-cell--outside","mini-cal-cell--today","mini-cal-cell--has-event","mini-cal-cell--gifting","mini-cal-cell--holiday","mini-cal-cell--spoyla",4,"ngFor","ngForOf"],[1,"evgroup"],[1,"evgroup__h"],["name","balloon-outline",1,"heading-icon"],[4,"ngIf","ngIfElse"],[4,"ngFor","ngForOf"],[1,"mini-cal-header-cell"],[1,"mini-cal-cell"],[1,"mini-cal-number"],[1,"evgroup__n"],["class","fev",3,"click",4,"ngIf"],["class","evrow",3,"evrow--not-navigable","click",4,"ngIf"],[1,"fev",3,"click"],[1,"fev__cover"],["class","fev__img",3,"src",4,"ngIf"],["class","fev__motif","aria-hidden","true",3,"name",4,"ngIf"],[1,"fev__veil"],[1,"fev__tag"],[3,"name"],["class","fev__when",4,"ngIf"],[1,"fev__head"],[1,"fev__name"],[1,"fev__date"],[1,"fev__foot"],["class","fev__going",4,"ngIf"],["type","button",1,"fev__rsvp",3,"click"],["name","checkmark"],[1,"fev__img",3,"src"],["aria-hidden","true",1,"fev__motif",3,"name"],[1,"fev__when"],[1,"fev__going"],["name","eye-off-outline"],["name","people-outline"],[1,"evrow",3,"click"],[1,"evrow__disc"],["class","evrow__av-img",3,"src",4,"ngIf"],[3,"name",4,"ngIf"],[1,"evrow__body"],[1,"evrow__n"],[1,"evrow__m"],["class","evrow__tag",3,"evrow__tag--holiday","evrow__tag--personal",4,"ngIf"],[4,"ngIf"],["name","chevron-forward-outline","class","evrow__arrow",4,"ngIf"],[1,"evrow__av-img",3,"src"],[1,"evrow__tag"],["name","chevron-forward-outline",1,"evrow__arrow"]],template:function(N,$){if(1&N&&(l.j41(0,"div",1)(1,"div",2),l.DNE(2,re,2,1,"div",3),l.k0s(),l.j41(3,"div",4),l.DNE(4,u,3,13,"div",5),l.k0s()(),l.j41(5,"div",6)(6,"h3",7),l.nrm(7,"ion-icon",8),l.DNE(8,ee,2,1,"ng-container",9)(9,X,3,2,"ng-template",null,0,l.C5r),l.k0s(),l.DNE(11,pe,3,2,"ng-container",10),l.k0s()),2&N){const K=l.sdS(10);l.R7$(2),l.Y8G("ngForOf",$.weekdayHeaders),l.R7$(2),l.Y8G("ngForOf",$.miniDays),l.R7$(3),l.AVh("no-events",0===$.events.length),l.R7$(),l.Y8G("ngIf",0===$.events.length)("ngIfElse",K),l.R7$(3),l.Y8G("ngForOf",$.events)}},dependencies:[g.Sq,g.bT,ne.iq],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block}.mini-cal[_ngcontent-%COMP%]{background:var(--spoyla-porcelain);border-radius:20px;border:1px solid var(--border-soft);box-shadow:var(--shadow-card);padding:16px 12px;margin-bottom:28px}.mini-cal-header[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:8px}.mini-cal-header-cell[_ngcontent-%COMP%]{text-align:center;font-family:var(--spoyla-font-body);font-size:11px;font-weight:600;color:var(--spoyla-text-muted);text-transform:uppercase;letter-spacing:.03em;padding:4px 0}.mini-cal-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(7,1fr);gap:2px 0}.mini-cal-cell[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;padding:4px 0;min-height:40px}.mini-cal-number[_ngcontent-%COMP%]{font-family:var(--spoyla-font-body);font-size:14px;font-weight:500;color:var(--spoyla-text-strong);width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:50%;line-height:1;border:1px solid transparent}.mini-cal-cell--outside[_ngcontent-%COMP%] .mini-cal-number[_ngcontent-%COMP%]{color:rgba(var(--ion-color-medium-rgb),.3)}.mini-cal-cell--has-event[_ngcontent-%COMP%] .mini-cal-number[_ngcontent-%COMP%]{background:rgba(var(--event-legend-personal-rgb),.2);border-color:rgba(var(--event-legend-personal-rgb),.35);box-shadow:inset 0 1px 2px #ffffff73,inset 0 -1px 2px #2e34400f;font-weight:700}.mini-cal-cell--gifting[_ngcontent-%COMP%] .mini-cal-number[_ngcontent-%COMP%]{background:var(--spoyla-action-champagne-soft);border-color:var(--spoyla-action-champagne-press);color:var(--spoyla-champagne-deep);font-weight:700;box-shadow:none}.mini-cal-cell--spoyla[_ngcontent-%COMP%] .mini-cal-number[_ngcontent-%COMP%]{background:rgba(var(--event-legend-event-rgb),.18);border-color:var(--event-legend-event);color:var(--spoyla-green-shade);font-weight:700;box-shadow:none}.mini-cal-cell--holiday[_ngcontent-%COMP%] .mini-cal-number[_ngcontent-%COMP%]{background:var(--spoyla-holiday-tint);border-color:var(--spoyla-holiday-ink);color:var(--spoyla-holiday-ink);font-weight:700;box-shadow:none}.mini-cal-cell--today[_ngcontent-%COMP%] .mini-cal-number[_ngcontent-%COMP%]{background:var(--ion-color-primary);color:var(--action-primary-contrast);font-weight:700;border-color:transparent;box-shadow:none}.mini-cal-cell--today.mini-cal-cell--has-event[_ngcontent-%COMP%] .mini-cal-number[_ngcontent-%COMP%]{box-shadow:0 0 0 3px rgba(var(--event-legend-personal-rgb),.24)}.heading-icon[_ngcontent-%COMP%]{font-size:22px;color:var(--spoyla-accent-mauve)}.heading-icon.no-events[_ngcontent-%COMP%]{color:var(--spoyla-text-subtle)}']}))}return b(),S})()},2195(Ee,te,h){h.d(te,{EventsModule:()=>
1oa});var l=h(2200),f=h(4341),g=h(7798),ne=h(8132),re=h(5553),u=h(467),ee=h(8530),X=h(8989),ie=h(9927),e=h(3664),ae=h(6168),O=h(8375),H=h(744),P=h(2193);function T(r,a){1&r&&e.nrm(0,"ion-skeleton-text",27),2&r&&e.Y8G("animated",!0)}function C(r,a){1&r&&(e.j41(0,"span"),e.EFF(1,"Save changes"),e.k0s())}let q=(()=>{var r;class a{constructor(t,n,o,s){this.modalController=t,this.userReminderService=n,this.logger=o,this.common=s,this.isBusy=!1,this.reminderNameInput="",this.reminderDateInput="",this.canSave=!1,this.summaryText=""}ngOnInit(){this.reminderNameInput=this.reminder?.reminderName?.trim()||"",this.reminderDateInput=(0,ie.h)(this.reminder?.reminderDT)??this.toDateInputValue(new Date),this.onInputChange()}onInputChange(){const t=this.parseDateInputValue(this.reminderDateInput);this.canSave=this.reminderNameInput.trim().length>0&&null!==t,this.updateSummary(t)}saveChanges(){var t=this;return(0,u.A)(function*(){if(t.isBusy)return;const n=t.reminderNameInput.trim(),o=t.parseDateInputValue(t.reminderDateInput);if(n&&o)try{t.isBusy=!0;const s={...t.reminder,reminderName:n,reminderDT:o,isActive:!0};yield t.userReminderService.InsUpdUserReminder(s),yield t.modalController.dismiss({saved:!0})}catch(s){t.logger.LogError(s,"Failed to save reminder"),yield t.common.handleError(s,"Failed to save reminder")}finally{t.isBusy=!1}else yield t.common.showAlertDialog("Missing details","Please provide a name and date for your reminder.")})()}deleteReminder(){var t=this;return(0,u.A)(function*(){if(t.isBusy)return;const n=t.reminder?.reminderName?.trim()||"this reminder";if(yield t.common.showConfirmAlertDialog("Delete reminder",`Delete ${n}? This can't be undone.`))try{t.isBusy=!0;const s={...t.reminder,isActive:!1};yield t.userReminderService.InsUpdUserReminder(s),yield t.modalController.dismiss({saved:!0,deleted:!0})}catch(s){t.logger.LogError(s,"Failed to delete reminder"),yield t.common.handleError(s,"Failed to delete reminder")}finally{t.isBusy=!1}})()}dismiss(){var t=this;return(0,u.A)(function*(){t.isBusy||(yield t.modalController.dismiss())})()}updateSummary(t){if(!t)return void(this.summaryText="");const n=this.getStartOfDay(new Date),o=this.getNextOccurrenceDate(t,n),s=this.getDaysDifference(n,o),d=this.formatDaysAway(s),p=Math.max(0,o.getUTCFullYear()-t.getUTCFullYear()),_=p>0?`${this.getOrdinal(p)} anniversary`:"First anniversary";this.summaryText=`${_} \xb7 ${d}`}formatDaysAway(t){return 0===t?"today":1===t?"in 1 day":`in ${t} days`}getOrdinal(t){const n=t%100;if(n>=11&&n<=13)return`${t}th`;switch(t%10){case 1:return`${t}st`;case 2:return`${t}nd`;case 3:return`${t}rd`;default:return`${t}th`}}getNextOccurrenceDate(t,n){const o=new Date(Date.UTC(n.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()));return this.getDaysDifference(n,o)<-1?new Date(Date.UTC(n.getUTCFullYear()+1,t.getUTCMonth(),t.getUTCDate())):o}getStartOfDay(t){return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()))}getDaysDifference(t,n){const s=n.getTime()-t.getTime();return Math.round(s/864e5)}toDateInputValue(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}parseDateInputValue(t){const n=t.trim();if(!n)return null;const o=/^(\d{4})-(\d{2})-(\d{2})/.exec(n);if(!o)return null;const s=Number(o[1]),d=Number(o[2])-1,p=Number(o[3]),_=new Date(Date.UTC(s,d,p));return Number.isNaN(_.getTime())||_.getUTCFullYear()!==s||_.getUTCMonth()!==d||_.getUTCDate()!==p?null:_}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(g.W3),e.rXU(ae.Y),e.rXU(O.g),e.rXU(H.o))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-user-reminder-edit-sheet"]],inputs:{reminder:"reminder"},standalone:!1,decls:38,vars:9,consts:[[1,"sheetbar-header"],[1,"sheetbar-toolbar"],[1,"sheetbar"],["type","button","aria-label","Close",1,"sheetbar__action",3,"click","disabled"],["name","close"],[1,"sheetbar__title"],[1,"reminder-sheet",3,"ngSubmit"],[1,"reminder-sheet-body"],[1,"evrow","evrow--not-navigable"],[1,"evrow__disc"],["name","notifications-outline"],[1,"evrow__body"],[1,"evrow__n"],[1,"evrow__m"],[1,"reminder-field"],[1,"reminder-field__label"],["lines","none",1,"spoyla-input"],["name","reminderName","type","text","placeholder","e.g. Our anniversary",3,"ngModelChange","ngModel"],["for","reminder-edit-date",1,"reminder-field__label"],["name","reminderDate","label","Date","placeholder","Select a date","presentation","date",3,"ngModelChange","ngModel"],[1,"t-xs","t-subtle"],[1,"sheet-footer","sheet-footer--stack"],["expand","block","fill","solid","color","primary","type","button",3,"click","disabled"],["class","spoyla-skeleton-button-label",3,"animated",4,"ngIf"],[4,"ngIf"],["expand","block","fill","outline","color","danger","type","button",3,"click","disabled"],["name","trash-outline","slot","start"],[1,"spoyla-skeleton-button-label",3,"animated"]],template:function(n,o){1&n&&(e.j41(0,"ion-header",0)(1,"ion-toolbar",1)(2,"div",2)(3,"button",3),e.bIt("click",function(){return o.dismiss()}),e.nrm(4,"ion-icon",4),e.k0s(),e.j41(5,"h2",5),e.EFF(6,"Edit reminder"),e.k0s()()()(),e.j41(7,"ion-content")(8,"form",6),e.bIt("ngSubmit",function(){return o.saveChanges()}),e.j41(9,"div",7)(10,"div",8)(11,"span",9),e.nrm(12,"ion-icon",10),e.k0s(),e.j41(13,"div",11)(14,"div",12),e.
1EFF(15),e.k0s(),e.j41(16,"div",13),e.EFF(17),e.k0s()()(),e.j41(18,"div",14)(19,"label",15),e.EFF(20,"What's the occasion?"),e.k0s(),e.j41(21,"ion-item",16)(22,"ion-input",17),e.mxI("ngModelChange",function(d){return e.DH7(o.reminderNameInput,d)||(o.reminderNameInput=d),d}),e.bIt("ngModelChange",function(){return o.onInputChange()}),e.k0s()()(),e.j41(23,"div",14)(24,"label",18),e.EFF(25,"Date"),e.k0s(),e.j41(26,"app-date-time-picker",19),e.mxI("ngModelChange",function(d){return e.DH7(o.reminderDateInput,d)||(o.reminderDateInput=d),d}),e.bIt("ngModelChange",function(){return o.onInputChange()}),e.k0s(),e.j41(27,"p",20),e.EFF(28,"Repeats every year \u2014 pick the original date and we'll count the years for you."),e.k0s()()()()(),e.j41(29,"ion-footer")(30,"ion-toolbar")(31,"div",21)(32,"ion-button",22),e.bIt("click",function(){return o.saveChanges()}),e.DNE(33,T,1,1,"ion-skeleton-text",23)(34,C,2,0,"span",24),e.k0s(),e.j41(35,"ion-button",25),e.bIt("click",function(){return o.deleteReminder()}),e.nrm(36,"ion-icon",26),e.EFF(37," Delete reminder "),e.k0s()()()()),2&n&&(e.R7$(3),e.Y8G("disabled",o.isBusy),e.R7$(12),e.JRh(o.reminderNameInput||"Reminder"),e.R7$(2),e.JRh(o.summaryText),e.R7$(5),e.R50("ngModel",o.reminderNameInput),e.R7$(4),e.R50("ngModel",o.reminderDateInput),e.R7$(6),e.Y8G("disabled",o.isBusy||!o.canSave),e.R7$(),e.Y8G("ngIf",o.isBusy),e.R7$(),e.Y8G("ngIf",!o.isBusy),e.R7$(),e.Y8G("disabled",o.isBusy))},dependencies:[l.bT,f.qT,f.BC,f.cb,f.vS,f.cV,g.Jm,g.W9,g.M0,g.eU,g.iq,g.$w,g.uz,g.ds,g.ai,g.Gw,P.P],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%}"]}))}return r(),a})();var c=h(2615),V=h(8461),se=h(1830),pe=h(2408),me=h(6274),b=h(9819),S=h(3136),m=h(7024),F=h(2047),N=h(6893),$=h(9601),K=h(4997),ve=h(5945);function Ue(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",9)(1,"button",10),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openAddReminder())}),e.nrm(2,"ion-icon",11),e.j41(3,"span"),e.EFF(4,"Reminder"),e.k0s()(),e.j41(5,"button",12),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openCreateEventFromHeader())}),e.nrm(6,"ion-icon",11),e.j41(7,"span"),e.EFF(8,"Event"),e.k0s()(),e.j41(9,"button",13),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openCreateSecretSantaFromHeader())}),e.nrm(10,"ion-icon",11),e.j41(11,"span"),e.EFF(12,"Secret Santa"),e.k0s()(),e.j41(13,"button",14),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openEventSettings())}),e.nrm(14,"ion-icon",15),e.j41(15,"span"),e.EFF(16,"Settings"),e.k0s()()()}}function Ae(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",9)(1,"button",16),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openMobileAddSheet())}),e.nrm(2,"ion-icon",17),e.k0s(),e.j41(3,"button",14),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openEventSettings())}),e.nrm(4,"ion-icon",15),e.k0s()()}}function ue(r,a){1&r&&(e.j41(0,"div",32),e.nrm(1,"ion-skeleton-text",33),e.k0s()),2&r&&(e.R7$(),e.Y8G("animated",!0))}function ke(r,a){1&r&&(e.j41(0,"div",39),e.nrm(1,"ion-skeleton-text",40)(2,"ion-skeleton-text",41),e.k0s()),2&r&&(e.R7$(),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0))}function Ce(r,a){if(1&r&&(e.j41(0,"div",36),e.nrm(1,"ion-skeleton-text",37),e.DNE(2,ke,3,2,"div",38),e.k0s()),2&r){const i=a.$implicit;e.R7$(),e.Y8G("animated",!0),e.R7$(),e.Y8G("ngIf",i.hasEvent)}}function ge(r,a){if(1&r&&(e.j41(0,"div",34),e.DNE(1,Ce,3,2,"div",35),e.k0s()),2&r){const i=a.$implicit;e.R7$(),e.Y8G("ngForOf",i)}}function je(r,a){1&r&&(e.j41(0,"ion-card",42)(1,"div",43),e.nrm(2,"ion-skeleton-text",44),e.j41(3,"div",45),e.nrm(4,"ion-skeleton-text",46)(5,"ion-skeleton-text",47),e.k0s()()()),2&r&&(e.R7$(2),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0))}function oe(r,a){if(1&r&&(e.j41(0,"ion-row",18)(1,"ion-col",19)(2,"div",20)(3,"div",21),e.nrm(4,"ion-skeleton-text",22)(5,"ion-skeleton-text",23)(6,"ion-skeleton-text",22),e.k0s(),e.j41(7,"div",24)(8,"div",25)(9,"div",26),e.DNE(10,ue,2,1,"div",27),e.k0s(),e.DNE(11,ge,2,1,"div",28),e.k0s()(),e.j41(12,"div",29)(13,"div",30),e.DNE(14,je,6,3,"ion-card",31),e.k0s()()()()()),2&r){const i=e.XpG();e.R7$(4),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0),e.R7$(4),e.Y8G("ngForOf",i.skeletonWeekdays),e.R7$(),e.Y8G("ngForOf",i.skeletonWeeks),e.R7$(3),e.Y8G("ngForOf",i.skeletonEvents)}}function Ge(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-row",18)(1,"ion-col",19)(2,"app-page-load-error",48),e.bIt("retry",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.retryLoad())}),e.k0s()()()}}function J(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-row",18)(1,"ion-col",19)(2,"div",20)(3,"div",21)(4,"button",49),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.navigatePreviousMonth())}),e.nrm(5,"ion-icon",50),e.k0s(),e.j41(6,"span",51),e.EFF(7),e.k0s(),e.j41(8,"button",52),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.navigateNextMonth())}),e.nrm(9,"ion-icon",53),e.k0s()(),e.j41(10,"div",24)(11,"app-calendar-grid",54),e.bIt("eventClicked",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.openFriend(n))})("spoylaEventClicked",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.openSpoylaEvent(n))}),e.k0s()(),e.j41(12,"app-calendar-list",55),e.bIt("eventClicked",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.openFriend(n))})("spoylaEventClicked",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.openSpoylaEvent(n))}),e.k0s()()()()}if(2&r){const i=e.XpG();
1e.R7$(7),e.JRh(i.monthLabel),e.R7$(4),e.Y8G("weeks",i.calendarWeeks)("weekdayHeaders",i.weekdayHeaders),e.R7$(),e.Y8G("events",i.monthEvents)("currentYear",i.currentYear)("currentMonth",i.currentMonth)("monthLabel",i.monthLabel)}}let at=(()=>{var r;class a{constructor(t,n,o,s,d,p,_,v,y,I,E,R,U){this.reportedMediaService=t,this.nav=n,this.route=o,this.common=s,this.logger=d,this.modalController=p,this.friendshipService=_,this.userReminderService=v,this.globalEventOccurrenceService=y,this.eventService=I,this.giftExchangeService=E,this.mediaAssetService=R,this.sessionService=U,this.isBusy=!0,this.hasError=!1,this.monthLabel="",this.calendarWeeks=[],this.monthEvents=[],this.weekdayHeaders=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],this.totalEventCount=0,this.currentYear=(new Date).getFullYear(),this.currentMonth=(new Date).getMonth(),this.skeletonEvents=[0,1],this.skeletonWeekdays=[0,1,2,3,4,5,6],this.skeletonWeeks=[[{hasEvent:!1},{hasEvent:!0},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1}],[{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!0},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1}],[{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!0},{hasEvent:!1}],[{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1}],[{hasEvent:!1},{hasEvent:!1},{hasEvent:!0},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1},{hasEvent:!1}]],this.isDesktopViewport=!0,this.friends=[],this.userEvents=[],this.spoylaEvents=[],this.giftExchangeIdByEventId=new Map,this.currentUser=null,this.globalEventsByYear=new Map,this.hasConsumedQuickAddParam=!1,this.wideViewportListener=G=>{this.isDesktopViewport=G.matches},this.syncMonthLabel(),this.wideViewportQuery=typeof window<"u"&&"function"==typeof window.matchMedia?window.matchMedia("(min-width: 768px)"):null,this.wideViewportQuery&&(this.isDesktopViewport=this.wideViewportQuery.matches,this.wideViewportQuery.addEventListener("change",this.wideViewportListener))}ngOnDestroy(){this.wideViewportQuery?.removeEventListener("change",this.wideViewportListener)}ionViewWillEnter(){var t=this;return(0,u.A)(function*(){yield t.loadData(),yield t.consumeQuickAddParam()})()}retryLoad(){var t=this;return(0,u.A)(function*(){yield t.loadData()})()}openEventSettings(){var t=this;return(0,u.A)(function*(){yield t.nav.navigateForward("/app/friends/events/settings")})()}openCreateEventFromHeader(){var t=this;return(0,u.A)(function*(){yield t.openCreateEvent()})()}openCreateSecretSantaFromHeader(){var t=this;return(0,u.A)(function*(){yield t.nav.navigateForward("/app/secret-santa/create")})()}openAddReminder(){var t=this;return(0,u.A)(function*(){try{const n=yield t.modalController.create({component:X.G,componentProps:{initialMode:"reminder"},cssClass:"popup-modal"});yield n.present();const{data:o}=yield n.onDidDismiss();o?.saved&&(yield t.loadData())}catch(n){t.logger.LogError(n,"Error opening quick-add reminder")}})()}openAddSheet(){var t=this;return(0,u.A)(function*(){const n=yield t.modalController.create({component:X.G,cssClass:"popup-modal"});yield n.present();const{data:o}=yield n.onDidDismiss();o?.saved?yield t.loadData():"wish"!==o?.typeId?"event"!==o?.typeId?"santa"===o?.typeId&&(yield t.nav.navigateForward("/app/secret-santa/create")):yield t.openCreateEvent():yield t.nav.navigateForward("/app/wishlist/new")})()}openMobileAddSheet(){var t=this;return(0,u.A)(function*(){try{const n=yield t.modalController.create({component:X.G,componentProps:{optionSet:"events-only"},cssClass:"popup-modal"});yield n.present();const{data:o}=yield n.onDidDismiss();if(o?.saved)return void(yield t.loadData());if("event"===o?.typeId)return void(yield t.openCreateEvent());"santa"===o?.typeId&&(yield t.nav.navigateForward("/app/secret-santa/create"))}catch(n){t.logger.LogError(n,"Error opening mobile quick-add sheet")}})()}consumeQuickAddParam(){var t=this;return(0,u.A)(function*(){t.hasConsumedQuickAddParam||(t.hasConsumedQuickAddParam=!0,"event"===t.route.snapshot.queryParamMap.get("quickAdd")&&(yield t.openCreateEvent()))})()}openCreateEvent(){var t=this;return(0,u.A)(function*(){yield t.nav.navigateForward("/app/events/new")})()}openReminderEdit(t){var n=this;return(0,u.A)(function*(){const o=n.userEvents.find(s=>s.userReminderId===t);if(o)try{const s=yield n.modalController.create({component:q,componentProps:{reminder:o},cssClass:"popup-modal"});yield s.present();const{data:d}=yield s.onDidDismiss();
1d?.saved&&(yield n.loadData())}catch(s){n.logger.LogError(s,"Failed to open reminder editor")}})()}openFriend(t){var n=this;return(0,u.A)(function*(){t&&(yield n.nav.navigateForward(`/app/friends/${t}`))})()}openSpoylaEvent(t){var n=this;return(0,u.A)(function*(){if(t?.actionEventId){if(t.actionGiftExchangeId)return void(yield n.nav.navigateForward(["/app/secret-santa",t.actionGiftExchangeId]));yield n.nav.navigateForward(["/app/events",t.actionEventId])}})()}navigatePreviousMonth(){var t=this;return(0,u.A)(function*(){0===t.currentMonth?(t.currentMonth=11,t.currentYear-=1):t.currentMonth-=1,yield t.ensureGlobalEventsForYear(t.currentYear),t.rebuildMonthView()})()}navigateNextMonth(){var t=this;return(0,u.A)(function*(){11===t.currentMonth?(t.currentMonth=0,t.currentYear+=1):t.currentMonth+=1,yield t.ensureGlobalEventsForYear(t.currentYear),t.rebuildMonthView()})()}loadData(){var t=this;return(0,u.A)(function*(){try{t.isBusy=!0,t.hasError=!1;const[n,o,s,d]=yield Promise.all([t.friendshipService.GetFriends(),t.userReminderService.GetUserReminders(),t.eventService.GetMyEvents(),t.giftExchangeService.GetMine()]);t.giftExchangeIdByEventId.clear();for(const p of d||[]){const _=p?.event?.eventId?.trim(),v=p?.giftExchange?.giftExchangeId?.trim();_&&v&&t.giftExchangeIdByEventId.set(_,v)}yield t.sessionService.ensureInitialized(),t.currentUser=t.sessionService.user,t.friends=n||[],t.userEvents=(o||[]).filter(p=>!1!==p.isActive),t.spoylaEvents=(s||[]).filter(p=>!!p.eventId&&!1!==p.isActive&&p.workflowStatusId!==ee.h.Cancelled),yield t.ensureGlobalEventsForYear(t.currentYear),t.rebuildMonthView()}catch(n){t.hasError=!0,yield t.common.handleError(n,"We could not load your events.")}finally{t.isBusy=!1}})()}ensureGlobalEventsForYear(t){var n=this;return(0,u.A)(function*(){if(n.globalEventsByYear.has(t))return;const o=yield n.globalEventOccurrenceService.GetGlobalEventOccurrencesByYear(t);n.globalEventsByYear.set(t,o||[])})()}rebuildMonthView(){this.syncMonthLabel();const n=[...this.buildBirthdayCards(),...this.buildCustomEventCards(),...this.buildGlobalEventCards(),...this.buildSpoylaEventCards()].filter(s=>s.month===this.currentMonth&&(null===s.year||s.year===this.currentYear)).sort((s,d)=>s.day!==d.day?s.day-d.day:s.title.localeCompare(d.title));this.totalEventCount=n.length,this.monthEvents=n;const o=new Map;for(const s of n){const d=o.get(s.day)||[];d.push(s),o.set(s.day,d)}this.calendarWeeks=this.buildCalendarGrid(o)}buildCalendarGrid(t){const n=new Date(this.currentYear,this.currentMonth,1),s=new Date(this.currentYear,this.currentMonth+1,0).getDate();let d=n.getDay()-1;d<0&&(d=6);const p=new Date,_=p.getFullYear()===this.currentYear&&p.getMonth()===this.currentMonth,v=p.getDate(),y=new Date(this.currentYear,this.currentMonth,0).getDate(),I=[];let E=1,R=1;const U=7*Math.ceil((d+s)/7);for(let G=0;G<U;G++){G%7==0&&I.push({days:[]});const A=I[I.length-1];G<d?A.days.push({dayNumber:y-d+G+1,isCurrentMonth:!1,isToday:!1,events:[]}):E<=s?(A.days.push({dayNumber:E,isCurrentMonth:!0,isToday:_&&E===v,events:t.get(E)||[]}),E++):(A.days.push({dayNumber:R,isCurrentMonth:!1,isToday:!1,events:[]}),R++)}return I}buildBirthdayCards(){const t=[...this.friends];return this.currentUser?.dateOfBirth&&this.currentUser.userId&&t.push(this.currentUser),t.filter(n=>!!n.userId&&!!n.dateOfBirth).map(n=>{const o=this.parseDateOnly(n.dateOfBirth);if(!o)return null;const s=new Date(this.currentYear,o.getMonth(),o.getDate()),d=this.getOrdinalDayParts(o.getDate()),p=this.getBirthdayStatus(o);return{id:`birthday-${n.userId}`,typeLabel:"Birthday",typeColor:"primary",title:n.nickName||"Friend",summary:`${p.verb} ${p.age}`,weekdayText:this.getWeekdayName(s),dayNumberText:d.numberText,daySuffixText:d.suffixText,monthText:this.getShortMonthName(o.getMonth()),imageUrl:this.reportedMediaService.isReported(n.media?.mediaId)?null:this.mediaAssetService.getMediaUrl(n.media),iconName:"gift-outline",actionUserId:n.userId,actionUserName:n.userName||"",actionEventId:"",isNavigable:!0,month:o.getMonth(),day:o.getDate(),year:null,chipKind:null,chipLabel:"",isHoliday:!1,isGiftExchange:!1}}).filter(n=>!!n)}buildCustomEventCards(){return this.userEvents.filter(t=>!!t.userReminderId&&!!t.reminderDT).map(t=>{const n=new Date(t.reminderDT),o=this.getOrdinalDayParts(n.getDate());return{id:`custom-${t.userReminderId}`,typeLabel:"Custom",typeColor:"tertiary",title:t.reminderName||"Custom event",summary:"",weekdayText:this.getWeekdayName(n),dayNumberText:o.numberText,daySuffixText:o.suffixText,monthText:this.getShortMonthName(n.getMonth()),imageUrl:null,iconName:"
1calendar-outline",actionUserId:"",actionUserName:"",actionEventId:"",isNavigable:!1,month:n.getMonth(),day:n.getDate(),year:null,chipKind:"personal",chipLabel:"Personal",isHoliday:!1,isGiftExchange:!1}})}buildGlobalEventCards(){return(this.globalEventsByYear.get(this.currentYear)||[]).filter(n=>!!n.globalEventOccurrenceId&&!!n.occurrenceDate).map(n=>{const o=new Date(n.occurrenceDate),s=this.getOrdinalDayParts(o.getDate()),d=n.globalEventVariant,p=!!n.holidayOfficialStatus?.holidayOfficialStatusId;return{id:`global-${n.globalEventOccurrenceId}`,typeLabel:"Global",typeColor:"warning",title:d?.variantName||d?.variantCode||"Global event",summary:"",weekdayText:this.getWeekdayName(o),dayNumberText:s.numberText,daySuffixText:s.suffixText,monthText:this.getShortMonthName(o.getMonth()),imageUrl:this.mediaAssetService.getMediaUrl(d?.media),iconName:"globe-outline",actionUserId:"",actionUserName:"",actionEventId:"",isNavigable:!1,month:o.getMonth(),day:o.getDate(),year:o.getFullYear(),chipKind:p?"holiday":null,chipLabel:p?"Holiday":"",isHoliday:p,isGiftExchange:!1}})}buildSpoylaEventCards(){return this.spoylaEvents.map(t=>{const n=this.parseDateOnly(t.startDT);if(!n)return null;const o=this.getOrdinalDayParts(n.getDate()),s=t.goingCount||0,d=2===t.eventTypeId,p=t.workflowStatusId===ee.h.Draft;return{id:`spoyla-${t.eventId}`,typeLabel:"Event",typeColor:"secondary",title:t.title?.trim()||"Event",summary:s>0?`${s} going`:"",weekdayText:this.getWeekdayName(n),dayNumberText:o.numberText,daySuffixText:o.suffixText,monthText:this.getShortMonthName(n.getMonth()),imageUrl:this.reportedMediaService.isReported(t.media?.mediaId)?null:this.mediaAssetService.getMediaUrl(t.media),iconName:d?"snow-outline":"calendar-outline",actionUserId:"",actionUserName:"",actionEventId:t.eventId,actionGiftExchangeId:d&&this.giftExchangeIdByEventId.get(t.eventId||"")||null,isNavigable:!0,month:n.getMonth(),day:n.getDate(),year:n.getFullYear(),chipKind:d?"giftExchange":"event",chipLabel:d?"Gift Exchange":"Event",isHoliday:!1,isGiftExchange:d,isDraft:p,goingCount:s}}).filter(t=>!!t)}syncMonthLabel(){const t=new Date(this.currentYear,this.currentMonth,1);this.monthLabel=`${t.toLocaleDateString(void 0,{month:"long"})} ${this.currentYear}`}getBirthdayStatus(t){const n=new Date,o=new Date(n.getFullYear(),n.getMonth(),n.getDate()),s=new Date(this.currentYear,t.getMonth(),t.getDate()),d=Math.max(0,this.currentYear-t.getFullYear());return s>=o?{verb:"turning",age:d}:{verb:"turned",age:d}}parseDateOnly(t){if(!t)return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:new Date(t.getFullYear(),t.getMonth(),t.getDate());const n=t.trim();if(!n)return null;const o=/^(\d{4})-(\d{2})-(\d{2})/.exec(n);if(o){const d=Number(o[1]),p=Number(o[2])-1,_=Number(o[3]);return new Date(d,p,_)}const s=new Date(n);return Number.isNaN(s.getTime())?null:new Date(s.getFullYear(),s.getMonth(),s.getDate())}getShortMonthName(t){return new Date(this.currentYear,t,1).toLocaleDateString(void 0,{month:"short"})}getWeekdayName(t){return t.toLocaleDateString(void 0,{weekday:"long"})}getOrdinalDayParts(t){const n=t%10,o=t%100;let s="th";return 1===n&&11!==o?s="st":2===n&&12!==o?s="nd":3===n&&13!==o&&(s="rd"),{fullText:`${t}${s}`,numberText:`${t}`,suffixText:s}}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(V.p),e.rXU(se.q9),e.rXU(pe.nX),e.rXU(H.o),e.rXU(O.g),e.rXU(g.W3),e.rXU(me.r),e.rXU(ae.Y),e.rXU(b.r),e.rXU(S.v),e.rXU(m.o),e.rXU(F.S),e.rXU(N.Q))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-app-events"]],standalone:!1,decls:15,vars:7,consts:[[1,"page-toolbar"],["slot","start"],["menu","app-shell-menu"],[1,"page-toolbar-title-wrap"],[1,"page-toolbar-title"],["slot","end","class","page-toolbar-actions",4,"ngIf"],[3,"fullscreen"],[1,"page-shell","page-shell-header-gap"],["class","page-section",4,"ngIf"],["slot","end",1,"page-toolbar-actions"],["type","button","aria-label","Add reminder",1,"header-action","header-action--on-surface",3,"click"],["name","add-outline"],["type","button","aria-label","Add event",1,"header-action","header-action--on-surface",3,"click"],["type","button","aria-label","Add Secret Santa",1,"header-action","header-action--on-surface",3,"click"],["type","button","aria-label","Event settings",1,"header-action","header-action--on-surface",3,"click"],["name","settings-outline"],["type","button","aria-label","Add",1,"header-action","header-action--on-surface",3,"click"],["name","add"],[1,"page-section"],["size","12"],[1,"calendar-wrapper"],[1,"month-nav"],[2,"width","44px","height","44px","border-radius","50%","margin","0",3,"animated"],[2,"width","140px","height","20px","margin","0",3,"animated"],[1,"cal
1-wrap","cal-view-grid"],[1,"cal-grid-skeleton"],[1,"cal-grid-skeleton-header"],["class","cal-grid-skeleton-header-cell",4,"ngFor","ngForOf"],["class","cal-grid-skeleton-week",4,"ngFor","ngForOf"],[1,"cal-view-list"],[1,"event-skeleton-list"],["class","event-skeleton-card",4,"ngFor","ngForOf"],[1,"cal-grid-skeleton-header-cell"],[2,"width","55%","height","12px","margin","0 auto",3,"animated"],[1,"cal-grid-skeleton-week"],["class","cal-grid-skeleton-day",4,"ngFor","ngForOf"],[1,"cal-grid-skeleton-day"],[2,"width","18px","height","13px","margin","0",3,"animated"],["class","cal-grid-skeleton-event",4,"ngIf"],[1,"cal-grid-skeleton-event"],[1,"cal-grid-skeleton-event-avatar",3,"animated"],[2,"width","70%","height","11px","margin","0",3,"animated"],[1,"event-skeleton-card"],[1,"event-skeleton-row"],[1,"spoyla-skeleton-avatar-44",3,"animated"],[1,"event-skeleton-info"],[2,"width","65%","height","15px",3,"animated"],[2,"width","45%","height","12px","margin-top","8px",3,"animated"],["title","Events unavailable","message","The event calendar could not be loaded right now.",3,"retry"],["type","button","aria-label","Previous month",1,"header-action","header-action--on-surface",3,"click"],["name","chevron-back-outline"],[1,"month-label"],["type","button","aria-label","Next month",1,"header-action","header-action--on-surface",3,"click"],["name","chevron-forward-outline"],[3,"eventClicked","spoylaEventClicked","weeks","weekdayHeaders"],[1,"cal-view-list",3,"eventClicked","spoylaEventClicked","events","currentYear","currentMonth","monthLabel"]],template:function(n,o){1&n&&(e.j41(0,"ion-header",0)(1,"ion-toolbar")(2,"ion-buttons",1),e.nrm(3,"ion-menu-button",2),e.k0s(),e.j41(4,"ion-title")(5,"div",3)(6,"span",4),e.EFF(7),e.k0s()()(),e.DNE(8,Ue,17,0,"div",5)(9,Ae,5,0,"div",5),e.k0s()(),e.j41(10,"ion-content",6)(11,"ion-grid",7),e.DNE(12,oe,15,6,"ion-row",8)(13,Ge,3,0,"ion-row",8)(14,J,13,7,"ion-row",8),e.k0s()()),2&n&&(e.R7$(7),e.JRh(o.monthLabel),e.R7$(),e.Y8G("ngIf",o.isDesktopViewport),e.R7$(),e.Y8G("ngIf",!o.isDesktopViewport),e.R7$(),e.Y8G("fullscreen",!0),e.R7$(2),e.Y8G("ngIf",o.isBusy),e.R7$(),e.Y8G("ngIf",!o.isBusy&&o.hasError),e.R7$(),e.Y8G("ngIf",!o.isBusy&&!o.hasError))},dependencies:[l.Sq,l.bT,g.QW,g.b_,g.hU,g.W9,g.lO,g.eU,g.iq,g.MC,g.ln,g.ds,g.BC,g.ai,$.F,K.y,ve.g],styles:['@charset "UTF-8";[_nghost-%COMP%]{display:block}.calendar-wrapper[_ngcontent-%COMP%]{padding:8px 0 0}.month-nav[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:0 0 16px}.month-label[_ngcontent-%COMP%]{font-family:var(--spoyla-font-head);font-size:1.25rem;color:var(--ion-color-dark)}@media (min-width: 900px){.calendar-wrapper[_ngcontent-%COMP%]{max-width:var(--spoyla-page-shell-max-width, 1080px);margin-inline:auto}}.cal-view-grid[_ngcontent-%COMP%]{display:none}.cal-view-list[_ngcontent-%COMP%]{display:block}@media (min-width: 768px){.cal-view-grid[_ngcontent-%COMP%]{display:block;margin-bottom:20px}.cal-view-list[_ngcontent-%COMP%]{display:none}}.cal-grid-skeleton[_ngcontent-%COMP%]{overflow:hidden}.cal-grid-skeleton-header[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border-bottom:1px solid var(--spoyla-line-cool)}.cal-grid-skeleton-header-cell[_ngcontent-%COMP%]{padding:12px 4px 10px;text-align:center}.cal-grid-skeleton-week[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(7,minmax(0,1fr))}.cal-grid-skeleton-week[_ngcontent-%COMP%] + .cal-grid-skeleton-week[_ngcontent-%COMP%]{border-top:1px solid rgba(var(--spoyla-line-cool-rgb),.5)}.cal-grid-skeleton-day[_ngcontent-%COMP%]{min-height:135px;padding:8px 6px 6px;display:flex;flex-direction:column;align-items:center;gap:6px;box-sizing:border-box;border-right:1px solid rgba(var(--spoyla-line-cool-rgb),.35)}.cal-grid-skeleton-day[_ngcontent-%COMP%]:last-child{border-right:none}.cal-grid-skeleton-event[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:6px;padding:6px 8px;border-radius:6px;background:var(--color-surface-sunken);box-sizing:border-box}.cal-grid-skeleton-event-avatar[_ngcontent-%COMP%]{width:18px;height:18px;border-radius:50%;flex-shrink:0;margin:0}.event-skeleton-list[_ngcontent-%COMP%]{display:grid;gap:var(--spoyla-space-3);margin-top:var(--spoyla-space-6)}.event-skeleton-card[_ngcontent-%COMP%]{margin:0;border-radius:22px;padding:0;overflow:hidden;box-shadow:none;border:1px solid var(--spoyla-line-cool)}.event-skeleton-row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--spoyla-space-3);padding:var(--spoyla-space-3) var(--spoyla-space-4)}.event-skeleton-info[_ngcontent-%COMP%]{flex:1;min-width:0}
1.cal-summary[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px;margin:24px 0 4px 4px;font-family:var(--spoyla-font-head);font-size:1.05rem;font-weight:600;color:var(--spoyla-text-strong)}.cal-summary-icon[_ngcontent-%COMP%]{font-size:22px;color:var(--spoyla-accent-mauve)}.cal-summary-icon--empty[_ngcontent-%COMP%]{color:var(--spoyla-text-subtle)}']}))}return r(),a})();var Ye=h(5312),$e=h(4195),W=h(9433),x=h(7613),we=h(2842),Ve=h(2559),Be=h(2643),Xe=h(4673);let fe=(()=>{var r;class a{constructor(t){this.baseService=t,this.version="1"}GetEventUsers(t,n,o,s,d,p){var _=this;return(0,u.A)(function*(){const v=`${_.baseService.apiUrl}/api/v${encodeURIComponent(_.version)}/EventUser/${encodeURIComponent(t)}?eventUserStatusId=${n?encodeURIComponent(n):""}&eventRsvpStatusId=${o?encodeURIComponent(o):""}&pageNumber=${s?encodeURIComponent(s):""}&pageSize=${d?encodeURIComponent(d):""}`;return yield _.baseService.httpGet(v,p)})()}GetEventUserCounts(t,n){var o=this;return(0,u.A)(function*(){const s=`${o.baseService.apiUrl}/api/v${encodeURIComponent(o.version)}/EventUser/${encodeURIComponent(t)}/counts`;return yield o.baseService.httpGet(s,n)})()}AddOrganizer(t,n){var o=this;return(0,u.A)(function*(){const s=`${o.baseService.apiUrl}/api/v${encodeURIComponent(o.version)}/EventUser/organizer`;return yield o.baseService.httpPost(s,t,n)})()}RemoveOrganizer(t,n){var o=this;return(0,u.A)(function*(){const s=`${o.baseService.apiUrl}/api/v${encodeURIComponent(o.version)}/EventUser/organizer/${encodeURIComponent(t)}`;return yield o.baseService.httpDelete(s,n)})()}RemoveEventUser(t,n){var o=this;return(0,u.A)(function*(){const s=`${o.baseService.apiUrl}/api/v${encodeURIComponent(o.version)}/EventUser/remove/${encodeURIComponent(t)}`;return yield o.baseService.httpPost(s,{},n)})()}InviteRegisteredUser(t,n){var o=this;return(0,u.A)(function*(){const s=`${o.baseService.apiUrl}/api/v${encodeURIComponent(o.version)}/EventUser/invite`;return yield o.baseService.httpPost(s,t,n)})()}InviteRegisteredUsers(t,n){var o=this;return(0,u.A)(function*(){const s=`${o.baseService.apiUrl}/api/v${encodeURIComponent(o.version)}/EventUser/invite/batch`;return yield o.baseService.httpPost(s,t,n)})()}CheckIn(t,n){var o=this;return(0,u.A)(function*(){const s=`${o.baseService.apiUrl}/api/v${encodeURIComponent(o.version)}/EventUser/${encodeURIComponent(t)}/checkin`;return yield o.baseService.httpPatch(s,n)})()}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(c.KVO(Xe.F))},this.\u0275prov=c.jDH({token:a,factory:a.\u0275fac,providedIn:"root"}))}return r(),a})();function st(r,a){if(1&r&&(e.qex(0),e.EFF(1),e.bVm()),2&r){const i=e.XpG();e.R7$(),e.SpI(" (",i.goingBadge,")")}}function lt(r,a){if(1&r&&(e.qex(0),e.EFF(1),e.bVm()),2&r){const i=e.XpG();e.R7$(),e.SpI(" (",i.maybeBadge,")")}}function dt(r,a){if(1&r&&(e.qex(0),e.EFF(1),e.bVm()),2&r){const i=e.XpG();e.R7$(),e.SpI(" (",i.notGoingBadge,")")}}function ct(r,a){if(1&r&&(e.qex(0),e.EFF(1),e.bVm()),2&r){const i=e.XpG();e.R7$(),e.SpI(" (",i.allBadge,")")}}function pt(r,a){1&r&&(e.j41(0,"ion-item",15),e.nrm(1,"ion-skeleton-text",16),e.j41(2,"ion-label")(3,"h3"),e.nrm(4,"ion-skeleton-text",17),e.k0s(),e.j41(5,"p"),e.nrm(6,"ion-skeleton-text",18),e.k0s()()()),2&r&&(e.R7$(),e.Y8G("animated",!0),e.R7$(3),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0))}function ut(r,a){if(1&r&&(e.j41(0,"ion-list",13),e.DNE(1,pt,7,3,"ion-item",14),e.k0s()),2&r){const i=e.XpG();e.R7$(),e.Y8G("ngForOf",i.loadingPlaceholders)}}function gt(r,a){if(1&r&&e.nrm(0,"ion-img",23),2&r){const i=e.XpG().$implicit;e.Y8G("src",i.photoUrl)("alt",i.displayName)}}function _t(r,a){if(1&r&&(e.j41(0,"div",24),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.initials)}}function ht(r,a){if(1&r&&(e.j41(0,"p"),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.detailText)}}function mt(r,a){if(1&r&&(e.j41(0,"ion-item",15)(1,"ion-avatar",20),e.DNE(2,gt,1,2,"ion-img",21)(3,_t,2,1,"div",22),e.k0s(),e.j41(4,"ion-label")(5,"h3"),e.EFF(6),e.k0s(),e.DNE(7,ht,2,1,"p",5),e.k0s()()),2&r){const i=a.$implicit;e.R7$(2),e.Y8G("ngIf",i.photoUrl),e.R7$(),e.Y8G("ngIf",!i.photoUrl),e.R7$(3),e.JRh(i.displayName),e.R7$(),e.Y8G("ngIf",i.detailText)}}function vt(r,a){if(1&r&&(e.j41(0,"ion-list"),e.DNE(1,mt,8,4,"ion-item",19),e.k0s()),2&r){const i=e.XpG();e.R7$(),e.Y8G("ngForOf",i.activeState.rows)("ngForTrackBy",i.trackRow)}}function ft(r,a){if(1&r&&(e.j41(0,"ion-item",15)(1,"ion-label")(2,"p"),e.EFF(3),e.k0s()()()),2&r){const i=e.XpG();e.R7$(3),e.JRh(i.activeState.emptyText)}}let yt=(()=>{var r;class a{constructor(t,n,o,s,d){this.modalController=t,this.eventUserService=n,this.mediaAssetService=o,this.logger=s,this.reportedMediaService=d,this.loadingPlaceholders=[0,1,2,3],this.eventId="",this.maxAttendees=null,this.activeSegment="going",this.goingBadge=null,this.maybeBadge=null,this.notGoingBadge=null,this.allBadge=null,this.segments={going:this.createSegmentState(W.$.Going,!1,"No one is going yet"),maybe:this.createSegmentState(W.$.Maybe,!1,"No maybes yet"),notGoing:this.createSegmentState(W.$.NotGoing,!1,"No not going responses yet"),all:this.createSegmentState(0,!0,"No members yet")},this.activeState=this.segments.going}ngOnInit(){var t=this;return(0,u.A)(function*(){yield Promise.all([t.loadCounts(),t.activateSegment(t.activeSegment)])})()}dismiss(){var t=this;return(0,u.A)(function*(){yield t.modalController.dismiss()})()}onSegmentChanged(){var t=this;return(0,u.A)(function*(){yield t.activateSegment(t.activeSegment)})()}loadMore(t){var n=this;return(0,u.A)(function*(){try{const o=n.activeState;o.hasMore&&!o.isLoading&&(yield n.loadPage(o))}finally{yield t.target.complete()}})()}trackRow(t,n){return n.eventUserId||`row-${t}`}createSegmentState(t,n,o){return{rsvpFilterId:t,rows:[],totalCount:0,pageNumber:0,hasMore:!1,isLoading:!1,hasLoaded:!1,includeRsvpInDetail:n,emptyText:o}}activateSegment(t){var n=this;return(0,u.A)(function*(){const o=n.segments[t];n.activeState=o,!o.hasLoaded&&!o.isLoading&&(yield n.loadPage(o))})()}loadPage(t){var n=this;return(0,u.A)(function*(){if(!t.isLoading&&n.eventId)try{t.isLoading=!0;const o=t.pageNumber+1,s=yield n.eventUserService.GetEventUsers(n.eventId,0,t.rsvpFilterId,o,24),d=s?.items||[];t.pageNumber=o,t.totalCount=s?.totalCount??t.totalCount;const p=new Set(t.rows.map(v=>v.eventUserId)),_=d.map(v=>n.toRow(v,t.includeRsvpInDetail)).filter(v=>!v.eventUserId||!p.has(v.eventUserId));t.rows=[...t.rows,..._],t.hasLoaded=!0,t.hasMore=d.length>=24&&t.rows.length<t.totalCount}catch(o){n.logger.LogError(o,"Failed to load event participants")}
1finally{t.isLoading=!1}})()}loadCounts(){var t=this;return(0,u.A)(function*(){if(t.eventId)try{const n=yield t.eventUserService.GetEventUserCounts(t.eventId);t.goingBadge=n?.goingCount??null,t.maybeBadge=n?.maybeCount??null,t.notGoingBadge=n?.notGoingCount??null,t.allBadge=n?.totalMembers??null}catch(n){t.logger.LogError(n,"Failed to load event participant counts")}})()}toRow(t,n){const o=t.user?.nickName||t.user?.userName||"Member",s=[],d=Number(t.guestCount||0);return t.eventUserStatusId===$e.t.Organizer&&s.push("Organizer"),n&&s.push(this.getRsvpLabel(t.eventRsvpStatusId)),d>0&&s.push(1===d?"+1 guest":`+${d} guests`),t.checkedInDT&&s.push("Checked in"),{eventUserId:t.eventUserId||"",displayName:o,photoUrl:this.reportedMediaService.isReported(t.userMedia?.mediaId)?"":this.mediaAssetService.getMediaUrl(t.userMedia)||"",initials:this.getInitials(o),detailText:s.join(" - ")}}getRsvpLabel(t){switch(t){case W.$.Going:return"Going";case W.$.Maybe:return"Maybe";case W.$.NotGoing:return"Not going";default:return"No response"}}getInitials(t){return t.trim().split(/\s+/).slice(0,2).map(s=>s[0]?.toUpperCase()??"").join("")||"?"}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(g.W3),e.rXU(fe),e.rXU(F.S),e.rXU(O.g),e.rXU(V.p))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-event-participant-manage-modal"]],inputs:{eventId:"eventId",maxAttendees:"maxAttendees"},standalone:!1,decls:31,vars:9,consts:[["slot","end"],["aria-label","Close",3,"click"],["slot","icon-only","name","close-outline"],[3,"ngModelChange","ionChange","ngModel"],["value","going"],[4,"ngIf"],["value","maybe"],["value","notGoing"],["value","all"],["aria-label","Loading participants","aria-busy","true",4,"ngIf"],["lines","none",4,"ngIf"],[3,"ionInfinite","disabled"],["loadingSpinner","dots","loadingText","Loading more participants..."],["aria-label","Loading participants","aria-busy","true"],["lines","none",4,"ngFor","ngForOf"],["lines","none"],["slot","start",1,"spoyla-skeleton-avatar-44",3,"animated"],[1,"spoyla-skeleton-line","spoyla-skeleton-line--w55",3,"animated"],[1,"spoyla-skeleton-line","spoyla-skeleton-line--meta","spoyla-skeleton-line--w40",3,"animated"],["lines","none",4,"ngFor","ngForOf","ngForTrackBy"],["slot","start",1,"participant-avatar"],[3,"src","alt",4,"ngIf"],["class","participant-avatar-placeholder",4,"ngIf"],[3,"src","alt"],[1,"participant-avatar-placeholder"]],template:function(n,o){1&n&&(e.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-title"),e.EFF(3,"Participants"),e.k0s(),e.j41(4,"ion-buttons",0)(5,"ion-button",1),e.bIt("click",function(){return o.dismiss()}),e.nrm(6,"ion-icon",2),e.k0s()()(),e.j41(7,"ion-toolbar")(8,"ion-segment",3),e.mxI("ngModelChange",function(d){return e.DH7(o.activeSegment,d)||(o.activeSegment=d),d}),e.bIt("ionChange",function(){return o.onSegmentChanged()}),e.j41(9,"ion-segment-button",4)(10,"ion-label"),e.EFF(11,"Going"),e.DNE(12,st,2,1,"ng-container",5),e.k0s()(),e.j41(13,"ion-segment-button",6)(14,"ion-label"),e.EFF(15,"Maybe"),e.DNE(16,lt,2,1,"ng-container",5),e.k0s()(),e.j41(17,"ion-segment-button",7)(18,"ion-label"),e.EFF(19,"Not Going"),e.DNE(20,dt,2,1,"ng-container",5),e.k0s()(),e.j41(21,"ion-segment-button",8)(22,"ion-label"),e.EFF(23,"All"),e.DNE(24,ct,2,1,"ng-container",5),e.k0s()()()()(),e.j41(25,"ion-content"),e.DNE(26,ut,2,1,"ion-list",9)(27,vt,2,2,"ion-list",5)(28,ft,4,1,"ion-item",10),e.j41(29,"ion-infinite-scroll",11),e.bIt("ionInfinite",function(d){return o.loadMore(d)}),e.nrm(30,"ion-infinite-scroll-content",12),e.k0s()()),2&n&&(e.R7$(8),e.R50("ngModel",o.activeSegment),e.R7$(4),e.Y8G("ngIf",null!==o.goingBadge),e.R7$(4),e.Y8G("ngIf",null!==o.maybeBadge),e.R7$(4),e.Y8G("ngIf",null!==o.notGoingBadge),e.R7$(4),e.Y8G("ngIf",null!==o.allBadge),e.R7$(2),e.Y8G("ngIf",o.activeState.isLoading&&0===o.activeState.rows.length),e.R7$(),e.Y8G("ngIf",o.activeState.rows.length>0),e.R7$(),e.Y8G("ngIf",o.activeState.hasLoaded&&!o.activeState.isLoading&&0===o.activeState.rows.length),e.R7$(),e.Y8G("disabled",!o.activeState.hasMore))},dependencies:[l.Sq,l.bT,f.BC,f.vS,g.mC,g.Jm,g.QW,g.W9,g.eU,g.iq,g.KW,g.Ax,g.Hp,g.uz,g.he,g.nf,g.Gp,g.eP,g.ds,g.BC,g.ai,g.Je],styles:[".participant-avatar[_ng
1content-%COMP%]{width:40px;height:40px}.participant-avatar-placeholder[_ngcontent-%COMP%]{width:100%;height:100%;border-radius:999px;display:grid;place-items:center;font-size:.85rem;font-weight:700;color:var(--ion-color-primary);background:rgba(var(--ion-color-primary-rgb),.12)}"]}))}return r(),a})();var It=h(1605),bt=h(8210);function Et(r,a){1&r&&e.eu8(0)}function kt(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-title"),e.EFF(3,"Invite People"),e.k0s(),e.j41(4,"ion-buttons",3)(5,"ion-button",4),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.dismiss())}),e.nrm(6,"ion-icon",5),e.k0s()()(),e.j41(7,"ion-toolbar"),e.DNE(8,Et,1,0,"ng-container",6),e.k0s()()}if(2&r){e.XpG();const i=e.sdS(4);e.R7$(8),e.Y8G("ngTemplateOutlet",i)}}function Ct(r,a){1&r&&e.eu8(0)}function Gt(r,a){if(1&r&&(e.j41(0,"ion-content"),e.DNE(1,Ct,1,0,"ng-container",6),e.k0s()),2&r){e.XpG();const i=e.sdS(6);e.R7$(),e.Y8G("ngTemplateOutlet",i)}}function wt(r,a){1&r&&e.eu8(0)}function Pt(r,a){1&r&&e.eu8(0)}function St(r,a){if(1&r&&(e.qex(0),e.DNE(1,wt,1,0,"ng-container",6)(2,Pt,1,0,"ng-container",6),e.bVm()),2&r){e.XpG();const i=e.sdS(4),t=e.sdS(6);e.R7$(),e.Y8G("ngTemplateOutlet",i),e.R7$(),e.Y8G("ngTemplateOutlet",t)}}function xt(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-segment",7),e.mxI("ngModelChange",function(n){c.eBV(i);const o=e.XpG();return e.DH7(o.activeSegment,n)||(o.activeSegment=n),c.Njj(n)}),e.j41(1,"ion-segment-button",8)(2,"ion-label"),e.EFF(3,"Friends"),e.k0s()(),e.j41(4,"ion-segment-button",9)(5,"ion-label"),e.EFF(6,"By Email"),e.k0s()()()}if(2&r){const i=e.XpG();e.R50("ngModel",i.activeSegment)}}function Rt(r,a){if(1&r&&e.nrm(0,"ion-img",18),2&r){const i=e.XpG().$implicit;e.Y8G("src",i.photoUrl)("alt",i.displayName)}}function Ft(r,a){1&r&&e.nrm(0,"ion-icon",19)}function Mt(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-item")(1,"ion-avatar",14),e.DNE(2,Rt,1,2,"ion-img",15)(3,Ft,1,0,"ion-icon",16),e.k0s(),e.j41(4,"ion-label"),e.EFF(5),e.k0s(),e.j41(6,"ion-button",17),e.bIt("click",function(){const n=c.eBV(i).$implicit,o=e.XpG(4);return c.Njj(o.inviteFriend(n))}),e.EFF(7," Invite "),e.k0s()()}if(2&r){const i=a.$implicit,t=e.XpG(4);e.R7$(2),e.Y8G("ngIf",i.photoUrl),e.R7$(),e.Y8G("ngIf",!i.photoUrl),e.R7$(2),e.JRh(i.displayName),e.R7$(),e.Y8G("disabled",t.isBusy)}}function Tt(r,a){if(1&r&&(e.j41(0,"ion-item")(1,"ion-label")(2,"p"),e.EFF(3),e.k0s()()()),2&r){const i=e.XpG(4);e.R7$(3),e.JRh(i.friendSearchQuery?"No friends matching your search":"No friends to invite")}}function Dt(r,a){if(1&r&&(e.j41(0,"ion-list"),e.DNE(1,Mt,8,4,"ion-item",13)(2,Tt,4,1,"ion-item",2),e.k0s()),2&r){const i=e.XpG(3);e.R7$(),e.Y8G("ngForOf",i.filteredFriendRows)("ngForTrackBy",i.trackFriend),e.R7$(),e.Y8G("ngIf",0===i.filteredFriendRows.length)}}function Ut(r,a){1&r&&(e.j41(0,"ion-item",22),e.nrm(1,"ion-skeleton-text",23),e.j41(2,"ion-label"),e.nrm(3,"ion-skeleton-text",24),e.k0s(),e.nrm(4,"ion-skeleton-text",25),e.k0s()),2&r&&(e.R7$(),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0))}function At(r,a){if(1&r&&(e.j41(0,"ion-list",20),e.DNE(1,Ut,5,3,"ion-item",21),e.k0s()),2&r){const i=e.XpG(3);e.R7$(),e.Y8G("ngForOf",i.loadingPlaceholders)}}function jt(r,a){if(1&r){const i=e.RV6();e.j41(0,"div")(1,"ion-item")(2,"ion-input",11),e.mxI("ngModelChange",function(n){c.eBV(i);const o=e.XpG(2);return e.DH7(o.friendSearchQuery,n)||(o.friendSearchQuery=n),c.Njj(n)}),e.bIt("ionInput",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.onFriendSearch())}),e.k0s()(),e.DNE(3,Dt,3,3,"ion-list",2)(4,At,2,1,"ion-list",12),e.k0s()}if(2&r){const i=e.XpG(2);e.R7$(2),e.R50("ngModel",i.friendSearchQuery),e.R7$(),e.Y8G("ngIf",!i.isLoadingFriends),e.R7$(),e.Y8G("ngIf",i.isLoadingFriends)}}function $t(r,a){1&r&&(e.j41(0,"p"),e.EFF(1,"Accepted"),e.k0s())}function Bt(r,a){1&r&&(e.j41(0,"p"),e.EFF(1,"Pending"),e.k0s())}function Lt(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-item"),e.nrm(1,"ion-icon",28),e.j41(2,"ion-label")(3,"h3"),e.EFF(4),e.k0s(),e.DNE(5,$t,2,0,"p",2)(6,Bt,2,0,"p",2),e.k0s(),e.j41(7,"ion-button",29),e.bIt("click",function(){const n=c.eBV(i).$implicit,o=e.XpG(5);return c.Njj(o.revokeExternalInvite(n))}),e.EFF(8," Revoke "),e.k0s()()}if(2&r){const i=a.$implicit,t=e.XpG(5);e.R7$(4),e.JRh(i.invitedEmail),e.R7$(),e.Y8G("ngIf",i.isAccepted),e.R7$(),e.Y8G("ngIf",!i.isAccepted),e.R7$(),e.Y8G("disabled",t.isBusy||i.isAccepted)}}function Ot(r,a){if(1&r&&(e.j41(0,"ion-list"),e.DNE(1,Lt,9,4,"ion-item",13),e.k0s()),2&r){const i=e.XpG(4);e.R7$(),e.Y8G("ngForOf",i.externalInvites)("ngForTrackBy",i.trackInvite)}}function Nt(r,a){if(1&r&&(e.j41(0,"div")(1,"ion-list-header")(2,"ion-label"),e.EFF(3,"Pending Invites"),e.k0s()(),e.DNE(4,Ot,2,2,"ion-list",2),e.k0s()),2&r){const i=e.XpG(3);e.R7$(4),e.Y8G("ngIf",!i.isLoadingExternalInvites)}}function Yt(r,a){1&r&&(e.j41(0,"ion-item")(1,"ion-label")(2,"p"),e.EFF(3,"No external invites sent yet"),e.k0s()()())}function Vt(r,a){if(1&r){const i=e.RV6();e.j41(0,"div")(1,"ion-item")(2,"ion-input",26),e.mxI("ngModelChange",function(n){c.eBV(i);const o=e.XpG(2);return e.DH7(o.emailInput,n)||(o.emailInput=n),c.Njj(n)}),e.k0s(),e.j41(3,"ion-button",27),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.sendEmailInvite())}),e.EFF(4," Send "),e.k0s()(),e.DNE(5,Nt,5,1,"div",2)(6,Yt,4,0,"ion-item",2),e.k0s()}if(2&r){const i=e.XpG(2);e.R7$(2),e.R50("ngModel",i.emailInput),e.Y8G("disabled",i.isBusy),e.R7$(),e.Y8G("disabled",i.isBusy||!i.emailInput.trim()),e.R7$(2),e.Y8G("ngIf",i.externalInvites.length>0),e.R7$(),e.Y8G("ngIf",0===i.externalInvites.length&&!i.isLoadingExternalInvites)}}function Xt(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",30)(1,"ion-button",31),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.dismiss())}),e.EFF(2," Done "),e.k0s()()}}function Wt(r,a){if(1&r&&e.DNE(0,jt,5,3,"div",2)(1,Vt,7,5,"div",2)(2,Xt,3,0,"div",10),2&r){const i=e.XpG();e.Y8G("ngIf","friends"===i.activeSegment),e.R7$(),e.Y8G("ngIf","email"===i.activeSegment),e.R7$(),e.Y8G("ngIf",i.hosted)}}let zt=(()=>{var r;class a{constructor(t,n,o,s,d,p,_,v){this.reportedMediaService=t,this.modalController=n,this.eventUserService=o,this.externalInviteService=s,this.friendshipService=d,this.mediaAssetService=p,this.logger=_,this.common=v,this.loadingPlaceholders=[0,1,2,3],this.eventId="",this.hosted=!1,this.completed=new e.bkB,this.friendRows=[],this.filteredFriendRows=[],this.externalInvites=[],this.friendSearchQuery="",this.emailInput="",this.isBusy=!1,this.isLoadingFriends=!1,this.isLoadingExternalInvites=!1,this.activeSegment="friends"}ngOnInit(){var t=this;return(0,u.A)(function*(){yield Promise.all([t.loadFriends(),t.loadExternalInvites()])})()}onFriendSearch(){const t=this.friendSearchQuery.trim().toLowerCase();this.filteredFriendRows=t?this.friendRows.filter(n=>n.displayName.toLowerCase().includes(t)):[...this.friendRows]}inviteFriend(t){var n=this;return(0,u.A)(function*(){if(!n.isBusy&&t.user.userId&&n.eventId)try{n.isBusy=!0;const o={eventId:n.eventId,invitedUserId:t.user.userId};yield n.eventUserService.InviteRegisteredUser(o),n.friendRows=n.friendRows.filter(s=>s.user.userId!==t.user.userId),n.filteredFriendRows=n.filteredFriendRows.filter(s=>s.user.userId!==t.user.userId),n.logger.LogInfo("Friend invited to event",{eventId:n.eventId,userId:t.user.userId})}catch(o){n.logger.LogError(o,"Failed to invite friend"),yield n.common.handleError(o,"Failed to send invite")}finally{n.isBusy=!1}})()}sendEmailInvite(){var t=this;return(0,u.A)(function*(){const n=t.emailInput.trim();if(!t.isBusy&&n&&t.eventId)try{t.isBusy=!0;const o=new Date;o.setDate(o.getDate()+30);const s={eventId:t.eventId,invitedEmail:n,expiryDT:o},d=yield t.externalInviteService.SendInvite(s);t.externalInvites=[...t.externalInvites,d],t.emailInput="",t.logger.LogInfo("Exter
1nal email invite sent",{eventId:t.eventId})}catch(o){t.logger.LogError(o,"Failed to send email invite"),yield t.common.handleError(o,"Failed to send email invite")}finally{t.isBusy=!1}})()}revokeExternalInvite(t){var n=this;return(0,u.A)(function*(){if(!n.isBusy&&t.eventExternalInviteId&&(yield n.common.showConfirmAlertDialog("Revoke Invite",`Revoke the invite sent to ${t.invitedEmail}?`)))try{n.isBusy=!0,yield n.externalInviteService.RevokeInvite(t.eventExternalInviteId),n.externalInvites=n.externalInvites.filter(s=>s.eventExternalInviteId!==t.eventExternalInviteId),n.logger.LogInfo("External invite revoked",{inviteId:t.eventExternalInviteId})}catch(s){n.logger.LogError(s,"Failed to revoke invite"),yield n.common.handleError(s,"Failed to revoke invite")}finally{n.isBusy=!1}})()}dismiss(){var t=this;return(0,u.A)(function*(){t.hosted?t.completed.emit():yield t.modalController.dismiss({invitesSent:!0})})()}trackFriend(t,n){return n.user.userId||`friend-${t}`}trackInvite(t,n){return n.eventExternalInviteId||`invite-${t}`}loadFriends(){var t=this;return(0,u.A)(function*(){if(!t.isLoadingFriends)try{t.isLoadingFriends=!0;const n=yield t.friendshipService.GetFriends();t.friendRows=(n||[]).map(o=>({user:o,displayName:o.nickName||o.userName||"Friend",photoUrl:t.reportedMediaService.isReported(o.media?.mediaId)?"":t.mediaAssetService.getMediaUrl(o.media)||""})),t.filteredFriendRows=[...t.friendRows]}catch(n){t.logger.LogError(n,"Failed to load friends for event invite")}finally{t.isLoadingFriends=!1}})()}loadExternalInvites(){var t=this;return(0,u.A)(function*(){if(!t.isLoadingExternalInvites&&t.eventId)try{t.isLoadingExternalInvites=!0,t.externalInvites=yield t.externalInviteService.GetInvitesForEvent(t.eventId)}catch(n){t.logger.LogError(n,"Failed to load external invites")}finally{t.isLoadingExternalInvites=!1}})()}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(V.p),e.rXU(g.W3),e.rXU(fe),e.rXU(bt.b),e.rXU(me.r),e.rXU(F.S),e.rXU(O.g),e.rXU(H.o))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-event-invite-modal"]],inputs:{eventId:"eventId",hosted:"hosted"},outputs:{completed:"completed"},standalone:!1,decls:7,vars:3,consts:[["inviteSegment",""],["inviteBody",""],[4,"ngIf"],["slot","end"],["aria-label","Close",3,"click"],["slot","icon-only","name","close-outline"],[4,"ngTemplateOutlet"],[3,"ngModelChange","ngModel"],["value","friends"],["value","email"],["class","sheet-footer hosted-action-row",4,"ngIf"],["type","search","placeholder","Search friends...",3,"ngModelChange","ionInput","ngModel"],["aria-label","Loading friends","aria-busy","true",4,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],["slot","start"],[3,"src","alt",4,"ngIf"],["name","person-circle-outline",4,"ngIf"],["slot","end","fill","outline","size","small",3,"click","disabled"],[3,"src","alt"],["name","person-circle-outline"],["aria-label","Loading friends","aria-busy","true"],["lines","none",4,"ngFor","ngForOf"],["lines","none"],["slot","start",1,"spoyla-skeleton-avatar-44",3,"animated"],[1,"spoyla-skeleton-line","spoyla-skeleton-line--w55",3,"animated"],["slot","end",1,"spoyla-skeleton-row__action",3,"animated"],["type","email","placeholder","Email address",3,"ngModelChange","ngModel","disabled"],["slot","end","fill","solid","size","small",3,"click","disabled"],["slot","start","name","mail-outline"],["slot","end","fill","clear","color","danger","size","small",3,"click","disabled"],[1,"sheet-footer","hosted-action-row"],["expand","block","fill","solid","color","primary",1,"footer-button",3,"click"]],template:function(n,o){1&n&&e.DNE(0,kt,9,1,"ion-header",2)(1,Gt,2,1,"ion-content",2)(2,St,3,2,"ng-container",2)(3,xt,7,1,"ng-template",null,0,e.C5r)(5,Wt,3,3,"ng-template",null,1,e.C5r),2&n&&(e.Y8G("ngIf",!o.hosted),e.R7$(),e.Y8G("ngIf",!o.hosted),e.R7$(),e.Y8G("ngIf",o.hosted))},dependencies:[l.Sq,l.bT,l.T3,f.BC,f.vS,g.mC,g.Jm,g.QW,g.W9,g.eU,g.iq,g.KW,g.$w,g.uz,g.he,g.nf,g.AF,g.Gp,g.eP,g.ds,g.BC,g.ai,g.Je,g.Gw],styles:["ion-avatar[_ngcontent-%COMP%]{display:grid;place-items:center}ion-avatar[_ngcontent-%COMP%] ion-icon[_ngcontent-%COMP%]{font-size:2rem;color:var(--spoyla-text-muted, #6b7280)}"]}))}return r(),a})();var Ht=h(5347),qt=h(3597),Kt=h(4323),Jt=h(7471),Qt=h(1599),Zt=h(6830);class en{constructor(a,i,t,n,o,s){this.reportedMediaService=a,this.pledgeService=i,this.mediaAssetService=t,this.commonPageService=n,this.logger=o,this.posthogService=s,this.groupGiftSummaries=[],this.isPledgeBusy=!1}loadGroupGifts(a){var i=this;return(0,u.A)(function*(){if(a)try{const t=yield i.pledgeService.GetPledgesByEventId(a);i.applyPledges(t)}catch(t){i.logger.LogError(t,"Failed to load group gifts for event"),yield i.commonPageService.handleError(t,"Failed to load group gifts")}})()}createGroupGift(a,i){var t=this;return(0,u.A)(function*(n,o,s={add:[],removePledgeItemIds:[]}){if(t.isPledgeBusy||!n)return!1;try{t.isPledgeBusy=!0;const d=yield t.pledgeService.CreatePledge({...o,originEventId:n});return yield t.applyItemChanges(d.pledgeId||"",s),t.logger.LogInfo("Group gift created",{eventId:n,pledgeId:d.pledgeId}),t.posthogService.posthog.capture("group_gift_created",{eventId:n,pledgeId:d.pledgeId}),yield t.refresh(n),!0}catch(d){return t.logger.LogError(d,"Failed to create group gift"),yield t.commonPageService.handleError(d,"Failed to start group gift"),!1}finally{t.isPledgeBusy=!1}}).apply(this,arguments)}updateGroupGift(a,i,t){var n=this;return(0,u.A)(function*(o,s,d,p={add:[],removePledgeItemIds:[]}){if(n.isPledgeBusy||!s)return!1;
1try{return n.isPledgeBusy=!0,yield n.pledgeService.UpdatePledge(d,s),yield n.applyItemChanges(s,p),n.logger.LogInfo("Group gift updated",{pledgeId:s}),yield n.refresh(o),!0}catch(_){return n.logger.LogError(_,"Failed to update group gift"),yield n.commonPageService.handleError(_,"Failed to save group gift changes"),!1}finally{n.isPledgeBusy=!1}}).apply(this,arguments)}submitPledgeContribution(a,i,t){var n=this;return(0,u.A)(function*(){if(n.isPledgeBusy||!i)return!1;try{n.isPledgeBusy=!0;const o={pledgeId:i,amount:t};return yield n.pledgeService.Contribute(o,i),n.logger.LogInfo("Pledge contribution recorded",{pledgeId:i,amount:t}),n.posthogService.posthog.capture("group_gift_contributed",{eventId:a,pledgeId:i,amount:t}),yield n.refresh(a),!0}catch(o){return n.logger.LogError(o,"Failed to record pledge contribution"),yield n.commonPageService.handleError(o,"Failed to record your contribution"),!1}finally{n.isPledgeBusy=!1}})()}withdrawContribution(a,i){var t=this;return(0,u.A)(function*(){if(t.isPledgeBusy||!i)return!1;try{return t.isPledgeBusy=!0,yield t.pledgeService.WithdrawContribution(i),t.logger.LogInfo("Pledge contribution withdrawn",{pledgeId:i}),t.posthogService.posthog.capture("group_gift_contribution_withdrawn",{eventId:a,pledgeId:i}),yield t.refresh(a),!0}catch(n){return t.logger.LogError(n,"Failed to withdraw pledge contribution"),yield t.commonPageService.handleError(n,"Failed to remove your pledge"),!1}finally{t.isPledgeBusy=!1}})()}setContributorPaid(a,i,t,n){var o=this;return(0,u.A)(function*(){if(o.isPledgeBusy||!i||!t)return!1;try{o.isPledgeBusy=!0;const s={pledgeContributorId:t,isPaid:n};return yield o.pledgeService.SetContributorPaid(s,i),o.logger.LogInfo("Group gift contributor paid status updated",{pledgeId:i,pledgeContributorId:t,isPaid:n}),yield o.refresh(a),!0}catch(s){return o.logger.LogError(s,"Failed to update group gift contributor paid status"),yield o.commonPageService.handleError(s,"Failed to update contributor status"),!1}finally{o.isPledgeBusy=!1}})()}cancelGroupGift(a,i){var t=this;return(0,u.A)(function*(){if(t.isPledgeBusy||!i)return!1;try{return t.isPledgeBusy=!0,yield t.pledgeService.CancelPledge(i),t.logger.LogInfo("Group gift cancelled",{pledgeId:i}),t.posthogService.posthog.capture("group_gift_cancelled",{eventId:a,pledgeId:i}),yield t.refresh(a),!0}catch(n){return t.logger.LogError(n,"Failed to cancel group gift"),yield t.commonPageService.handleError(n,"Failed to cancel group gift"),!1}finally{t.isPledgeBusy=!1}})()}fulfilGroupGift(a,i){var t=this;return(0,u.A)(function*(){if(t.isPledgeBusy||!i)return!1;try{return t.isPledgeBusy=!0,yield t.pledgeService.FulfilPledge(i),t.logger.LogInfo("Group gift closed",{pledgeId:i}),t.posthogService.posthog.capture("group_gift_completed",{eventId:a,pledgeId:i}),yield t.refresh(a),!0}catch(n){return t.logger.LogError(n,"Failed to close group gift"),yield t.commonPageService.handleError(n,"Failed to close group gift"),!1}finally{t.isPledgeBusy=!1}})()}refresh(a){var i=this;return(0,u.A)(function*(){const t=yield i.pledgeService.GetPledgesByEventId(a);i.applyPledges(t)})()}applyPledges(a){this.groupGiftSummaries=(0,Zt.XQ)(a,i=>this.mediaAssetService.getMediaUrl(i),i=>this.reportedMediaService.isReported(i))}applyItemChanges(a,i){var t=this;return(0,u.A)(function*(){a&&(yield Promise.all(i.add.map(n=>t.pledgeService.AddPledgeItem({...n,pledgeId:a},a))),yield Promise.all(i.removePledgeItemIds.map(n=>t.pledgeService.RemovePledgeItem(a,n))))})()}}var Pe=h(9759);function tn(r,a){if(1&r&&(e.j41(0,"div",10),e.nrm(1,"img",11),e.k0s()),2&r){const i=e.XpG();e.R7$(),e.Y8G("src",i.previewUrl,e.B4B)}}function nn(r,a){1&r&&(e.j41(0,"p",12),e.EFF(1," This photo will show in the event's cover carousel. "),e.k0s())}function on(r,a){1&r&&(e.j41(0,"div",13),e.nrm(1,"ion-icon",14),e.j41(2,"span"),e.EFF(3,"This is the last cover photo slot."),e.k0s()())}function rn(r,a){1&r&&(e.j41(0,"div",15),e.nrm(1,"ion-icon",14),e.j41(2,"span"),e.EFF(3,"The cover carousel is full. Remove a photo before adding another."),e.k0s()())}let an=(()=>{var r;class a{constructor(t,n,o,s,d){this.modalController=t,this.eventMediaService=n,this.mediaAssetService=o,this.logger=s,this.commonPageService=d,this.eventMediaItem=null,this.currentCarouselCount=0,this.sortOrder=0,this.isBusy=!1,this.previewUrl="",this.isNearCap=!1,this.isAtCap=!1}ngOnInit(){this.eventMediaItem?.mediaFilePath&&(this.previewUrl=this.mediaAssetService.getMediaUrlFromFilePath(this.eventMediaItem.mediaFilePath)??""),this.sortOrder=this.currentCarouselCount,this.isAtCap=this.currentCarouselCount>=10,this.isNearCap=this.currentCarouselCount>=9&&!this.isAtCap}addToCarousel(){var t=this;return(0,u.A)(function*(){if(!t.isBusy&&t.eventMediaItem?.eventMediaId&&!t.isAtCap)try{t.isBusy=!0;const n={eventMediaId:t.eventMediaItem.eventMediaId,sortOrder:t.sortOrder};yield t.eventMediaService.PromoteToCarousel(n),t.logger.LogInfo("Gallery item promoted to carousel",{eventMediaId:t.eventMediaItem.eventMediaId,sortOrder:t.sortOrder}),yield t.modalController.dismiss({promoted:!0})}catch(n){t.logger.LogError(n,"Failed to promote media to carousel"),yield t.commonPageService.handleError(n,"Failed to add to carousel")}finally{t.isBusy=!1}})()}dismiss(){var t=this;return(0,u.A)(function*(){yield t.modalController.dismiss({promoted:!1})})()}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(g.W3),e.rXU(Pe.r),e.rXU(F.S),e.rXU(O.g),e.rXU(H.o))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-promote-to-carousel-modal"]],inputs:{eventMediaItem:"eventMediaItem",currentCarouselCount:"currentCarouselCount"},standalone:!1,decls:17,vars:5,consts:[["slot","end"],["aria-label","Close",3,"click"],["slot","icon-only","name","close-outline"],[1,"promote-carousel-content"],["class","promote-carousel-preview",4,"ngIf"],["class","muted-note",4,"ngIf"],["class","promote-carousel-warning",4,"ngIf"],["class","promote-carousel-warning promote-carousel-warning--blocked",4,"ngIf"],[1,"promote-carousel-footer"],["expand","block",3,"click","disabled"],[1,"promote-carousel-preview"],["alt","Photo to add to the cover carousel",3,"src"],[1,"muted-note"],[1,"promote-carousel-warning"],["name","alert-circle-outline"],[1,"promote-carousel-warning","promote-carousel-warning--blocked"]],template:function(n,o){1&n&&(e.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-title"),e.EFF(3,"Add to cover photos"),e.k0s(),e.j41(4,"ion-buttons",0)(5,"ion-button",1),e.bIt("click",function(){return o.dismiss()}),e.nrm(6,"ion-icon",2),e.k0s()()()(),e.j41(7,"ion-content",3),e.DNE(8,tn,2,1,"div",4)(9,nn,2,0,"p",5)(10,on,4,0,"div",6)(11,rn,4,0,"div",7),e.k0s(),e.j41(12,"ion-footer")(13,"ion-toolbar")(14,"div",8)(15,"ion-button",9),e.bIt("click",function(){return o.addToCarousel()}),e.EFF(16," Add to cover photos "),e.k0s()()()()),2&n&&(e.R7$(8),e.Y8G("ngIf",o.previewUrl),e.R7$(),e.Y8G("ngIf",!o.isAtCap),e.R7$(),e.Y8G("ngIf",o.isNearCap),e.R7$(),e.Y8G("ngIf",o.isAtCap),e.R7$(4),e.Y8G("disabled",o.isBusy||o.isAtCap))},dependencies:[l.bT,g.Jm,g.QW,g.W9,g.M0,g.eU,g.iq,g.BC,g.ai],styles:[".promote-carousel-content[_ngcontent-%COMP%]{--padding-start: var(--spoyla-space-4);--padding-end: var(--spoyla-space-4);--padding-top: var(--spoyla-space-4)}.promote-carousel-preview[_ngcontent-%COMP%]{border-radius:var(--radius-lg);overflow:hidden;margin-bottom:var(--spoyla-space-3);background:var(--color-surface-sunken)}.promote-carousel-preview[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{display:block;width:100%;max-height:260px;object-fit:cover}.promote-carousel-warning[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--spoyla-space-2);padding:var(--spoyla-space-3);border-radius:var(--radius-md);background:var(--spoyla-warning-bg);color:var(--spoyla-warning);font-size:.9rem}.promote-carousel-warning--blocked[_ngcontent-%COMP%]{background:var(--spoyla-danger-bg);color:var(--spoyla-danger)}.promote-carousel-footer[_ngcontent-%COMP%]{padding:var(--spoyla-space-2) var(--spoyla-space-4)}"]}))}return r(),a})();var sn=h(8180),ze=h(578),Se=h(5216),ln=h(9934),He=h(3923),Le=h(7494),dn=h(7435),xe=h(1320),qe=h(3559),cn=h(6431),pn=h(4996),Ke=h(2429);function un(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",23),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.shareEvent())}),e.nrm(1,"ion-icon",24),e.j41(2,"span"),e.EFF(3,"Share"),e.k0s()()}if(2&r){const i=e.XpG(2);e.Y8G("disabled",i.isShareBusy)}}function gn(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",25),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openInviteModal())}),e.nrm(1,"ion-icon",26),e.j41(2,"span"),e.EFF(3,"Invite"),e.k0s()()}}function _n(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",27),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.editEvent())}),e.nrm(1,"ion-icon",28),e.j41(2,"span"),e.EFF(3,"Edit"),e.k0s()()}}function hn(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",11),e.nrm(1,"div",12),e.j41(2,"div",13)(3,"div",14)(4,"button",15),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.goBack())}),e.nrm(5,"ion-icon",16),e.k0s()(),e.j41(6,"div",17)(7,"p",18),e.EFF(8),e.k0s()(),e.j41(9,"div",19),e.DNE(10,un,4,1,"button",20)(11,gn,4,0,"button",21)(12,_n,4,0,"button",22),e.k0s()()()}if(2&r){const i=e.XpG();e.AVh("fade-header--scrolled",i.isScrolled),e.R7$(),e.xc7("opacity",i.headerOpacity),e.R7$(5),e.xc7("opacity",i.titleOpacity),e.R7$(2),e.JRh((null==i.event?null:i.event.title)||"Event"),e.R7$(2),e.Y8G("ngIf",i.isMember),e.R7$(),e.Y8G("ngIf",i.isOrganizer),e.R7$(),e.Y8G("ngIf",i.isOrganizer)}}function mn(r,a){1&r&&e.nrm(0,"ion-skeleton-text",52),2&r&&e.Y8G("animated",!0)}function vn(r,a){if(1&r&&(e.j41(0,"div",29),e.nrm(1,"ion-skeleton-text",3
10),e.j41(2,"div",31)(3,"div",32)(4,"ion-card",33),e.nrm(5,"ion-skeleton-text",34)(6,"ion-skeleton-text",35),e.k0s(),e.j41(7,"ion-card",36),e.nrm(8,"ion-skeleton-text",37),e.j41(9,"div",38),e.nrm(10,"ion-skeleton-text",39)(11,"ion-skeleton-text",39)(12,"ion-skeleton-text",39),e.k0s()(),e.j41(13,"ion-card",36),e.nrm(14,"ion-skeleton-text",37)(15,"ion-skeleton-text",40),e.k0s(),e.j41(16,"ion-card",36),e.nrm(17,"ion-skeleton-text",37)(18,"ion-skeleton-text",40),e.k0s(),e.j41(19,"ion-card",36),e.nrm(20,"ion-skeleton-text",37),e.j41(21,"div",41)(22,"div",42),e.DNE(23,mn,1,1,"ion-skeleton-text",43),e.k0s(),e.nrm(24,"ion-skeleton-text",44),e.k0s()(),e.j41(25,"ion-card",36),e.nrm(26,"ion-skeleton-text",37),e.j41(27,"div",45),e.nrm(28,"ion-skeleton-text",46),e.j41(29,"div",47),e.nrm(30,"ion-skeleton-text",48)(31,"ion-skeleton-text",49),e.k0s()()(),e.j41(32,"ion-card",50),e.nrm(33,"ion-skeleton-text",37)(34,"ion-skeleton-text",51),e.k0s()()()()),2&r){const i=e.XpG();e.R7$(),e.Y8G("animated",!0),e.R7$(4),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(3),e.Y8G("ngForOf",i.loadingPlaceholders),e.R7$(),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0)}}function fn(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-grid",53)(1,"ion-row",54)(2,"ion-col",55)(3,"app-page-load-error",56),e.bIt("retry",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.retryLoad())}),e.k0s()()()()}}
1function yn(r,a){if(1&r&&e.nrm(0,"span",83),2&r){const i=e.XpG(3);e.xc7("background-image",i.heroFillBackgroundImage)}}function In(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",84),e.bIt("click",function(){const n=c.eBV(i).$implicit,o=e.XpG(3);return c.Njj(o.openHeroPhotoViewer(n))}),e.nrm(1,"img",85),e.k0s()}if(2&r){const i=a.$implicit;e.BMQ("aria-label","Open event image "+i.alt),e.R7$(),e.Y8G("src",i.imageUrl,e.B4B)("alt",i.alt)}}function bn(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",88),e.bIt("click",function(){const n=c.eBV(i).index;e.XpG(2);const o=e.sdS(3),s=e.XpG(2);return c.Njj(s.scrollToHero(n,o))}),e.k0s()}if(2&r){const i=a.index,t=e.XpG(4);e.AVh("is-active",i===t.heroActiveIndex),e.BMQ("aria-label","Show event image "+(i+1))}}function En(r,a){if(1&r&&(e.j41(0,"div",86),e.DNE(1,bn,1,3,"button",87),e.k0s()),2&r){const i=e.XpG(3);e.R7$(),e.Y8G("ngForOf",i.heroMediaItems)("ngForTrackBy",i.trackHeroMedia)}}function kn(r,a){if(1&r){const i=e.RV6();e.qex(0),e.DNE(1,yn,1,2,"span",76),e.j41(2,"div",77,2),e.bIt("scroll",function(){c.eBV(i);const n=e.sdS(3),o=e.XpG(2);return c.Njj(o.handleHeroScroll(n))}),e.j41(4,"div",78),e.DNE(5,In,2,3,"button",79),e.k0s()(),e.nrm(6,"span",80)(7,"div",81),e.DNE(8,En,2,2,"div",82),e.bVm()}if(2&r){const i=e.XpG(2);e.R7$(),e.Y8G("ngIf",i.heroFillBackgroundImage),e.R7$(3),e.xc7("--detail-hero-collage-slide-count",i.heroMediaItems.length)("--detail-hero-collage-duration",i.collagePanDuration),e.AVh("is-panning",i.canPanCollage),e.R7$(),e.Y8G("ngForOf",i.heroMediaItems)("ngForTrackBy",i.trackHeroMedia),e.R7$(3),e.Y8G("ngIf",i.heroMediaItems.length>1)}}function Cn(r,a){1&r&&(e.j41(0,"div",89),e.nrm(1,"ion-icon",90),e.k0s())}function Gn(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-button",91),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2),o=e.sdS(7);return c.Njj(n.triggerCarouselUpload(o))}),e.nrm(1,"ion-icon",92),e.EFF(2),e.k0s()}if(2&r){const i=e.XpG(2);e.Y8G("disabled",i.isUploadBusy||i.isCarouselFull),e.R7$(2),e.SpI(" ",i.isCarouselFull?"Cover photos full":i.isUploadBusy?"Uploading...":"Add cover photo"," ")}}function wn(r,a){1&r&&(e.j41(0,"div",93)(1,"span",94),e.nrm(2,"ion-icon",95),e.k0s(),e.j41(3,"span",96)(4,"strong"),e.EFF(5,"Not published yet"),e.k0s(),e.j41(6,"span"),e.EFF(7,"Only you can see this event until it's published from the app."),e.k0s()()())}function Pn(r,a){if(1&r&&(e.j41(0,"p",97),e.EFF(1),e.k0s()),2&r){const i=e.XpG(2);e.R7$(),e.SpI("Hosted by ",i.hostName)}}
1function Sn(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-chip",98),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openOnlineUrl())}),e.nrm(1,"ion-icon",99),e.j41(2,"ion-label"),e.EFF(3,"Join Online"),e.k0s()()}}function xn(r,a){if(1&r&&(e.j41(0,"ion-chip",100),e.nrm(1,"ion-icon",101),e.j41(2,"ion-label"),e.EFF(3),e.k0s()()),2&r){const i=e.XpG(2);e.Y8G("color",i.capacityColor),e.R7$(3),e.JRh(i.capacityLabel)}}function Rn(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",105),e.bIt("click",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.toggleDescription())}),e.EFF(1),e.k0s()}if(2&r){const i=e.XpG(3);e.R7$(),e.SpI(" ",i.isDescriptionExpanded?"Show less":"Show more"," ")}}function Fn(r,a){if(1&r&&(e.j41(0,"div",102)(1,"p",103),e.EFF(2),e.k0s(),e.DNE(3,Rn,2,1,"button",104),e.k0s()),2&r){const i=e.XpG(2);e.R7$(),e.AVh("is-expanded",i.isDescriptionExpanded),e.R7$(),e.JRh(i.event.description),e.R7$(),e.Y8G("ngIf",i.isDescriptionClamped)}}function Mn(r,a){if(1&r&&(e.j41(0,"div",108),e.nrm(1,"ion-icon",109),e.j41(2,"span"),e.EFF(3),e.k0s()()),2&r){const i=e.XpG(3);e.R7$(3),e.JRh(i.rsvpClosedLabel)}}function Tn(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",110)(1,"ion-button",111),e.bIt("click",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.selectRsvp(n.EventRsvpStatusId.Going))}),e.nrm(2,"ion-icon",112),e.EFF(3," Going "),e.k0s(),e.j41(4,"ion-button",113),e.bIt("click",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.selectRsvp(n.EventRsvpStatusId.Maybe))}),e.nrm(5,"ion-icon",114),e.EFF(6," Maybe "),e.k0s(),e.j41(7,"ion-button",115),e.bIt("click",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.selectRsvp(n.EventRsvpStatusId.NotGoing))}),e.nrm(8,"ion-icon",116),e.EFF(9," Not Going "),e.k0s()()}if(2&r){const i=e.XpG(3);e.R7$(),e.Y8G("fill",i.currentUserRsvpStatusId===i.EventRsvpStatusId.Going?"solid":"outline")("disabled",i.isRsvpBusy),e.R7$(3),e.Y8G("fill",i.currentUserRsvpStatusId===i.EventRsvpStatusId.Maybe?"solid":"outline")("disabled",i.isRsvpBusy),e.R7$(3),e.Y8G("fill",i.currentUserRsvpStatusId===i.EventRsvpStatusId.NotGoing?"solid":"outline")("disabled",i.isRsvpBusy)}}function Dn(r,a){if(1&r&&(e.j41(0,"ion-card",36)(1,"div",69)(2,"h2",70),e.EFF(3,"Your RSVP"),e.k0s()(),e.DNE(4,Mn,4,1,"div",106)(5,Tn,10,6,"div",107),e.k0s()),2&r){const i=e.XpG(2);e.R7$(4),e.Y8G("ngIf",i.isRsvpClosed),e.R7$(),e.Y8G("ngIf",!i.isRsvpClosed)}}function Un(r,a){if(1&r&&(e.j41(0,"ion-card",36)(1,"div",69)(2,"h2",70),e.EFF(3,"When"),e.k0s()(),e.j41(4,"div",117)(5,"span",118),e.nrm(6,"ion-icon",90),e.k0s(),e.j41(7,"span",119)(8,"strong"),e.EFF(9),e.k0s()()()()),2&r){const i=e.XpG(2);e.R7$(9),e.JRh(i.formattedDateRange)}}function An(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-button",123),e.bIt("click",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.openDirections())}),e.EFF(1," Directions "),e.k0s()}}function jn(r,a){if(1&r&&(e.j41(0,"span"),e.EFF(1),e.k0s()),2&r){const i=e.XpG(3);e.R7$(),e.JRh(i.locationSubtitle)}}function $n(r,a){if(1&r&&(e.j41(0,"ion-card",36)(1,"div",69)(2,"h2",70),e.EFF(3,"Where"),e.k0s(),e.DNE(4,An,2,0,"ion-button",120),e.k0s(),e.j41(5,"div",117)(6,"span",121),e.nrm(7,"ion-icon",122),e.k0s(),e.j41(8,"span",119)(9,"strong"),e.EFF(10),e.k0s(),e.DNE(11,jn,2,1,"span",10),e.k0s()()()),2&r){const i=e.XpG(2);e.R7$(4),e.Y8G("ngIf",i.directionsUrl),e.R7$(6),e.JRh(i.locationTitle),e.R7$(),e.Y8G("ngIf",i.locationSubtitle)}}function Bn(r,a){if(1&r&&(e.j41(0,"ion-chip",100)(1,"ion-label"),e.EFF(2),e.k0s()()),2&r){const i=e.XpG(3);e.Y8G("color",i.giftExchangeStatusColor),e.R7$(2),e.JRh(i.giftExchangeStatusLabel)}}function Ln(r,a){if(1&r&&(e.j41(0,"p",103),e.EFF(1),e.k0s()),2&r){const i=e.XpG(3);e.R7$(),e.JRh(i.giftExchangeBudgetLabel)}}function On(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-card",36)(1,"div",69)(2,"h2",70),e.nrm(3,"ion-icon",124),e.EFF(4," Gift Exchange "),e.k0s(),e.DNE(5,Bn,3,2,"ion-chip",66),e.k0s(),e.DNE(6,Ln,2,1,"p",125),e.j41(7,"ion-button",126),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openGiftExchangeManage())}),e.nrm(8,"ion-icon",127),e.EFF(9),e.k0s()()}if(2&r){const i=e.XpG(2);
1e.R7$(5),e.Y8G("ngIf",i.giftExchangeStatusLabel),e.R7$(),e.Y8G("ngIf",i.giftExchangeBudgetLabel),e.R7$(3),e.SpI(" ",i.isOrganizer?"Manage Gift Exchange":"View Gift Exchange"," ")}}function Nn(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-button",123),e.bIt("click",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.openRsvpOrganizer())}),e.EFF(1," RSVPs "),e.k0s()}}function Yn(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-button",123),e.bIt("click",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.openParticipantManage())}),e.EFF(1," View "),e.k0s()}}function Vn(r,a){if(1&r&&e.nrm(0,"img",85),2&r){const i=e.XpG().$implicit;e.Y8G("src",i.photoUrl,e.B4B)("alt",i.displayName)}}function Xn(r,a){if(1&r&&(e.j41(0,"span"),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.initials)}}function Wn(r,a){if(1&r&&(e.j41(0,"span",133),e.DNE(1,Vn,1,2,"img",134)(2,Xn,2,1,"span",10),e.k0s()),2&r){const i=a.$implicit;e.R7$(),e.Y8G("ngIf",i.photoUrl),e.R7$(),e.Y8G("ngIf",!i.photoUrl)}}function zn(r,a){if(1&r&&(e.j41(0,"span",135),e.EFF(1),e.k0s()),2&r){const i=e.XpG(3);e.R7$(),e.SpI("+",i.attendeeOverflowCount)}}function Hn(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-card",36)(1,"div",69)(2,"h2",70),e.EFF(3,"Who's going"),e.k0s(),e.DNE(4,Nn,2,0,"ion-button",120)(5,Yn,2,0,"ion-button",120),e.k0s(),e.j41(6,"button",128),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openParticipantManage())}),e.j41(7,"span",129),e.DNE(8,Wn,3,2,"span",130)(9,zn,2,1,"span",131),e.k0s(),e.j41(10,"span",132),e.EFF(11),e.k0s()()()}if(2&r){const i=e.XpG(2);e.R7$(4),e.Y8G("ngIf",i.isOrganizer),e.R7$(),e.Y8G("ngIf",i.isMember),e.R7$(3),e.Y8G("ngForOf",i.attendees)("ngForTrackBy",i.trackAttendee),e.R7$(),e.Y8G("ngIf",i.attendeeOverflowCount>0),e.R7$(2),e.JRh(i.goingSummaryLabel)}}function qn(r,a){1&r&&e.nrm(0,"img",141),2&r&&e.Y8G("src",a.$implicit,e.B4B)}function Kn(r,a){if(1&r&&(e.qex(0),e.DNE(1,qn,1,1,"img",140),e.bVm()),2&r){const i=e.XpG(3);e.R7$(),e.Y8G("ngForOf",i.giftIdeasSummary.previewUrls)("ngForTrackBy",i.trackPreviewUrl)}}function Jn(r,a){1&r&&e.nrm(0,"ion-icon",142)}function Qn(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-card",36)(1,"div",69)(2,"h2",70),e.EFF(3,"Gift ideas"),e.k0s(),e.j41(4,"ion-button",123),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openGiftIdeas())}),e.EFF(5," View all "),e.k0s()(),e.j41(6,"button",136),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openGiftIdeas())}),e.j41(7,"span",137),e.DNE(8,Kn,2,2,"ng-container",138)(9,Jn,1,0,"ng-template",null,3,e.C5r),e.k0s(),e.j41(11,"span",139)(12,"strong"),e.EFF(13),e.k0s(),e.j41(14,"span"),e.EFF(15),e.k0s()()()()}if(2&r){const i=e.sdS(10),t=e.XpG(2);e.R7$(8),e.Y8G("ngIf",t.giftIdeasSummary.previewUrls.length>0)("ngIfElse",i),e.R7$(5),e.Lme("",t.giftIdeasSummary.giftCount," ",1===t.giftIdeasSummary.giftCount?"Gift":"Gifts"),e.R7$(2),e.Lme("",t.giftIdeasSummary.wishlistCount," ",1===t.giftIdeasSummary.wishlistCount?"Wishlist":"Wishlists")}}function Zn(r,a){1&r&&(e.j41(0,"p",147),e.EFF(1," No group gifts yet \u2014 start one and invite others to chip in. "),e.k0s())}function ei(r,a){if(1&r&&e.nrm(0,"img",85),2&r){const i=e.XpG().$implicit;e.Y8G("src",i.recipientPhotoUrl,e.B4B)("alt",i.recipientName)}}function ti(r,a){if(1&r&&(e.j41(0,"span"),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.recipientInitials)}}function ni(r,a){1&r&&(e.j41(0,"ion-badge",155),e.EFF(1,"Closed"),e.k0s())}function ii(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",150),e.bIt("click",function(){const n=c.eBV(i).$implicit,o=e.XpG(4);return c.Njj(o.openGroupGiftDetail(n))}),e.j41(1,"span",151),e.DNE(2,ei,1,2,"img",134)(3,ti,2,1,"span",10),e.k0s(),e.j41(4,"span",152)(5,"strong"),e.EFF(6),e.k0s(),e.j41(7,"span",153),e.EFF(8),e.k0s()(),e.DNE(9,ni,2,0,"ion-badge",154),e.k0s()}if(2&r){const i=a.$implicit;e.R7$(2),e.Y8G("ngIf",i.recipientPhotoUrl),e.R7$(),e.Y8G("ngIf",!i.recipientPhotoUrl),e.R7$(3),e.JRh(i.displayTitle),e.R7$(2),e.Lme("",i.pledgedAmountLabel," \xb7 ",i.pledgedPeopleLabel),e.R7$(),e.Y8G("ngIf",!i.isOpen)}}function oi(r,a){if(1&r&&(e.j41(0,"div",148),e.DNE(1,ii,10,6,"button",149),e.k0s()),2&r){const i=e.XpG(3);e.R7$(),e.Y8G("ngForOf",i.groupGiftSummaries)("ngForTrackBy",i.trackGroupGift)}}function ri(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-card",36)(1,"div",69)(2,"h2",70),e.EFF(3,"Group gifts"),e.k0s(),e.j41(4,"ion-button",143),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.startGroupGift())}),e.nrm(5,"ion-icon",144),e.EFF(6," Start one "),e.k0s()(),e.DNE(7,Zn,2,0,"p",145)(8,oi,2,2,"div",146),e.k0s()}if(2&r){const i=e.XpG(2);e.R7$(4),e.Y8G("disabled",i.isPledgeBusy),e.R7$(3),e.Y8G("ngIf",0===i.groupGiftSummaries.length),e.R7$(),e.Y8G("ngIf",i.groupGiftSummaries.length>0)}}function ai(r,a){if(1&r&&(e.j41(0,"ion-badge"),e.EFF(1),e.k0s()),2&r){const i=e.XpG(2);e.R7$(),e.JRh(i.galleryTotalCount)}}
1function si(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-button",143),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2),o=e.sdS(5);return c.Njj(n.triggerGalleryUpload(o))}),e.nrm(1,"ion-icon",92),e.EFF(2),e.k0s()}if(2&r){const i=e.XpG(2);e.Y8G("disabled",i.isUploadBusy),e.R7$(2),e.SpI(" ",i.isUploadBusy?"Uploading...":"Add Photos"," ")}}function li(r,a){1&r&&(e.j41(0,"ion-badge",164),e.EFF(1," Under review "),e.k0s())}function di(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-button",165),e.bIt("click",function(n){c.eBV(i);const o=e.XpG().$implicit,s=e.XpG(3);return n.stopPropagation(),c.Njj(s.openPromoteToCarousel(o))}),e.nrm(1,"ion-icon",166),e.k0s()}}function ci(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-button",167),e.bIt("click",function(n){c.eBV(i);const o=e.XpG().$implicit,s=e.XpG(3);return n.stopPropagation(),c.Njj(s.reportGalleryPhoto(o))}),e.nrm(1,"ion-icon",168),e.k0s()}if(2&r){const i=e.XpG(4);e.Y8G("disabled",i.isReportBusy)}}function pi(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",158),e.bIt("click",function(){const n=c.eBV(i).$implicit,o=e.XpG(3);return c.Njj(o.openPhotoViewer(n))}),e.nrm(1,"img",159),e.DNE(2,li,2,0,"ion-badge",160),e.j41(3,"div",161),e.DNE(4,di,2,0,"ion-button",162)(5,ci,2,1,"ion-button",163),e.k0s()()}if(2&r){const i=a.$implicit,t=e.XpG(3);e.AVh("gallery-thumb-wrap--under-review",i.isUnderReview),e.R7$(),e.Y8G("src",i.imageUrl,e.B4B),e.R7$(),e.Y8G("ngIf",i.isUnderReview),e.R7$(2),e.Y8G("ngIf",t.canManageCarousel),e.R7$(),e.Y8G("ngIf",t.isMember&&!i.isOwnPhoto)}}function ui(r,a){if(1&r&&(e.j41(0,"div",156),e.DNE(1,pi,6,6,"div",157),e.k0s()),2&r){const i=e.XpG(2);e.R7$(),e.Y8G("ngForOf",i.galleryItems)("ngForTrackBy",i.trackGalleryItem)}}function gi(r,a){1&r&&(e.j41(0,"p"),e.EFF(1,"No photos yet \u2014 be the first to add one!"),e.k0s())}function _i(r,a){1&r&&(e.j41(0,"p"),e.EFF(1,"No photos yet."),e.k0s())}function hi(r,a){if(1&r&&(e.j41(0,"div",169),e.nrm(1,"ion-icon",170),e.DNE(2,gi,2,0,"p",10)(3,_i,2,0,"p",10),e.k0s()),2&r){const i=e.XpG(2);e.R7$(2),e.Y8G("ngIf",i.isMember),e.R7$(),e.Y8G("ngIf",!i.isMember)}}function mi(r,a){if(1&r){const i=e.RV6();e.qex(0),e.j41(1,"section",57),e.DNE(2,kn,9,10,"ng-container",10)(3,Cn,2,0,"div",58)(4,Gn,3,2,"ion-button",59),e.k0s(),e.j41(5,"div",31)(6,"div",32),e.DNE(7,wn,8,0,"div",60),e.j41(8,"ion-card",33)(9,"p",61),e.EFF(10),e.k0s(),e.j41(11,"h1",62),e.EFF(12),e.k0s(),e.DNE(13,Pn,2,1,"p",63),e.j41(14,"div",64),e.DNE(15,Sn,4,0,"ion-chip",65)(16,xn,4,2,"ion-chip",66),e.k0s(),e.DNE(17,Fn,4,4,"div",67),e.k0s(),e.DNE(18,Dn,6,2,"ion-card",68)(19,Un,10,1,"ion-card",68)(20,$n,12,3,"ion-card",68)(21,On,10,3,"ion-card",68)(22,Hn,12,6,"ion-card",68)(23,Qn,16,6,"ion-card",68)(24,ri,9,3,"ion-card",68),e.j41(25,"ion-card",50)(26,"div",69)(27,"h2",70),e.EFF(28," User Photos "),e.DNE(29,ai,2,1,"ion-badge",10),e.k0s(),e.DNE(30,si,3,2,"ion-button",71),e.k0s(),e.DNE(31,ui,2,2,"div",72)(32,hi,4,2,"div",73),e.k0s(),e.j41(33,"ion-infinite-scroll",74),e.bIt("ionInfinite",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.loadMoreGallery(n))}),e.nrm(34,"ion-infinite-scroll-content",75),e.k0s()()(),e.bVm()}if(2&r){const i=e.XpG();e.R7$(2),e.Y8G("ngIf",i.heroMediaItems.length>0),e.R7$(),e.Y8G("ngIf",0===i.heroMediaItems.length),e.R7$(),e.Y8G("ngIf",i.canManageCarousel),e.R7$(3),e.Y8G("ngIf",i.isDraft),e.R7$(3),e.SpI(" ",i.isOrganizer?"You're hosting":"You're invited"," "),e.R7$(2),e.JRh(i.event.title),e.R7$(),e.Y8G("ngIf",!i.isOrganizer),e.R7$(2),e.Y8G("ngIf",i.isOnlineOrHybrid&&i.event.onlineUrl),e.R7$(),e.Y8G("ngIf",i.showCapacity),e.R7$(),e.Y8G("ngIf",i.event.description),e.R7$(),e.Y8G("ngIf",i.canRsvp),e.R7$(),e.Y8G("ngIf",i.formattedDateRange),e.R7$(),e.Y8G("ngIf",i.showLocation&&(i.event.locationName||i.directionsUrl)),e.R7$(),e.Y8G("ngIf",i.isGiftExchange),e.R7$(),e.Y8G("ngIf",i.canViewParticipants),e.R7$(),e.Y8G("ngIf",i.wishlists.length>0),e.R7$(),e.Y8G("ngIf",i.showGroupGiftSection),e.R7$(5),e.Y8G("ngIf",i.galleryTotalCount>0),e.R7$(),e.Y8G("ngIf",i.isMember),e.R7$(),e.Y8G("ngIf",i.galleryItems.length>0),e.R7$(),e.Y8G("ngIf",0===i.galleryItems.length),e.R7$(),e.Y8G("disabled",!i.galleryHasMore)}}var le=function(r){return r[r.Draft=1]="Draft",r[r.Drawn=2]="Drawn",r[r.Revealed=3]="Revealed",r[r.Cancelled=4]="Cancelled",r}(le||{});let Ci=(()=>{var r;class a{get groupGiftSummaries(){return this.groupGiftState?.groupGiftSummaries??[]}get isPledgeBusy(){return this.groupGiftState?.isPledgeBusy??!1}constructor(t,n,o,s,d,p,_,v,y,I,E,R,U,G,A,de,ce,he,Te,k){this.route=t,this.modalController=n,this.nav=o,this.logger=s,this.common=d,this.jwtService=p,this.eventService=_,this.eventUserService=v,this.eventRsvpService=y,this.eventRsvpQuestionService=I,this.eventMediaService=E,this.knownMediaService=R,this.mediaReportService=U,this.reportedMediaService=G,this.eventWishlistService=A,this.wishlistItemService=de,this.shareService=ce,this.mediaAssetService=he,this.pledgeService=Te,this.posthogService=k,this.loadingPlaceholders=[0,1,2,3],this.eventId="",this.shareCode=null,this.pendingGroupGiftId=null,this.event=null,this.carouselMedia=[],this.heroMediaItems=[],this.heroActiveIndex=0,this.canPanCollage=!1,this.collagePanDuration="40s",this.heroFillBackgroun
1dImage=null,this.galleryItems=[],this.galleryTotalCount=0,this.galleryHasMore=!1,this.wishlists=[],this.giftIdeasSummary={giftCount:0,wishlistCount:0,previewUrls:[]},this.participants={goingCount:0,maybeCount:0,notGoingCount:0,invitedCount:0},this.attendees=[],this.attendeeOverflowCount=0,this.goingSummaryLabel="",this.currentUserId="",this.currentUserRsvpStatusId=null,this.isOrganizer=!1,this.isMember=!1,this.canRsvp=!1,this.canViewParticipants=!1,this.formattedStartDate="",this.formattedEndDate="",this.formattedDateRange="",this.locationTitle="",this.locationSubtitle="",this.hostName="",this.formatLabel="",this.formatIcon="calendar-outline",this.coverImageUrl=null,this.knownMediaIds=new Set,this.directionsUrl=null,this.capacityLabel="",this.capacityColor="",this.showCapacity=!1,this.isOnlineOrHybrid=!1,this.showLocation=!1,this.EventRsvpStatusId=W.$,this.isBusy=!1,this.hasError=!1,this.isRsvpBusy=!1,this.isShareBusy=!1,this.isReportBusy=!1,this.isUploadBusy=!1,this.isDraft=!1,this.isDescriptionExpanded=!1,this.isDescriptionClamped=!1,this.isGiftExchange=!1,this.giftExchangeId="",this.giftExchangeStatusLabel="",this.giftExchangeStatusColor="",this.giftExchangeBudgetLabel="",this.isGiftExchangeDrawn=!1,this.headerOpacity=0,this.isScrolled=!1,this.titleOpacity=0,this.surfaceFadeDistance=60,this.scrolledThreshold=16,this.titleFadeDistance=60,this.heroScrollSettleTimer=null,this.participantCounts=null,this.lastKnownOrganizers=[],this.galleryPageNumber=1,this.galleryPageSize=24,this.isGalleryLoadingMore=!1,this.groupGiftState=new en(this.reportedMediaService,this.pledgeService,this.mediaAssetService,this.common,this.logger,this.posthogService)}get showGroupGiftSection(){return this.isMember}ngOnInit(){if(this.eventId=this.route.snapshot.paramMap.get("eventId")||"",!this.eventId)return this.hasError=!0,void this.logger.LogWarning("Event detail route missing eventId");this.shareCode=this.route.snapshot.queryParamMap.get("shareCode"),this.pendingGroupGiftId=this.route.snapshot.queryParamMap.get("groupGift"),this.initPage()}ionViewWillEnter(){var t=this;return(0,u.A)(function*(){t.eventId&&(yield t.loadEventDetail())})()}retryLoad(){var t=this;return(0,u.A)(function*(){yield t.loadEventDetail()})()}onScroll(t){const n=t.detail.scrollTop;this.headerOpacity=this.ramp(n,0,this.surfaceFadeDistance),this.titleOpacity=this.ramp(n,0,this.titleFadeDistance),this.isScrolled=n>this.scrolledThreshold}toggleDescription(){this.isDescriptionExpanded=!this.isDescriptionExpanded}goBack(){this.nav.navigateBack("/app/events")}editEvent(){var t=this;return(0,u.A)(function*(){!t.isOrganizer||!t.eventId||(yield t.nav.navigateForward(`/app/events/${t.eventId}/edit`))})()}ramp(t,n,o){return o<=0?t>n?1:0:Math.min(Math.max((t-n)/o,0),1)}handleRefresh(t){var n=this;return(0,u.A)(function*(){try{n.eventId&&(yield n.loadEventDetail())}finally{yield t.target.complete()}})()}selectRsvp(t){var n=this;return(0,u.A)(function*(){if(n.isRsvpBusy||!n.eventId||n.isRsvpClosed||n.isGiftExchangeDrawn)return;if(t===W.$.Going&&(yield n.hasGuestQuestions()))return void(yield n.openRsvpResponseModal(t));const o=n.currentUserRsvpStatusId;n.currentUserRsvpStatusId=t;try{n.isRsvpBusy=!0;const s={eventId:n.eventId,eventRsvpStatusId:t,...n.shareCode?{shareCode:n.shareCode}:{}};yield n.eventRsvpService.UpsertRsvp(s),n.isMember=!0,n.logger.LogInfo("RSVP updated",{eventId:n.eventId,statusId:t}),yield n.refreshParticipantCounts()}catch(s){n.currentUserRsvpStatusId=o,n.logger.LogError(s,"Failed to update RSVP"),yield n.common.handleError(s,"Failed to update RSVP")}finally{n.isRsvpBusy=!1}})()}get isRsvpClosed(){const t=this.event?.startDT?new Date(this.event.startDT).getTime():NaN;return!isNaN(t)&&t<=Date.now()}get rsvpClosedLabel(){switch(this.currentUserRsvpStatusId){case W.$.Going:return"This event has started, so RSVPs are closed. You were down as going.";case W.$.Maybe:return"This event has started, so RSVPs are closed. You were down as a maybe.";case W.$.NotGoing:return"This event has started, so RSVPs are closed. You were down as not going.";default:return"This event has started, so RSVPs are closed."}}hasGuestQuestions(){var t=this;return(0,u.A)(function*(){try{return((yield t.eventRsvpQuestionService.GetQuestionsForEvent(t.eventId,t.shareCode??""))?.length??0)>0}catch(n){return t.logger.LogDebug("Guest question lookup failed; using status-only RSVP",{eventId:t.eventId,error:n}),!1}})()}openRsvpOrganizer(){var t=this;return(0,u.A)(function*(){if(!t.eventId||!t.isOrganizer)return;const n=yield t.modalController.create({component:qt.r,componentProps:{eventId:t.eventId,eventTitle:t.event?.title??""},cssClass:"popup-modal-centered",backdropDismiss:!0});yield n.present(),yield n.onDidDismiss(),yield t.refreshParticipantCounts()})()}openRsvpResponseModal(t){var n=this;return(0,u.A)(function*(){const o=n.currentUserRsvpStatusId,s=yield n.modalController.create({component:Ht.z,componentProps:{eventId:n.eventId,shareCode:n.shareCode??null,maxPartySize:n.event?.maxPartySize??null,eventRsvpStatusId:t},cssClass:"popup-modal-centered",backdropDismiss:!0});yield s.present();const{role:d}=yield s.onDidDismiss();"submitted"===d?(n.currentUserRsvpStatusId=t,n.isMember=!0,n.logger.LogInfo("RSVP updated with guest answers",{eventId:n.eventId,statusId:t}),yield n.refreshParticipantCounts()):n.currentUserRsvpStatusId=o})()}openOnlineUrl(){var t=this;return(0,u.A)(function*(){const n=t.event?.onlineUrl?.trim();n&&(yield t.common.openExternalLink(n))})()}openDirections(){var t=this;return(0,u.A)(function*(){t.directionsUrl&&(yield t.common.openExternalLink(t.directionsUrl))})()}shareEvent(){var t=this;return(0,u.A)(function*(){if(!t.isShareBusy&&t.isMember&&t.eventId)try{t.isShareBusy=!0;const n=t.event?.title?.trim()||"Event",o={type:"event",id:t.eventId,title:n,shareUrl:`${Ye.c.webUrl}/event/${t.eventId}
1`,iconName:"calendar-outline",noteText:"Who can open this link depends on the event's privacy setting.",shareMessage:t.buildShareMessage(),shareTitle:"Share Event",copyToastMessage:"Event link copied",qrTitle:n};t.formattedDateRange&&(o.meta=t.formattedDateRange);const s=yield t.modalController.create({component:ze.I,componentProps:{shareContext:o},cssClass:"share-options-modal"});t.posthogService.posthog.capture("modal_shown",{modal:"share_options",type:"event"}),yield s.present(),yield s.onDidDismiss(),t.logger.LogInfo("Event share modal shown",{eventId:t.eventId})}catch(n){t.logger.LogError(n,"Failed to share event"),yield t.common.handleError(n,"Failed to share event")}finally{t.isShareBusy=!1}})()}buildShareMessage(){const n=["Check out this event on Spoyla:",this.event?.title?.trim()||"my event"];return this.formattedDateRange&&n.push(this.formattedDateRange),n.join("\n")}handleHeroScroll(t){t.clientWidth&&(this.heroActiveIndex=this.computeHeroIndex(t),this.heroScrollSettleTimer&&clearTimeout(this.heroScrollSettleTimer),this.heroScrollSettleTimer=setTimeout(()=>{this.heroActiveIndex=this.computeHeroIndex(t),this.heroScrollSettleTimer=null},120))}scrollToHero(t,n){this.heroActiveIndex=t,n.scrollTo({left:t*n.clientWidth,behavior:"smooth"})}computeHeroIndex(t){const n=Math.round(t.scrollLeft/t.clientWidth);return Math.max(0,Math.min(n,this.heroMediaItems.length-1))}openParticipantManage(){var t=this;return(0,u.A)(function*(){if(!t.isMember)return;const n=yield t.modalController.create({component:yt,componentProps:{eventId:t.eventId,maxAttendees:t.event?.maxAttendees||null},cssClass:"popup-modal-centered"});yield n.present(),yield n.onDidDismiss()})()}openInviteModal(){var t=this;return(0,u.A)(function*(){if(!t.isOrganizer)return;const n=yield t.modalController.create({component:zt,componentProps:{eventId:t.eventId},cssClass:"popup-modal-centered"});yield n.present(),yield n.onDidDismiss(),t.loadEventDetail()})()}openPhotoViewer(t){var n=this;return(0,u.A)(function*(){if(!t.dto.eventMediaId)return;const o=n.galleryItems.filter(s=>!!s.dto.eventMediaId).map(s=>({eventMediaId:s.dto.eventMediaId,imageUrl:s.imageUrl,canDelete:s.isOwnPhoto||n.isOrganizer,canReport:!s.isOwnPhoto&&n.isMember}));yield n.presentPhotoViewer(o,t.dto.eventMediaId,s=>n.handleGalleryViewerDelete(s),s=>n.handleGalleryViewerReport(s))})()}openHeroPhotoViewer(t){var n=this;return(0,u.A)(function*(){if(!t)return;const o=n.heroMediaItems.map(s=>{const d=n.carouselMedia.find(_=>_.eventMediaId===s.id);return{eventMediaId:s.id,imageUrl:s.imageUrl,canDelete:!!d&&n.isOrganizer,canReport:!!d&&!(d&&d.uploadedByUserId===n.currentUserId)&&n.isMember}});yield n.presentPhotoViewer(o,t.id,s=>n.handleCarouselViewerDelete(s),s=>n.handleCarouselViewerReport(s))})()}presentPhotoViewer(t,n,o,s){var d=this;return(0,u.A)(function*(){if(0===t.length)return;const p=yield d.modalController.create({component:It.j,componentProps:{items:t,initialEventMediaId:n,onDeletePhoto:o,onReportPhoto:s},cssClass:"photo-viewer-modal",backdropDismiss:!0});yield p.present(),yield p.onDidDismiss()})()}handleGalleryViewerDelete(t){var n=this;return(0,u.A)(function*(){const o=n.galleryItems.find(d=>d.dto.eventMediaId===t.eventMediaId);if(!o)return!1;const s=n.galleryItems.length;if(o.isOwnPhoto)yield n.removeOwnGalleryPhoto(o);else{if(!n.isOrganizer)return!1;yield n.moderateRemoveGalleryPhoto(o)}return n.galleryItems.length<s})()}handleGalleryViewerReport(t){var n=this;return(0,u.A)(function*(){const o=n.galleryItems.find(d=>d.dto.eventMediaId===t.eventMediaId);if(!o)return!1;const s=n.galleryItems.length;return yield n.reportGalleryPhoto(o),n.galleryItems.length<s})()}handleCarouselViewerDelete(t){var n=this;return(0,u.A)(function*(){if(!n.carouselMedia.find(p=>p.eventMediaId===t.eventMediaId)?.eventMediaId||!n.isOrganizer||!(yield n.common.showConfirmAlertDialog("Remove Photo","Remove this photo from the event carousel?")))return!1;const d=[...n.carouselMedia];n.carouselMedia=n.carouselMedia.filter(p=>p.eventMediaId!==t.eventMediaId),n.calculateHeroMedia();try{return yield n.eventMediaService.RemoveCarouselMedia(t.eventMediaId),n.logger.LogInfo("Carousel photo removed",{eventMediaId:t.eventMediaId}),!0}catch(p){return n.carouselMedia=d,n.calculateHeroMedia(),n.logger.LogError(p,"Failed to remove carousel photo"),yield n.common.handleError(p,"Failed to remove photo"),!1}})()}handleCarouselViewerReport(t){var n=this;return(0,u.A)(function*(){const o=n.carouselMedia.find(_=>_.eventMediaId===t.eventMediaId),s=o?.uploadedByUserId===n.currentUserId;if(n.isReportBusy||!o?.eventMediaId||s||!n.isMember)return!1;const d=yield n.common.showConfirmInputDialog("Report Photo","Report this photo to be reviewed? It will be hidden from the event carousel.","Reason (optional)");if(!d.confirmed)return!1;const p=[...n.carouselMedia];n.carouselMedia=n.carouselMedia.filter(_=>_.eventMediaId!==t.eventMediaId),n.calculateHeroMedia();try{n.isReportBusy=!0;const _={mediaId:o.mediaId,eventMediaId:o.eventMediaId,reason:d.value};return yield n.mediaReportService.ReportMedia(_),n.reportedMediaService.markReported(o.mediaId),n.logger.LogInfo("Carousel photo reported",{eventMediaId:t.eventMediaId}),!0}catch(_){return n.carouselMedia=p,n.calculateHeroMedia(),n.logger.LogError(_,"Failed to report carousel photo"),yield n.common.handleError(_,"Failed to report photo"),!1}finally{n.isReportBusy=!1}})()}triggerGalleryUpload(t){!this.isMember||this.isUploadBusy||t.click()}onGalleryFilesSelected(t){var n=this;return(0,u.A)(function*(){const o=t.target,s=Array.from(o.files||[]).slice(0,10);if(o.value="",0!==s.length&&n.isMember&&n.eventId)try{n.isUploadBusy=!0;let d=0;for(const p of s)try{const _=yield n.mediaAssetService.uploadMediaBlob(p,p.name,Be.k.Landscape);if(!_?.mediaId){d++;continue}const v={eventId:n.eventId,mediaId:_.mediaId};yield n.eventMediaService.AddContributedMedia(v)}catch(_){d++,n.logger.LogError(_,"Failed to upload gallery photo")}d<s.length&&(n.logger.LogInfo("Gallery photos added",{eventId:n.eventId,count:s.length-d}),yield n.loadGallery()),d>0&&(yield n.common.handleError(new Error("Some photos could not be uploaded"),"Some photos could not be uploaded"))}finally{n.isUploadBusy=!1}})()}get canManageCarousel(){return this.isOrganizer}get isCarouselFull(){return this.carouselMedia.length>=10}triggerCarouselUpload(t){!this.canManageCarousel||this.isUploadBusy||this.isCarouselFull||t.click()}onCarouselFilesSelected(t){var n=this;return(0,u.A)(function*(){const o=t.target,s=Array.from(o.files||[]);if(o.value="",0===s.length||!n.canManageCarousel||!n.eventId)return;const d=Math.max(0,10-n.carouselMedia.length),p=s.slice(0,d);if(0!==p.length)try{n.isUploadBusy=!0;let _=0,v=n.carouselMedia.length;for(const y of p)try{const I=yield n.mediaAssetService.uploadMediaBlob(y,y.name,Be.k.Landscape);if(!I?.mediaId){_++;continue}const E={eventId:n.eventId,mediaId:I.mediaId,sortOrder:v};yield n.eventMediaService.AddCarouselMedia(E),v++}catch(I){_++,n.logger.LogError(I,"Failed to upload cover photo")}_<p.length&&(n.logger.LogInfo("Cover photos added",{eventId:n.eventId,count:p.length-_}
1),yield n.loadCarousel()),_>0&&(yield n.common.handleError(new Error("Some photos could not be uploaded"),"Some cover photos could not be uploaded"))}finally{n.isUploadBusy=!1}else yield n.common.showAlertDialog("Cover photos are full","You can have up to 10 cover photos. Remove one before adding another.")})()}openPromoteToCarousel(t){var n=this;return(0,u.A)(function*(){if(!n.canManageCarousel||!t.dto)return;const o=yield n.modalController.create({component:an,componentProps:{eventMediaItem:t.dto,currentCarouselCount:n.carouselMedia.length},cssClass:"popup-modal-centered",backdropDismiss:!0});yield o.present();const{data:s}=yield o.onDidDismiss();s?.promoted&&(yield n.loadCarousel(),yield n.loadGallery())})()}removeOwnGalleryPhoto(t){var n=this;return(0,u.A)(function*(){if(!t.isOwnPhoto||!t.dto.eventMediaId||!(yield n.common.showConfirmAlertDialog("Remove Photo","Remove this photo from the event gallery?")))return;const s=[...n.galleryItems];n.galleryItems=n.galleryItems.filter(d=>d.dto.eventMediaId!==t.dto.eventMediaId);try{yield n.eventMediaService.RemoveOwnContributedMedia(t.dto.eventMediaId),n.logger.LogInfo("Own gallery photo removed",{eventMediaId:t.dto.eventMediaId})}catch(d){n.galleryItems=s,n.logger.LogError(d,"Failed to remove gallery photo"),yield n.common.handleError(d,"Failed to remove photo")}})()}reportGalleryPhoto(t){var n=this;return(0,u.A)(function*(){if(n.isReportBusy||t.isOwnPhoto||!n.isMember||!t.dto.eventMediaId)return;const o=yield n.common.showConfirmInputDialog("Report Photo","Report this photo to be reviewed? It will be hidden from the gallery.","Reason (optional)");if(!o.confirmed)return;const s=[...n.galleryItems];n.galleryItems=n.galleryItems.filter(d=>d.dto.eventMediaId!==t.dto.eventMediaId);try{n.isReportBusy=!0;const d={mediaId:t.dto.mediaId,eventMediaId:t.dto.eventMediaId,reason:o.value};yield n.mediaReportService.ReportMedia(d),n.reportedMediaService.markReported(t.dto.mediaId),n.logger.LogInfo("Gallery photo reported",{eventMediaId:t.dto.eventMediaId})}catch(d){n.galleryItems=s,n.logger.LogError(d,"Failed to report gallery photo"),yield n.common.handleError(d,"Failed to report photo")}finally{n.isReportBusy=!1}})()}moderateRemoveGalleryPhoto(t){var n=this;return(0,u.A)(function*(){if(!n.isOrganizer||!t.dto.eventMediaId||!(yield n.common.showConfirmAlertDialog("Remove Photo","Remove this photo from the gallery?")))return;const s=[...n.galleryItems];n.galleryItems=n.galleryItems.filter(d=>d.dto.eventMediaId!==t.dto.eventMediaId);try{yield n.eventMediaService.ModerateRemoveContributedMedia(t.dto.eventMediaId),n.logger.LogInfo("Gallery photo moderated away",{eventMediaId:t.dto.eventMediaId})}catch(d){n.galleryItems=s,n.logger.LogError(d,"Failed to remove gallery photo"),yield n.common.handleError(d,"Failed to remove photo")}})()}openGiftExchangeManage(){var t=this;return(0,u.A)(function*(){t.giftExchangeId&&(yield t.nav.navigateForward(`/app/secret-santa/${t.giftExchangeId}`))})()}goToWishlist(t){var n=this;return(0,u.A)(function*(){t?.trim()&&(yield n.nav.navigateForward(`/app/wishlist/${t}`))})()}openGiftIdeas(){var t=this;return(0,u.A)(function*(){if(0!==t.wishlists.length){if(1===t.wishlists.length)return void(yield t.goToWishlist(t.wishlists[0].wishlistId));yield t.nav.navigateForward(`/app/events/${t.eventId}/gifts`)}})()}loadMoreGallery(t){var n=this;return(0,u.A)(function*(){if(!n.isGalleryLoadingMore&&n.galleryHasMore&&n.eventId)try{n.isGalleryLoadingMore=!0;const o=n.galleryPageNumber+1,s=yield n.eventMediaService.GetContributedGallery(n.eventId,o,n.galleryPageSize),d=s?.items||[];if(n.galleryPageNumber=o,n.galleryTotalCount=s?.totalCount??n.galleryTotalCount,d.length>0){const p=new Set(n.galleryItems.map(v=>v.dto.eventMediaId)),_=n.mapGalleryItems(d).filter(v=>!p.has(v.dto.eventMediaId));n.galleryItems=[...n.galleryItems,..._]}n.galleryHasMore=d.length>=n.galleryPageSize&&n.galleryItems.length<n.galleryTotalCount}catch(o){n.logger.LogError(o,"Failed to load more gallery photos")}finally{n.isGalleryLoadingMore=!1,yield t.target.complete()}else yield t.target.complete()})()}trackWishlist(t,n){return n.wishlistId||`wishlist-${t}`}trackPreviewUrl(t,n){return n||`preview-${t}`}trackGalleryItem(t,n){return n.dto.eventMediaId||`gallery-${t}`}
1trackHeroMedia(t,n){return n.id}trackAttendee(t,n){return n.id||`attendee-${t}`}initPage(){var t=this;return(0,u.A)(function*(){try{t.currentUserId=yield t.jwtService.getUserId()}catch(n){t.logger.LogError(n,"Failed to get current user id on event detail")}})()}loadEventDetail(){var t=this;return(0,u.A)(function*(){if(!t.isBusy&&t.eventId)try{t.isBusy=!0,t.hasError=!1,t.currentUserId||(yield t.initPage());const[n,o,s,d]=yield Promise.all([t.eventService.GetEventById(t.eventId,t.shareCode||""),t.eventMediaService.GetCarouselMedia(t.eventId),t.eventMediaService.GetContributedGallery(t.eventId,1,t.galleryPageSize),t.eventWishlistService.GetWishlistsForEvent(t.eventId),t.loadKnownMediaIds()]);t.event=n,t.carouselMedia=o||[],t.wishlists=(d||[]).map(p=>p.wishlist).filter(p=>!!p?.wishlistId).map(p=>({wishlistId:p.wishlistId,name:p.name||"Wishlist",description:p.description||"",mediaUrl:t.mediaAssetService.getMediaUrl(p.media)??"",itemCount:p.totalItems??0})),t.calculateDisplayFields(n),t.calculateHeroMedia(),t.applyGalleryPage(s?.items||[],s?.totalCount??0),yield t.loadParticipantData(),yield t.loadGiftIdeasSummary(),yield t.loadGroupGifts(),t.logger.LogDebug("Event detail loaded",{eventId:t.eventId}),t.posthogService.posthog.capture("event_viewed",{eventId:t.eventId})}catch(n){t.logger.LogError(n,"Failed to load event detail"),t.hasError=!0}finally{t.isBusy=!1}})()}loadGiftIdeasSummary(){var t=this;return(0,u.A)(function*(){const n=t.wishlists;if(0===n.length)return void(t.giftIdeasSummary={giftCount:0,wishlistCount:0,previewUrls:[]});const o=yield Promise.all(n.map(function(){var I=(0,u.A)(function*(E){try{const R=yield t.wishlistItemService.GetItemsByWishlist(E.wishlistId,1,3);return{items:Array.isArray(R?.items)?R.items:[],totalCount:R?.totalCount??E.itemCount}}catch(R){return t.logger.LogError(R,"Failed to load wishlist items for event gift ideas"),{items:[],totalCount:E.itemCount}}});return function(E){return I.apply(this,arguments)}}())),s=o.reduce((I,E)=>I.concat(E.items),[]),d=o.reduce((I,E)=>I+E.totalCount,0),p=n.reduce((I,E)=>I+E.itemCount,0),_=d||p||s.length,v=[],y=[...s.map(I=>t.mediaAssetService.getMediaUrl(I.media)??""),...n.map(I=>I.mediaUrl)];for(const I of y){const E=I?.trim();if(E&&!v.includes(E)&&v.push(E),v.length>=3)break}t.giftIdeasSummary={giftCount:_,wishlistCount:n.length,previewUrls:v}})()}trackGroupGift(t,n){return n.pledgeId||`group-gift-${t}`}openGroupGiftDetail(t){var n=this;return(0,u.A)(function*(){const o=yield n.modalController.create({component:Kt.f,componentProps:{summary:t},cssClass:"popup-modal-centered",backdropDismiss:!0});yield o.present();const{role:s}=yield o.onDidDismiss();switch(s){case"pledge":return void(yield n.openContributionModal(t));case"edit":return void(yield n.editGroupGift(t));case"fulfil":return void(yield n.groupGiftState.fulfilGroupGift(n.eventId,t.pledgeId));case"cancel":return void(yield n.groupGiftState.cancelGroupGift(n.eventId,t.pledgeId));case"withdraw":return void(yield n.groupGiftState.withdrawContribution(n.eventId,t.pledgeId));case"refresh":return void(yield n.loadGroupGifts());default:return}})()}openContributionModal(t){var n=this;return(0,u.A)(function*(){const o=yield n.modalController.create({component:Jt.D,componentProps:{recipientName:t.recipientName,pledgedAmountLabel:t.pledgedAmountLabel,currencySymbol:t.currencySymbol},cssClass:"popup-modal-centered",backdropDismiss:!0});yield o.present();const{data:s,role:d}=yield o.onDidDismiss();"pledge"!==d||!s?.amount||s.amount<=0||(yield n.submitContribution(t.pledgeId,s.amount))})()}submitContribution(t,n){var o=this;return(0,u.A)(function*(){yield o.groupGiftState.submitPledgeContribution(o.eventId,t,n)})()}startGroupGift(){var t=this;return(0,u.A)(function*(){const n=yield t.presentGroupGiftEditor(null);"create"===n?.mode&&(yield t.groupGiftState.createGroupGift(t.eventId,n.request,n.itemChanges))})()}editGroupGift(t){var n=this;return(0,u.A)(function*(){const o=yield n.presentGroupGiftEditor(t);"edit"===o?.mode&&o.pledgeId&&(yield n.groupGiftState.updateGroupGift(n.eventId,o.pledgeId,o.request,o.itemChanges))})()}presentGroupGiftEditor(t){var n=this;return(0,u.A)(function*(){const o=yield n.modalController.create({component:Qt.L,componentProps:{eventId:n.eventId,attendees:n.attendees,currentUserId:n.currentUserId,wishlists:n.wishlists.map(p=>({wishlistId:p.wishlistId,name:p.name})),existing:t},cssClass:"popup-modal-centered",backdropDismiss:!0});yield o.present();const{data:s,role:d}=yield o.onDidDismiss();return"submit"===d&&s?s:null})()}loadGroupGifts(){var t=this;return(0,u.A)(function*(){t.eventId&&(yield t.groupGiftState.loadGroupGifts(t.eventId),yield t.openPendingGroupGift())})()}openPendingGroupGift(){var t=this;return(0,u.A)(function*(){if(!t.pendingGroupGiftId)return;const n=t.pendingGroupGiftId;t.pendingGroupGiftId=null;const o=t.groupGiftSummaries.find(s=>s.pledgeId===n);o&&(yield t.openGroupGiftDetail(o))})()}
1loadCarousel(){var t=this;return(0,u.A)(function*(){try{t.carouselMedia=yield t.eventMediaService.GetCarouselMedia(t.eventId),t.calculateHeroMedia()}catch(n){t.logger.LogError(n,"Failed to reload carousel")}})()}loadGallery(){var t=this;return(0,u.A)(function*(){try{const n=yield t.eventMediaService.GetContributedGallery(t.eventId,1,t.galleryPageSize);t.applyGalleryPage(n?.items||[],n?.totalCount??0)}catch(n){t.logger.LogError(n,"Failed to reload gallery")}})()}calculateDisplayFields(t){if(!t)return;this.coverImageUrl=this.mediaAssetService.getMediaUrl(t.media)||null,this.hostName=t.createdByUser?.nickName?.trim()||"A Spoyla member",this.formattedStartDate=this.formatEventDate(t.startDT),this.formattedEndDate=this.formatEventDate(t.endDT);const n=(t.locationName||"").split(",").map(d=>d.trim()).filter(d=>!!d);this.locationTitle=n[0]||t.locationName||"Event location",this.locationSubtitle=n.slice(1).join(", ");const o=t.startDT?new Date(t.startDT):null,s=t.endDT?new Date(t.endDT):null;if(o&&s){const d={weekday:"short",day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"},p=o.toLocaleString(void 0,d),v=o.toDateString()===s.toDateString()?s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):s.toLocaleString(void 0,d);this.formattedDateRange=`${p} \u2013 ${v}`}else this.formattedDateRange=this.formattedStartDate;switch(this.isDraft=t.workflowStatusId===ee.h.Draft,this.isDescriptionExpanded=!1,this.isDescriptionClamped=(t.description?.length||0)>180,this.calculateGiftExchangeFields(t),t.eventFormatTypeId){case x.n.InPerson:this.formatLabel="In Person",this.formatIcon="location-outline",this.isOnlineOrHybrid=!1;break;case x.n.Online:this.formatLabel="Online",this.formatIcon="videocam-outline",this.isOnlineOrHybrid=!0;break;case x.n.Hybrid:this.formatLabel="Hybrid",this.formatIcon="globe-outline",this.isOnlineOrHybrid=!0;break;default:this.formatLabel="",this.formatIcon="calendar-outline",this.isOnlineOrHybrid=!1}this.directionsUrl=null==t.locationLat||null==t.locationLng||0===t.locationLat&&0===t.locationLng?null:`https://www.google.com/maps/dir/?api=1&destination=${t.locationLat},${t.locationLng}`,this.showLocation=t.eventFormatTypeId===x.n.InPerson||t.eventFormatTypeId===x.n.Hybrid,t.maxAttendees&&t.maxAttendees>0?this.showCapacity=!0:(this.showCapacity=!1,this.capacityLabel="",this.capacityColor="")}calculateGiftExchangeFields(t){const n=t.giftExchange;if(this.isGiftExchange=!!n?.giftExchangeId,this.giftExchangeId=n?.giftExchangeId||"",!this.isGiftExchange)return this.giftExchangeStatusLabel="",this.giftExchangeStatusColor="",this.giftExchangeBudgetLabel="",void(this.isGiftExchangeDrawn=!1);const o=n.giftExchangeDrawStatusId;switch(this.isGiftExchangeDrawn=o===le.Drawn||o===le.Revealed,o){case le.Draft:this.giftExchangeStatusLabel="Setting up",this.giftExchangeStatusColor="warning";break;case le.Drawn:this.giftExchangeStatusLabel="Names drawn",this.giftExchangeStatusColor="primary";break;case le.Revealed:this.giftExchangeStatusLabel="Revealed",this.giftExchangeStatusColor="success";break;case le.Cancelled:this.giftExchangeStatusLabel="Cancelled",this.giftExchangeStatusColor="medium";break;default:this.giftExchangeStatusLabel="",this.giftExchangeStatusColor="medium"}const s=(0,sn.h)(n.currency,n.budgetAmount);this.giftExchangeBudgetLabel=s?`${s} per person`:"No budget set"}formatEventDate(t){if(!t)return"";const n=new Date(t);return Number.isNaN(n.getTime())?"":n.toLocaleString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})}loadParticipantData(){var t=this;return(0,u.A)(function*(){t.currentUserId||(yield t.initPage());let n=null;try{n=(yield t.eventRsvpService.GetMyRsvpStatus(t.eventId))??null}catch(p){t.logger.LogError(p,"Failed to load own RSVP status")}let o=null,s=[],d=[];try{const[p,_,v]=yield Promise.all([t.eventUserService.GetEventUserCounts(t.eventId),t.eventUserService.GetEventUsers(t.eventId,$e.t.Organizer,0,1,100),t.eventUserService.GetEventUsers(t.eventId,0,W.$.Going,1,8)]);o=p||null,s=_?.items||[],d=v?.items||[]}catch(p){t.logger.LogDebug("Participant data unavailable for current user",{eventId:t.eventId,error:p})}t.participantCounts=o,t.canViewParticipants=!!o,t.lastKnownOrganizers=s,t.calculateMembership(n,s,!!o),t.applyParticipantCounts(),t.applyAttendees(s,d)})()}refreshParticipantCounts(){var t=this;return(0,u.A)(function*(){try{const[n,o]=yield Promise.all([t.eventUserService.GetEventUserCounts(t.eventId),t.eventUserService.GetEventUsers(t.eventId,0,W.$.Going,1,8)]);t.participantCounts=n||null,t.canViewParticipants=t.canViewParticipants||!!t.participantCounts,t.applyParticipantCounts(),t.applyAttendees(t.lastKnownOrganizers,o?.items||[])}catch(n){t.logger.LogDebug("Failed to refresh participant counts",{eventId:t.eventId,error:n})}})()}calculateMembership(t,n,o){this.currentUserRsvpStatusId=t;const s=this.event?.eventVisibilityTypeId,d=s===we.w.Public,p=s===we.w.Private;this.isOrganizer=!!this.currentUserId&&this.event?.createdByUserId===this.currentUserId||n.some(_=>!!_.userId&&_.userId===this.currentUserId),this.isMember=this.isOrganizer||null!=t||p||!d&&o,this.canRsvp=!0===this.event?.rsvpEnabled&&(this.isMember||!p)&&!this.isGiftExchangeDrawn}applyParticipantCounts(){this.participants={goingCount:this.participantCounts?.goingCount??0,maybeCount:this.participantCounts?.maybeCount??0,notGoingCount:this.participantCounts?.notGoingCount??0,invitedCount:this.participantCounts?.invitedCount??0};const t=this.event?.maxAttendees||0;if(t>0&&this.participantCounts){this.showCapacity=!0;const n=this.participants.goingCount,o=t;this.capacityLabel=`${n} / ${o}`;const s=n/o;this.capacityColor=s>=1?"danger":s>=.8?"warning":"medium"}else this.showCapacity=!1,this.capacityLabel="",this.capacityColor=""}applyAttendees(t,n){const o=t.filter((y,I,E)=>E.findIndex(R=>R.userId===y.userId)===I),s=new Set(o.map(y=>y.userId)),d=n.filter(y=>!s.has(y.userId)),p=[...o,...d],_=this.participants.goingCount;this.attendees=p.slice(0,4).map(y=>{const I=y.user?.nickName||y.user?.userName||"Member",E=y.userId===this.currentUserId;return{id:y.eventUserId||y.userId,label:E?"You":this.getFirstName(I),displayName:E?"You":I,photoUrl:this.mediaAssetService.getMediaUrl(y.userMedia)??"",initials:this.getInitials(I),isCurrentUser:E}}),this.attendeeOverflowCount=Math.max(0,_-this.attendees.length);const v=`${_} going`;this.goingSummaryLabel=this.participants.invitedCount>0?`${v} \xb7 ${this.participants.invitedCount} invited`:v}getInitials(t){return t.trim().split(/\s+/).slice(0,2).map(s=>s[0]?.toUpperCase()??"").join("")||"?"}getFirstName(t){return t.trim().split(/\s+/)[0]||"Guest"}loadKnownMediaIds(){var t=this;return(0,u.A)(function*(){try{const n=yield t.knownMediaService.GetActiveKnownMedia(Ve._.Wishlist);t.knownMediaIds=new Set((n??[]).map(o=>o.mediaId).filter(o=>!!o))}catch(n){t.logger.LogError(n,"Failed to load known media catalogue for hero rendering"),t.knownMediaIds=new Set}})()}calculateHeroMedia(){const n=this.knownMediaIds.has(this.event?.mediaId||"")?[]:this.carouselMedia.filter(d=>!this.reportedMediaService.isReported(d.mediaId)).map((d,p)=>({id:d.eventMediaId||`carousel-${p}`,imageUrl:d.mediaFilePath?this.mediaAssetService.getMediaUrlFromFilePath(d.mediaFilePath)??"":"",alt:`${this.event?.title||"Event"} image ${p+1}`})).filter(d=>!!d.imageUrl);this.heroMediaItems=n.length>0?n:this.coverImageUrl?[{id:"cover",imageUrl:this.coverImageUrl,alt:`${this.event?.title||"Event"} cover`}]:[],this.heroActiveIndex>=this.heroMediaItems.length&&(this.heroActiveIndex=0);const o=this.heroMediaItems[0]?.imageUrl??null;
1this.heroFillBackgroundImage=o?`url("${o}")`:null;const s=Math.max(0,this.heroMediaItems.length-3);this.canPanCollage=s>0,this.collagePanDuration=14*s+"s"}applyGalleryPage(t,n){this.galleryPageNumber=1,this.galleryItems=this.mapGalleryItems(t),this.galleryTotalCount=n,this.galleryHasMore=t.length>=this.galleryPageSize&&this.galleryItems.length<this.galleryTotalCount}mapGalleryItems(t){return t.filter(n=>!this.reportedMediaService.isReported(n.mediaId)).map(n=>({dto:n,imageUrl:n.mediaFilePath?this.mediaAssetService.getMediaUrlFromFilePath(n.mediaFilePath)??"":"",isOwnPhoto:n.uploadedByUserId===this.currentUserId,isUnderReview:!0===n.isHidden}))}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(pe.nX),e.rXU(g.W3),e.rXU(se.q9),e.rXU(O.g),e.rXU(H.o),e.rXU(Se.B),e.rXU(S.v),e.rXU(fe),e.rXU(ln.A),e.rXU(He.O),e.rXU(Pe.r),e.rXU(Le.U),e.rXU(dn.v),e.rXU(V.p),e.rXU(xe.e),e.rXU(qe.v),e.rXU(cn.D),e.rXU(F.S),e.rXU(pn.q),e.rXU(Ke.s))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-app-event-detail"]],standalone:!1,decls:11,vars:6,consts:[["galleryFileInput",""],["carouselFileInput",""],["heroTrack",""],["giftIdeasFallback",""],["class","fade-header fade-header--onhero",3,"fade-header--scrolled",4,"ngIf"],[3,"ionScroll","fullscreen","scrollEvents"],["slot","fixed",3,"ionRefresh"],["type","file","accept","image/*","multiple","",1,"gallery-file-input",3,"change"],["aria-label","Loading event","aria-busy","true",4,"ngIf"],["class","page-shell page-shell-header-gap",4,"ngIf"],[4,"ngIf"],[1,"fade-header","fade-header--onhero"],[1,"fade-header__surface"],[1,"fade-header__inner"],[1,"fade-header__lead"],["type","button","aria-label","Go back",1,"header-action","header-action--on-hero",3,"click"],["name","chevron-back"],[1,"fade-header__title"],[1,"fade-header__name"],[1,"fade-header__actions"],["type","button","class","header-action header-action--on-hero","aria-label","Share event",3,"disabled","click",4,"ngIf"],["type","button","class","header-action header-action--on-hero","aria-label","Invite people",3,"click",4,"ngIf"],["type","button","class","header-action header-action--on-hero","aria-label","Edit event",3,"click",4,"ngIf"],["type","button","aria-label","Share event",1,"header-action","header-action--on-hero",3,"click","disabled"],["name","share-outline"],["type","button","aria-label","Invite people",1,"header-action","header-action--on-hero",3,"click"],["name","person-add-outline"],["type","button","aria-label","Edit event",1,"header-action","header-action--on-hero",3,"click"],["name","create-outline"],["aria-label","Loading event","aria-busy","true"],[1,"app-event-skeleton-hero",3,"animated"],[1,"detail-surface","detail-surface--overlap","detail-surface--flat"],[1,"detail-card-wrap","detail-card-wrap--rsvp-aside"],[1,"detail-card","detail-card--event-header"],[1,"app-event-skeleton-eyebrow",3,"animated"],[1,"app-event-skeleton-title",3,"animated"],[1,"detail-card"],[1,"app-event-skeleton-heading",3,"animated"],[1,"app-event-skeleton-rsvp"],[1,"app-event-skeleton-rsvp-btn",3,"animated"],[1,"app-event-skeleton-row-card",3,"animated"],[1,"app-event-skeleton-people"],[1,"app-event-skeleton-avatar-stack"],["class","app-event-skeleton-avatar",3,"animated",4,"ngFor","ngForOf"],[1,"app-event-skeleton-count",3,"animated"],[1,"app-event-skeleton-gifts"],[1,"app-event-skeleton-gifts-media",3,"animated"],[1,"app-event-skeleton-gifts__body"],[1,"app-event-skeleton-name",3,"animated"],[1,"app-event-skeleton-status",3,"animated"],[1,"detail-card","detail-card--full"],[1,"app-event-skeleton-gallery",3,"animated"],[1,"app-event-skeleton-avatar",3,"animated"],[1,"page-shell","page-shell-header-gap"],[1,"page-section"],["size","12"],["title","Event unavailable","message","We could not load this event right now.",3,"retry"],[1,"hero-shell"],["class","detail-hero__empty",4,"ngIf"],["class","hero-shell__corner-action","size","small","fill","solid",3,"disabled","click",4,"ngIf"],["class","draft-banner",4,"ngIf"],[1,"event-preview-eyebrow","event-preview-eyebrow--on-card"],[1,"event-title"],["class","event-host-line",4,"ngIf"],[1,"event-chips"],["color","secondary",3,"click",4,"ngIf"],[3,"color",4,"ngIf"],["class","event-description",4,"ngIf"],["class","detail-card",4,"ngIf"],[1,"section-head","section-head--card"],[1,"section-title"],["fill","clear","size","small",3,"disabled","click",4,"ngIf"],["class","gallery-grid",4,"ngIf"],["class","gallery-empty",4,"ngIf"],[3,"ionInfinite","disabled"],["loadingSpinner","dots","loadingText","Loading more photos..."],["class","detail-hero__fill","aria-hidden","true",3,"background-image",4,"ngIf"],[1,"detail-hero__track","detail-hero__track--collage",3,"scroll"],[1,"detail-hero__rail"],["type","button","class","detail-hero__slide",3,"click",4,"ngFor","ngForOf","ngForTrackBy"],[1,"detail-hero__veil"],[1,"hero-shell__status-scrim"],["class","detail-hero__dots",4,"ngIf"],["aria-hidden","true",1,"detail-hero__fill"],["type","button",1,"detail-hero__slide",3,"click"],[3,"src","alt"],[1,"detail-hero__dots"],["type","button","class","detail-hero__dot",3,"is-active","click",4,"ngFor","ngForOf","ngForTrackBy"],["type","button",1,"detail-hero__dot",3,"click"],[1,"detail-hero__empty"],["name","calendar-outline"],["size","small","fill","solid",1,"hero-shell__corner-action",3,"click","disabled"],["slot","start","name","camera-outline"],[1,"draft-banner"],[1,"draft-banner__icon"],["name","eye-off-outline"],[1,"draft-banner__copy"],[1,"event-host-line"],["color","secondary",3,"click"],["name","link-outline"],[3,"color"],["name","people-outline"],[1,"event-description"],[1,"detail-info-text"],["type","button","class","detail-info-toggle",3,"click",4,"ngIf"],["type","button",1,"detail-info-toggle",3,"click"],["class","notice notice--muted",4,"ngIf"],["class","rsvp-buttons",4,"ngIf"],[1,"notice","notice--muted"],["name","lock-closed-outline"],[1,"rsvp-buttons"],["color","success",3,"click","fill","disabled"],["slot","start","name","checkmark-outline"],["color","warning",3,"click","fill","disabled"],["slot","start","name","help-outline"],["color","danger",3,"click","fill","disabled"],["slot","start","name","close-outline"],[1,"event-location-card"],[1,"event-location-card__icon","event-location-card__icon--accent"],[1,"event-location-card__body"],["fill","clear","size","small",3,"click",4,"ngIf"],[1,"event-location-card__icon"],["name","location"],["fill","clear","size","small",3,"click"],["name","snow-outline"],["class","detail-info-text",4,"ngIf"],["expand","block","fill","outline","color","primary",3,"click"],["slot","start","name","gift-outline"],["type","button",1,"people-summary-card",3,"click"],[1,"people-summary-card__stack"],["class","avatar avatar--md avatar--white-border",4,"ngFor","ngForOf","ngForTrackBy"],["class","people-summary-card__more",4,"ngIf"],[1,"people-summary-card__count"],[1,"avatar","avatar--md","avatar--white-border"],[3,"src","alt",4,"ngIf"],[1,"people-summary-card__more"],["type","button",1,"gift-ideas-card",3,"click"],[1,"g
1ift-ideas-card__media"],[4,"ngIf","ngIfElse"],[1,"gift-ideas-card__body"],["alt","",3,"src",4,"ngFor","ngForOf","ngForTrackBy"],["alt","",3,"src"],["name","gift-outline"],["fill","clear","size","small",3,"click","disabled"],["slot","start","name","add-outline"],["class","muted-note",4,"ngIf"],["class","groupgift-list",4,"ngIf"],[1,"muted-note"],[1,"groupgift-list"],["type","button","class","groupgift-row",3,"click",4,"ngFor","ngForOf","ngForTrackBy"],["type","button",1,"groupgift-row",3,"click"],[1,"avatar","avatar--md"],[1,"groupgift-row__body"],[1,"groupgift-row__meta"],["color","medium",4,"ngIf"],["color","medium"],[1,"gallery-grid"],["class","gallery-thumb-wrap",3,"gallery-thumb-wrap--under-review","click",4,"ngFor","ngForOf","ngForTrackBy"],[1,"gallery-thumb-wrap",3,"click"],["alt","Gallery photo",1,"gallery-thumb",3,"src"],["class","under-review-badge","color","warning",4,"ngIf"],[1,"gallery-thumb-actions"],["fill","clear","color","primary","size","small","aria-label","Add photo to cover carousel",3,"click",4,"ngIf"],["fill","clear","color","warning","size","small","aria-label","Report photo",3,"disabled","click",4,"ngIf"],["color","warning",1,"under-review-badge"],["fill","clear","color","primary","size","small","aria-label","Add photo to cover carousel",3,"click"],["slot","icon-only","name","images-outline"],["fill","clear","color","warning","size","small","aria-label","Report photo",3,"click","disabled"],["slot","icon-only","name","flag-outline"],[1,"gallery-empty"],["name","images-outline"]],template:function(n,o){if(1&n){const s=e.RV6();e.DNE(0,hn,13,10,"div",4),e.j41(1,"ion-content",5),e.bIt("ionScroll",function(p){return c.eBV(s),c.Njj(o.onScroll(p))}),e.j41(2,"ion-refresher",6),e.bIt("ionRefresh",function(p){return c.eBV(s),c.Njj(o.handleRefresh(p))}),e.nrm(3,"ion-refresher-content"),e.k0s(),e.j41(4,"input",7,0),e.bIt("change",function(p){return c.eBV(s),c.Njj(o.onGalleryFilesSelected(p))}),e.k0s(),e.j41(6,"input",7,1),e.bIt("change",function(p){return c.eBV(s),c.Njj(o.onCarouselFilesSelected(p))}),e.k0s(),e.DNE(8,vn,35,20,"div",8)(9,fn,4,0,"ion-grid",9)(10,mi,35,22,"ng-container",10),e.k0s()}2&n&&(e.Y8G("ngIf",!o.isBusy&&!o.hasError),e.R7$(),e.Y8G("fullscreen",!0)("scrollEvents",!0),e.R7$(7),e.Y8G("ngIf",o.isBusy),e.R7$(),e.Y8G("ngIf",!o.isBusy&&o.hasError),e.R7$(),e.Y8G("ngIf",!o.isBusy&&!o.hasError&&o.event))},dependencies:[l.Sq,l.bT,g.In,g.Jm,g.b_,g.ZB,g.hU,g.W9,g.lO,g.iq,g.Ax,g.Hp,g.he,g.To,g.Ki,g.ln,g.ds,$.F],styles:["[_nghost-%COMP%]{display:block}.app-event-skeleton-hero[_ngcontent-%COMP%]{display:block;width:100%;height:var(--spoyla-hero-height-standard);margin:0;border-radius:0}@media (min-width: 768px){.app-event-skeleton-hero[_ngcontent-%COMP%]{height:var(--spoyla-hero-height-standard-md)}}.app-event-skeleton-eyebrow[_ngcontent-%COMP%]{width:104px;height:12px;border-radius:var(--radius-sm);margin:0 0 10px}.app-event-skeleton-title[_ngcontent-%COMP%]{width:62%;height:26px;border-radius:var(--radius-sm);margin:0}.app-event-skeleton-heading[_ngcontent-%COMP%]{display:block;width:96px;height:20px;border-radius:var(--radius-sm);margin:0 0 12px}.app-event-skeleton-rsvp[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:8px}.app-event-skeleton-rsvp-btn[_ngcontent-%COMP%]{flex:1 1 120px;height:44px;border-radius:var(--radius-lg);margin:0}.app-event-skeleton-row-card[_ngcontent-%COMP%]{display:block;width:100%;height:62px;border-radius:var(--radius-md);margin:0}.app-event-skeleton-people[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:12px}.app-event-skeleton-avatar-stack[_ngcontent-%COMP%]{display:flex;align-items:center}.app-event-skeleton-avatar[_ngcontent-%COMP%]{width:36px;height:36px;flex-shrink:0;border-radius:var(--radius-pill);margin:0;border:2px solid var(--color-surface)}.app-event-skeleton-avatar[_ngcontent-%COMP%] + .app-event-skeleton-avatar[_ngcontent-%COMP%]{margin-left:-10px}.app-event-skeleton-count[_ngcontent-%COMP%]{width:108px;height:13px;flex-shrink:0;border-radius:var(--radius-sm);margin:0}.app-event-skeleton-gifts[_ngcontent-%COMP%]{display:flex;align-items:center;gap:14px}.app-event-skeleton-gifts-media[_ngcontent-%COMP%]{width:108px;height:44px;flex-shrink:0;border-radius:var(--radius-md);margin:0}.app-event-skeleton-gifts__body[_ngcontent-%COMP%]{flex:1;min-width:0}
1.app-event-skeleton-name[_ngcontent-%COMP%]{width:52%;height:15px;border-radius:var(--radius-sm);margin:0 0 7px}.app-event-skeleton-status[_ngcontent-%COMP%]{width:38%;height:12px;border-radius:var(--radius-sm);margin:0}.app-event-skeleton-gallery[_ngcontent-%COMP%]{display:block;width:100%;height:132px;border-radius:var(--radius-md);margin:0}"]}))}return r(),a})();var Gi=h(1942),wi=h(6756),Pi=h(8945),Si=h(8569),xi=h(9),Ri=h(4178),z=h(8242),Fi=h(5420);function Mi(r,a){1&r&&(e.j41(0,"div",15)(1,"div",16),e.nrm(2,"ion-skeleton-text",17),e.k0s(),e.nrm(3,"ion-skeleton-text",18)(4,"ion-skeleton-text",19),e.k0s()),2&r&&(e.R7$(2),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0),e.R7$(),e.Y8G("animated",!0))}function Ti(r,a){if(1&r&&(e.j41(0,"div",13),e.DNE(1,Mi,5,3,"div",14),e.k0s()),2&r){const i=e.XpG();e.R7$(),e.Y8G("ngForOf",i.skeletonCards)}}function Di(r,a){if(1&r){const i=e.RV6();e.j41(0,"app-page-load-error",20),e.bIt("retry",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.retryLoad())}),e.k0s()}}function Ui(r,a){1&r&&(e.j41(0,"div",21)(1,"div",22),e.nrm(2,"ion-icon",23),e.k0s(),e.j41(3,"div",24),e.EFF(4,"No access"),e.k0s(),e.j41(5,"div",25),e.EFF(6,"You don't have access to this event's gift ideas. Ask an organizer to invite you, then try again."),e.k0s()())}function Ai(r,a){if(1&r&&e.nrm(0,"img",35),2&r){const i=e.XpG(2).$implicit;e.Y8G("src",i.ownerMediaUrl,e.B4B)("alt",i.label)}}function ji(r,a){if(1&r&&(e.j41(0,"span"),e.EFF(1),e.k0s()),2&r){const i=e.XpG(2).$implicit;e.R7$(),e.JRh(i.initials)}}function $i(r,a){if(1&r&&(e.j41(0,"span",33),e.DNE(1,Ai,1,2,"img",34)(2,ji,2,1,"span",12),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.Y8G("ngIf",i.ownerMediaUrl),e.R7$(),e.Y8G("ngIf",!i.ownerMediaUrl)}}function Bi(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",29),e.bIt("click",function(){const n=c.eBV(i).$implicit,o=e.XpG(3);return c.Njj(o.selectGroup(n.key))}),e.DNE(1,$i,3,2,"span",32),e.EFF(2),e.j41(3,"span",30),e.EFF(4),e.k0s()()}if(2&r){const i=a.$implicit,t=e.XpG(3);e.AVh("gchip--active",t.selectedGroupKey===i.key),e.BMQ("aria-pressed",t.selectedGroupKey===i.key),e.R7$(),e.Y8G("ngIf","person"===t.axis),e.R7$(),e.SpI(" ",i.label," "),e.R7$(2),e.JRh(i.items.length)}}function Li(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",28)(1,"button",29),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.selectGroup(n.ALL_GROUP_KEY))}),e.EFF(2," All "),e.j41(3,"span",30),e.EFF(4),e.k0s()(),e.DNE(5,Bi,5,6,"button",31),e.k0s()}if(2&r){const i=e.XpG(2);e.R7$(),e.AVh("gchip--active",i.isAllSelected),e.BMQ("aria-pressed",i.isAllSelected),e.R7$(3),e.JRh(i.totalItemCount),e.R7$(),e.Y8G("ngForOf",i.groups)("ngForTrackBy",i.trackGroup)}}function Oi(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",36),e.nrm(1,"ion-icon",37),e.j41(2,"input",38),e.mxI("ngModelChange",function(n){c.eBV(i);const o=e.XpG(2);return e.DH7(o.searchTerm,n)||(o.searchTerm=n),c.Njj(n)}),e.k0s()()}if(2&r){const i=e.XpG(2);e.R7$(2),e.R50("ngModel",i.searchTerm)}}function Ni(r,a){if(1&r&&e.nrm(0,"img",35),2&r){const i=e.XpG(2).$implicit;e.Y8G("src",i.ownerMediaUrl,e.B4B)("alt",i.label)}}function Yi(r,a){if(1&r&&(e.j41(0,"span"),e.EFF(1),e.k0s()),2&r){const i=e.XpG(2).$implicit;e.R7$(),e.JRh(i.initials)}}function Vi(r,a){if(1&r&&(e.j41(0,"span",47),e.DNE(1,Ni,1,2,"img",34)(2,Yi,2,1,"span",12),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.Y8G("ngIf",i.ownerMediaUrl),e.R7$(),e.Y8G("ngIf",!i.ownerMediaUrl)}}function Xi(r,a){if(1&r&&(e.qex(0),e.EFF(1),e.bVm()),2&r){const i=e.XpG().$implicit;e.R7$(),e.SpI(" \xb7 ",i.subLabel)}}function Wi(r,a){if(1&r&&e.nrm(0,"img",35),2&r){const i=e.XpG().$implicit;e.Y8G("src",i.imageUrl,e.B4B)("alt",i.title)}}function zi(r,a){1&r&&e.nrm(0,"ion-icon",53)}function Hi(r,a){if(1&r&&(e.j41(0,"div",54)(1,"span"),e.EFF(2),e.k0s()()),2&r){const i=e.XpG().$implicit;e.R7$(2),e.JRh(i.isReservedByMe?"Yours":"Reserved")}}function qi(r,a){if(1&r&&(e.j41(0,"div",55)(1,"span",56),e.EFF(2),e.k0s()()),2&r){const i=e.XpG().$implicit;e.R7$(2),e.JRh(i.priceLabel)}}function Ki(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",48),e.bIt("click",function(){const n=c.eBV(i).$implicit,o=e.XpG(4);return c.Njj(o.openItem(n))}),e.j41(1,"div",16),e.DNE(2,Wi,1,2,"img",34)(3,zi,1,0,"ion-icon",49)(4,Hi,3,1,"div",50),e.k0s(),e.j41(5,"div",51),e.EFF(6),e.k0s(),e.DNE(7,qi,3,1,"div",52),e.k0s()}if(2&r){const i=a.$implicit;e.R7$(2),e.Y8G("ngIf",i.imageUrl),e.R7$(),e.Y8G("ngIf",!i.imageUrl),e.R7$(),e.Y8G("ngIf",i.isReserved),e.R7$(2),e.JRh(i.title),e.R7$(),e.Y8G("ngIf",i.priceLabel)}}function Ji(r,a){if(1&r&&(e.qex(0),e.j41(1,"div",40),e.DNE(2,Vi,3,2,"span",41),e.j41(3,"span",42)(4,"strong",43),e.EFF(5),e.k0s(),e.j41(6,"span",44),e.EFF(7),e.DNE(8,Xi,2,1,"ng-container",12),e.k0s()()(),e.j41(9,"div",45),e.DNE(10,Ki,8,5,"div",46),e.k0s(),e.bVm()),2&r){const i=a.$implicit,t=e.XpG(3);e.R7$(2),e.Y8G("ngIf","person"===t.axis),e.R7$(3),e.JRh(i.label),e.R7$(2),e.SpI(" ",t.countLabel(i.items.length)),e.R7$(),e.Y8G("ngIf",i.subLabel),e.R7$(2),e.Y8G("ngForOf",i.items)("ngForTrackBy",t.trackItem)}}function Qi(r,a){if(1&r&&(e.qex(0),e.DNE(1,Ji,11,6,"ng-container",39),e.bVm()),2&r){const i=e.XpG(2);e.R7$(),e.Y8G("ngForOf",i.visibleGroups)("ngForTrackBy",i.trackGroup)}}function Zi(r,a){if(1&r&&(e.qex(0),e.EFF(1),e.bVm()),2&r){const i=e.XpG(4);e.R7$(),e.SpI(" \xb7 ",null==i.selectedGroup?null:i.selectedGroup.label)}}
1function eo(r,a){if(1&r&&e.nrm(0,"img",35),2&r){const i=e.XpG().$implicit;e.Y8G("src",i.imageUrl,e.B4B)("alt",i.title)}}function to(r,a){1&r&&e.nrm(0,"ion-icon",53)}function no(r,a){if(1&r&&(e.j41(0,"div",54)(1,"span"),e.EFF(2),e.k0s()()),2&r){const i=e.XpG().$implicit;e.R7$(2),e.JRh(i.isReservedByMe?"Yours":"Reserved")}}function io(r,a){if(1&r&&(e.j41(0,"div",55)(1,"span",56),e.EFF(2),e.k0s()()),2&r){const i=e.XpG().$implicit;e.R7$(2),e.JRh(i.priceLabel)}}function oo(r,a){if(1&r&&(e.j41(0,"div",61),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.wishlistName)}}function ro(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",48),e.bIt("click",function(){const n=c.eBV(i).$implicit,o=e.XpG(4);return c.Njj(o.openItem(n))}),e.j41(1,"div",16),e.DNE(2,eo,1,2,"img",34)(3,to,1,0,"ion-icon",49)(4,no,3,1,"div",50),e.k0s(),e.j41(5,"div",51),e.EFF(6),e.k0s(),e.DNE(7,io,3,1,"div",52)(8,oo,2,1,"div",60),e.k0s()}if(2&r){const i=a.$implicit,t=e.XpG(4);e.R7$(2),e.Y8G("ngIf",i.imageUrl),e.R7$(),e.Y8G("ngIf",!i.imageUrl),e.R7$(),e.Y8G("ngIf",i.isReserved),e.R7$(2),e.JRh(i.title),e.R7$(),e.Y8G("ngIf",i.priceLabel),e.R7$(),e.Y8G("ngIf",t.isAllSelected)}}function ao(r,a){if(1&r&&(e.qex(0),e.j41(1,"div",58),e.EFF(2),e.DNE(3,Zi,2,1,"ng-container",12),e.k0s(),e.j41(4,"div",59),e.DNE(5,ro,9,6,"div",46),e.k0s(),e.bVm()),2&r){const i=e.XpG(3);e.R7$(2),e.SpI(" ",i.countLabel(i.visibleItems.length)),e.R7$(),e.Y8G("ngIf",!i.isAllSelected&&i.selectedGroup),e.R7$(2),e.Y8G("ngForOf",i.visibleItems)("ngForTrackBy",i.trackItem)}}function so(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-button",64),e.bIt("click",function(){c.eBV(i);const n=e.XpG(4);return c.Njj(n.clearSearch())}),e.EFF(1,"Clear search"),e.k0s()}}
1function lo(r,a){if(1&r&&(e.j41(0,"div",21)(1,"div",22),e.nrm(2,"ion-icon",62),e.k0s(),e.j41(3,"div",25),e.EFF(4),e.k0s(),e.DNE(5,so,2,0,"ion-button",63),e.k0s()),2&r){const i=e.XpG(3);e.R7$(4),e.JRh(i.emptyMessage),e.R7$(),e.Y8G("ngIf",i.hasSearchTerm)}}function co(r,a){if(1&r&&(e.qex(0),e.DNE(1,ao,6,4,"ng-container",57)(2,lo,6,2,"ng-template",null,0,e.C5r),e.bVm()),2&r){const i=e.sdS(3),t=e.XpG(2);e.R7$(),e.Y8G("ngIf",t.visibleItems.length>0)("ngIfElse",i)}}function po(r,a){if(1&r&&(e.qex(0),e.DNE(1,Li,6,6,"div",26)(2,Oi,3,1,"div",27)(3,Qi,2,2,"ng-container",12)(4,co,4,2,"ng-container",12),e.bVm()),2&r){const i=e.XpG();e.R7$(),e.Y8G("ngIf",i.groups.length>1),e.R7$(),e.Y8G("ngIf",i.showSearch),e.R7$(),e.Y8G("ngIf",i.showGroupedRails),e.R7$(),e.Y8G("ngIf",!i.showGroupedRails)}}let uo=(()=>{var r;class a{constructor(t,n,o,s,d,p,_,v,y,I,E,R,U){this.reportedMediaService=t,this.route=n,this.nav=o,this.modalController=s,this.common=d,this.posthogService=p,this.eventService=_,this.eventWishlistService=v,this.wishlistItemService=y,this.reservationService=I,this.tokenService=E,this.mediaAssetService=R,this.logger=U,this.eventId="",this.event=null,this.isBusy=!1,this.hasError=!1,this.isUnauthorized=!1,this.axis="wishlist",this.groups=[],this.selectedGroupKey=z.rE,this.searchTerm="",this.ALL_GROUP_KEY=z.rE,this.skeletonCards=[1,2,3,4],this.allItems=[],this.currentUserId="",this.itemsById=new Map,this.reservationsByItemId=new Map}ngOnInit(){const t=this.route.snapshot.paramMap.get("eventId");if(!t)return this.logger.LogWarning("Missing eventId parameter on event gifts page"),void this.nav.navigateBack("/app/events");this.eventId=t,this.load()}goBack(){this.nav.navigateBack(`/app/events/${this.eventId}`)}get isAllSelected(){return this.selectedGroupKey===z.rE}get hasSearchTerm(){return this.searchTerm.trim().length>0}get showSearch(){return this.allItems.length>=z.Xp}get showGroupedRails(){return this.isAllSelected&&!this.hasSearchTerm&&this.groups.length>1}get selectedGroup(){return this.groups.find(t=>t.key===this.selectedGroupKey)??null}get visibleItems(){const t=this.isAllSelected?(0,z.Td)(this.allItems):this.selectedGroup?.items??[];return(0,z.re)(t,this.searchTerm)}get visibleGroups(){return this.groups.filter(t=>t.items.length>0)}get totalItemCount(){return this.allItems.length}get emptyMessage(){return this.hasSearchTerm?"No gifts match that search.":"No gift ideas have been added to this event yet."}countLabel(t){return`${t} ${1===t?"gift":"gifts"}`}isItemPending(t){return t.statusId===wi.S.Unprocessed}trackGroup(t,n){return n.key}trackItem(t,n){return n.wishlistItemId}selectGroup(t){this.selectedGroupKey=t}clearSearch(){this.searchTerm=""}openItem(t){var n=this;return(0,u.A)(function*(){const o=n.itemsById.get(t.wishlistItemId),s=o?.finalUrl?.trim()||o?.originalUrl?.trim()||null,d=o?.description?.trim()||"",p=o?.notes?.trim()||"",_=!!n.currentUserId&&t.ownerId===n.currentUserId,v={title:t.title,imageUrl:t.imageUrl||null,hasImage:!!t.imageUrl,priceText:t.priceLabel,hasPrice:!!t.priceLabel,description:d,hasDescription:!!d,notes:p,hasNotes:!!p,shopUrl:s,hasShopUrl:!1,shopHostText:"",hasShopHost:!1,statusWarning:null,canAddToWishlist:!_,canReserve:!_,isReservedByCurrentUser:t.isReservedByMe,wishlistItemId:t.wishlistItemId},y=yield n.modalController.create({component:xi.n,componentProps:{item:v},cssClass:"item-info-modal"});n.posthogService.posthog.capture("modal_shown",{modal:"wishlist_item_info"}),yield y.present();const{data:I,role:E}=yield y.onDidDismiss();if("action"===E&&I?.action)switch(I.action){case"shop":s&&(yield n.common.openExternalLink(s));break;case"reserve":yield n.toggleReservation(t);break;case"iwantthis":yield n.openIWantThisModal(t);break;case"share":yield n.openGiftShareModal(t)}})()}openGiftShareModal(t){var n=this;return(0,u.A)(function*(){if(!t.wishlistItemId)return;const o=t.title?.trim()||"Gift",s={type:"gift",id:t.wishlistItemId,title:o,shareUrl:(0,Ri.Y)(Ye.c.webUrl,t.wishlistItemId),iconName:"gift-outline",noteText:"Anyone with the link can see this gift, even without a Spoyla account.",shareTitle:"Share Gift",copyToastMessage:"Gift link copied",qrTitle:o};t.priceLabel&&(s.meta=t.priceLabel);const d=yield n.modalController.create({component:ze.I,componentProps:{shareContext:s},cssClass:"share-options-modal"});n.posthogService.posthog.capture("modal_shown",{modal:"share_options",type:"gift"}),yield d.present(),yield d.onDidDismiss()})()}toggleReservation(t){var n=this;return(0,u.A)(function*(){const o=n.getCurrentUserReservation(t.wishlistItemId),s=new Gi.G;s.wishlistItemId=t.wishlistItemId,s.wishlistId=t.wishlistId,s.userId=n.currentUserId,s.reservationTypeId=o?.reservationTypeId||Pi.c.Buying,s.isActive=!o,o?.wishlistItemUserReservationId&&(s.wishlistItemUserReservationId=o.wishlistItemUserReservationId);try{yield n.reservationService.ReserveItem(s),n.posthogService.posthog.capture("wishlist_item_reserved",{wishlist_item_id:t.wishlistItemId,wishlist_id:t.wishlistId,is_reserving:!o}),yield n.load()}catch(d){yield n.common.handleError(d,"We could not update the reservation.")}})()}openIWantThisModal(t){var n=this;return(0,u.A)(function*(){const o=n.itemsById.get(t.wishlistItemId),s=o?.finalUrl?.trim()||o?.originalUrl?.trim()||"";if(!o||!s)return void(yield n.common.showAlertDialog("No URL","This item does not have a shopping URL available."));const d=yield n.modalController.create({component:Si.n,cssClass:"add-wish-modal",componentProps:{sourceItem:o,returnToUrl:`/app/events/${n.eventId}/gifts`}});n.posthogService.posthog.capture("modal_shown",{modal:"add_wish"}),yield d.present()})()}getCurrentUserReservation(t){return(this.reservationsByItemId.get(t)||[]).find(n=>n.userId===this.currentUserId)}
1retryLoad(){var t=this;return(0,u.A)(function*(){yield t.load()})()}handleRefresh(t){var n=this;return(0,u.A)(function*(){try{yield n.load()}finally{yield t.target.complete()}})()}load(){var t=this;return(0,u.A)(function*(){if(!t.isBusy)try{t.isBusy=!0,t.hasError=!1,t.isUnauthorized=!1,t.currentUserId=yield t.tokenService.getUserId();const[n,o]=yield Promise.all([t.eventService.GetEventById(t.eventId,""),t.eventWishlistService.GetWishlistsForEvent(t.eventId)]);t.event=n;const s=(0,z.rm)((Array.isArray(o)?o:[]).map(d=>d?.wishlist),d=>t.mediaAssetService.getMediaUrl(d)??"",d=>t.reportedMediaService.isReported(d));t.allItems=yield t.loadItems(s),t.axis=(0,z.Jh)(s),t.groups=(0,z.Zc)(s,t.allItems,t.axis),!t.isAllSelected&&!t.selectedGroup&&(t.selectedGroupKey=z.rE),t.logger.LogDebug("Event gifts loaded",{eventId:t.eventId,axis:t.axis,groupCount:t.groups.length,itemCount:t.allItems.length})}catch(n){401===n?.status||403===n?.status?t.isUnauthorized=!0:(t.logger.LogError(n,"Failed to load event gift ideas"),t.hasError=!0)}finally{t.isBusy=!1}})()}loadItems(t){var n=this;return(0,u.A)(function*(){return n.itemsById.clear(),n.reservationsByItemId.clear(),0===t.length?[]:(yield Promise.all(t.map(function(){var s=(0,u.A)(function*(d){try{const[p,_]=yield Promise.all([n.wishlistItemService.GetItemsByWishlist(d.wishlistId,1,z.g2),n.loadReservations(d.wishlistId)]),v=Array.isArray(p?.items)?p.items:[];for(const y of v)y?.wishlistItemId&&n.itemsById.set(y.wishlistItemId,y);for(const y of _){if(!y?.isActive||!y.wishlistItemId)continue;const I=n.reservationsByItemId.get(y.wishlistItemId)||[];I.push(y),n.reservationsByItemId.set(y.wishlistItemId,I)}return(0,z.jo)(v,d,(0,z.Qn)(_),n.currentUserId,y=>n.mediaAssetService.getMediaUrl(y)??"",y=>n.reportedMediaService.isReported(y))}catch(p){return n.logger.LogError(p,"Failed to load items for an event wishlist"),[]}});return function(d){return s.apply(this,arguments)}}()))).reduce((s,d)=>s.concat(d),[])})()}loadReservations(t){var n=this;return(0,u.A)(function*(){try{const o=yield n.reservationService.GetReservationsByWishlistId(t);return Array.isArray(o)?o:[]}catch{return n.logger.LogWarning("Failed to load reservations for an event wishlist",{wishlistId:t}),[]}})()}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(V.p),e.rXU(pe.nX),e.rXU(se.q9),e.rXU(g.W3),e.rXU(H.o),e.rXU(Ke.s),e.rXU(S.v),e.rXU(xe.e),e.rXU(qe.v),e.rXU(Fi.E),e.rXU(Se.B),e.rXU(F.S),e.rXU(O.g))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-app-event-gifts"]],standalone:!1,decls:16,vars:5,consts:[["giftsEmpty",""],[1,"page-toolbar"],["slot","start"],["fill","clear","aria-label","Go back",3,"click"],["name","chevron-back","slot","icon-only"],[1,"page-toolbar-title-wrap"],[1,"page-toolbar-title"],[3,"fullscreen"],["slot","fixed",3,"ionRefresh"],["class","ggrid","aria-hidden","true",4,"ngIf"],["title","Gift ideas unavailable","message","We could not load this event's gift ideas right now.",3,"retry",4,"ngIf"],["class","empty",4,"ngIf"],[4,"ngIf"],["aria-hidden","true",1,"ggrid"],["class","gcard",4,"ngFor","ngForOf"],[1,"gcard"],[1,"gcard__well"],[1,"spoyla-skeleton-fill",3,"animated"],[2,"width","80%","height","14px","margin","11px 2px 4px",3,"animated"],[2,"width","40%","height","13px","margin","0 2px",3,"animated"],["title","Gift ideas unavailable","message","We could not load this event's gift ideas right now.",3,"retry"],[1,"empty"],[1,"empty__icon"],["name","lock-closed-outline"],[1,"empty__title"],[1,"empty__body"],["class","gchip-rail",4,"ngIf"],["class","fsearch fsearch--shell",4,"ngIf"],[1,"gchip-rail"],["type","button",1,"gchip",3,"click"],[1,"gchip__count"],["type","button","class","gchip",3,"gchip--active","click",4,"ngFor","ngForOf","ngForTrackBy"],["class","gchip__avatar",4,"ngIf"],[1,"gchip__avatar"],[3,"src","alt",4,"ngIf"],[3,"src","alt"],[1,"fsearch","fsearch--shell"],["name","search-outline"],["type","search","placeholder","Search gifts, lists or people","aria-label","Search gift ideas",1,"fsearch__in",3,"ngModelChange","ngModel"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"ghead"],["class","avatar avatar--md ghead__avatar",4,"ngIf"],[1,"ghead__body"],[1,"ghead__title"],[1,"ghead__meta"],[1,"ggrid","ggrid--grouped"],["class","gcard",3,"click",4,"ngFor","ngForOf","ngForTrackBy"],[1,"avatar","avatar--md","ghead__avatar"],[1,"gcard",3,"click"],["class","gcard__fallback","name","gift-outline",4,"ngIf"],["class","reservation-overlay",4,"ngIf"],[1,"gcard__t"],["class","gcard__prices",4,"ngIf"],["name","gift-outline",1,"gcard__fallback"],[1,"reservation-overlay"],[1,"gcard__prices"],[1,"gcard__p"],[4,"ngIf","ngIfElse"],[1,"gcount"],[1,"ggrid"],["class","gcard__from",4,"ngIf"],[1,"gcard__from"],["name","gift-outline"],["fill","clear","size","small",3,"click",4,"ngIf"],["fill","clear","size","small",3,"click"]],template:function(n,o){1&n&&(e.j41(0,"ion-header",1)(1,"ion-toolbar")(2,"ion-buttons",2)(3,"ion-button",3),e.bIt("click",function(){return o.goBack()}),e.nrm(4,"ion-icon",4),e.k0s()(),e.j41(5,"ion-title")(6,"div",5)(7,"span",6),e.EFF(8,"Gift ideas"),e.k0s()()()()(),e.j41(9,"ion-content",7)(10,"ion-refresher",8),e.bIt("ionRefresh",function(d){return o.handleRefresh(d)}),e.nrm(11,"ion-refresher-content"),e.k0s(),e.DNE(12,Ti,2,1,"div",9)(13,Di,1,0,"app-page-load-error",10)(14,Ui,7,0,"div",11)(15,po,5,4,"ng-container",12),e.k0s()),2&n&&(e.R7$(9),e.Y8G("fullscreen",!0),e.R7$(3),e.Y8G("ngIf",o.isBusy),e.R7$(),e.Y8G("ngIf",!o.isBusy&&o.hasError),e.R7$(),e.Y8G("ngIf",!o.isBusy&&o.isUnauthorized),e.R7$(),e.Y8G("ngIf",!o.isBusy&&!o.hasError&&!o.isUnauthorized))},dependencies:[l.Sq,l.bT,f.me,f.BC,f.vS,g.Jm,g.QW,g.W9,g.eU,g.iq,g.To,g.Ki,g.ds,g.BC,g.ai,$.F],styles:["[_nghost-%COMP%]{display:block}"]}))}return r(),a})();var Re=h(54),Qe=h(6990),D=h(1601),Ie=h(359),Ze=h(5535);function go(r,a){if(1&r&&(e.j41(0,"ion-segment-button",21),e.nrm(1,"ion-icon",14),e.j41(2,"ion-label"),e.EFF(3),e.k0s()()),2&r){const i=a.$implicit,t=e.XpG(2);e.Y8G("value",i.id),e.R7$(),e.Y8G("name",t.getVisibilityIcon(i.label)),e.R7$(2),e.JRh(i.label)}}function _o(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Privacy is required."),e.k0s())}function ho(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",4)(1,"ion-label",5),e.EFF(2,"Privacy "),e.j41(3,"ion-text",6),e.EFF(4,"*"),e.k0s()(),e.j41(5,"ion-segment",18),e.bIt("ionChange",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.selectVisibility(n.detail.value))}),e.DNE(6,go,4,3,"ion-segment-button",19),e.k0s(),e.j41(7,"p",20),e.EFF(8),e.k0s(),e.DNE(9,_o,2,0,"p",9),e.k0s()}if(2&r){let i;const t=e.XpG();e.R7$(5),e.Y8G("value",null==(i=t.form.get("eventVisibilityTypeId"))?null:i.value),e.R7$(),e.Y8G("ngForOf",t.visibilityOptions),e.R7$(2),e.JRh(t.visibilityDescription),e.R7$(),e.Y8G("ngIf",t.form.controls.eventVisibilityTypeId.hasError("required")&&t.form.controls.eventVisibilityTypeId.touched)}}
1function mo(r,a){if(1&r&&(e.j41(0,"p",20),e.EFF(1),e.k0s()),2&r){const i=e.XpG(2);e.R7$(),e.JRh(i.dressCodeDescription)}}function vo(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Please describe the dress code."),e.k0s())}function fo(r,a){if(1&r&&(e.qex(0),e.j41(1,"ion-item",7),e.nrm(2,"ion-input",26),e.k0s(),e.DNE(3,vo,2,0,"p",9),e.bVm()),2&r){const i=e.XpG(2);e.R7$(3),e.Y8G("ngIf",i.form.controls.dressCodeCustomText.hasError("required")&&i.form.controls.dressCodeCustomText.touched)}}function yo(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",23)(1,"ion-label",5),e.EFF(2,"Dress Code"),e.k0s(),e.j41(3,"div",13),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openDressCodeModal())})("keydown.enter",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openDressCodeModal())}),e.nrm(4,"ion-icon",24),e.j41(5,"span",15),e.EFF(6),e.k0s(),e.nrm(7,"ion-icon",16),e.k0s(),e.DNE(8,mo,2,1,"p",25)(9,fo,4,1,"ng-container",12),e.k0s()}if(2&r){let i;const t=e.XpG();e.Y8G("formGroup",t.form),e.R7$(5),e.AVh("location-btn-label--placeholder",!(null!=(i=t.form.get("eventDressCodeTypeId"))&&i.value)),e.R7$(),e.JRh(t.dressCodeBtnLabel),e.R7$(2),e.Y8G("ngIf",t.dressCodeDescription),e.R7$(),e.Y8G("ngIf",t.showDressCodeCustomText)}}function Io(r,a){1&r&&e.eu8(0)}function bo(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Event name is required."),e.k0s())}function Eo(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Too many characters."),e.k0s())}function ko(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Start date and time is required."),e.k0s())}function Co(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"An event cannot start on a past date."),e.k0s())}function Go(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-button",27),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.toggleEndDate())}),e.nrm(1,"ion-icon",28),e.EFF(2," Add End Date "),e.k0s()}}function wo(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"End time must be after start time."),e.k0s())}function Po(r,a){if(1&r&&(e.qex(0),e.j41(1,"ion-label",5),e.EFF(2,"End Date & Time"),e.k0s(),e.nrm(3,"app-date-time-picker",29),e.DNE(4,wo,2,0,"p",9),e.bVm()),2&r){const i=e.XpG();e.R7$(3),e.Y8G("min",i.minEndDT),e.R7$(),e.Y8G("ngIf",i.form.hasError("endBeforeStart"))}}function So(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Location is required."),e.k0s())}function xo(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Online link is required."),e.k0s())}function Ro(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Enter a valid link beginning with http:// or https://."),e.k0s())}function Fo(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Add a location or online link."),e.k0s())}function Mo(r,a){1&r&&(e.j41(0,"p",22),e.EFF(1,"Description is too long."),e.k0s())}function To(r,a){1&r&&e.eu8(0)}let Fe=(()=>{var r;class a{constructor(t){this.modalController=t,this.visibilityOptions=[],this.formatOptions=[],this.dressCodeOptions=[],this.showOnlineUrl=!1,this.showLocation=!1,this.minSelectableEventDateTime=null,this.minEndDT=null,this.initialLocationLat=null,this.initialLocationLng=null,this.initialLocationLabel="",this.layout="wizard",this.locationPicked=new e.bkB,this.requestLocationPicker=new e.bkB,this.showEndDate=!1,this.visibilityDescription="",this.dressCodeDescription="",this.showDressCodeCustomText=!1,this.dressCodeBtnLabel="Select a dress code",this.EventDressCodeTypeId=D.w}ngOnInit(){this.form.get("endDT")?.value&&(this.showEndDate=!0),this.updateVisibilityDescription(this.form.get("eventVisibilityTypeId")?.value),this.updateDressCodeDisplay(this.form.get("eventDressCodeTypeId")?.value)}compareById(t,n){return null!=t&&null!=n&&Number(t)===Number(n)}selectVisibility(t){const n=this.form.get("eventVisibilityTypeId");n?.setValue(t),n?.markAsDirty(),n?.markAsTouched(),this.form.updateValueAndValidity(),this.updateVisibilityDescription(t)}updateVisibilityDescription(t){this.visibilityDescription=(0,Ie.vH)(t)}selectDressCode(t){const n=this.form.get("eventDressCodeTypeId");if(n?.setValue(t),n?.markAsDirty(),n?.markAsTouched(),t!==D.w.Other){const o=this.form.get("dressCodeCustomText");o?.setValue(""),o?.markAsPristine(),o?.markAsUntouched()}this.form.updateValueAndValidity(),this.updateDressCodeDisplay(t)}updateDressCodeDisplay(t){this.showDressCodeCustomText=t===D.w.Other;const n=this.dressCodeOptions.find(o=>o.id===t);
1this.dressCodeDescription=n?.description??"",this.dressCodeBtnLabel=n?.label??"Select a dress code"}openDressCodeModal(){var t=this;return(0,u.A)(function*(){const n=t.form.get("eventDressCodeTypeId")?.value,o=t.dressCodeOptions.map(d=>({value:String(d.id),label:d.label,description:d.description,icon:d.icon??"shirt-outline",isSelected:d.id===n})),s=yield(0,Ze.a)(t.modalController,{title:"Dress Code",options:o});null!==s&&t.selectDressCode(Number(s))})()}getVisibilityIcon(t){const n=t?.toLowerCase()??"";return n.includes("friend")?"people-outline":n.includes("public")?"globe-outline":n.includes("private")?"lock-closed-outline":n.includes("link")?"link-outline":"ellipse-outline"}toggleEndDate(){this.showEndDate=!0}onEndDateToggleChange(t){this.showEndDate=t,t||(this.form.get("endDT")?.setValue(null),this.form.updateValueAndValidity())}get hasLocation(){const t=this.form.get("locationName")?.value,n=this.form.get("eventFormatTypeId")?.value,o=this.form.get("onlineUrl")?.value;return!!(t?.trim()||n===x.n.Online&&o?.trim())}getLocationBtnLabel(){const t=this.form.get("locationName")?.value;if(t?.trim())return t.trim();const n=this.form.get("eventFormatTypeId")?.value,o=this.form.get("onlineUrl")?.value;return n===x.n.Online&&o?.trim()?o.trim():"Select location"}openLocationModal(){this.requestLocationPicker.emit()}applyLocationResult(t){this.form.patchValue({eventFormatTypeId:t.eventFormatTypeId,locationName:t.locationName,locationLat:t.locationLat,locationLng:t.locationLng,onlineUrl:t.onlineUrl}),this.form.get("locationName")?.markAsDirty(),this.form.get("locationName")?.markAsTouched(),this.form.get("onlineUrl")?.markAsDirty(),this.form.get("onlineUrl")?.markAsTouched(),this.form.updateValueAndValidity(),t.locationName&&t.locationLat&&t.locationLng&&this.locationPicked.emit({lat:parseFloat(t.locationLat),lng:parseFloat(t.locationLng),label:t.locationName,address:null})}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(g.W3))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-event-wizard-basics"]],inputs:{form:"form",visibilityOptions:"visibilityOptions",formatOptions:"formatOptions",dressCodeOptions:"dressCodeOptions",showOnlineUrl:"showOnlineUrl",showLocation:"showLocation",minSelectableEventDateTime:"minSelectableEventDateTime",minEndDT:"minEndDT",initialLocationLat:"initialLocationLat",initialLocationLng:"initialLocationLng",initialLocationLabel:"initialLocationLabel",layout:"layout"},outputs:{locationPicked:"locationPicked",requestLocationPicker:"requestLocationPicker"},standalone:!1,decls:47,vars:19,consts:[["privacyField",""],["dressCodeField",""],[1,"field-stack",3,"formGroup"],[4,"ngTemplateOutlet"],[1,"input-wrapper"],[1,"input-label"],["color","danger"],["lines","none",1,"spoyla-input"],["type","text","formControlName","title","maxlength","300","placeholder","Give your event a name"],["class","field-error",4,"ngIf"],["formControlName","startDT","placeholder","Select start date and time","label","Start Date & Time","presentation","date-time",3,"min"],["fill","clear","class","add-end-date-btn","type","button",3,"click",4,"ngIf"],[4,"ngIf"],["role","button","tabindex","0",1,"location-btn-row",3,"click","keydown.enter"],[3,"name"],[1,"location-btn-label"],["name","chevron-forward-outline",1,"chevron-icon"],["formControlName","description","maxlength","4000","rows","4","autoGrow","true","placeholder","What should guests know before they arrive?"],[1,"segment--filled",3,"ionChange","value"],["layout","icon-top",3,"value",4,"ngFor","ngForOf"],[1,"field-hint"],["layout","icon-top",3,"value"],[1,"field-error"],[1,"input-wrapper",3,"formGroup"],["name","shirt-outline"],["class","field-hint",4,"ngIf"],["type","text","formControlName","dressCodeCustomText","maxlength","200","placeholder","e.g. 1920s Gatsby theme"],["fill","clear","type","button",1,"add-end-date-btn",3,"click"],["slot","start","name","add-outline"],["formControlName","endDT","placeholder","Select end date and time","label","End Date & Time","presentation","date-time",3,"min"]],template:function(n,o){if(1&n){const s=e.RV6();e.DNE(0,ho,10,4,"ng-template",null,0,e.C5r)(2,yo,10,6,"ng-template",null,1,e.C5r),e.j41(4,"div",2),e.DNE(
15,Io,1,0,"ng-container",3),e.j41(6,"div",4)(7,"ion-label",5),e.EFF(8,"Event Name "),e.j41(9,"ion-text",6),e.EFF(10,"*"),e.k0s()(),e.j41(11,"ion-item",7),e.nrm(12,"ion-input",8),e.k0s(),e.DNE(13,bo,2,0,"p",9)(14,Eo,2,0,"p",9),e.k0s(),e.j41(15,"div",4)(16,"ion-label",5),e.EFF(17,"Start Date & Time "),e.j41(18,"ion-text",6),e.EFF(19,"*"),e.k0s()(),e.nrm(20,"app-date-time-picker",10),e.DNE(21,ko,2,0,"p",9)(22,Co,2,0,"p",9),e.k0s(),e.j41(23,"div",4),e.DNE(24,Go,3,0,"ion-button",11)(25,Po,5,2,"ng-container",12),e.k0s(),e.j41(26,"div",4)(27,"ion-label",5),e.EFF(28,"Location "),e.j41(29,"ion-text",6),e.EFF(30,"*"),e.k0s()(),e.j41(31,"div",13),e.bIt("click",function(){return c.eBV(s),c.Njj(o.openLocationModal())})("keydown.enter",function(){return c.eBV(s),c.Njj(o.openLocationModal())}),e.nrm(32,"ion-icon",14),e.j41(33,"span",15),e.EFF(34),e.k0s(),e.nrm(35,"ion-icon",16),e.k0s(),e.DNE(36,So,2,0,"p",9)(37,xo,2,0,"p",9)(38,Ro,2,0,"p",9)(39,Fo,2,0,"p",9),e.k0s(),e.j41(40,"div",4)(41,"ion-label",5),e.EFF(42,"Description"),e.k0s(),e.j41(43,"ion-item",7),e.nrm(44,"ion-textarea",17),e.k0s(),e.DNE(45,Mo,2,0,"p",9),e.k0s(),e.DNE(46,To,1,0,"ng-container",3),e.k0s()}if(2&n){const s=e.sdS(1),d=e.sdS(3);e.R7$(4),e.Y8G("formGroup",o.form),e.R7$(),e.Y8G("ngTemplateOutlet",s),e.R7$(8),e.Y8G("ngIf",o.form.controls.title.hasError("required")&&o.form.controls.title.touched),e.R7$(),e.Y8G("ngIf",o.form.controls.title.hasError("maxlength")&&o.form.controls.title.touched),e.R7$(6),e.Y8G("min",o.minSelectableEventDateTime),e.R7$(),e.Y8G("ngIf",o.form.controls.startDT.hasError("required")&&o.form.controls.startDT.touched),e.R7$(),e.Y8G("ngIf",o.form.hasError("startInPast")),e.R7$(2),e.Y8G("ngIf",!o.showEndDate),e.R7$(),e.Y8G("ngIf",o.showEndDate),e.R7$(7),e.Y8G("name",o.showOnlineUrl&&!o.showLocation?"videocam-outline":"location-outline"),e.R7$(),e.AVh("location-btn-label--placeholder",!o.hasLocation),e.R7$(),e.JRh(o.getLocationBtnLabel()),e.R7$(2),e.Y8G("ngIf",(null==o.form.controls.locationName?null:o.form.controls.locationName.hasError("required"))&&(null==o.form.controls.locationName?null:o.form.controls.locationName.touched)),e.R7$(),e.Y8G("ngIf",(null==o.form.controls.onlineUrl?null:o.form.controls.onlineUrl.hasError("required"))&&(null==o.form.controls.onlineUrl?null:o.form.controls.onlineUrl.touched)),e.R7$(),e.Y8G("ngIf",(null==o.form.controls.onlineUrl?null:o.form.controls.onlineUrl.hasError("pattern"))&&(null==o.form.controls.onlineUrl?null:o.form.controls.onlineUrl.touched)),e.R7$(),e.Y8G("ngIf",o.form.hasError("hybridPlaceRequired")),e.R7$(6),e.Y8G("ngIf",o.form.controls.description.hasError("maxlength")&&o.form.controls.description.touched),e.R7$(),e.Y8G("ngTemplateOutlet",d)}},dependencies:[l.Sq,l.bT,l.T3,f.BC,f.cb,f.tU,f.j4,f.JD,g.Jm,g.iq,g.$w,g.uz,g.he,g.Gp,g.eP,g.IO,g.nc,g.Je,g.Gw,P.P],styles:["[_nghost-%COMP%]{display:block}"]}))}return r(),a})();var _e=h(8183),L=h(6570);class Do{constructor(a){this.steps=a,this.currentStepIndex=0}get currentStep(){return this.steps[this.currentStepIndex]}get progress(){return(this.currentStepIndex+1)/this.steps.length*100}get isFirstStep(){return 0===this.currentStepIndex}get isLastStep(){return this.currentStepIndex===this.steps.length-1}get primaryLabel(){return this.isLastStep?"Create Event":"Continue"}next(){this.currentStepIndex=Math.min(this.currentStepIndex+1,this.steps.length-1)}previous(){this.currentStepIndex=Math.max(this.currentStepIndex-1,0)}goTo(a,i){if(!(a<0||a>=this.steps.length||a===this.currentStepIndex)){if(a<this.currentStepIndex)return void(this.currentStepIndex=a);for(let t=0;t<a;t++)if(!i(this.steps[t].id))return void(this.currentStepIndex=t);this.currentStepIndex=a}}goToById(a){const i=this.steps.findIndex(t=>t.id===a);i>=0&&(this.currentStepIndex=i)}isBeforeCurrentStep(a){return this.steps.findIndex(t=>t.id===a)<this.currentStepIndex}}class et{constructor(a,i=!0){this.lastStartDT=null,this.defaultDurationMinutes=120,this.form=a.group({title:["",[f.k0.required,f.k0.maxLength(300)]],description:["",[f.k0.maxLength(4e3)]],startDT:[null,[f.k0.required]],endDT:[null],eventFormatTypeId:[x.n.InPerson,[f.k0.required]],eventVisibilityTypeId:[Ie.$t,[f.k0.required]],eventDressCodeTypeId:[D.w.NotAp
1plicable],dressCodeCustomText:[""],onlineUrl:[""],rsvpEnabled:[!1],rsvpDeadlineDT:[null],maxAttendees:[null,[f.k0.min(1)]],locationName:[""],locationLat:[null],locationLng:[null]},{validators:i?[L.di,L.xT]:[L.di]}),this.updateFormatValidators(this.form.get("eventFormatTypeId")?.value),this.updateDressCodeValidators(this.form.get("eventDressCodeTypeId")?.value),this.formatSubscription=this.form.get("eventFormatTypeId")?.valueChanges.subscribe(t=>{this.updateFormatValidators(t)}),this.dressCodeSubscription=this.form.get("eventDressCodeTypeId")?.valueChanges.subscribe(t=>{this.updateDressCodeValidators(t)}),this.startDTSubscription=this.form.get("startDT")?.valueChanges.subscribe(t=>{this.handleStartDateChanged(t)})}destroy(){this.formatSubscription?.unsubscribe(),this.dressCodeSubscription?.unsubscribe(),this.startDTSubscription?.unsubscribe()}seedLastStartDT(a){this.lastStartDT=a}applyFormatValidators(){this.updateFormatValidators(this.form.get("eventFormatTypeId")?.value),this.updateDressCodeValidators(this.form.get("eventDressCodeTypeId")?.value)}updateFormatValidators(a){const i=this.form.get("onlineUrl"),t=this.form.get("locationName");i?.clearValidators(),t?.clearValidators(),a===x.n.Online?i?.setValidators([f.k0.required,f.k0.pattern(L.V6)]):a===x.n.Hybrid?i?.setValidators([f.k0.pattern(L.V6)]):a===x.n.InPerson&&t?.setValidators([f.k0.required]),i?.updateValueAndValidity({emitEvent:!1}),t?.updateValueAndValidity({emitEvent:!1}),this.form.updateValueAndValidity({emitEvent:!1})}updateDressCodeValidators(a){const i=this.form.get("dressCodeCustomText");i?.clearValidators(),i?.setValidators(a===D.w.Other?[f.k0.required,f.k0.maxLength(200)]:[f.k0.maxLength(200)]),i?.updateValueAndValidity({emitEvent:!1})}handleStartDateChanged(a){if(!a)return this.lastStartDT=null,void this.form.updateValueAndValidity({emitEvent:!1});const i=new Date(a);if(isNaN(i.getTime()))return;const t=this.form.get("endDT"),n=t?.value,o=this.lastStartDT?new Date(this.lastStartDT):null;let s=6e4*this.defaultDurationMinutes;if(n&&o&&!isNaN(o.getTime())){const p=new Date(n).getTime()-o.getTime();!isNaN(p)&&p>0&&(s=p)}if(n&&o){const d=new Date(i.getTime()+s);t?.setValue(d.toISOString(),{emitEvent:!1})}this.lastStartDT=i.toISOString(),this.form.updateValueAndValidity({emitEvent:!1})}}var Me=h(7631);function Uo(r,a,i){return{id:`media-${r.mediaId}`,order:i,thumbnailUrl:a,mediaId:r.mediaId,fileName:r.fileName,mimeType:r.mimeType,getBlob:()=>Promise.reject(new Error("Already uploaded - no blob needed"))}}var jo=h(2522);class tt{constructor(a,i,t,n,o,s){this.knownMediaService=a,this.mediaAssetService=i,this.batchMediaUpload=t,this.eventMediaService=n,this.commonPageService=o,this.logger=s,this.selectedCoverMediaId=null,this.selectedPhotos=[],this.selectedCoverPreviewUrl=null,this.knownMediaCategories=[],this.isKnownMediaLoading=!1,this.hasKnownMediaError=!1,this.activeCategoryId=null,this.uploadSnapshot=null,this.carouselUploadTiles=[],this.uploadHandle=null,this.pendingCoverPhotoId=null,this.removedEventMediaIds=[]}loadKnownMedia(){var a=this;return(0,u.A)(function*(){if(!a.isKnownMediaLoading)try{a.isKnownMediaLoading=!0,a.hasKnownMediaError=!1;const i=yield a.knownMediaService.GetActiveKnownMedia(Ve._.Wishlist);a.knownMediaCategories=(0,jo.s)(i??[],a.mediaAssetService),a.activeCategoryId=a.knownMediaCategories.length>0?a.knownMediaCategories[0].categoryId:null}catch(i){a.logger.LogError(i,"Failed to load known media"),a.hasKnownMediaError=!0}finally{a.isKnownMediaLoading=!1}})()}lookupMediaPreviewUrl(a){for(const i of this.knownMediaCategories){const t=i.mediaOptions.find(n=>n.knownMedia.mediaId===a);if(t)return t.previewUrl||t.thumbnailUrl}return null}isKnownMediaId(a){return!!a&&this.knownMediaCategories.some(i=>i.mediaOptions.some(t=>t.knownMedia.mediaId===a))}applyCoverPickerResult(a,i){var t=this;return(0,u.A)(function*(){if(!a)return;t.activeCategoryId=a.activeCategoryId;const n=a.selectedMediaId&&t.isKnownMediaId(a.selectedMediaId)&&!0===a.artworkSelectedByUser?a.selectedMediaId:null;if(n){if(i)for(const G of t.selectedPhotos.filter(A=>t.isPersistedCarouselPhoto(A)))t.queueCarouselPhotoRemoval(G.id);return t.selectedCoverMediaId=n,t.selectedCoverPreviewUrl=t.lookupMediaPreviewUrl(n),t.selectedPhotos=[],t.uploadHandle?.cancel(),t.uploadHandle=null,t.uploadSnapsh
1ot=null,t.pendingCoverPhotoId=null,t.recomputeCarouselUploadTiles(),void t.logger.LogInfo("Cover artwork selected",{mediaId:n})}const o=a.uploadedPhotos;if(void 0===o)return;const d=i?t.selectedPhotos.filter(G=>!!G.mediaId):[],p=new Set(o.filter(G=>!!G.mediaId).map(G=>G.mediaId)),_=d.filter(G=>G.mediaId&&p.has(G.mediaId)),v=d.filter(G=>!_.includes(G));for(const G of v)t.isPersistedCarouselPhoto(G)&&t.queueCarouselPhotoRemoval(G.id);let y=o.filter(G=>!G.mediaId);if(0===y.length&&0===v.length)return;const I=_.length;y.length>0&&I>=10&&(yield t.commonPageService.showAlertDialog("Photo limit reached","This event already has the maximum of 10 photos. Remove some before adding more."),y=[]);const E=10-I;y.length>E&&(yield t.commonPageService.showAlertDialog("Too many photos",`Only ${E} more photo${1===E?"":"s"} can be added (max 10 total). The rest were not added.`),y=y.slice(0,E));const R=y.map((G,A)=>({...G,order:I+A+1})),U=t.isKnownMediaId(t.selectedCoverMediaId);t.selectedPhotos=[..._,...R],R.length>0?(t.pendingCoverPhotoId=R[0]?.id??null,t.selectedCoverMediaId=R[0]?.mediaId??t.selectedCoverMediaId):!U&&t.selectedCoverMediaId&&!t.selectedPhotos.some(G=>G.mediaId===t.selectedCoverMediaId)&&(t.selectedCoverMediaId=t.selectedPhotos[0]?.mediaId??null),t.refreshCoverPreviewUrl(),t.logger.LogInfo("Cover photos updated",{added:R.length,removed:v.length}),t.recomputeCarouselUploadTiles(),R.length>0&&t.startBackgroundUpload()})()}startBackgroundUpload(){this.uploadHandle?.cancel(),this.uploadHandle=null,this.uploadSnapshot=null;const a=this.selectedPhotos.filter(i=>!i.mediaId);if(0!==a.length)try{const i=this.batchMediaUpload.start(a,t=>{this.uploadSnapshot=t,this.recomputeCarouselUploadTiles()},2,void 0,Be.k.Landscape);this.uploadHandle=i,this.uploadSnapshot=i.getSnapshot(),this.recomputeCarouselUploadTiles(),this.logger.LogInfo("Backgroun
1d photo upload started",{count:a.length})}catch(i){this.logger.LogError(i,"Failed to start background photo upload")}}cancelUpload(){this.uploadHandle?.cancel()}linkUploadedPhotos(a){var i=this;return(0,u.A)(function*(){let t=0;if(i.removedEventMediaIds.length>0){const p=[...i.removedEventMediaIds];i.removedEventMediaIds=[];for(const _ of p)try{yield i.eventMediaService.RemoveCarouselMedia(_),i.logger.LogInfo("Carousel media removed",{eventId:a,eventMediaId:_})}catch(v){t+=1,i.logger.LogError(v,`Failed to remove carousel media (eventMediaId ${_})`)}}if(!i.uploadHandle)return i.selectedCoverMediaId||(i.selectedCoverMediaId=i.selectedPhotos[0]?.mediaId??null),i.refreshCoverPreviewUrl(),t;const n=yield i.uploadHandle.whenDone();i.uploadSnapshot=n,t+=n.failedCount;const o=n.items.filter(p=>"completed"===p.status&&p.media?.mediaId).sort((p,_)=>p.order-_.order),s=i.selectedPhotos.filter(p=>!!p.mediaId).reduce((p,_)=>Math.max(p,_.order),0);let d=s;for(const p of o){d+=1;try{const _={eventId:a,mediaId:p.media.mediaId,sortOrder:d};yield i.eventMediaService.AddCarouselMedia(_),i.logger.LogInfo("Carousel media linked",{eventId:a,sortOrder:d})}catch(_){t+=1,i.logger.LogError(_,`Failed to link carousel media (sortOrder ${d})`)}}if(i.pendingCoverPhotoId){const p=o.find(_=>_.id===i.pendingCoverPhotoId);p?.media?.mediaId&&(i.selectedCoverMediaId=p.media.mediaId),i.pendingCoverPhotoId=null}else if(0===s){const p=i.selectedPhotos.find(v=>!!v.mediaId)?.mediaId,_=o[0]?.media?.mediaId;i.selectedCoverMediaId=p??_??i.selectedCoverMediaId}return i.uploadHandle=null,i.recomputeCarouselUploadTiles(),t})()}retryUploadPhoto(a){var i=this;return(0,u.A)(function*(){i.uploadHandle&&(yield i.uploadHandle.retryItem(a),i.uploadSnapshot=i.uploadHandle.getSnapshot(),i.recomputeCarouselUploadTiles())})()}removeUploadPhoto(a){!this.uploadSnapshot?.items.some(t=>t.id===a)||!this.uploadHandle||(this.uploadHandle.removeItem(a),this.uploadSnapshot=this.uploadHandle.getSnapshot(),this.selectedPhotos=this.selectedPhotos.filter(t=>t.id!==a),this.recomputeCarouselUploadTiles())}recomputeCarouselUploadTiles(){const a=new Map((this.uploadSnapshot?.items??[]).map(t=>[t.id,t])),i=this.getCoverPhotoId();this.carouselUploadTiles=this.selectedPhotos.filter(t=>t.id!==i).map(t=>{const n=a.get(t.id);return n?function Ao(r,a){return{id:r.id,previewUrl:a,progress:r.progress,status:r.status,showProgressBar:!0}}(n,t.thumbnailUrl):{id:t.id,previewUrl:t.thumbnailUrl,progress:100,status:"completed",showProgressBar:!1}})}getCoverPhotoId(){if(this.pendingCoverPhotoId&&this.selectedPhotos.some(i=>i.id===this.pendingCoverPhotoId))return this.pendingCoverPhotoId;const a=this.selectedCoverMediaId;if(a){const i=this.selectedPhotos.find(t=>t.mediaId===a);if(i)return i.id;if(this.isKnownMediaId(a))return null}return this.selectedPhotos[0]?.id??null}isPersistedCarouselPhoto(a){return!!a.mediaId&&a.id!==`media-${a.mediaId}`}queueCarouselPhotoRemoval(a){this.removedEventMediaIds.includes(a)||this.removedEventMediaIds.push(a)}refreshCoverPreviewUrl(){const a=this.getCoverPhotoId();this.selectedCoverPreviewUrl=a?this.selectedPhotos.find(i=>i.id===a)?.thumbnailUrl||null:this.selectedCoverMediaId?this.lookupMediaPreviewUrl(this.selectedCoverMediaId):null}syncSelectedCoverState(a,i=[]){const t=a,n=i.filter(o=>!!o.mediaId).sort((o,s)=>(o.sortOrder??0)-(s.sortOrder??0)).map((o,s)=>{const d=this.getEventMediaDtoUrl(o);return{id:o.eventMediaId||`event-media-${o.mediaId}`,order:s+1,thumbnailUrl:d,mediaId:o.mediaId,getBlob:()=>Promise.reject(new Error("Already uploaded - no blob needed"))}}).filter(o=>!!o.thumbnailUrl);if(n.length>0)return this.selectedPhotos=n,this.selectedCoverMediaId=t?.mediaId?.trim()||n[0]?.mediaId||null,this.recomputeCarouselUploadTiles(),void this.refreshCoverPreviewUrl();if(!t?.mediaId||!t.media)return this.selectedCoverMediaId=null,this.selectedPhotos=[],this.recomputeCarouselUploadTiles(),void this.refreshCoverPreviewUrl();if(this.selectedCoverMediaId=t.mediaId,0===this.selectedPhotos.length){const o=this.getExistingEventMediaUrl(t)??"";this.selectedPhotos=[Uo({...t.media,mediaId:t.media.mediaId??t.mediaId},o,1)]}this.recomputeCarouselUploadTiles(),this.refreshCoverPreviewUrl()}getExistingEventMediaUrl(a){const i=a?.media?.filePath||a?.media?.fileThumbn
1ailPath;return i?this.mediaAssetService.getMediaUrlFromFilePath(i):null}getEventMediaDtoUrl(a){const i=a.mediaThumbnailPath||a.mediaFilePath;return i?this.mediaAssetService.getMediaUrlFromFilePath(i)??"":""}}let nt=(()=>{var r;class a{constructor(t,n){this.mediaAssetService=t,this.logger=n,this.activeBatches=new Map}getActiveBatch(t){return this.activeBatches.get(t)??null}clearBatch(t){this.activeBatches.delete(t)}start(t,n,o=2,s,d){var p=this;const _=t.map(k=>({id:k.id,order:k.order,status:"pending",progress:0}));let I,v=!1,y=n??null,E=new Promise(k=>{I=k});const R=new Map(t.map(k=>[k.id,k])),U=new Set,G=()=>{const k=_.filter(j=>!U.has(j.id)),w=k.filter(j=>"completed"===j.status).length,M=k.filter(j=>"failed"===j.status).length,Y=k.length,B=0===Y?100:Math.round(k.reduce((j,De)=>j+De.progress,0)/Y),Z=k.every(j=>"completed"===j.status||"failed"===j.status);return{items:k,completedCount:w,failedCount:M,totalCount:Y,overallProgress:B,isComplete:Z}},A=()=>{const k=G();y&&y(k),k.isComplete&&I(k)},de=function(){var k=(0,u.A)(function*(w,M){if(!U.has(w.id)){if(v&&"pending"===w.status)return w.status="failed",w.error=new Error("Cancelled"),void A();w.status="uploading",w.progress=0,A();try{const Y=yield M.getBlob(),B=yield p.mediaAssetService.uploadMediaBlobWithProgress(Y,M.fileName,Z=>{"uploading"===w.status&&(w.progress=Math.max(w.progress,Math.min(Z,99)),A())},d);w.media=B,M.mediaId=B.mediaId,w.status="completed",w.progress=100,p.logger.LogInfo("BatchMediaUploadService: item uploaded",{id:w.id,order:w.order})}catch(Y){w.status="failed",w.error=Y,p.logger.LogError(Y,`BatchMediaUploadService: upload failed for item ${w.id}`)}A()}});return function(M,Y){return k.apply(this,arguments)}}(),ce=function(){var k=(0,u.A)(function*(w){const M=[...w],Y=function(){var Z=(0,u.A)(function*(){for(;M.length>0;){const j=M.shift();if(!j)break;if(U.has(j.id))continue;const De=R.get(j.id);De&&(yield de(j,De))}});return function(){return Z.apply(this,arguments)}}(),B=[];for(let Z=0;Z<Math.min(o,M.length);Z++)B.push(Y());yield Promise.all(B),0===_.length&&I(G())});return function(M){return k.apply(this,arguments)}}(),he=_.filter(k=>"pending"===k.status);0===he.length?I(G()):ce(he);const Te={getSnapshot:()=>G(),whenDone:()=>E,retryFailed:(k=(0,u.A)(function*(){let w;const M=new Promise(B=>{w=B});I=w,E=M;const Y=_.filter(B=>"failed"===B.status);for(const B of Y)B.status="pending",B.progress=0,B.error=void 0;A(),yield ce(Y),I(G()),yield M}),function(){return k.apply(this,arguments)}),cancel:()=>{v=!0;for(const k of _)"pending"===k.status&&(k.status="failed",k.error=new Error("Cancelled"));A()},setOnProgress:k=>{y=k},retryItem:function(){var k=(0,u.A)(function*(w){const M=_.find(j=>j.id===w);if(!M||"failed"!==M.status||U.has(w)||!R.get(w))return;let B;const Z=new Promise(j=>{B=j});I=B,E=Z,M.status="pending",M.progress=0,M.error=void 0,A(),yield ce([M]),I(G()),yield Z});return function(M){return k.apply(this,arguments)}}(),removeItem:k=>{!_.find(M=>M.id===k)||U.has(k)||(U.add(k),this.logger.LogInfo("BatchMediaUploadService: item removed locally",{id:k}),A())}};var k;return s&&this.activeBatches.set(s,{handle:Te,photos:[...t],attachedItemIds:new Set}),Te}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(c.KVO(F.S),c.KVO(O.g))},this.\u0275prov=c.jDH({token:a,factory:a.\u0275fac,providedIn:"root"}))}return r(),a})();function $o(r,a){if(1&r&&e.nrm(0,"img",12),2&r){const i=e.XpG().$implicit;e.Y8G("src",i.previewUrl,e.B4B)}}function Bo(r,a){1&r&&e.nrm(0,"div",13)}function Lo(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",14)(1,"button",15),e.bIt("click",function(){c.eBV(i);const n=e.XpG().$implicit,o=e.XpG(2);return c.Njj(o.removeItem.emit(n.id))}),e.nrm(2,"ion-icon",16),e.k0s(),e.j41(3,"span",17),e.EFF(4,"Failed"),e.k0s(),e.j41(5,"button",18),e.bIt("click",function(){c.eBV(i);const n=e.XpG().$implicit,o=e.XpG(2);return c.Njj(o.retryItem.emit(n.id))}),e.nrm(6,"ion-icon",19),e.EFF(7," Retry "),e.k0s()()}}function Oo(r,a){if(1&r&&(e.j41(0,"div",20),e.nrm(1,"div",21),e.k0s()),2&r){const i=e.XpG().$implicit;e.AVh("is-pending","pending"===i.status)("is-busy","uploading"===i.status)("is-done","completed"===i.status)("is-failed","failed"===i.status),e.R7$(),e.xc7("width","pending"===i.status?0:"uploading"===i.status?i.progress:100,"%")}}function No(r,a){1&r&&e.nrm(0,"ion-icon",22)}
1function Yo(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",23),e.bIt("click",function(){c.eBV(i);const n=e.XpG().$implicit,o=e.XpG(2);return c.Njj(o.removeItem.emit(n.id))}),e.nrm(1,"ion-icon",24),e.k0s()}}function Vo(r,a){if(1&r&&(e.j41(0,"div",25),e.nrm(1,"div",21),e.k0s()),2&r){const i=e.XpG().$implicit,t=e.XpG(2);e.AVh("upload-bar--compact","grid"===t.layout)("is-pending","pending"===i.status)("is-busy","uploading"===i.status)("is-done","completed"===i.status)("is-failed","failed"===i.status),e.R7$(),e.xc7("width","pending"===i.status?0:"uploading"===i.status?i.progress:100,"%")}}function Xo(r,a){if(1&r&&(e.j41(0,"div",3)(1,"div",4),e.DNE(2,$o,1,1,"img",5)(3,Bo,1,0,"div",6)(4,Lo,8,0,"div",7)(5,Oo,2,10,"div",8)(6,No,1,0,"ion-icon",9)(7,Yo,2,0,"button",10),e.k0s(),e.DNE(8,Vo,2,12,"div",11),e.k0s()),2&r){const i=a.$implicit,t=e.XpG(2);e.R7$(),e.AVh("upload-tile--uploading","uploading"===i.status)("upload-tile--completed","completed"===i.status)("upload-tile--failed","failed"===i.status),e.R7$(),e.Y8G("ngIf",i.previewUrl),e.R7$(),e.Y8G("ngIf","failed"===i.status),e.R7$(),e.Y8G("ngIf","failed"===i.status),e.R7$(),e.Y8G("ngIf","cover"===t.layout&&!1!==i.showProgressBar),e.R7$(),e.Y8G("ngIf","completed"===i.status),e.R7$(),e.Y8G("ngIf","failed"!==i.status),e.R7$(),e.Y8G("ngIf","cover"!==t.layout&&!1!==i.showProgressBar)}}function Wo(r,a){if(1&r&&(e.j41(0,"div",1),e.DNE(1,Xo,9,13,"div",2),e.k0s()),2&r){const i=e.XpG();e.xc7("grid-template-columns","grid"===i.layout?"repeat("+i.columns+", 1fr)":null),e.AVh("upload-grid--single","single"===i.layout)("upload-grid--cover","cover"===i.layout),e.R7$(),e.Y8G("ngForOf",i.tiles)("ngForTrackBy",i.trackTile)}}let it=(()=>{var r;class a{constructor(){this.tiles=[],this.layout="grid",this.columns=3,this.retryItem=new e.bkB,this.removeItem=new e.bkB}get isCoverLayout(){return"cover"===this.layout}trackTile(t,n){return n.id}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)},this.\u0275cmp=e.VBU({type:a,selectors:[["media-upload-grid"]],hostVars:2,hostBindings:function(n,o){2&n&&e.AVh("media-upload-grid--cover-host",o.isCoverLayout)},inputs:{tiles:"tiles",layout:"layout",columns:"columns"},outputs:{retryItem:"retryItem",removeItem:"removeItem"},standalone:!1,decls:1,vars:1,consts:[["class","upload-grid",3,"upload-grid--single","upload-grid--cover","gridTemplateColumns",4,"ngIf"],[1,"upload-grid"],["class","upload-tile-wrap",4,"ngFor","ngForOf","ngForTrackBy"],[1,"upload-tile-wrap"],[1,"upload-tile"],["class","upload-tile__img","alt","Upload preview",3,"src",4,"ngIf"],["class","upload-tile__scrim",4,"ngIf"],["class","upload-tile__failed",4,"ngIf"],["class","upload-bar upload-bar--overlay",3,"is-pending","is-busy","is-done","is-failed",4,"ngIf"],["name","checkmark-circle","class","upload-tile__complete-icon",4,"ngIf"],["type","button","class","upload-tile__remove","aria-label","Remove photo",3,"click",4,"ngIf"],["class","upload-bar",3,"upload-bar--compact","is-pending","is-busy","is-done","is-failed",4,"ngIf"],["alt","Upload preview",1,"upload-tile__img",3,"src"],[1,"upload-tile__scrim"],[1,"upload-tile__failed"],["type","button","aria-label","Remove failed photo",1,"upload-tile__failed-remove",3,"click"],["name","close-circle",1,"upload-tile__failed-icon"],[1,"upload-tile__failed-label"],["type","button","aria-label","Retry upload",1,"upload-tile__retry",3,"click"],["name","refresh-outline"],[1,"upload-bar","upload-bar--overlay"],[1,"upload-bar__fill"],["name","checkmark-circle",1,"upload-tile__complete-icon"],["type","button","aria-label","Remove photo",1,"upload-tile__remove",3,"click"],["name","close",1,"upload-tile__remove-icon"],[1,"upload-bar"]],template:function(n,o){1&n&&e.DNE(0,Wo,2,8,"div",0),2&n&&e.Y8G("ngIf",o.tiles.length>0)},dependencies:[l.Sq,l.bT,g.iq],styles:["[_nghost-%COMP%]{display:block}.media-upload-grid--cover-host[_nghost-%COMP%]{width:100%;height:100%}.upload-grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--spoyla-space-3)}.upload-grid--single[_ngcontent-%COMP%]{grid-template-columns:1fr;max-width:220px}.upload-grid--cover[_ngcontent-%COMP%]{grid-template-columns:1fr;gap:0;width:100%;height:100%}.upload-tile-wrap[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--spoyla-space-2)}.upload-grid--cover[_ngcontent-%COMP%] .upload-tile-wrap[_ngcontent-%COMP%]{width:100%;height:100%}.upload-tile[_ngcontent-%COMP%]{position:relative;aspect-ratio:1;border-radius:var(--radius-md);overflow:hidden;background:var(--color-surface-sunken)}.upload-grid--cover[_ngcontent-%COMP%] .upload-tile[_ngcontent-%COMP%]{aspect-ratio:auto;width:100%;height:100%;border-radius:0}.upload-tile__img[_ngcontent-%COMP%]{width:100%;height:100%;object-fit:cover;display:block}.upload-tile__scrim[_ngcontent-%COMP%]{position:absolute;inset:0;background:#00000059}.upload-tile__complete-icon[_ngcontent-%COMP%]{position:absolute;bottom:6px;right:6px;font-size:22px;color:var(--spoyla-green);background:var(--color-surface);border-radius:var(--radius-pill)}.upload-tile__failed[_ngcontent-%COMP%]{position:absolute;inset:0;z-index:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--spoyla-space-2)}.upload-tile__failed-remove[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:0;border:none;background:transparent;cursor:pointer}.upload-tile__failed-icon[_ngcontent-%COMP%]{font-size:28px;color:var(--spoyla-danger);background:var(--color-surface);border-radius:var(--radius-pill)}.upload-tile__failed-label[_ngcontent-%COMP%]{font-size:var(--text-2xs);font-weight:var(--weight-semibold);color:var(--action-primary-contrast)}.upload-tile__retry[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:4px;padding:4px 10px;border:none;border-radius:var(--radius-pill);background:var(--color-surface);color:var(--spoyla-danger);font-size:var(--text-2xs);font-weight:var(--weight-semibold);
1cursor:pointer}.upload-tile__retry[_ngcontent-%COMP%] ion-icon[_ngcontent-%COMP%]{font-size:14px}.upload-tile__remove[_ngcontent-%COMP%]{position:absolute;top:4px;right:4px;display:flex;align-items:center;justify-content:center;width:22px;height:22px;padding:0;border:none;border-radius:var(--radius-pill);background:#0000008c;cursor:pointer}.upload-tile__remove-icon[_ngcontent-%COMP%]{font-size:14px;color:var(--action-primary-contrast)}.upload-tile--failed[_ngcontent-%COMP%]{outline:2px solid var(--spoyla-danger);outline-offset:-2px}.upload-bar[_ngcontent-%COMP%]{height:4px;border-radius:var(--radius-pill);background:var(--border-hairline);overflow:hidden}.upload-bar--compact[_ngcontent-%COMP%]{height:3px}.upload-bar--overlay[_ngcontent-%COMP%]{position:absolute;left:var(--spoyla-space-2);right:var(--spoyla-space-2);bottom:var(--spoyla-space-2)}.upload-bar__fill[_ngcontent-%COMP%]{height:100%;width:0;background:var(--action-primary);transition:width var(--dur-fast) var(--ease-standard)}.upload-bar.is-done[_ngcontent-%COMP%] .upload-bar__fill[_ngcontent-%COMP%]{background:var(--spoyla-green)}.upload-bar.is-failed[_ngcontent-%COMP%] .upload-bar__fill[_ngcontent-%COMP%]{background:var(--spoyla-danger)}"]}))}return r(),a})();var ot=h(5199);function zo(r,a){1&r&&(e.j41(0,"p",17),e.EFF(1,"RSVP deadline must be before the event starts."),e.k0s())}function Ho(r,a){1&r&&(e.j41(0,"p",17),e.EFF(1,"Capacity must be at least 1."),e.k0s())}function qo(r,a){if(1&r){const i=e.RV6();e.qex(0),e.j41(1,"div",4)(2,"ion-label",5),e.EFF(3,"RSVP Deadline"),e.k0s(),e.nrm(4,"app-date-time-picker",6),e.DNE(5,zo,2,0,"p",7),e.k0s(),e.j41(6,"div",4)(7,"ion-label",5),e.EFF(8,"Capacity Limit"),e.k0s(),e.j41(9,"ion-item",8),e.nrm(10,"ion-input",9),e.k0s(),e.j41(11,"p",10),e.EFF(12,"When set, extra attendees are placed on a waitlist."),e.k0s(),e.DNE(13,Ho,2,0,"p",7),e.k0s(),e.j41(14,"div",4)(15,"ion-label",5),e.EFF(16,"Guest questions"),e.k0s(),e.j41(17,"div",11)(18,"button",12),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openQuestionBuilder())}),e.j41(19,"span",13),e.nrm(20,"ion-icon",14),e.k0s(),e.j41(21,"span",15),e.EFF(22),e.k0s(),e.nrm(23,"ion-icon",16),e.k0s()(),e.j41(24,"p",10),e.EFF(25,"Optional \u2014 skip this and guests just reply going, maybe, or not going."),e.k0s()(),e.bVm()}if(2&r){const i=e.XpG(2);e.R7$(4),e.Y8G("max",i.maxRsvpDT)("min",i.minSelectableEventDateTime),e.R7$(),e.Y8G("ngIf",i.form.hasError("rsvpAfterStart")),e.R7$(8),e.Y8G("ngIf",i.form.controls.maxAttendees.hasError("min")&&i.form.controls.maxAttendees.touched),e.R7$(5),e.Y8G("disabled",!i.eventId||i.isQuestionBuilderBusy),e.R7$(4),e.SpI(" ",i.eventId?i.questionSummaryLabel:i.questionsUnavailableLabel," ")}}function Ko(r,a){if(1&r){const i=e.RV6();e.qex(0),e.j41(1,"ion-item",2)(2,"ion-label")(3,"h3"),e.EFF(4,"Enable RSVP"),e.k0s(),e.j41(5,"p"),e.EFF(6,"Let people mark going, maybe, or not going."),e.k0s()(),e.j41(7,"ion-toggle",3),e.bIt("ionChange",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.onRsvpToggleChange(n.detail.checked))}),e.k0s()(),e.DNE(8,qo,26,6,"ng-container",1),e.bVm()}if(2&r){const i=e.XpG();e.R7$(7),e.Y8G("checked",i.showRsvpOptions),e.R7$(),e.Y8G("ngIf",i.showRsvpOptions)}}function Jo(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",19)(1,"div",20),e.nrm(2,"ion-icon",21),e.k0s(),e.j41(3,"div",22),e.EFF(4,"No one invited yet"),e.k0s(),e.j41(5,"p",23),e.EFF(6,"Invite your friends on Spoyla here, or skip this step \u2014 you can always invite more people later."),e.k0s(),e.j41(7,"ion-button",24),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openInvitePicker())}),e.nrm(8,"ion-icon",25),e.EFF(9," Invite friends "),e.k0s()()}}function Qo(r,a){if(1&r&&e.nrm(0,"img",41),2&r){const i=e.XpG().$implicit;e.Y8G("src",i.photoUrl,e.B4B)("alt",i.displayName)}}function Zo(r,a){if(1&r&&(e.j41(0,"span",42),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.initials)}}function er(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",33)(1,"span",34),e.DNE(2,Qo,1,2,"img",35)(3,Zo,2,1,"span",36),e.k0s(),e.j41(4,"div",37)(5,"div",38),e.EFF(6),e.k0s()(),e.j41(7,"button",39),e.bIt("click",function(){const n=c.eBV(i).$implicit,o=e.XpG(3);return c.Njj(o.openPersonMenu(n))}),e.EFF(8," Invited "),e.nrm(9,"ion-icon",40),e.k0s()()}if(2&r){const i=a.$implicit;e.R7$(2),e.Y8G("ngIf",i.photoUrl),e.R7$(),e.Y8G("ngIf",!i.photoUrl),e.R7$(3),e.JRh(i.displayName),e.R7$(),e.BMQ("aria-label",i.displayName+" \u2014 Invited, tap to change")}}function tr(r,a){if(1&r){const i=e.RV6();e.qex(0),e.j41(1,"div",26)(2,"span",27),e.EFF(3,"People "),e.j41(4,"span",28),e.EFF(5),e.k0s()(),e.j41(6,"button",29),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openInvitePicker())}),e.nrm(7,"ion-icon",30),e.EFF(8," Invite "),e.k0s()(),e.j41(9,"div",31),e.DNE(10,er,10,4,"div",32),e.k0s(),e.bVm()}if(2&r){const i=e.XpG(2);e.R7$(5),e.SpI("\xb7 ",i.invitedPeople.length),e.R7$(5),e.Y8G("ngForOf",i.invitedPeople)("ngForTrackBy",i.trackInvitedPerson)}}function nr(r,a){if(1&r&&(e.qex(0),e.DNE(1,Jo,10,0,"div",18)(2,tr,11,3,"ng-container",1),e.bVm()),2&r){const i=e.XpG();e.R7$(),e.Y8G("ngIf",0===i.invitedPeople.length),e.R7$(),e.Y8G("ngIf",i.invitedPeople.length>0)}}let Oe=(()=>{var r;class a{constructor(t,n,o,s,d,p){this.modalController=t,this.friendshipService=n,this.mediaAssetService=o,this.logger=s,this.rsvpQuestionService=d,this.reportedMediaService=p,this.maxRsvpDT=null,this.minSelectableEventDateTime=null,this.layout="wizard",this.initialSelectedUserIds=null,this.eventId=null,this.invitedUserIdsChanged=new e.bkB,this.requestQuestionBuilder=new e.bkB,this.showRsvpOptions=!1,this.showRsvpSettings=!0,this.showInvitePicker=!0,this.isQuestionBuilderBusy=!1,this.questionSummaryLabel="Ask guests about meals, dietary needs, and more",this.questionsUnavailableLabel="Preparing your event \u2014 questions unlock in a moment.",this.invitedPeople=[],this.selectedUserIds=new Set}ngOnInit(){var t=this;return(0,u.A)(function*(){t.showRsvpOptions=!0===t.form?.get("rsvpEnabled")?.value,t.applyLayoutFlags(),t.initialSelectedUserIds?.length&&(t.selectedUserIds=new Set(t.initialSelectedUserIds),t.showInvitePicker&&(yield t.hydrateInvitedPeople())),t.showRsvpSettings&&t.eventId&&(yield t.refreshQuestionSummary())})()}ngOnChanges(t){var n=this;return(0,u.A)(function*(){t.layout&&n.applyLayoutFlags();const o=t.eventId;o&&!o.firstChange&&n.eventId&&n.showRsvpSettings&&(yield n.refreshQuestionSummary())})()}applyLayoutFlags(){this.showRsvpSettings="invites"!==this.layout,this.showInvitePicker="edit"!==this.layout&&"rsvp"!==this.layout}openQuestionBuilder(){!this.eventId||this.isQuestionBuilderBusy||this.requestQuestionBuilder.emit()}refreshQuestionSummary(){var t=this;return(0,u.A)(function*(){if(t.eventId)try{t.isQuestionBuilderBusy=!0;const n=(yield t.rsvpQuestionService.GetQuestionsForEvent(t.eventId,""))||[];t.questionSummaryLabel=0===n.length?"Ask guests about meals, dietary needs, and more":`${n.length} question${1===n.length?"":"s"} asked at RSVP`}catch(n){t.logger.LogError(n,"Failed to load RSVP question summary")}
1finally{t.isQuestionBuilderBusy=!1}})()}onRsvpToggleChange(t){this.showRsvpOptions=t,this.form.get("rsvpEnabled")?.setValue(t)}trackInvitedPerson(t,n){return n.userId||`person-${t}`}openInvitePicker(){var t=this;return(0,u.A)(function*(){const n=Array.from(t.selectedUserIds),o=yield t.modalController.create({component:ot.T,cssClass:"popup-modal-lg",componentProps:{excludeUserIds:n}});yield o.present();const{data:s}=yield o.onWillDismiss();if(!s?.selectedUsers?.length)return;const d=s.selectedUsers.filter(p=>!!p.userId&&!t.selectedUserIds.has(p.userId)).map(p=>t.toInvitedPersonRow(p));for(const p of d)t.selectedUserIds.add(p.userId);t.invitedPeople=[...t.invitedPeople,...d],t.emitSelectionChanged()})()}openPersonMenu(t){var n=this;return(0,u.A)(function*(){"remove"===(yield(0,Ze.a)(n.modalController,{title:t.displayName,subtitle:"Invited",options:[{value:"remove",label:"Remove from event",description:"They will not be invited",icon:"close-circle-outline",isDanger:!0}]}))&&(n.invitedPeople=n.invitedPeople.filter(s=>s.userId!==t.userId),n.selectedUserIds.delete(t.userId),n.emitSelectionChanged())})()}hydrateInvitedPeople(){var t=this;return(0,u.A)(function*(){try{const n=yield t.friendshipService.GetFriends(),o=new Map;for(const s of n??[])s.userId&&o.set(s.userId,s);t.invitedPeople=Array.from(t.selectedUserIds).map(s=>{const d=o.get(s);return d?t.toInvitedPersonRow(d):t.toFallbackPersonRow(s)})}catch(n){t.logger.LogError(n,"Failed to hydrate previously invited people for event"),t.invitedPeople=Array.from(t.selectedUserIds).map(o=>t.toFallbackPersonRow(o))}})()}toInvitedPersonRow(t){const n=t.nickName||t.userName||"Friend";return{userId:t.userId,displayName:n,photoUrl:t.media&&!this.reportedMediaService.isReported(t.media.mediaId)?this.mediaAssetService.getMediaUrl(t.media)??null:null,initials:this.getInitials(n)}}
1toFallbackPersonRow(t){return{userId:t,displayName:"Guest",photoUrl:null,initials:"?"}}getInitials(t){return t.trim().split(/\s+/).slice(0,2).map(s=>s[0]?.toUpperCase()??"").join("")||"?"}emitSelectionChanged(){this.invitedUserIdsChanged.emit(Array.from(this.selectedUserIds))}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(g.W3),e.rXU(me.r),e.rXU(F.S),e.rXU(O.g),e.rXU(He.O),e.rXU(V.p))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-event-wizard-people"]],inputs:{form:"form",maxRsvpDT:"maxRsvpDT",minSelectableEventDateTime:"minSelectableEventDateTime",layout:"layout",initialSelectedUserIds:"initialSelectedUserIds",eventId:"eventId"},outputs:{invitedUserIdsChanged:"invitedUserIdsChanged",requestQuestionBuilder:"requestQuestionBuilder"},standalone:!1,features:[e.OA$],decls:3,vars:3,consts:[[1,"field-stack",3,"formGroup"],[4,"ngIf"],["lines","none",1,"toggle-row"],["slot","end",3,"ionChange","checked"],[1,"input-wrapper"],[1,"input-label"],["formControlName","rsvpDeadlineDT","placeholder","Select RSVP deadline","label","RSVP Deadline","presentation","date-time",3,"max","min"],["class","field-error",4,"ngIf"],["lines","none",1,"spoyla-input"],["type","number","formControlName","maxAttendees","min","1","placeholder","Leave blank for unlimited"],[1,"field-hint"],[1,"settings"],["type","button",1,"setrow",3,"click","disabled"],[1,"setrow__ic"],["name","help-circle-outline"],[1,"setrow__l"],["name","chevron-forward-outline",1,"setrow__chev"],[1,"field-error"],["class","empty",4,"ngIf"],[1,"empty"],[1,"empty__icon"],["name","people-outline"],[1,"empty__title"],[1,"empty__desc"],["fill","solid","color","primary",3,"click"],["name","person-add-outline","slot","start"],[1,"grp-section-head"],[1,"grp-section-head__t"],[1,"grp-section-head__c"],["type","button",1,"grp-section-head__a",3,"click"],["name","person-add-outline"],[1,"fcard-list"],["class","fcard",4,"ngFor","ngForOf","ngForTrackBy"],[1,"fcard"],[1,"fcard__av"],["loading","lazy",3,"src","alt",4,"ngIf"],["class","fcard__init",4,"ngIf"],[1,"fcard__body"],[1,"fcard__n"],["type","button",1,"role-pill",3,"click"],["name","chevron-down-outline"],["loading","lazy",3,"src","alt"],[1,"fcard__init"]],template:function(n,o){1&n&&(e.j41(0,"div",0),e.DNE(1,Ko,9,2,"ng-container",1)(2,nr,3,2,"ng-container",1),e.k0s()),2&n&&(e.Y8G("formGroup",o.form),e.R7$(),e.Y8G("ngIf",o.showRsvpSettings),e.R7$(),e.Y8G("ngIf",o.showInvitePicker))},dependencies:[l.Sq,l.bT,f.BC,f.cb,f.j4,f.JD,g.Jm,g.iq,g.$w,g.uz,g.he,g.BY,g.hB,g.su,g.T6,P.P],styles:["[_nghost-%COMP%]{display:block}"]}))}return r(),a})();const ir=["rsvpStep"];function or(r,a){if(1&r&&(e.j41(0,"div",15),e.EFF(1),e.k0s()),2&r){const i=e.XpG();e.R7$(),e.E5c("Step ",i.currentWizardStepIndex+1," of ",i.wizardSteps.length,": ",i.currentWizardStep.label)}}function rr(r,a){if(1&r&&e.nrm(0,"ion-progress-bar",18),2&r){const i=a.$implicit,t=a.index,n=e.XpG(2);e.Y8G("value",t<=n.currentWizardStepIndex?1:0),e.BMQ("aria-label",i.label+" progress segment")}}function ar(r,a){if(1&r&&(e.j41(0,"div",16),e.DNE(1,rr,1,2,"ion-progress-bar",17),e.k0s()),2&r){const i=e.XpG();e.R7$(),e.Y8G("ngForOf",i.wizardSteps)("ngForTrackBy",i.trackWizardStep)}}function sr(r,a){1&r&&(e.j41(0,"div",19)(1,"div",20)(2,"div",21),e.nrm(3,"ion-skeleton-text",22),e.j41(4,"h2"),e.EFF(5,"Creating your event"),e.k0s(),e.j41(6,"p"),e.EFF(7,"Hang tight while we finish up."),e.k0s()()()()),2&r&&(e.R7$(3),e.Y8G("animated",!0))}function lr(r,a){if(1&r&&e.nrm(0,"img",29),2&r){const i=e.XpG(2);e.Y8G("src",i.coverPhotoState.selectedCoverPreviewUrl,e.B4B)}}function dr(r,a){1&r&&(e.j41(0,"div",30)(1,"span",31),e.nrm(2,"ion-icon",32),e.k0s(),e.j41(3,"p"),e.EFF(4,"Pick artwork"),e.k0s()())}function cr(r,a){if(1&r){const i=e.RV6();e.j41(0,"media-upload-grid",33),e.bIt("retryItem",function(n){c.eBV(i);const o=e.XpG(2);return c.Njj(o.coverPhotoState.retryUploadPhoto(n))})("removeItem",function(n){c.eBV(i);const o=e.XpG(2);return c.Njj(o.coverPhotoState.removeUploadPhoto(n))}),e.k0s()}if(2&r){const i=e.XpG(2);e.Y8G("tiles",i.coverPhotoState.carouselUploadTiles)}}function pr(r,a){if(1&r){const i=e.RV6();e.qex(0),e.j41(1,"div",23),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openCoverPicker())})("keydown.enter",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.openCoverPicker())}),e.DNE(2,lr,1,1,"img",24)(3,dr,5,0,"div",25),e.j41(4,"ion-button",26),e.bIt("click",function(n){c.eBV(i);const o=e.XpG();return n.stopPropagation(),c.Njj(o.openCoverPicker())}),e.nrm(5,"ion-icon",27),e.k0s()(),e.DNE(6,cr,1,1,"media-upload-grid",28),e.bVm()}if(2&r){const i=e.XpG();e.R7$(2),e.Y8G("ngIf",i.coverPhotoState.selectedCoverPreviewUrl),e.R7$(),e.Y8G("ngIf",!i.coverPhotoState.selectedCoverPreviewUrl),e.R7$(3),e.Y8G("ngIf",i.coverPhotoState.carouselUploadTiles.length>0)}}function ur(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",34)(1,"app-event-wizard-basics",35),e.bIt("locationPicked",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.onLocationPicked())})("requestLocationPicker",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.onRequestLocationPicker())}),e.k0s(),e.j41(2,"div",36)(3,"div",37)(4,"div",38),e.nrm(5,"ion-icon",39),e.k0s(),e.j41(6,"span",40),e.EFF(7," Allow group gifts "),e.j41(8,"span",41),e.EFF(9,"Let guests start group gifts for this event."),e.k0s()(),e.j41(10,"ion-toggle",42),e.bIt("ionChange",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.onAllowGroupGiftsChange(n.detail.checked))}),e.k0s()(),e.j41(11,"div",37)(12,"div",38),e.nrm(13,"ion-icon",43),e.k0s(),e.j41(14,"span",40),e.EFF(15," Allow guest photo uploads "),e.j41(16,"span",41),e.EFF(17,"Let guests add their own photos to this event."),e.k0s()(),e.j41(18,"ion-toggle",42),e.bIt("ionChange",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.onAllowUsersToUploadPhotosChange(n.detail.checked))}),e.k0s()()()()}if(2&r){const i=e.XpG();e.Y8G("hidden","basics"!==i.currentWizardStep.id),e.R7$(),e.Y8G("form",i.eventForm)("visibilityOptions",i.visibilityOptions)("formatOptions",i.formatOptions)("dressCodeOptions",i.dressCodeOptions)("showOnlineUrl",i.showOnlineUrl)("showLocation",i.showLocation)("minSelectableEventDateTime",i.minSelectableEventDateTime)("minEndDT",i.minEndDT)("initialLocationLat",i.initialLocationLat)("initialLocationLng",i.initialLocationLng)("initialLocationLabel",i.initialLocationLabel),e.R7$(9),e.Y8G("checked",i.allowGroupGifts),e.R7$(8),e.Y8G("checked",i.allowUsersToUploadPhotos)}}function gr(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",34)(1,"app-wishlist-link-picker",44),e.bIt("wishlistSelectionChanged",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.onWishlistSelectionChanged(n))})("requestArtworkPicker",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.onRequestWishlistArtwork(n))}),e.k0s()()}if(2&r){const i=e.XpG();e.Y8G("hidden","wishlists"!==i.currentWizardStep.id),e.R7$(),e.Y8G("eventId",i.draftEventId)("initialSelectedWishlistIds",i.selectedWishlistIds)}}function _r(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",34)(1,"app-event-wizard-people",45,0),e.bIt("requestQuestionBuilder",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.onRequestQuestionBuilder())}),e.k0s()()}if(2&r){const i=e.XpG();e.Y8G("hidden","rsvp"!==i.currentWizardStep.id),e.R7$(),e.Y8G("form",i.eventForm)("eventId",i.draftEventId)("maxRsvpDT",i.maxRsvpDT)("minSelectableEventDateTime",i.minSelectableEventDateTime)}}function hr(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",34)(1,"app-event-wizard-people",46),e.bIt("invitedUserIdsChanged",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.onInvitedUserIdsChanged(n))}),e.k0s()()}if(2&r){const i=e.XpG();e.Y8G("hidden","invites"!==i.currentWizardStep.id),e.R7$(),e.Y8G("form",i.eventForm)("initialSelectedUserIds",i.selectedInviteUserIds)}}function mr(r,a){if(1&r){const i=e.RV6();e.j41(0,"app-event-rsvp-question-builder",48),e.bIt("completed",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.onQuestionBuilderCompleted())})("viewChanged",function(n){c.eBV(i);const o=e.XpG(2);return c.Njj(o.onQuestionBuilderViewChanged(n))}),e.k0s()}if(2&r){const i=e.XpG(2);e.Y8G("hosted",!0)("eventId",i.draftEventId)}}function vr(r,a){if(1&r&&(e.qex(0),e.DNE(1,mr,1,2,"app-event-rsvp-question-builder",47),e.bVm()),2&r){const i=e.XpG();e.R7$(),e.Y8G("ngIf","rsvp-questions"===i.currentView&&i.draftEventId)}}function fr(r,a){1&r&&e.nrm(0,"ion-skeleton-text",54),2&r&&e.Y8G("animated",!0)}function yr(r,a){1&r&&e.nrm(0,"ion-icon",55)}function Ir(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-footer")(1,"ion-toolbar")(2,"ion-row",49)(3,"ion-col")(4,"ion-button",50),e.bIt("click",function(){c.eBV(i);const n=e.XpG();
1return c.Njj(n.isFirstWizardStep?n.dismiss():n.previousWizardStep())}),e.EFF(5),e.k0s()(),e.j41(6,"ion-col")(7,"ion-button",51),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.handleWizardPrimaryAction())}),e.DNE(8,fr,1,1,"ion-skeleton-text",52),e.EFF(9),e.DNE(10,yr,1,0,"ion-icon",53),e.k0s()()()()()}if(2&r){const i=e.XpG();e.R7$(4),e.Y8G("disabled",i.isBusy),e.R7$(),e.SpI(" ",i.isFirstWizardStep?"Cancel":"Back"," "),e.R7$(2),e.Y8G("disabled",i.isBusy||i.isLastWizardStep&&(i.reviewIssues.length>0||i.eventForm.invalid)),e.R7$(),e.Y8G("ngIf",i.isBusy),e.R7$(),e.SpI(" ",i.wizardPrimaryLabel," "),e.R7$(),e.Y8G("ngIf",!i.isBusy&&!i.isLastWizardStep)}}let br=(()=>{var r;class a{get eventForm(){return this.formCore.form}get showOnlineUrl(){const t=this.eventForm?.get("eventFormatTypeId")?.value;return t===x.n.Online||t===x.n.Hybrid}get showLocation(){const t=this.eventForm?.get("eventFormatTypeId")?.value;return t===x.n.InPerson||t===x.n.Hybrid}get showRsvpOptions(){return!0===this.eventForm?.get("rsvpEnabled")?.value}get minEndDT(){return this.eventForm?.get("startDT")?.value??this.minSelectableEventDateTime}get maxRsvpDT(){return this.eventForm?.get("startDT")?.value??null}get currentWizardStepIndex(){return this.wizardNav.currentStepIndex}get currentWizardStep(){return this.wizardNav.currentStep}get isFirstWizardStep(){return this.wizardNav.isFirstStep}get isLastWizardStep(){return this.wizardNav.isLastStep}get wizardPrimaryLabel(){return this.wizardNav.primaryLabel}get reviewIssues(){return L.lh(this.eventForm)}constructor(t,n,o,s,d,p,_,v,y,I,E,R,U){this.formBuilder=t,this.nav=n,this.modalController=o,this.logger=s,this.commonPageService=d,this.tokenService=p,this.eventService=_,this.mediaAssetService=v,this.eventWishlistService=y,this.eventUserService=I,this.knownMediaService=E,this.eventMediaService=R,this.batchMediaUploadService=U,this.viewStack=["wizard"],this.currentView="wizard",this.headerTitle="Create Event",this.headerActionIcon="chevron-back",this.headerActionLabel="Back",this.isSubViewActive=!1,this.isBusy=!1,this.currentUserId="",this.selectedWishlistIds=[],this.selectedInviteUserIds=[],this.allowGroupGifts=!0,this.allowUsersToUploadPhotos=!0,this.draftEventId=null,this.draftCreatePromise=null,this.assignedWishlistIds=new Map,this.wishlistAssignPromise=null,this.visitedWizardSteps={basics:!0,wishlists:!1,rsvp:!1,invites:!1},this.wizardSteps=[{id:"basics",label:"Details",title:"Set up your event",icon:"sparkles-outline"},{id:"wishlists",label:"Wishlists",title:"Link your wishlists",icon:"gift-outline"},{id:"rsvp",label:"RSVP",title:"RSVP, capacity & questions",icon:"checkmark-circle-outline"},{id:"invites",label:"Invites",title:"Invite your people",icon:"people-outline"}],this.formatOptions=[{id:x.n.InPerson,label:"In person",icon:"location-outline"},{id:x.n.Online,label:"Online",icon:"videocam-outline"},{id:x.n.Hybrid,label:"Hybrid",icon:"globe-outline"}],this.visibilityOptions=Ie.j3,this.dressCodeOptions=[{id:D.w.NotApplicable,label:"No Dress Code",icon:"ban-outline"},{id:D.w.Casual,label:"Casual",description:"Everyday, comfortable clothing. Jeans and sneakers are fine.",icon:"shirt-outline"},{id:D.w.SmartCasual,label:"Smart Casual",description:"Neat and put-together, but relaxed. Think collared shirts \u2014 no need for a suit.",icon:"business-outline"},{id:D.w.Cocktail,label:"Cocktail",description:"Semi-formal. Suit or cocktail dress \u2014 dressier than smart casual, short of a tuxedo or gown.",icon:"wine-outline"},{id:D.w.Formal,label:"Formal",description:"Black tie. Tuxedo or dark suit, floor-length or formal dress.",icon:"ribbon-outline"},{id:D.w.Other,label:"Other",description:"Specify",icon:"create-outline"}],this.EventFormatTypeId=x.n,this.EventVisibilityTypeId=we.w,this.EventDressCodeTypeId=D.w,this.minSelectableEventDateTime=L.fn(),this.isPublishing=!1,this.initialLocationLat=null,this.initialLocationLng=null,this.initialLocationLabel="",this.wizardNav=new Do(this.wizardSteps),this.formCore=new et(this.formBuilder),this.coverPhotoState=new tt(this.knownMediaService,this.mediaAssetService,this.batchMediaUploadService,this.eventMediaService,this.commonPageService,this.logger)}ngOnInit(){var t=this;return(0,u.A)(function*(){try{t.currentUserId=yield t.tokenService.getUserId()}catch(n){t.logger.LogError(n,"Failed to get current user id for event creation page")}yield t.coverPhotoState.loadKnownMedia()})()}ngOnDestroy(){this.formCore.destroy(),this.coverPhotoState.cancelUpload()}dismiss(){var t=this;return(0,u.A)(function*(){yield t.nav.navigateBack("/app/events")})()}onWishlistSelectionChanged(t){this.selectedWishlistIds=t}onInvitedUserIdsChanged(t){this.selectedInviteUserIds=t}onLocationPicked(){}onAllowGroupGiftsChange(t){this.allowGroupGifts=t}onAllowUsersToUploadPhotosChange(t){this.allowUsersToUploadPhotos=t}handleHeaderAction(){var t=this;return(0,u.A)(function*(){"rsvp-questions"===t.currentView&&t.questionBuilder?.canStepBack?t.questionBuilder.stepBack():t.viewStack.length>1?t.popView():yield t.dismiss()})()}openCoverPicker(){var t=this;return(0,u.A)(function*(){const n=yield t.modalController.create({component:Re.d,componentProps:{knownMediaCategories:t.coverPhotoState.knownMediaCategories,selectedMediaId:t.coverPhotoState.selectedCoverMediaId,activeCategoryId:t.coverPhotoState.activeCategoryId,selectedMediaDisplayName:"",selectedMediaPreviewUrl:t.coverPhotoState.selectedCoverPreviewUrl,isKnownMediaLoading:t.coverPhotoState.isKnownMediaLoading,hasKnownMediaError:t.coverPhotoState.hasKnownMediaError,maxImages:10,initialUploadedPhotos:t.coverPhotoState.selectedPhotos},cssClass:"popup-modal-lg"});yield n.present();const{data:o,role:s}=yield n.onDidDismiss();"confirm"===s&&o&&(yield t.coverPhotoState.applyCoverPickerResult(o,!1))})()}onRequestWishlistArtwork(t){var n=this;return(0,u.A)(function*(){const o=yield n.modalController.create({component:Re.d,componentProps:{knownMediaCategories:t.knownMediaCategories,selectedMediaId:t.selectedMediaId,activeCategoryId:t.activeCategoryId,selectedMediaDisplayName:t.
1selectedMediaDisplayName,selectedMediaPreviewUrl:t.selectedMediaPreviewUrl,isKnownMediaLoading:t.isKnownMediaLoading,hasKnownMediaError:t.hasKnownMediaError},cssClass:"popup-modal-lg"});yield o.present();const{data:s,role:d}=yield o.onDidDismiss();"confirm"===d&&s&&(yield n.wishlistsStep?.applyArtworkResult(s))})()}onRequestLocationPicker(){var t=this;return(0,u.A)(function*(){const n=t.eventForm.get("locationLat")?.value,o=t.eventForm.get("locationLng")?.value,s=yield t.modalController.create({component:Qe.g,componentProps:{formatOptions:t.formatOptions,initialFormatTypeId:t.eventForm.get("eventFormatTypeId")?.value??x.n.InPerson,initialLocationName:t.eventForm.get("locationName")?.value??"",initialLocationLat:n?parseFloat(n):null,initialLocationLng:o?parseFloat(o):null,initialOnlineUrl:t.eventForm.get("onlineUrl")?.value??""},cssClass:"popup-modal location-modal"});yield s.present();const{data:d,role:p}=yield s.onDidDismiss();"confirm"===p&&d&&t.basicsStep?.applyLocationResult(d)})()}onRequestQuestionBuilder(){this.pushView("rsvp-questions")}onQuestionBuilderCompleted(){var t=this;return(0,u.A)(function*(){t.popView(),yield t.rsvpStep?.refreshQuestionSummary()})()}onSubViewCancelled(){this.popView()}onQuestionBuilderViewChanged(t){"rsvp-questions"===this.currentView&&(this.headerTitle=t)}pushView(t){this.viewStack=[...this.viewStack,t],this.refreshHeaderForCurrentView()}popView(){this.viewStack.length<=1||(this.viewStack=this.viewStack.slice(0,-1),this.refreshHeaderForCurrentView())}refreshHeaderForCurrentView(){if(this.currentView=this.viewStack[this.viewStack.length-1],this.isSubViewActive=this.viewStack.length>1,!this.isSubViewActive)return this.headerTitle="Create Event",this.headerActionIcon="chevron-back",void(this.headerActionLabel="Back");this.headerActionIcon="chevron-back",this.headerActionLabel="Back",this.headerTitle="Guest questions"}handleWizardPrimaryAction(){var t=this;return(0,u.A)(function*(){t.isLastWizardStep?yield t.publishNewEvent():t.nextWizardStep()})()}nextWizardStep(){const t=this.currentWizardStep.id;this.validateWizardStep(t)&&("basics"===t?this.enqueueDraftCreate():"wishlists"===t&&this.enqueueWishlistAssignments(),this.wizardNav.next(),this.markCurrentWizardStepVisited())}previousWizardStep(){this.wizardNav.previous(),this.markCurrentWizardStepVisited()}goToWizardStep(t){this.wizardNav.goTo(t,n=>this.validateWizardStep(n)),this.markCurrentWizardStepVisited()}markCurrentWizardStepVisited(){this.visitedWizardSteps[this.currentWizardStep.id]=!0}trackWizardStep(t,n){return n.id}enqueueDraftCreate(){var t=this;this.draftEventId||this.draftCreatePromise||(this.draftCreatePromise=(0,u.A)(function*(){try{const n=t.buildPayload(ee.h.Draft),o=yield t.eventService.InsUpdEvent(n);return t.draftEventId=o.eventId??null,t.logger.LogInfo("Draft event pre-created",{eventId:o.eventId}),o.eventId??null}catch(n){return t.logger.LogError(n,"Failed to pre-create draft event"),t.draftCreatePromise=null,null}})())}enqueueWishlistAssignments(){var t=this;this.wishlistAssignPromise=(0,u.A)(function*(){const n=yield t.ensureDraftEventId();n&&(yield t.assignPendingWishlists(n))})()}ensureDraftEventId(){var t=this;return(0,u.A)(function*(){return t.draftEventId?t.draftEventId:(t.draftCreatePromise||t.enqueueDraftCreate(),t.draftCreatePromise?yield t.draftCreatePromise:null)})()}assignPendingWishlists(t){var n=this;return(0,u.A)(function*(){yield n.applyPrivateWishlistFixes();const o=new Set(n.selectedWishlistIds);for(const s of o)if(!n.assignedWishlistIds.has(s))try{const d=yield n.eventWishlistService.AssignWishlist({eventId:t,wishlistId:s});n.assignedWishlistIds.set(s,d.eventWishlistId)}catch(d){n.logger.LogError(d,"Failed to assign wishlist to draft event")}for(const[s,d]of Array.from(n.assignedWishlistIds.entries()))if(!o.has(s))try{yield n.eventWishlistService.UnassignWishlist(d),n.assignedWishlistIds.delete(s)}catch(p){n.logger.LogError(p,"Failed to unassign wishlist from draft event")}})()}sendStagedInvites(t){var n=this;return(0,u.A)(function*(){if(0!==n.selectedInviteUserIds.length)try{const o=yield n.eventUserService.InviteRegisteredUsers({eventId:t,invitedUserIds:n.selectedInviteUserIds});n.logger.LogInfo("Staged guest invites sent",{eventId:t,invitedCount:o.invited?.length??0,failedCount:o.failed?.length??0})}catch(o){n.logger.LogError(o,"Failed to send staged invites")}})()}
1publishNewEvent(){var t=this;return(0,u.A)(function*(){if(!t.isBusy)try{t.isBusy=!0,t.isPublishing=!0;const n=yield t.ensureDraftEventId();if(!n)throw new Error("Failed to create event");t.wishlistAssignPromise&&(yield t.wishlistAssignPromise),yield t.assignPendingWishlists(n),yield t.sendStagedInvites(n),yield t.coverPhotoState.linkUploadedPhotos(n);const o=t.buildPayload(ee.h.Published);o.eventId=n;const s=yield t.eventService.InsUpdEvent(o);t.logger.LogInfo("Event published",{eventId:s.eventId}),yield t.nav.navigateForward(`/app/events/${s.eventId||n}`,{replaceUrl:!0})}catch(n){t.logger.LogError(n,"Failed to publish event"),yield t.commonPageService.handleError(n,"Failed to create event")}finally{t.isBusy=!1,t.isPublishing=!1}})()}buildPayload(t){return L.nI(this.eventForm,{isEditMode:!1,eventId:"",draftEventId:this.draftEventId,existingEvent:null,currentUserId:this.currentUserId,selectedCoverMediaId:this.coverPhotoState.selectedCoverMediaId,showOnlineUrl:this.showOnlineUrl,showLocation:this.showLocation,showRsvpOptions:this.showRsvpOptions,allowGroupGifts:this.allowGroupGifts,allowUsersToUploadPhotos:this.allowUsersToUploadPhotos},t)}getStepIssues(t){return L.b3(this.eventForm,t)}getStepControlNames(t){return L.yb(this.eventForm,t)}validateWizardStep(t){const n=this.getStepControlNames(t);for(const d of n)this.eventForm.get(d)?.markAsTouched();const o=n.some(d=>this.eventForm.get(d)?.invalid),s=this.getStepIssues(t).length>0;return!o&&!s}applyPrivateWishlistFixes(){var t=this;return(0,u.A)(function*(){for(const n of t.wishlistSteps?.toArray()??[])yield n.applyPrivateWishlistFixes()})()}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(f.ok),e.rXU(se.q9),e.rXU(g.W3),e.rXU(O.g),e.rXU(H.o),e.rXU(Se.B),e.rXU(S.v),e.rXU(F.S),e.rXU(xe.e),e.rXU(fe),e.rXU(Le.U),e.rXU(Pe.r),e.rXU(nt))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-event-create"]],viewQuery:function(n,o){if(1&n&&(e.GBs(Fe,5),e.GBs(_e.B,5),e.GBs(ir,5),e.GBs(Me.u,5),e.GBs(_e.B,5)),2&n){let s;e.mGM(s=e.lsd())&&(o.basicsStep=s.first),e.mGM(s=e.lsd())&&(o.wishlistsStep=s.first),e.mGM(s=e.lsd())&&(o.rsvpStep=s.first),e.mGM(s=e.lsd())&&(o.questionBuilder=s.first),e.mGM(s=e.lsd())&&(o.wishlistSteps=s)}},standalone:!1,decls:22,vars:16,consts:[["rsvpStep",""],["slot","start"],["color","primary",3,"click","disabled"],["slot","icon-only",3,"name"],[1,"page-title-stack"],[1,"page-title"],["class","page-subtitle",4,"ngIf"],["class","header-wizard-progress",4,"ngIf"],[1,"creation-page-content"],[1,"creation-page-body"],["class","publish-overlay",4,"ngIf"],[3,"formGroup","hidden"],[4,"ngIf"],[1,"wizard-card","creation-page-card"],["class","wizard-step-panel",3,"hidden",4,"ngIf"],[1,"page-subtitle"],[1,"header-wizard-progress"],[3,"value",4,"ngFor","ngForOf","ngForTrackBy"],[3,"value"],[1,"publish-overlay"],[1,"publish-card"],[1,"publish-head"],[1,"event-create-publish-skeleton",3,"animated"],["role","button","tabindex","0","aria-label","Pick artwork",1,"cover-hero",3,"click","keydown.enter"],["alt","Event cover","class","cover-hero__img",3,"src",4,"ngIf"],["class","cover-hero__placeholder",4,"ngIf"],["fill","solid","aria-label","Open artwork picker",1,"cover-hero__camera",3,"click"],["name","camera"],["layout","grid",3,"tiles","retryItem","removeItem",4,"ngIf"],["alt","Event cover",1,"cover-hero__img",3,"src"],[1,"cover-hero__placeholder"],[1,"cover-hero__placeholder-icon"],["name","image-outline"],["layout","grid",3,"retryItem","removeItem","tiles"],[1,"wizard-step-panel",3,"hidden"],[3,"locationPicked","requestLocationPicker","form","visibilityOptions","formatOptions","dressCodeOptions","showOnlineUrl","showLocation","minSelectableEventDateTime","minEndDT","initialLocationLat","initialLocationLng","initialLocationLabel"],[1,"settings"],[1,"setrow","setrow--toggle"],[1,"setrow__ic"],["name","gift-outline"],[1,"setrow__l"],[1,"setrow__sub"],[3,"ionChange","checked"],["name","camera-outline"],[3,"wishlistSelectionChanged","requestArtworkPicker","eventId","initialSelectedWishlistIds"],["layout","rsvp",3,"requestQuestionBuilder","form","eventId","maxRsvpDT","minSelectableEventDateTime"],["layout","invites",3,"invitedUserIdsChanged","form","initialSelectedUserIds"],[3,"hosted","eventId","completed","viewChanged",4,"ngIf"],[3,"completed","viewChanged","hosted","eventId"],[1,"footer-row"],["expand","block","fill","solid","type","button",1,"footer-button","footer-button--secondary",3,"click","disabled"],["expand","block","fill","solid","color","primary","type","button",1,"footer-button",3,"click","disabled"],["slot","start","class","event-create-button-skeleton",3,"animated",4,"ngIf"],["name","arrow-forward-outline","slot","end",4,"ngIf"],["slot","start",1,"event-create-button-skeleton",3,"animated"],["name","arrow-forward-outline","slot","end"]],template:function(n,o){1&n&&(e.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons",1)(3,"ion-button",2),e.bIt("click",function(){return o.handleHeaderAction()}),e.nrm(4,"ion-icon",3),e.k0s()(),e.j41(5,"div",4)(6,"div",5),e.EFF(7),e.k0s(),e.DNE(8,or,2,3,"div",6),e.k0s()(),e.DNE(9,ar,2,2,"div",7),e.k0s(),e.j41(10,"ion-content",8)(11,"div",9),e.DNE(12,sr,8,1,"div",10),e.j41(13,"form",11),e.DNE(14,pr,7,3,"ng-container",12),e.j41(15,"section",13),e.DNE(16,ur,19,14,"div",14)(17,gr,2,3,"div",14)(18,_r,3,5,"div",14)(19,hr,2,3,"div",14),e.k0s()(),e.DNE(20,vr,2,1,"ng-container",12),e.k0s()(),e.DNE(21,Ir,11,6,"ion-footer",12)),2&n&&(e.R7$(3),e.Y8G("disabled",o.isBusy),e.BMQ("aria-label",o.headerActionLabel),e.R7$(),e.Y8G("name",o.headerActionIcon),e.R7$(3),e.JRh(o.headerTitle),e.R7$(),e.Y8G("ngIf",!o.isSubViewActive),e.R7$(),e.Y8G("ngIf",!o.isSubViewActive),e.R7$(3),e.Y8G("ngIf",o.isPublishing),e.R7$(),e.Y8G("formGroup",o.eventForm)("hidden",o.isSubViewActive),e.R7$(),e.Y8G("ngIf","basics"===o.currentWizardStep.id),e.R7$(2),e.Y8G("ngIf",o.visitedWizardSteps.basics),e.R7$(),e.Y8G("ngIf",o.visitedWizardSteps.wishlists),e.R7$(),e.Y8G("ngIf",o.visitedWizardSteps.rsvp),e.R7$(),e.Y8G("ngIf",o.visitedWizardSteps.invites),e.R7$(),e.Y8G("ngIf",o.isSubViewActive),e.R7$(),e.Y8G("ngIf",!o.isSubViewActive))},dependencies:[l.Sq,l.bT,f.qT,f.cb,f.j4,g.Jm,g.QW,g.hU,g.W9,g.M0,g.eU,g.iq,g.FH,g.ln,g.ds,g.BY,g.ai,g.hB,it,_e.B,Me.u,Fe,Oe],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%}.event-create-publish-skeleton[_ngcontent-%COMP%]{width:160px;height:20px;border-radius:var(--radius-pill);margin:0 auto 6px}.event-create-button-skeleton[_ngcontent-%COMP%]{width:20px;height:16px;border-radius:var(--radius-sm)}"]}))}return r(),a})();var be=h(8317),Ne=h(5237);class Er{constructor(a,i,t,n,o){this.reportedMediaService=a,this.eventUserService=i,this.eventUserAccessService=t,this.mediaAssetService=n,this.logger=o,this.guestRows=[],this.filteredGuestRows=[],this.guestTotalCount=0,this.isGuestSummaryLoading=!1,this.guestRowsFullyLoaded=!1,this.busyGuestUserIds=new Set,this.isCurrentUserOrganizer=!1,this.eventUserAccessByUserId=new Map,this.noGuestFilter=0,this.guestSummaryPageSize=5,this.guestSectionPageSize=50}setOrganizerFallback(a,i){this.isCurrentUserOrganizer=!!a&&i===a}loadEditGuestSummary(a,i,t,n){var o=this;return(0,u.A)(function*(){if(i&&a&&!o.isGuestSummaryLoading)try{o.isGuestSummaryLoading=!0;const s=yield o.eventUserService.GetEventUsers(a,o.noGuestFilter,o.noGuestFilter,1,o.guestSummaryPageSize);o.guestRows=(s?.items??[]).map(p=>o.toGuestRow(p,t)),o.recomputeOrganizerFlagFromGuestRows(t),o.syncFilteredGuestRows(n),o.guestTotalCount=s?.totalCount??o.guestRows.length,o.guestRowsFullyLoaded=o.guestRows.length>=o.guestTotalCount}catch(s){o.logger.LogError(s,"Failed to load event edit guest summary"),o.guestRows=[],o.filteredGuestRows=[],o.guestTotalCount=0}finally{o.isGuestSummaryLoading=!1}})()}loadFullEditGuestList(a,i,t,n){var o=this;return(0,u.A)(function*(){if(i&&a&&!o.isGuestSummaryLoading)try{o.isGuestSummaryLoading=!0;const s=[];let d=1,p=0,_=!0;for(;_;){const v=yield o.eventUserService.GetEventUsers(a,o.noGuestFilter,o.noGuestFilter,d,o.guestSectionPageSize),y=v?.items??[];s.push(...y.map(I=>o.toGuestRow(I,t))),p=v?.totalCount??s.length,y.length<o.guestSectionPageSize||s.length>=p?_=!1:d+=1}o.guestRows=s,o.recomputeOrganizerFlagFromGuestRows(t),o.syncFilteredGuestRows(n),o.guestTotalCount=p,o.guestRowsFullyLoaded=!0}catch(s){o.logger.LogError(s,"Failed to load full event edit guest list")}finally{o.isGuestSummaryLoading=!1}})()}syncFilteredGuestRows(a){const i=a.trim().toLocaleLowerCase();this.filteredGuestRows=i?this.guestRows.filter(t=>t.displayName.toLocaleLowerCase().includes(i)):[...this.guestRows]}loadEventUserAccess(a){var i=this;return(0,u.A)(function*(){if(a)try{const t=yield i.eventUserAccessService.GetEventUserAccessByEventId(a);i.eventUserAccessByUserId=new Map((t??[]).filter(n=>!1!==n.isActive&&!!n.userId).map(n=>[n.userId,{eventAccessId:n.eventAccessId,eventUserAccessId:n.eventUserAccessId}]))}catch(t){i.logger.LogError(t,"Failed to load event user access grants"),i.eventUserAccessByUserId=new Map}})()}toGuestRow(a,i){const t=a.user?.nickName||a.user?.userName||"Guest",n=this.getGuestPhotoUrl(a),o=a.userId===i,s=a.eventUserStatusId===$e.t.Organizer,d=this.eventUserAccessByUserId.get(a.userId)?.eventAccessId??null;return{eventUserId:a.eventUserId,userId:a.userId,displayName:t,photoUrl:n,initials:L.IM(t),roleLabel:L.PT(a),rsvpLabel:a.eventRsvpStatus?.eventRsvpStatusName||"",isCurrentUser:o,isOwnerRow:s,eventAccessId:d,accessRoleLabel:d===be.a.Manager?"Admin":"Invited",canEditRole:!s&&!o&&this.canManageGuestAccess(i)}}getGuestPhotoUrl(a){return this.reportedMediaService.isReported(a.userMedia?.mediaId)?"":this.mediaAssetService.getMediaUrl(a.userMedia)??""}canManageGuestAccess(a){return!!this.isCurrentUserOrganizer||this.eventUserAccessByUserId.get(a)?.eventAccessId===be.a.Manager}recomputeOrganizerFlagFromGuestRows(a){const i=this.guestRows.find(t=>t.isCurrentUser);
1i&&(this.isCurrentUserOrganizer=i.isOwnerRow),this.guestRows=this.guestRows.map(t=>({...t,canEditRole:!t.isOwnerRow&&!t.isCurrentUser&&this.canManageGuestAccess(a)}))}applyGuestAccessChange(a,i,t){var n=this;return(0,u.A)(function*(){const o=a.eventAccessId,s=a.accessRoleLabel,d=n.eventUserAccessByUserId.get(a.userId);a.eventAccessId=t,a.accessRoleLabel=t===be.a.Manager?"Admin":"Invited";try{n.busyGuestUserIds.add(a.userId);const p={eventUserAccessId:d?.eventUserAccessId,eventId:i,userId:a.userId,eventAccessId:t,isActive:!0,totalRows:0},_=yield n.eventUserAccessService.InsUpdEventUserAccess(p);n.eventUserAccessByUserId.set(a.userId,{eventAccessId:t,eventUserAccessId:_?.eventUserAccessId??d?.eventUserAccessId}),n.logger.LogInfo("Guest access updated",{eventId:i,userId:a.userId,eventAccessId:t})}catch(p){a.eventAccessId=o,a.accessRoleLabel=s,n.logger.LogError(p,"Failed to update guest access")}finally{n.busyGuestUserIds.delete(a.userId)}})()}markGuestListStale(){this.guestRowsFullyLoaded=!1}}let kr=(()=>{var r;class a{constructor(t){this.baseService=t,this.version="1"}GetEventUserAccessByEventId(t,n){var o=this;return(0,u.A)(function*(){const s=`${o.baseService.apiUrl}/api/v${encodeURIComponent(o.version)}/EventUserAccess/event/${encodeURIComponent(t)}`;return yield o.baseService.httpGet(s,n)})()}InsUpdEventUserAccess(t,n){var o=this;return(0,u.A)(function*(){const s=`${o.baseService.apiUrl}/api/v${encodeURIComponent(o.version)}/EventUserAccess`;return yield o.baseService.httpPost(s,t,n)})()}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(c.KVO(Xe.F))},this.\u0275prov=c.jDH({token:a,factory:a.\u0275fac,providedIn:"root"}))}return r(),a})();const Cr=()=>({standalone:!0}),Gr=()=>[1,2,3];function wr(r,a){1&r&&(e.qex(0),e.j41(1,"div",8),e.nrm(2,"ion-skeleton-text",9),e.k0s(),e.bVm()),2&r&&(e.R7$(2),e.Y8G("animated",!0))}function Pr(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",10)(1,"app-page-load-error",11),e.bIt("retry",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.retryLoad())}),e.k0s()()}}function Sr(r,a){if(1&r&&e.nrm(0,"img",31),2&r){const i=e.XpG(3);e.Y8G("src",i.coverPhotoState.selectedCoverPreviewUrl,e.B4B)}}function xr(r,a){1&r&&(e.j41(0,"div",32),e.nrm(1,"ion-icon",33),e.k0s())}function Rr(r,a){if(1&r){const i=e.RV6();e.j41(0,"media-upload-grid",34),e.bIt("retryItem",function(n){c.eBV(i);const o=e.XpG(3);return c.Njj(o.coverPhotoState.retryUploadPhoto(n))})("removeItem",function(n){c.eBV(i);const o=e.XpG(3);return c.Njj(o.coverPhotoState.removeUploadPhoto(n))}),e.k0s()}if(2&r){const i=e.XpG(3);e.Y8G("tiles",i.coverPhotoState.carouselUploadTiles)}}function Fr(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",35)(1,"div",36)(2,"div",37),e.nrm(3,"ion-icon",38),e.k0s(),e.j41(4,"span",39),e.EFF(5," Allow group gifts "),e.j41(6,"span",40),e.EFF(7,"Let guests start group gifts for this event."),e.k0s()(),e.j41(8,"ion-toggle",41),e.bIt("ionChange",function(n){c.eBV(i);const o=e.XpG(3);return c.Njj(o.onAllowGroupGiftsChange(n.detail.checked))}),e.k0s()(),e.j41(9,"div",36)(10,"div",37),e.nrm(11,"ion-icon",42),e.k0s(),e.j41(12,"span",39),e.EFF(13," Allow guest photo uploads "),e.j41(14,"span",40),e.EFF(15,"Let guests add their own photos to this event."),e.k0s()(),e.j41(16,"ion-toggle",41),e.bIt("ionChange",function(n){c.eBV(i);const o=e.XpG(3);return c.Njj(o.onAllowUsersToUploadPhotosChange(n.detail.checked))}),e.k0s()()()}if(2&r){const i=e.XpG(3);e.R7$(8),e.Y8G("checked",i.allowGroupGifts),e.R7$(8),e.Y8G("checked",i.allowUsersToUploadPhotos)}}function Mr(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",43)(1,"ion-button",44),e.bIt("click",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.deleteEvent())}),e.nrm(2,"ion-icon",45),e.EFF(3," Delete event "),e.k0s()()}if(2&r){const i=e.XpG(3);e.R7$(),e.Y8G("disabled",i.isBusy)}}function Tr(r,a){if(1&r){const i=e.RV6();e.j41(0,"section",20)(1,"div",21),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openCoverPicker())})("keydown.enter",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openCoverPicker())}),e.DNE(2,Sr,1,1,"img",22)(3,xr,2,0,"div",23),e.nrm(4,"div",24),e.j41(5,"ion-button",25),e.bIt("click",function(n){c.eBV(i);const o=e.XpG(2);return n.stopPropagation(),c.Njj(o.openCoverPicker())}),e.nrm(6,"ion-icon",26),e.k0s()(),e.DNE(7,Rr,1,1,"media-upload-grid",27),e.j41(8,"app-event-wizard-basics",28),e.bIt("locationPicked",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.onLocationPicked())})("requestLocationPicker",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.onRequestLocationPicker())}),e.k0s(),e.DNE(9,Fr,17,2,"div",29)(10,Mr,4,1,"div",30),e.k0s()}if(2&r){const i=e.XpG(2);e.Y8G("hidden","details"!==i.activeEditSection),e.R7$(2),e.Y8G("ngIf",i.coverPhotoState.selectedCoverPreviewUrl),e.R7$(),e.Y8G("ngIf",!i.coverPhotoState.selectedCoverPreviewUrl),e.R7$(4),e.Y8G("ngIf",i.coverPhotoState.carouselUploadTiles.length>0),e.R7$(),e.Y8G("form",i.eventForm)("visibilityOptions",i.visibilityOptions)("formatOptions",i.formatOptions)("dressCodeOptions",i.dressCodeOptions)("showOnlineUrl",i.showOnlineUrl)("showLocation",i.showLocation)("minSelectableEventDateTime",i.minSelectableEventDateTime)("minEndDT",i.minEndDT)("initialLocationLat",i.initialLocationLat)("initialLocationLng",i.initialLocationLng)("initialLocationLabel",i.initialLocationLabel),e.R7$(),e.Y8G("ngIf",i.isCurrentUserOrganizer),e.R7$(),e.Y8G("ngIf",i.isCurrentUserOrganizer)}}function Dr(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-searchbar",56),e.mxI("ngModelChange",function(n){c.eBV(i);const o=e.XpG(3);return e.DH7(o.guestSearchTerm,n)||(o.guestSearchTerm=n),c.Njj(n)}),e.bIt("ionInput",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.onGuestSearchChange())}),e.k0s()}if(2&r){const i=e.XpG(3);e.R50("ngModel",i.guestSearchTerm),e.Y8G("ngModelOptions",e.lJ4(2,Cr))}}function Ur(r,a){1&r&&(e.j41(0,"div",59),e.nrm(1,"ion-skeleton-text",60),e.j41(2,"div",61),e.nrm(3,"ion-skeleton-text",62),e.k0s()()),2&r&&(e.R7$(),e.Y8G("animated",!0),e.R7$(2),e.Y8G("animated",!0))}function Ar(r,a){1&r&&(e.j41(0,"div",57),e.DNE(1,Ur,4,2,"div",58),e.k0s()),2&r&&(e.R7$(),e.Y8G("ngForOf",e.lJ4(1,Gr)))}function jr(r,a){if(1&r&&e.nrm(0,"img",71),2&r){const i=e.XpG().$implicit;e.Y8G("src",i.photoUrl,e.B4B)("alt",i.displayName)}}function $r(r,a){if(1&r&&(e.j41(0,"span"),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.initials)}}function Br(r,a){1&r&&(e.j41(0,"span",72),e.EFF(1,"You"),e.k0s())}function Lr(r,a){if(1&r&&(e.j41(0,"span",73),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.rsvpLabel)}}function Or(r,a){if(1&r&&(e.j41(0,"span",74),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.roleLabel)}}function Nr(r,a){1&r&&e.nrm(0,"ion-skeleton-text",77),2&r&&e.Y8G("animated",!0)}function Yr(r,a){if(1&r&&(e.qex(0),e.EFF(1),e.nrm(2,"ion-icon",78),e.bVm()),2&r){const i=e.XpG(2).$implicit;e.R7$(),e.SpI(" ",i.accessRoleLabel," ")}}function Vr(r,a){if(1&r){const i=e.RV6();e.j41(0,"button",75),e.bIt("click",function(n){c.eBV(i);const o=e.XpG().$implicit,s=e.XpG(4);return c.Njj(s.onGuestRoleChipClick(o,n))}),e.DNE(1,Nr,1,1,"ion-skeleton-text",76)(2,Yr,3,1,"ng-container",5),e.k0s()}if(2&r){const i=e.XpG().$implicit,t=e.XpG(4);e.AVh("role-pill--active",i.eventAccessId===t.EventAccessId.Manager),e.Y8G("disabled",t.busyGuestUserIds.has(i.userId)),e.R7$(),e.Y8G("ngIf",t.busyGuestUserIds.has(i.userId)),e.R7$(),e.Y8G("ngIf",!t.busyGuestUserIds.has(i.userId))}}function Xr(r,a){if(1&r&&(e.j41(0,"span",74),e.EFF(1),e.k0s()),2&r){const i=e.XpG().$implicit;e.R7$(),e.JRh(i.accessRoleLabel)}}function Wr(r,a){if(1&r&&(e.j41(0,"div",59)(1,"div",64),e.DNE(2,jr,1,2,"img",65)(3,$r,2,1,"span",5),e.k0s(),e.j41(4,"div",61)(5,"span",66),e.EFF(6),e.DNE(7,Br,2,0,"span",67),e.k0s(),e.DNE(8,Lr,2,1,"span",68),e.k0s(),e.DNE(9,Or,2,1,"span",69)(10,Vr,3,5,"button",70)(11,Xr,2,1,"span",69),e.k0s()),2&r){const i=a.$implicit;e.R7$(2),e.Y8G("ngIf",i.photoUrl),e.R7$(),e.Y8G("ngIf",!i.photoUrl),e.R7$(3),e.SpI(" ",i.displayName," "),e.R7$(),e.Y8G("ngIf",i.isCurrentUser),e.R7$(),e.Y8G("ngIf",i.rsvpLabel),e.R7$(),e.Y8G("ngIf",i.isOwnerRow),e.R7$(),e.Y8G("ngIf",!i.isOwnerRow&&i.canEditRole),e.R7$(),e.Y8G("ngIf",!i.isOwnerRow&&!i.canEditRole)}}function zr(r,a){if(1&r&&(e.j41(0,"div",57),e.DNE(1,Wr,12,8,"div",63),e.k0s()),2&r){const i=e.XpG(3);e.R7$(),e.Y8G("ngForOf",i.filteredGuestRows)("ngForTrackBy",i.trackGuestRow)}}function Hr(r,a){if(1&r){const i=e.RV6();e.j41(0,"div",79)(1,"div",80),e.nrm(2,"ion-icon",81),e.k0s(),e.j41(3,"div",82),e.EFF(4,"No one invited yet"),e.k0s(),e.j41(5,"p",83),e.EFF(6,"Invite your friends on Spoyla here, or skip this
1step \u2014 you can always invite more people later."),e.k0s(),e.j41(7,"ion-button",84),e.bIt("click",function(){c.eBV(i);const n=e.XpG(3);return c.Njj(n.openSendInvite())}),e.nrm(8,"ion-icon",85),e.EFF(9," Invite friends "),e.k0s()()}if(2&r){const i=e.XpG(3);e.R7$(7),e.Y8G("disabled",i.isBusy)}}function qr(r,a){1&r&&(e.j41(0,"div",86),e.EFF(1," No guests match your search. "),e.k0s())}function Kr(r,a){if(1&r){const i=e.RV6();e.j41(0,"section",20)(1,"app-event-wizard-people",46),e.bIt("requestQuestionBuilder",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.onRequestQuestionBuilder())}),e.k0s(),e.j41(2,"div",47)(3,"span",48),e.EFF(4,"Guests "),e.j41(5,"span",49),e.EFF(6),e.k0s()(),e.j41(7,"button",50),e.bIt("click",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.openSendInvite())}),e.nrm(8,"ion-icon",51),e.EFF(9," Invite "),e.k0s()(),e.DNE(10,Dr,1,3,"ion-searchbar",52)(11,Ar,2,2,"div",53)(12,zr,2,2,"div",53)(13,Hr,10,1,"div",54)(14,qr,2,0,"div",55),e.k0s()}if(2&r){const i=e.XpG(2);e.Y8G("hidden","guests"!==i.activeEditSection),e.R7$(),e.Y8G("form",i.eventForm)("eventId",i.eventId)("maxRsvpDT",i.maxRsvpDT)("minSelectableEventDateTime",i.minSelectableEventDateTime),e.R7$(5),e.SpI("\xb7 ",i.guestTotalCount),e.R7$(),e.Y8G("disabled",i.isBusy),e.R7$(3),e.Y8G("ngIf",!i.isGuestSummaryLoading&&i.guestRows.length>0),e.R7$(),e.Y8G("ngIf",i.isGuestSummaryLoading),e.R7$(),e.Y8G("ngIf",!i.isGuestSummaryLoading&&i.filteredGuestRows.length>0),e.R7$(),e.Y8G("ngIf",!i.isGuestSummaryLoading&&0===i.guestRows.length),e.R7$(),e.Y8G("ngIf",!i.isGuestSummaryLoading&&i.guestRows.length>0&&0===i.filteredGuestRows.length)}}function Jr(r,a){if(1&r){const i=e.RV6();e.j41(0,"section",20)(1,"app-wishlist-link-picker",87),e.bIt("wishlistSelectionChanged",function(n){c.eBV(i);const o=e.XpG(2);return c.Njj(o.onWishlistSelectionChanged(n))})("requestArtworkPicker",function(n){c.eBV(i);const o=e.XpG(2);return c.Njj(o.onRequestWishlistArtwork(n))}),e.k0s()()}if(2&r){const i=e.XpG(2);e.Y8G("hidden","wishlists"!==i.activeEditSection),e.R7$(),e.Y8G("eventId",i.eventId)("initialSelectedWishlistIds",i.selectedWishlistIds)}}function Qr(r,a){if(1&r){const i=e.RV6();e.j41(0,"form",12)(1,"div",13)(2,"nav",14)(3,"ion-segment",15),e.bIt("ionChange",function(n){c.eBV(i);const o=e.XpG();return c.Njj(o.onEditSectionChange(n.detail.value))}),e.j41(4,"ion-segment-button",16)(5,"ion-label"),e.EFF(6,"Details"),e.k0s()(),e.j41(7,"ion-segment-button",17)(8,"ion-label"),e.EFF(9,"Guests"),e.k0s()(),e.j41(10,"ion-segment-button",18)(11,"ion-label"),e.EFF(12,"Wishlists"),e.k0s()()()(),e.DNE(13,Tr,11,17,"section",19)(14,Kr,15,12,"section",19)(15,Jr,2,3,"section",19),e.k0s()()}if(2&r){const i=e.XpG();e.Y8G("formGroup",i.eventForm)("hidden",i.isSubViewActive),e.R7$(3),e.Y8G("value",i.activeEditSection),e.R7$(10),e.Y8G("ngIf",i.visitedEditSections.details),e.R7$(),e.Y8G("ngIf",i.visitedEditSections.guests),e.R7$(),e.Y8G("ngIf",i.visitedEditSections.wishlists)}}function Zr(r,a){if(1&r){const i=e.RV6();e.j41(0,"app-event-rsvp-question-builder",89),e.bIt("completed",function(){c.eBV(i);const n=e.XpG(2);return c.Njj(n.onQuestionBuilderCompleted())})("viewChanged",function(n){c.eBV(i);const o=e.XpG(2);return c.Njj(o.onQuestionBuilderViewChanged(n))}),e.k0s()}if(2&r){const i=e.XpG(2);e.Y8G("hosted",!0)("eventId",i.eventId)}}function ea(r,a){if(1&r&&(e.qex(0),e.DNE(1,Zr,1,2,"app-event-rsvp-question-builder",88),e.bVm()),2&r){const i=e.XpG();e.R7$(),e.Y8G("ngIf","rsvp-questions"===i.currentView&&i.eventId)}}function ta(r,a){1&r&&e.nrm(0,"ion-skeleton-text",94),2&r&&e.Y8G("animated",!0)}function na(r,a){if(1&r){const i=e.RV6();e.j41(0,"ion-footer")(1,"ion-toolbar")(2,"div",90)(3,"ion-button",91),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.dismiss())}),e.EFF(4," Cancel "),e.k0s(),e.j41(5,"ion-button",92),e.bIt("click",function(){c.eBV(i);const n=e.XpG();return c.Njj(n.saveEvent())}),e.DNE(6,ta,1,1,"ion-skeleton-text",93),e.EFF(7," Save changes "),e.k0s()()()()}if(2&r){const i=e.XpG();e.R7$(3),e.Y8G("disabled",i.isBusy),e.R7$(2),e.Y8G("disabled",i.eventForm.invalid||i.isBusy),e.R7$(),e.Y8G("ngIf",i.isBusy)}}const ia=[{path:"",component:at},{path:"new",component:br},{path:":eventId/gifts",component:uo},{path:":eventId/edit",component:(()=>{var r;class a{get guestRows(){return this.guestState.guestRows}get filteredGuestRows(){return this.guestState.filteredGuestRows}get guestTotalCount(){return this.guestState.guestTotalCount}get isGuestSummaryLoading(){return this.guestState.isGuestSummaryLoading}get busyGuestUserIds(){return this.guestState.busyGuestUserIds}get isCurrentUserOrganizer(){return this.guestState.canManageGuestAccess(this.currentUserId)}
1get eventForm(){return this.formCore.form}get showOnlineUrl(){const t=this.eventForm?.get("eventFormatTypeId")?.value;return t===x.n.Online||t===x.n.Hybrid}get showLocation(){const t=this.eventForm?.get("eventFormatTypeId")?.value;return t===x.n.InPerson||t===x.n.Hybrid}get showRsvpOptions(){return!0===this.eventForm?.get("rsvpEnabled")?.value}get minEndDT(){return this.eventForm?.get("startDT")?.value??this.minSelectableEventDateTime}get maxRsvpDT(){return this.eventForm?.get("startDT")?.value??null}get isCancelled(){return this.existingEvent?.workflowStatusId===ee.h.Cancelled}constructor(t,n,o,s,d,p,_,v,y,I,E,R,U,G,A,de,ce,he){this.reportedMediaService=t,this.formBuilder=n,this.route=o,this.nav=s,this.modalController=d,this.popoverController=p,this.alertController=_,this.logger=v,this.commonPageService=y,this.tokenService=I,this.eventService=E,this.mediaAssetService=R,this.eventWishlistService=U,this.eventUserService=G,this.eventUserAccessService=A,this.knownMediaService=de,this.eventMediaService=ce,this.batchMediaUploadService=he,this.eventId="",this.viewStack=["edit"],this.currentView="edit",this.headerTitle="Edit Event",this.headerActionIcon="chevron-back",this.headerActionLabel="Back",this.isSubViewActive=!1,this.locationSeed=null,this.activeEditSection="details",this.visitedEditSections={details:!0,wishlists:!1,guests:!1},this.isBusy=!1,this.isLoading=!1,this.hasError=!1,this.currentUserId="",this.existingEvent=null,this.guestSearchTerm="",this.selectedWishlistIds=[],this.originalWishlistAssignments=[],this.allowGroupGifts=!0,this.allowUsersToUploadPhotos=!0,this.formatOptions=[{id:x.n.InPerson,label:"In person",icon:"location-outline"},{id:x.n.Online,label:"Online",icon:"videocam-outline"},{id:x.n.Hybrid,label:"Hybrid",icon:"globe-outline"}],this.visibilityOptions=Ie.j3,this.dressCodeOptions=[{id:D.w.NotApplicable,label:"No Dress Code",icon:"ban-outline"},{id:D.w.Casual,label:"Casual",description:"Everyday, comfortable clothing. Jeans and sneakers are fine.",icon:"shirt-outline"},{id:D.w.SmartCasual,label:"Smart Casual",description:"Neat and put-together, but relaxed. Think collared shirts \u2014 no need for a suit.",icon:"business-outline"},{id:D.w.Cocktail,label:"Cocktail",description:"Semi-formal. Suit or cocktail dress \u2014 dressier than smart casual, short of a tuxedo or gown.",icon:"wine-outline"},{id:D.w.Formal,label:"Formal",description:"Black tie. Tuxedo or dark suit, floor-length or formal dress.",icon:"ribbon-outline"},{id:D.w.Other,label:"Other",description:"Specify",icon:"create-outline"}],this.EventFormatTypeId=x.n,this.EventAccessId=be.a,this.EventVisibilityTypeId=we.w,this.EventDressCodeTypeId=D.w,this.minSelectableEventDateTime=L.fn(),this.initialLocationLat=null,this.initialLocationLng=null,this.initialLocationLabel="",this.guestState=new Er(this.reportedMediaService,this.eventUserService,this.eventUserAccessService,this.mediaAssetService,this.logger),this.formCore=new et(this.formBuilder,!1),this.coverPhotoState=new tt(this.knownMediaService,this.mediaAssetService,this.batchMediaUploadService,this.eventMediaService,this.commonPageService,this.logger)}ngOnInit(){var t=this;return(0,u.A)(function*(){if(t.eventId=t.route.snapshot.paramMap.get("eventId")||"",!t.eventId)return t.hasError=!0,void t.logger.LogWarning("Event edit route missing eventId");try{t.currentUserId=yield t.tokenService.getUserId()}catch(n){t.logger.LogError(n,"Failed to get current user id for event edit page")}yield Promise.all([t.loadEvent(),t.coverPhotoState.loadKnownMedia()])})()}ngOnDestroy(){this.formCore.destroy(),this.coverPhotoState.cancelUpload()}dismiss(){var t=this;return(0,u.A)(function*(){yield t.nav.navigateBack(`/app/events/${t.eventId}`)})()}retryLoad(){this.loadEvent()}openEditSection(t){var n=this;return(0,u.A)(function*(){n.activeEditSection=t,n.visitedEditSections[t]=!0,"guests"===t&&!n.guestState.guestRowsFullyLoaded&&(yield n.guestState.loadFullEditGuestList(n.eventId,!0,n.currentUserId,n.guestSearchTerm))})()}onEditSectionChange(t){!t||t===this.activeEditSection||this.openEditSection(t)}onWishlistSelectionChanged(t){this.selectedWishlistIds=t}onGuestSearchChange(){this.guestState.syncFilteredGuestRows(this.guestSearchTerm)}onAllowGroupGiftsChange(t){this.allowGroupGifts=t}onAllowUsersToUploadPhotosChange(t){this.allowUsersToUploadPhotos=t}onLocationPicked(){}handleHeaderAction(){var t=this;return(0,u.A)(function*(){"rsvp-questions"===t.currentView&&t.questionBuilder?.canStepBack?t.questionBuilder.stepBack():t.viewStack.length>1?t.popView():yield t.dismiss()})()}openCoverPicker(){var t=this;return(0,u.A)(function*(){const n=yield t.modalController.create({component:Re.d,componentProps:{knownMediaCategories:t.coverPhotoState.knownMediaCategories,selectedMediaId:t.coverPhotoState.selectedCoverMediaId,activeCategoryId:t.coverPhotoState.activeCategoryId,selectedMediaDisplayName:"",selectedMediaPreviewUrl:t.coverPhotoState.selectedCoverPreviewUrl,isKnownMediaLoading:t.coverPhotoState.isKnownMediaLoading,hasKnownMediaError:t.coverPhotoState.hasKnownMediaError,maxImages:10,initialUploadedPhotos:t.coverPhotoState.selectedPhotos},cssClass:"popup-modal-lg"});yield n.present();const{data:o,role:s}=yield n.onDidDismiss();"confirm"===s&&o&&(yield t.coverPhotoState.applyCoverPickerResult(o,!0))})()}onRequestWishlistArtwork(t){var n=this;return(0,u.A)(function*(){const o=yield n.modalController.create({component:Re.d,componentProps:{knownMediaCategories:t.knownMediaCategories,selectedMediaId:t.selectedMediaId,activeCategoryId:t.activeCategoryId,selectedMediaDisplayName:t.
1selectedMediaDisplayName,selectedMediaPreviewUrl:t.selectedMediaPreviewUrl,isKnownMediaLoading:t.isKnownMediaLoading,hasKnownMediaError:t.hasKnownMediaError},cssClass:"popup-modal-lg"});yield o.present();const{data:s,role:d}=yield o.onDidDismiss();"confirm"===d&&s&&(yield n.wishlistsSection?.applyArtworkResult(s))})()}onRequestLocationPicker(){var t=this;return(0,u.A)(function*(){const n=t.eventForm.get("locationLat")?.value,o=t.eventForm.get("locationLng")?.value,s=yield t.modalController.create({component:Qe.g,componentProps:{formatOptions:t.formatOptions,initialFormatTypeId:t.eventForm.get("eventFormatTypeId")?.value??x.n.InPerson,initialLocationName:t.eventForm.get("locationName")?.value??"",initialLocationLat:n?parseFloat(String(n)):null,initialLocationLng:o?parseFloat(String(o)):null,initialOnlineUrl:t.eventForm.get("onlineUrl")?.value??""},cssClass:"popup-modal location-modal"});yield s.present();const{data:d,role:p}=yield s.onDidDismiss();"confirm"===p&&d&&t.basicsSection?.applyLocationResult(d)})()}onRequestQuestionBuilder(){this.pushView("rsvp-questions")}openSendInvite(){var t=this;return(0,u.A)(function*(){if(!t.eventId||t.isBusy)return;const n=t.guestRows.map(d=>d.userId).filter(d=>!!d),o=yield t.modalController.create({component:ot.T,cssClass:"popup-modal-lg",componentProps:{excludeUserIds:n}});yield o.present();const{data:s}=yield o.onWillDismiss();if(s?.selectedUserIds?.length)try{t.isBusy=!0;const d=yield t.eventUserService.InviteRegisteredUsers({eventId:t.eventId,invitedUserIds:s.selectedUserIds});t.logger.LogInfo("Invited registered users to event",{eventId:t.eventId,invitedCount:d.invited?.length??0}),d.failed?.length&&(t.logger.LogWarning("Some invites failed for event",{eventId:t.eventId,failedCount:d.failed.length}),yield t.commonPageService.showAlertDialog("Invite not sent",d.failed[0]?.reason||"Some invites could not be sent")),yield t.refreshGuestListAfterInviteChange()}catch(d){t.logger.LogError(d,"Failed to invite registered users to event"),yield t.commonPageService.handleError(d,"Failed to send invites")}finally{t.isBusy=!1}})()}refreshGuestListAfterInviteChange(){var t=this;return(0,u.A)(function*(){t.eventId&&(t.guestState.markGuestListStale(),"guests"===t.activeEditSection?yield t.guestState.loadFullEditGuestList(t.eventId,!0,t.currentUserId,t.guestSearchTerm):yield t.guestState.loadEditGuestSummary(t.eventId,!0,t.currentUserId,t.guestSearchTerm))})()}onQuestionBuilderCompleted(){var t=this;return(0,u.A)(function*(){t.popView(),yield t.peopleSection?.refreshQuestionSummary()})()}onSubViewCancelled(){this.popView()}onQuestionBuilderViewChanged(t){"rsvp-questions"===this.currentView&&(this.headerTitle=t)}pushView(t){this.viewStack=[...this.viewStack,t],this.refreshHeaderForCurrentView()}popView(){this.viewStack.length<=1||(this.viewStack=this.viewStack.slice(0,-1),this.refreshHeaderForCurrentView())}refreshHeaderForCurrentView(){if(this.currentView=this.viewStack[this.viewStack.length-1],this.isSubViewActive=this.viewStack.length>1,!this.isSubViewActive)return this.headerTitle="Edit Event",this.headerActionIcon="chevron-back",void(this.headerActionLabel="Back");this.headerActionIcon="chevron-back",this.headerActionLabel="Back",this.headerTitle="Guest questions"}onGuestRoleChipClick(t,n){var o=this;return(0,u.A)(function*(){if(!t.canEditRole||o.busyGuestUserIds.has(t.userId))return;const s=t.eventAccessId??be.a.View,d=yield o.popoverController.create({component:Ne.gK,componentProps:{currentEventAccessId:s,keepLabel:"Invited",canRemove:o.guestState.canManageGuestAccess(o.currentUserId)},event:n,dismissOnSelect:!0});yield d.present();const{data:p}=yield d.onDidDismiss();p!==Ne.HE?null==p||p===Ne.K6||p===s||(yield o.guestState.applyGuestAccessChange(t,o.eventId,p)):yield o.confirmRemoveGuest(t)})()}confirmRemoveGuest(t){var n=this;return(0,u.A)(function*(){yield(yield n.alertController.create({header:"Remove guest?",message:`${t.displayName} will be removed from this event and will lose access to it.`,buttons:[{text:"Cancel",role:"cancel"},{text:"Remove",role:"destructive",handler:()=>{n.removeGuest(t)}}]})).present()})()}removeGuest(t){var n=this;return(0,u.A)(function*(){if(t.eventUserId&&!n.busyGuestUserIds.has(t.userId)
1)try{n.busyGuestUserIds.add(t.userId),yield n.eventUserService.RemoveEventUser(t.eventUserId),n.logger.LogInfo("Guest removed from event",{eventId:n.eventId,userId:t.userId}),yield n.refreshGuestListAfterInviteChange()}catch(o){n.logger.LogError(o,"Failed to remove guest from event"),yield n.commonPageService.handleError(o,"Failed to remove guest")}finally{n.busyGuestUserIds.delete(t.userId)}})()}trackGuestRow(t,n){return n.eventUserId||`guest-${t}`}saveEvent(){var t=this;return(0,u.A)(function*(){if(!t.isBusy){if(t.eventForm.invalid)return t.eventForm.markAllAsTouched(),void(yield t.openEditSection("details"));if(!t.hasHighImpactChanges()||(yield t.commonPageService.showConfirmAlertDialog("Save Event Changes","These changes affect when, where, or how people respond to this event.")))try{t.isBusy=!0,yield t.coverPhotoState.linkUploadedPhotos(t.eventId);const n=t.buildPayload(),o=yield t.eventService.InsUpdEvent(n);t.logger.LogInfo("Event saved",{eventId:o.eventId,isEditMode:!0}),yield t.applyPrivateWishlistFixes();const s=new Set(t.originalWishlistAssignments.map(p=>p.wishlistId)),d=new Set(t.selectedWishlistIds);for(const p of d)if(!s.has(p))try{yield t.eventWishlistService.AssignWishlist({eventId:t.eventId,wishlistId:p})}catch(_){t.logger.LogError(_,"Failed to assign wishlist to event")}for(const p of t.originalWishlistAssignments)if(!d.has(p.wishlistId))try{yield t.eventWishlistService.UnassignWishlist(p.eventWishlistId)}catch(_){t.logger.LogError(_,"Failed to unassign wishlist from event")}yield t.dismiss()}catch(n){t.logger.LogError(n,"Failed to save event"),yield t.commonPageService.handleError(n,"Failed to save event")}finally{t.isBusy=!1}}})()}deleteEvent(){var t=this;return(0,u.A)(function*(){if(t.eventId&&!t.isBusy&&(yield t.commonPageService.showConfirmAlertDialog("Delete Event","Delete this event permanently?")))try{t.isBusy=!0,yield t.eventService.DeleteEvent(t.eventId),t.logger.LogInfo("Event deleted",{eventId:t.eventId}),yield t.nav.navigateRoot("/app/events")}catch(o){t.logger.LogError(o,"Failed to delete event"),yield t.commonPageService.handleError(o,"Failed to delete event")}finally{t.isBusy=!1}})()}loadEvent(){var t=this;return(0,u.A)(function*(){if(!t.isLoading&&t.eventId)try{t.isLoading=!0,t.hasError=!1;const[n,o,s]=yield Promise.all([t.eventService.GetEventById(t.eventId,""),t.eventWishlistService.GetWishlistsForEvent(t.eventId),t.eventMediaService.GetCarouselMedia(t.eventId)]);t.existingEvent=n,t.coverPhotoState.syncSelectedCoverState(n,s??[]),t.guestState.setOrganizerFallback(t.currentUserId,n.createdByUserId),t.originalWishlistAssignments=(o??[]).filter(d=>!!d.eventWishlistId).map(d=>({eventWishlistId:d.eventWishlistId,wishlistId:d.wishlistId})),t.selectedWishlistIds=t.originalWishlistAssignments.map(d=>d.wishlistId),t.populateForm(t.existingEvent),t.allowGroupGifts=!1!==n.allowGroupGifts,t.allowUsersToUploadPhotos=!1!==n.allowUsersToUploadPhotos,yield t.guestState.loadEventUserAccess(t.eventId),yield t.guestState.loadEditGuestSummary(t.eventId,!0,t.currentUserId,t.guestSearchTerm),t.logger.LogDebug("Event loaded for edit",{eventId:t.eventId})}catch(n){t.logger.LogError(n,"Failed to load event for editing"),t.hasError=!0}finally{t.isLoading=!1}})()}populateForm(t){const n=t.startDT?new Date(t.startDT).toISOString():null;this.minSelectableEventDateTime=L.Ks(n),this.eventForm.patchValue({title:t.title||"",description:t.description||"",startDT:n,endDT:t.endDT?new Date(t.endDT).toISOString():null,eventFormatTypeId:t.eventFormatTypeId||x.n.InPerson,eventVisibilityTypeId:t.eventVisibilityTypeId||Ie.$t,eventDressCodeTypeId:t.eventDressCodeTypeId||D.w.NotAp
1plicable,dressCodeCustomText:t.dressCodeCustomText||"",onlineUrl:t.onlineUrl||"",rsvpEnabled:t.rsvpEnabled||!1,rsvpDeadlineDT:t.rsvpDeadlineDT?new Date(t.rsvpDeadlineDT).toISOString():null,maxAttendees:t.maxAttendees||null,locationName:t.locationName||"",locationLat:t.locationLat||null,locationLng:t.locationLng||null},{emitEvent:!1}),this.formCore.seedLastStartDT(n),this.formCore.applyFormatValidators();const o=parseFloat(String(t.locationLat??"")),s=parseFloat(String(t.locationLng??""));!isNaN(o)&&!isNaN(s)&&(this.initialLocationLat=o,this.initialLocationLng=s,this.initialLocationLabel=t.locationName??"")}buildPayload(){return L.nI(this.eventForm,{isEditMode:!0,eventId:this.eventId,draftEventId:null,existingEvent:this.existingEvent,currentUserId:this.currentUserId,selectedCoverMediaId:this.coverPhotoState.selectedCoverMediaId,showOnlineUrl:this.showOnlineUrl,showLocation:this.showLocation,showRsvpOptions:this.showRsvpOptions,allowGroupGifts:this.allowGroupGifts,allowUsersToUploadPhotos:this.allowUsersToUploadPhotos})}hasHighImpactChanges(){return L.y5(this.eventForm,this.existingEvent)}applyPrivateWishlistFixes(){var t=this;return(0,u.A)(function*(){for(const n of t.wishlistSteps?.toArray()??[])yield n.applyPrivateWishlistFixes()})()}static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)(e.rXU(V.p),e.rXU(f.ok),e.rXU(pe.nX),e.rXU(se.q9),e.rXU(g.W3),e.rXU(g.IE),e.rXU(g.hG),e.rXU(O.g),e.rXU(H.o),e.rXU(Se.B),e.rXU(S.v),e.rXU(F.S),e.rXU(xe.e),e.rXU(fe),e.rXU(kr),e.rXU(Le.U),e.rXU(Pe.r),e.rXU(nt))},this.\u0275cmp=e.VBU({type:a,selectors:[["app-event-edit"]],viewQuery:function(n,o){if(1&n&&(e.GBs(Fe,5),e.GBs(_e.B,5),e.GBs(Oe,5),e.GBs(Me.u,5),e.GBs(_e.B,5)),2&n){let s;e.mGM(s=e.lsd())&&(o.basicsSection=s.first),e.mGM(s=e.lsd())&&(o.wishlistsSection=s.first),e.mGM(s=e.lsd())&&(o.peopleSection=s.first),e.mGM(s=e.lsd())&&(o.questionBuilder=s.first),e.mGM(s=e.lsd())&&(o.wishlistSteps=s)}},standalone:!1,decls:14,vars:9,consts:[["slot","start"],["color","primary",3,"click","disabled"],["slot","icon-only",3,"name"],[1,"creation-page-content"],[1,"creation-page-body"],[4,"ngIf"],["class","error-container",4,"ngIf"],[3,"formGroup","hidden",4,"ngIf"],[1,"event-edit-skeleton-hero"],[1,"event-edit-skeleton-hero-fill",3,"animated"],[1,"error-container"],[3,"retry"],[3,"formGroup","hidden"],[1,"edit-shell"],["aria-label","Event editing sections",1,"edit-shell__segment"],[3,"ionChange","value"],["value","details"],["value","guests"],["value","wishlists"],["class","edit-shell__panel",3,"hidden",4,"ngIf"],[1,"edit-shell__panel",3,"hidden"],["role","button","tabindex","0","aria-label","Pick artwork",1,"cover-hero","cover-hero--edit",3,"click","keydown.enter"],["alt","Event cover",3,"src",4,"ngIf"],["class","cover-hero--edit__fallback",4,"ngIf"],[1,"cover-hero--edit__overlay"],["fill","solid","aria-label","Change artwork",1,"cover-hero--edit__camera",3,"click"],["name","camera"],["layout","grid",3,"tiles","retryItem","removeItem",4,"ngIf"],["layout","edit",3,"locationPicked","requestLocationPicker","form","visibilityOptions","formatOptions","dressCodeOptions","showOnlineUrl","showLocation","minSelectableEventDateTime","minEndDT","initialLocationLat","initialLocationLng","initialLocationLabel"],["class","settings",4,"ngIf"],["class","edit-actions",4,"ngIf"],["alt","Event cover",3,"src"],[1,"cover-hero--edit__fallback"],["name","calendar-outline",1,"cover-hero--edit__fallback-motif"],["layout","grid",3,"retryItem","removeItem","tiles"],[1,"settings"],[1,"setrow","setrow--toggle"],[1,"setrow__ic"],["name","gift-outline"],[1,"setrow__l"],[1,"setrow__sub"],[3,"ionChange","checked"],["name","camera-outline"],[1,"edit-actions"],["expand","block","fill","outline","color","danger","type","button",1,"danger-outline-button",3,"click","disabled"],["name","trash-outline","slot","start"],["layout","edit",3,"requestQuestionBuilder","form","eventId","maxRsvpDT","minSelectableEventDateTime"],[1,"grp-section-head"],[1,"grp-section-head__t"],[1,"grp-section-head__c"],["type","button",1,"grp-section-head__a",3,"click","disabled"],["name","person-add-outline"],["class","spoyla-warm-searchbar","placeholder","Search guests","show-clear-button","focus","enterkeyhint","search","aria-label","Search guests",3,"ngModel","ngModelOptions","ngModelChange","ionInput",4,"ngIf"],["class","editlist",4,"ngIf"],["class","empty",4,"ngIf"],["class","empty-inline",4,"ngIf"],["placeholder","Search guests","show-clear-button","focus","enterkeyhint","search","aria-label","Search guests",1,"spoyla-warm-searchbar",3,"ngModelChange","ionInput","ngModel","ngModelOptions"],[1,"editlist"],["class","editrow",4,"ngFor","ngForOf"],[1,"editrow"],[1,"editrow__avatar",3,"animated"],[1,"editrow__body"],[2,"width","58%","height","14px","border-radius","6px",3,"animated"],["class","editrow",4,"ngFor","ngForOf","ngForTrackBy"],[1,"editrow__avatar"],[3,"src","alt",4,"ngIf"],[1,"editrow__name"],["class","chip chip--soft",4,"ngIf"],["class","editrow__sub",4,"ngIf"],["class","role-pill",4,"ngIf"],["type","button","class","role-pill",3,"role-pill--active","disabled","click",4,"ngIf"],[3,"src","alt"],[1,"chip","chip--soft"],[1,"editrow__sub"],[1,"role-pill"],["type","button",1,"role-pill",3,"click","disabled"],["class","spoyla-skeleton-button-label spoyla-skeleton-button-label--sm",3,"animated",4,"ngIf"],[1,"spoyla-skeleton-button-label","spoyla-skeleton-button-label--sm",3,"animated"],["name","chevron-down-outline"],[1,"empty"],[1,"empty__icon"],["name","people-outline"],[1,"empty__title"],[1,"empty__desc"],["fill","solid","color","primary",3,"click","disabled"],["name","person-add-outline","slot","start"],[1,"empty-inline"],["layout","edit",3,"wishlistSelectionChanged","requestArtworkPicker","eventId","initialSelectedWishlistIds"],[3,"hosted","eventId","completed","viewChanged",4,"ngIf"],[3,"completed","viewChanged","hosted","eventId"],[1,"creation-page-footer"],["fill","solid","color","secondary","type","button",3,"click","disabled"],["fill","solid","color","primary","type","button",3,"click","disabled"],["slot","start","class","event-edit-button-skeleton",3,"animated",4,"ngIf"],["slot","start",1,"event-edit-button-skeleton",3,"animated"]],template:function(n,o){1&n&&(e.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-buttons",0)(3,"ion-button",1),e.bIt("click",function(){return o.handleHeaderAction()}),e.nrm(4,"ion-icon",2),e.k0s()(),e.j41(5,"ion-title"),e.EFF(6),e.k0s()()(),e.j41(7,"ion-content",3)(8,"div",4),e.DNE(9,wr,3,1,"ng-container",5)(10,Pr,2,0,"div",6)(11,Qr,16,6,"form",7)(12,ea,2,1,"ng-container",5),e.k0s()(),e.DNE(13,na,8,3,"ion-footer",5)),2&n&&(e.R7$(3),e.Y8G("disabled",o.isBusy),e.BMQ("aria-label",o.headerActionLabel),e.R7$(),e.Y8G("name",o.headerActionIcon),e.R7$(2),e.JRh(o.headerTitle),e.R7$(3),e.Y8G("ngIf",o.isLoading&&!o.isSubViewActive),e.R7$(),e.Y8G("ngIf",o.hasError&&!o.isLoading&&!o.isSubViewActive),e.R7$(),e.Y8G("ngIf",!o.isLoading&&!o.hasError),e.R7$(),e.Y8G("ngIf",o.isSubViewActive),e.R7$(),e.Y8G("ngIf",!o.isLoading&&!o.hasError&&!o.isSubViewActive))},dependencies:[l.Sq,l.bT,f.qT,f.BC,f.cb,f.vS,f.j4,g.Jm,g.QW,g.W9,g.M0,g.eU,g.iq,g.he,g.S1,g.Gp,g.eP,g.ds,g.BC,g.BY,g.ai,g.hB,g.Je,g.Gw,it,$.F,_e.B,Me.u,Fe,Oe],styles:["[_nghost-%COMP%]{display:flex;flex-direction:column;height:100%}.event-edit-button-skeleton[_ngcontent-%COMP%]{width:20px;height:16px;border-radius:var(--radius-sm)}.event-edit-skeleton-hero[_ngcontent-%COMP%]{height:200px;border-radius:var(--radius-xl);overflow:hidden;margin-bottom:var(--spoyla-space-4)}.event-edit-skeleton-hero-fill[_ngcontent-%COMP%]{width:100%;height:100%;margin:0;border-radius:0}"]}))}return r(),a})()},{path:":eventId",component:Ci}];let oa=(()=>{var r;class a{static#e=r=()=>(this.\u0275fac=function(n){return new(n||a)},this.\u0275mod=e.$C({type:a}),this.\u0275inj=c.G2t({imports:[l.MD,f.YN,f.X1,g.bv,re.u,ne.iI.forChild(ia)]}))}return r(),a})()},9819(Ee,te,h){h.d(te,{r:()=>ne});var l=h(467),f=h(2615),g=h(4673);let ne=(()=>{var re;class u{constructor(X){this.baseService=X,this.version="1"}GetGlobalEventOccurrencesByYear(X,ie){var e=this;return(0,l.A)(function*(){const ae=`${e.baseService.apiUrl}/api/v${encodeURIComponent(e.version)}/GlobalEventOccurrence?year=${X?encodeURIComponent(X):""}`;return yield e.baseService.httpGet(ae,ie)})()}static#e=re=()=>(this.\u0275fac=function(ie){return new(ie||u)(f.KVO(g.F))},this.\u0275prov=f.jDH({token:u,factory:u.\u0275fac,providedIn:"root"}))}return re(),u})()}}]);
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.