import{o as p}from"./chunk-RB4ISITT.js";import{a}from"./chunk-TQ3TEUHH.js";import{$ as m,Q as v,Wc as o,Y as b,Zc as f,c as n,h as g}from"./chunk-2SSKXWW5.js";var I=(()=>{class d{constructor(t){this.httpClient=t,this.selectedSeatsSubject=new n,this.tdcCartInfoSubject=new n,this.changeEventsSubject=new n,this.changeSeatsSubject=new n,this.tdcErrorSubject=new n,this.timerSubject=new n}getBraintreeToken(t,r,e=null){let i=new o().set("entertainerId",t).set("currentETag",r);return e&&(i=i.set("clientBrandingId",e)),this.httpClient.get(`${a.apiUrl}Cart/tdc/braintreeToken`,{params:i})}braintreeCheckout(t,r,e,i,s,c=null){let l=new o().set("cardType",t).set("brainTreeNonce",r).set("entertainerId",e).set("currentETag",i).set("creditToApply",s);return c&&(l=l.set("clientBrandingId",c)),this.httpClient.get(`${a.apiUrl}Checkout/tdc/checkout`,{params:l})}braintreeCheckoutV2(t,r,e,i,s,c,l=null,h=null){let u={brainTreeNonce:r,entertainerId:e,currentETag:i,creditToApply:s,events:c};return t&&(u.cardType=t),l&&(u.clientBrandingId=l),h&&h.length>0&&(u.dataProtectionPreferences=h),this.httpClient.post(`${a.apiV2Url}CheckoutV2/tdc/checkout`,u)}sendCheckoutEmail(t){return this.httpClient.post(`${a.apiUrl}Checkout/tdc/sendEmail`,t)}getTdcCartInfo(){return this.tdcCartInfoSubject.asObservable()}setTdcCartInfo(t){this.tdcCartInfoSubject.next(t)}getChangeEventsObservable(){return this.changeEventsSubject.asObservable()}triggerChangeEvents(){this.changeEventsSubject.next(!0)}getChangeSeatsObservable(){return this.changeSeatsSubject.asObservable()}triggerChangeSeats(){this.changeSeatsSubject.next(!0)}getClearTimerObservable(){return this.timerSubject.asObservable()}triggerClearTimer(){this.timerSubject.next(!0)}getTdcErrorObservable(){return this.tdcErrorSubject.asObservable()}triggerTdcError(t){this.tdcErrorSubject.next(t)}canAutoDimissErrorMessage(t){return!["pv.cart.50029"].includes(t?.code)}getTdcErrorMessage(t,r=""){try{if(!t||!t.code)return p.Oops;switch(t.code){case"pv.cart.50029":return t.message?"Your request would have stranded a single seat. Please select different seats and try again.":"";case"pv.cart.50015":switch(r){case"miamimarlins/fpldiscount":return"We had trouble finding seats for you. Please hit the Continue button to try again.";default:return"Dang it, looks like those seats aren't available anymore. Please delete them from your cart and select different seats."}case"pv.cart.50011":case"pv.cart.50012":var e=t.message?t.message.match(/(?<=most ').*(?=' ticket)/g):["1"];return"Sorry, you can't get more than "+(e&&e.length>0?e[0]=="1"?"1 ticket":e[0]+" tickets":"")+" with this offer.";case"pv.cart.50348":var e=t.message?t.message.match(/(?<=price type is ').*(?='.)/g):["1"];return"Sorry, you can't get more than "+(e&&e.length>0?e[0]=="1"?"1 ticket":e[0]+" tickets":"")+" with this offer.";case"pv.common.20015":return"The postal code is not valid. Please update in order to move forward.";case"xnow.cart.1000":return"You have an existing cart on another device. Either use that device to finish your purchase or clear your cart. <a href='"+window.location.href+"?clearCart=true'>Clear cart</a>";case"pv.cart.50418":case"pv.cart.50011.client":default:return t.message}}catch{return p.Oops}}createTdcPatron(t){return this.httpClient.get(`${a.apiUrl}user/createTdcPatron?entertainerId=${t}`)}getTdcCart(t){return this.httpClient.get(`${a.apiUrl}Cart/tdc/getCart?entertainerId=${t}`)}getTypedTdcCart(t){return this.httpClient.get(`${a.apiUrl}Cart/tdc/getCart?entertainerId=${t}`)}getEventsIds(t){return this.httpClient.get(`${a.apiUrl}Cart/tdc/getEventsIds`,{params:{tdcEventId:t}})}setCartEvents(t){return this.httpClient.post(`${a.apiUrl}Cart/tdc/setCartEvents`,t)}setCartEventsTyped(t){return this.httpClient.post(`${a.apiUrl}Cart/tdc/setCartEvents`,t)}removeTdcCart(t){return this.httpClient.get(`${a.apiUrl}Cart/tdc/removeCart?entertainerId=${t}`)}removeTicketsByOfferIdTyped(t,r,e){return this.removeTicketsByOfferId(t,r,e)}removeTicketsByOfferId(t,r,e){return gtag&>ag("event","remove_tickets_by_ offer_id",{data:{offerId:t,entertainerId:r,etag:e}}),this.httpClient.get(`${a.apiUrl}Cart/tdc/removeTicketsByOfferId?offerId=${t}&entertainerId=${r}¤tETag=${e}`)}getTypedSectionAvailability(t,r,e,i=null){return this.getSectionAvailability(t,r,e,i)}getSectionAvailability(t,r,e,i=null){let s=new o().set("numGames",e);return i&&(s=s.set("clientBrandingId",i)),this.httpClient.get(`${a.apiUrl}Event/availability/tdc/${t}/section/${r}`,{params:s})}addTicketsById(t){return gtag&>ag("event","add_tickets_by_id",{data:t}),this.httpClient.post(`${a.apiUrl}Cart/tdc/addTicketsById`,t)}addTicketsByIdTyped(t){return this.addTicketsById(t)}getTypedTdcSeatingAvailability(t,r,e=null){return this.getTdcSeatingAvailability(t,r,e)}getTdcSeatingAvailability(t,r,e=null){let i=new o().set("availabilityType",1).set("numGames",r);return e&&(i=i.set("clientBrandingId",e)),this.httpClient.get(`${a.apiUrl}Event/availability/tdc/${t}`,{params:i}).pipe(v(s=>{try{s?.availability?.availabilityGroups&&(s.availability.availabilityGroups=s.availability.availabilityGroups.filter(c=>c.price?.value>0))}catch{}return g(s)}))}getTypedTdcSeating(t,r=!1){return this.getTdcSeating(t,r)}getTdcSeating(t,r=!1){return this.httpClient.get(`${a.apiUrl}Event/seating/tdc/${t}?includeAllSeatMapDetails=${r}`)}getSeaticMap(){let t=new o().set("websiteConfigId",a.seaticsApi.websiteConfigId.toString()).set("consumerKey",a.seaticsApi.apiKey).set("eventName","The+Weeknd").set("venue","Allstate+Arena").set("dateTime","201901202000");return this.httpClient.get("https://sandbox.tn-apis.com/maps/v3/MapAndLayout",{params:t,observe:"response",responseType:"text",reportProgress:!0})}getAdditionalFiles(t){return this.httpClient.get(t)}setSelectedSeats(t,r=!0,e=!1,i=!1){var s={selectedSeats:t,processNextStep:r,removeRequest:e,showCart:i};this.selectedSeatsSubject.next(s)}getSelectedSeats(){return this.selectedSeatsSubject.asObservable()}static{this.\u0275fac=function(r){return new(r||d)(m(f))}}static{this.\u0275prov=b({token:d,factory:d.\u0275fac,providedIn:"root"})}}return d})();export{I as a};