1import{b as H}from"./chunk-HBW5SY5Q.js";import{a as Ne}from"./chunk-W4XARCWK.js";import{a as Me,b as Oe}from"./chunk-XHAJW5OT.js";import{c as Ie,d as De}from"./chunk-SZFRSQ3T.js";import{X as ve,aa as Pe}from"./chunk-GPLRYFJS.js";import{b as he,d as T,f as ye,g as Ae,p as xe,q as Se,t as Ee,w as Te}from"./chunk-XM6XKUFW.js";import{o as fe}from"./chunk-BSPYIDFA.js";import"./chunk-UT5S7HBW.js";import{a as V}from"./chunk-NTHFH5IH.js";import{f as U}from"./chunk-EO5VAUSF.js";import"./chunk-UC5IZWBI.js";import{a as Ce,c as ge,t as ue}from"./chunk-UQGUWLW6.js";import{$ as f,$a as d,$b as re,A as ee,Ab as P,Dc as le,Ea as o,Eb as A,Ec as pe,Fb as I,Gb as S,J as te,Jd as de,Kb as D,Kd as w,Lb as N,Mb as G,Na as M,Nd as B,Qa as O,Sa as v,Tb as u,Tc as se,Ub as k,X as ne,Yc as me,Za as m,Zb as _,_a as z,_b as C,a as W,ab as ie,ae as R,b as Y,cb as oe,cc as K,db as ae,ea as h,eb as l,fa as y,fb as c,fc as ce,fe as b,gb as p,hb as g,jc as Z,je as F,l as j,lb as q,mb as E,ob as x,p as Q,pe as L,qb as r,re as _e,u as X}from"./chunk-42GU2DB2.js";var Ge=(()=>{class e{constructor(){this.DEFAULT_IMG=f(U).getCatalogAsset(V.NO_IMAGE_AGENCY,{folderType:ge.IMG}),this.MAP_ID="AGENCY_INFO_ID"}transform(t){let n=`${t.agency_latitude}`.replace(",","."),i=`${t.agency_longitude}`.replace(",",".");return{image:{image:t.agency_logo||this.DEFAULT_IMG.src,altText:t.agency_name||this.DEFAULT_IMG.altText},title:{content:t.agency_name,type:"h3"},agencyMainEmail:t.agency_main_email||"",agencyMainPhone:t.agency_main_phone||"",agencyAdress:t.agency_address||"",agencyUuid:t.agency_insider_uuid||"",map:Number(n)&&Number(i)?{mapOptions:{controlSize:26,mapId:this.MAP_ID},markers:[{position:{lat:Number(n),lng:Number(i)},pinOptions:{glyph:t?.agency_name}}]}:void 0,modal:{component:{title:{content:t.agency_name}}}}}static{this.\u0275fac=function(n){return new(n||e)}}static{this.\u0275pipe=O({name:"agencyDigitalExperienceToAgencyDEConverter",type:e,pure:!0})}}return e})();var J=e=>({text:e}),ke=e=>({disabled:e});function Le(e,a){if(e&1&&(c(0,"p"),A(1),p()),e&2){let t=r();o(),I(t.agencyAdress)}}function Ve(e,a){if(e&1&&g(0,"w2m-map-advanced",1),e&2){let t=r(2);l("options",t.mapOpenMarker())}}function Ue(e,a){if(e&1&&(c(0,"li",9),A(1),p()),e&2){let t=r(2);o(),S(" ",t.agencyMainPhone," ")}}function He(e,a){if(e&1&&(c(0,"li",10),A(1),p()),e&2){let t=r(2);o(),S(" ",t.agencyMainEmail," ")}}function $e(e,a){if(e&1&&(c(0,"li",11),A(1),p()),e&2){let t=r(2);o(),S(" ",t.agencyAdress," ")}}function We(e,a){if(e&1&&(c(0,"ul",5),m(1,Ue,2,1,"li",9),m(2,He,2,1,"li",10),m(3,$e,2,1,"li",11),p()),e&2){let t=r();o(),d(t.agencyMainPhone?1:-1),o(),d(t.agencyMainEmail?2:-1),o(),d(t.agencyAdress?3:-1)}}function Ye(e,a){if(e&1){let t=E();c(0,"div")(1,"cms-modal",0),G("openChange",function(i){h(t);let s=r();return N(s.openModal,i)||(s.openModal=i),y(i)}),m(2,Le,2,1,"p"),m(3,Ve,1,1,"w2m-map-advanced",1),p(),c(4,"div",2),g(5,"cms-image",3),c(6,"div",4),g(7,"cms-title",3),m(8,We,4,3,"ul",5),g(9,"cms-button",6),_(10,"translate"),c(11,"div",7)(12,"cms-button",8),_(13,"translate"),x("clickedButton",function(){let i=h(t),s=r();return y(s.howToGo(i.map))}),p(),c(14,"cms-button",8),_(15,"translate"),x("clickedButton",function(){h(t);let i=r();return y(i.openModal=!0)}),p()()()()()}if(e&2){let t=a,n=r();o(),l("component",t.modal.component),D("open",n.openModal),o(),d(t.agencyAdress?2:-1),o(),d(n.openModal&&n.mapOpenMarker()?3:-1),o(2),l("component",t.image),o(2),l("component",t.title),o(),d(t.agencyMainPhone||t.agencyMainPhone||t.agencyMainEmail?8:-1),o(),l("id",t.agencyUuid)("component",u(19,J,C(10,13,"SEARCH-AG
1ENCY.SEARCH.CONTACT_US"))),o(3),l("component",u(21,J,C(13,15,"PAGE.DETAIL.PROGRAM.MAP.HOW_TO_GO")))("options",u(23,ke,!(!(t.map==null||t.map.markers==null)&&t.map.markers[0]))),o(2),l("component",u(25,J,C(15,17,"PAGE.DETAIL.PROGRAM.MAP.SHOW")))("options",u(27,ke,!(!(t.map==null||t.map.markers==null)&&t.map.markers[0])))}}var we=(()=>{class e{constructor(){this.mapsSettings=Z.required(),this.agency=Z.required(),this.mapOpenMarker=ce(()=>this.initMapOpenMarker()),this.openModal=!1,this.navigationService=f(fe),this.GOOGLE_HOW_TO_GO="https://www.google.com/maps/dir/"}howToGo(t){let n=t.markers,i=n?n[0]?.position:null;if(i){let s=`${this.GOOGLE_HOW_TO_GO}/${i.lat},${i.lng}`;this.navigationService.openNewWindowUrl(s)}}initMapOpenMarker(){return this.mapsSettings()?Y(W({},this.mapsSettings()),{markers:this.mapsSettings().markers?this.mapsSettings().markers?.map(t=>Y(W({},t),{infoWindowOpenOnLoad:this.samePosition(t.position)})):[]}):this.mapsSettings()}samePosition(t){let n=`${this.agency().agency_latitude}`.replace(",","."),i=`${this.agency().agency_longitude}`.replace(",",".");return t.lat===Number(n)&&t.lng===Number(i)}static{this.\u0275fac=function(n){return new(n||e)}}static{this.\u0275cmp=M({type:e,selectors:[["app-agency-info"]],inputs:{mapsSettings:[1,"mapsSettings"],agency:[1,"agency"]},decls:2,vars:3,consts:[[3,"openChange","component","open"],[3,"options"],[1,"c-card-agency"],[3,"component"],[1,"c-card-agency__content"],[1,"c-card-agency__list"],[1,"c-card-agency__button","c-card-agency__button--contact",3,"id","component"],[1,"c-card-agency__button-group"],[1,"c-card-agency__button",3,"clickedButton","component","options"],[1,"c-card-agency__list-item","c-card-agency__list-item--phone"],[1,"c-card-agency__list-item","c-card-agency__list-item--mail"],[1,"c-card-agency__list-item","c-card-agency__list-item--address"]],template:function(n,i){if(n&1&&(m(0,Ye,16,29,"div"),_(1,"agencyDigitalExperienceToAgencyDEConverter")),n&2){let s;d((s=C(1,1,i.agency()))?0:-1,s)}},dependencies:[b,F,B,R,H,L,Ge,w],encapsulation:2})}}return e})();var Be=(()=>{class e{transform(t){let n=t?.length?t[0]:null;return n?.agency_latitude&&n?.agency_longitude?{markers:[...this.getAllMapMarkers(t)],mapOptions:{mapId:crypto.randomUUID(),fitAllMarkers:!0,maxZoom:15,minZoom:10,zoom:12}}:null}normalizeCoordinate(t){return Number(`${t}`.replace(",","."))}getAllMapMarkers(t){return t.map(n=>{let i=this.normalizeCoordinate(n.agency_latitude),s=this.normalizeCoordinate(n.agency_longitude);return i&&s?{position:{lat:i,lng:s},infoWindowContent:`<h3>${n.agency_name}</h3> 2 <p>${n.agency_main_phone}</p> 3 <a href="mailto:${n.agency_main_email}">${n.agency_main_email}</a> 4 <p>${n.agency_address}</p>`}:null}).filter(n=>!!n)}static{this.\u0275fac=function(n){return new(n||e)}}static{this.\u0275pipe=O({name:"agenciesToMaps",type:e,pure:!0})}}return e})();var Re=(()=>{class e{constructor(){this.httpClient=f(se),this.URL=`${f(ue).publicApiUrl}/mdm-cdp-adapter/api/v1`}searchAgencies(t){return this.httpClient.get(`${this.URL}/public/agency/postal-code/${t}`)}static{this.\u0275fac=function(n){return new(n||e)}}static{this.\u0275prov=ne({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();var je=e=>({type:"h1",content:e}),ze=(e,a)=>({image:e,altText:a}),qe=e=>({postalCode:e,formControlName:"firstPostalCode"}),Ke=e=>({postalCode:e,formControlName:"secondPostalCode"}),Ze=e=>({value:e}),Je=e=>({type:"h4",content:e}),Qe=e=>({text:e,icon:"w2m-icon i-bold-location-dot"}),Xe=e=>({disabled:e}),be=(e,a)=>({type:"h2",content:e,subtitle:a});function et(e,a){if(e&1&&g(0,"cms-image",3),e&2){let t=r();l("component",k(1,ze,t.BACKGROUND_IMG.src,t.BACKGROUND_IMG.altText))}}function tt(e,a){if(e&1&&q(0,11),e&2){r();let t=P(12),n=r();l("ngTemplateOutlet",t)("ngTemplateOutletContext",u(2,Ke,n.secondPostalCode))}}function nt(e,a){if(e&1&&g(0,"cms-loading",13),e&2){let t=r(2);l("component",t.LOADER)}}function it(e,a){e&1&&(c(0,"span"),A(1),_(2,"translate"),p()),e&2&&(o(),I(C(2,1,"SEARCH.FORM.SUBMIT")))}function ot(e,a){e&1&&(A(0),_(1,"translate")),e&2&&S(" ",C(1,1,"FIELD.REQUIRED")," ")}function at(e,a){e&1&&(A(0),_(1,"translate")),e&2&&S(" ",C(1,1,"FIELD.POSTAL_CODE.ERROR")," ")}function rt(e,a){if(e&1&&(c(0,"mat-error"),m(1,ot,2,3),m(2,at,2,3),p()),e&2){let t=r().postalCode;o(),d(t.errors.required?1:-1),o(),d(t.errors.pattern?2:-1)}}function ct(e,a){if(e&1){let t=E();c(0,"div",15)(1,"mat-form-field",16),x("keyup.enter",function(){h(t);let i=r(2);return y(i.searchAgencies())}),g(2,"input",17),_(3,"translate"),g(4,"span",18),p(),m(5,rt,3,2,"mat-error"),p()}if(e&2){let t=a.postalCode,n=a.formControlName;o(2),l("placeholder",C(3,3,"SEARCH.FORM.SUBMIT.PLACEHOLDER"))("formControlName",n),o(3),d(t.errors&&t.touched?5:-1)}}function lt(e,a){if(e&1){let t=E();c(0,"div",5)(1,"div",9)(2,"div",10),q(3,11),m(4,tt,1,4,"ng-container",11),c(5,"button",12),x("click",function(){h(t);let i=r();return y(i.searchAgencies())}),m(6,nt,1,1,"cms-loading",13)(7,it,3,3,"span"),p()(),c(8,"mat-checkbox",14),x("change",function(i){h(t);let s=r();return y(s.changeViewSecondPostalCode(i))}),A(9),_(10,"translate"),p(),v(11,ct,6,5,"ng-template",null,1,K),p()()}if(e&2){let t=P(12),n=r();o(),l("formGroup",n.formGroup),o(2),l("ngTemplateOutlet",t)("ngTemplateOutletContext",u(9,qe,n.firstPostalCode)),o(),d(n.checkSecondPostalCode!=null&&n.checkSecondPostalCode.value?4:-1),o(),l("disabled",!n.formGroup.valid||n.loading),o(),d(n.loading?6:7
4),o(3),S(" ",C(10,7,"SEARCH.FORM.DUAL.POSTAL.CODE")," ")}}function pt(e,a){if(e&1&&g(0,"w2m-map-advanced",21),e&2){let t=r();l("options",t)}}function st(e,a){if(e&1&&g(0,"app-agency-info",25),e&2){let t=a.$implicit,n=r(2);l("agency",t)("mapsSettings",n)}}function mt(e,a){if(e&1){let t=E();g(0,"cms-title",22),_(1,"translate"),c(2,"cms-button",23),_(3,"translate"),x("clickedButton",function(){h(t);let i=r(3);return y(i.openModal=!0)}),p(),c(4,"div",24),oe(5,st,1,2,"app-agency-info",25,ie),p()}if(e&2){let t=r(),n=r();l("component",u(10,Je,re(1,3,"SEARCH-AGENCY.RESULTS",u(8,Ze,n.length)))),o(2),l("component",u(12,Qe,C(3,6,"SEARCH-AGENCY.VIEW.AGENCIES.MAP")))("options",u(14,Xe,!t)),o(3),ae(n)}}function dt(e,a){}function _t(e,a){if(e&1&&v(0,dt,0,0,"ng-template",19),e&2){r(3);let t=P(11);l("ngTemplateOutlet",t)}}function Ct(e,a){if(e&1){let t=E();c(0,"cms-modal",20),G("openChange",function(i){h(t);let s=r(2);return N(s.openModal,i)||(s.openModal=i),y(i)}),m(1,pt,1,1,"w2m-map-advanced",21),p(),m(2,mt,7,16)(3,_t,1,1,null,19)}if(e&2){let t=r(),n=r();D("open",n.openModal),o(),d(n.openModal?1:-1),o(),d(t!=null&&t.length?2:3)}}function gt(e,a){}function ut(e,a){if(e&1&&v(0,gt,0,0,"ng-template",19),e&2){r(2);let t=P(11);l("ngTemplateOutlet",t)}}function ft(e,a){if(e&1&&(c(0,"div",7),m(1,Ct,4,3),_(2,"agenciesToMaps"),z(3,ut,1,1,null,19),p()),e&2){let t;o(),d((t=C(2,1,a))?1:3,t)}}function ht(e,a){e&1&&(c(0,"div",8),g(1,"span",26)(2,"cms-title",27),_(3,"translate"),_(4,"translate"),p()),e&2&&(o(2),l("component",k(5,be,C(3,1,"SEARCH-AGENCY.SEARCH-POSTAL-CODE"),C(4,3,"SEARCH-AGENCY.DESTINATIONS"))))}function yt(e,a){e&1&&(c(0,"div",8),g(1,"cms-title",27),_(2,"translate"),_(3,"translate"),p()),e&2&&(o(),l("component",k(5,be,C(2,1,"COMMON.NO_RESULTS"),C(3,3,"SEARCH-AGENCY.NO_RESULTS"))))}var sn=(()=>{class e{constructor(){this.assetsService=f(U),this.BACKGROUND_IMG=this.assetsService.getCatalogAsset(V.BACKGROUND_IMAGE_AGENCY),this.LOADER={url:this.assetsService.getCatalogAsset(Ce.LOADER).src},this.loading=!1,this.openModal=!1,this.digitalExperienceService=f(Re),this.title=f(me),this.fb=f(Ee),this.translateService=f(de),this.POSTAL_CODE_PATTERN=/^(\d{5}|\d{4}-\d{3})$/}ngOnInit(){this.initForm(),this.translateService.get("TITLE.SEARCH_AGENCY").subscribe(t=>this.title.setTitle(t))}searchAgencies(){if(this.formGroup.valid){this.loading=!0;let t=this.digitalExperienceService.searchAgencies(this.firstPostalCode?.value),n=this.secondPostalCode?.value?this.digitalExperienceService.searchAgencies(this.secondPostalCode.value):j([]);this.agencies$=X([t,n]).pipe(Q(([i,s])=>this.removeDuplicates([...i?.agencies||[],...s.agencies||[]])),ee(()=>j([])),te(()=>{this.loading=!1}))}}changeViewSecondPostalCode(t){t.checked?this.secondPostalCode?.setValidators([T.required,T.pattern(this.POSTAL_CODE_PATTERN)]):(this.secondPostalCode?.setValidators([T.pattern(this.POSTAL_CODE_PATTERN)]),this.secondPostalCode?.setValue("")),this.secondPostalCode?.updateValueAndValidity()}removeDuplicates(t){return t?.length?t.filter((n,i)=>i===t.findIndex(s=>s.agency_code===n.agency_code)):[]}initForm(){this.formGroup=this.fb.group({firstPostalCode:["",[T.required,T.pattern(this.POSTAL_CODE_PATTERN)]],checkSecondPostalCode:[!1],secondPostalCode:["",[T.pattern(this.POSTAL_CODE_PATTERN)]]})}get checkSecondPostalCode(){return this.formGroup.get("checkSecondPostalCode")}get firstPostalCode(){return this.formGroup.get("firstPostalCode")}get secondPostalCode(){return this.formGroup.get("secondPostalCode")}static{this.\u0275fac=function(n){return new(n||e)}}static{this.\u0275cmp=M({type:e,selectors:[["app-page-search-agency"]],decls:12,vars:10,consts:[["noData",""],["inputPostalCode",""],[1,"s-hero"],[3,"component"],[1,"s-search-agency"],[1,"c-search-form"],[1,"s-search-agency__container"],[1,"s-search-agency__results"],[1,"s-search-agency__nosearch"],[1,"c-search-form__content",3,"formGroup"],[1,"c-search-form__input"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],["type","button",1,"c-search-form__button",3,"click","disabled"],[1,"c-search-form__button-loader",3,"component"],["formControlName","checkSecondPostalCode",3,"change"],[1,"c-search-form__input-group"],["appearance","outline",3,"keyup.enter"],["matInput","",3,"placeholder","formControlName"],[1,"input-icon__icon","input-icon__icon--destination"],[3,"ngTemplateOutlet"],[3,"openChange","open"],[3,"options"],[1,"s-search-agency__results-title",3,"component"],[3,"clickedButton","component","options"],[1,"s-search-agency__results-cards"],[1,"s-search-agency__results-cards-list",3,"agency","mapsSettings"],[1,"s-search-agency__nosearch--icon"],[1,"s-search-agency__nosearch--title",3,"component"]],template:function(n,i){if
4(n&1&&(c(0,"section",2),m(1,et,1,4,"cms-image",3),g(2,"cms-title",3),_(3,"translate"),p(),c(4,"section",4),m(5,lt,13,11,"div",5),c(6,"div",6),m(7,ft,4,3,"div",7),_(8,"async"),z(9,ht,5,8,"div",8),p()(),v(10,yt,4,8,"ng-template",null,0,K)),n&2){let s;o(),d(i.BACKGROUND_IMG?1:-1),o(),l("component",u(8,je,C(3,4,"SEARCH-AGENCY.TITLE"))),o(3),d(i.formGroup?5:-1),o(2),d((s=C(8,6,i.agencies$))?7:9,s)}},dependencies:[le,B,Te,he,ye,Ae,Se,xe,Ne,F,we,b,De,Ie,Pe,ve,_e,Oe,Me,R,L,H,pe,w,Be],encapsulation:2})}}return e})();export{sn as PageSearchAgencyComponent};
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.