"use strict";(self.webpackChunkfindagrave_frontend=self.webpackChunkfindagrave_frontend||[]).push([[219],{11045(e,t,o){o.d(t,{Aq:()=>c,Ue:()=>r});const n=["cemetery","city","county","state","country"];function r(e,t=!1){return(t?n.slice(1):n).map(t=>e[t]).filter(e=>e).join(", ")}function c(e){return e.slice(1).map(e=>e.name).join(", ")}},56267(e,t,o){var n=o(39708),r=o(71757),c=o.n(r),i=o(69917),s=o(99376),y=function(e,t,o,n){return new(o||(o=Promise))(function(r,c){function i(e){try{y(n.next(e))}catch(e){c(e)}}function s(e){try{y(n.throw(e))}catch(e){c(e)}}function y(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(i,s)}y((n=n.apply(e,t||[])).next())})};const a=o(59236);class u{constructor(e){var t;this.bindElement="",this.idElement="",this.locationsWithoutCemeteries=!1,this.browseType="",this.startLocation="",this.limitToCemetery=!1,this.browseInput=new Map,this.browse=new Map,this.loaded=!1,this.hasCemeteries=!1,this.lowestLevel="city",this.ignoreCemeteries=!0,this.bindElement=e.bindElement,this.idElement=e.idElement,this.locationsWithoutCemeteries=e.locationsWithoutCemeteries||!1,this.browseType=e.browseType||"",this.startLocation=(null===(t=c()(this.idElement).val())||void 0===t?void 0:t.trim())||this.getLocation(),this.limitToCoordinates=!!e.limitToCoordinates,this.apolloClient=e.apolloClient,this.hasCemeteries=e.hasCemeteries||!1,this.lowestLevel=e.lowestLevel||"city",this.ignoreCemeteries="boolean"!=typeof e.ignoreCemeteries||e.ignoreCemeteries,this.limitToCemetery="boolean"==typeof e.limitToCemetery&&e.limitToCemetery,this.initialize(this)}initialize(e){c()(`#browse-loading${e.browseType}`).removeClass("hidden"),c()(document).on("click",".browse-link",function(){u.openIdx=Number(c()(this).data("idx"))}),function(e,t){y(this,void 0,void 0,function*(){let{data:o}=yield t.apolloClient.query({query:n.J1` query browseStart($ids: [ID!]) { locationsById(ids: $ids) { locations { ...on Location { id locations { city cityId county countyId state stateId country countryId continentId } coordinates { lat lon } } } } } `,variables:{ids:[e]}});["continentId","countryId","stateId","countyId","cityId"].map(e=>{var t,n;return null===(n=null===(t=o.locationsById.locations[0])||void 0===t?void 0:t.locations[0])||void 0===n?void 0:n[e]}).filter(t=>t&&t!==e).forEach(e=>t.browseInput.set(e.replace(/_\d+/,""),e)),yield t.loadBrowse(["top",...t.browseInput.values(),e]),c()(t.idElement).trigger("data.loaded")})}(e.startLocation,e),c()(this.idElement).data("locationBrowse",e),c()(this.idElement).on("data.loaded",this.displayValues.bind(this)),u.eventsInitialized||(u.eventsInitialized=!0,c()(document).on("shown.bs.modal","#cemetery-browse"+e.browseType,this.highlightAndScroll.bind(this)))}buildBrowseContainer(e,t,o){var n;"continent"!==t&&"country"!==t&&c()("#useLocation"+o.browseType).prop("disabled",!1);const r={state:0,county:0,city:0};for(const i of e.locations){const e=i.id,y=i.names[0].name,u=(0,s.v)(null===(n=i.locations)||void 0===n?void 0:n[0]),[l]=e.split("_");"number"==typeof r[t]&&r[t]++;const d=i.coordinates?Object.assign({},i.coordinates):void 0;if("cemetery"!==l||"cemetery"===l&&!o.ignoreCemeteries){const n=c()(a.render({location:u,id:e,name:y,coordinates:d,browseType:o.browseType,initialType:t,limitToCoordinates:o.limitToCoordinates,type:l}));n.data("location",i),c()(".bc-"+t+o.browseType).find(".bc-container").append(n)}}r.state&&c()(".bc-state"+o.browseType).find(".count").html(r.state),r.county&&c()(".bc-county"+o.browseType).find(".count").html(r.county),r.city&&c()(".bc-city"+o.browseType).find(".count").html(r.city),"country"===t&&(c()(".bc-continent"+o.browseType).removeClass("hidden"),c()(".bc-country"+o.browseType).removeClass("hidden"),c()(".bc-state"+o.browseType).addClass("hidden"),c()(".bc-county"+o.browseType).addClass("hidden"),c()(".bc-city"+o.browseType).addClass("hidden")),"state"===t&&(c()(".bc-continent"+o.browseType).removeClass("hidden"),c()(".bc-country"+o.browseType).removeClass("hidden"),c()(".bc-county"+o.browseType).addClass("hidden"),r.city&&!r.state?(c()(".bc-state"+o.browseType).addClass("hidden"),c()(".bc-city"+o.browseType).removeClass("hidden")):(c()(".bc-state"+o.browseType).removeClass("hidden"),c()(".bc-city"+o.browseType).addClass("hidden"))),"county"===t&&(c()(".bc-continent"+o.browseType).removeClass("hidden"),c()(".bc-country"+o.browseType).removeClass("hidden"),c()(".bc-state"+o.browseType).removeClass("hidden"),r.city&&!r.county?(c()(".bc-county"+o.browseType).addClass("hidden"),c()(".bc-city"+o.browseType).removeClass("hidden")):(c()(".bc-county"+o.browseType).removeClass("hidden"),c()(".bc-city"+o.browseType).addClass("hidden"))),"city"===t&&(c()(".bc-continent"+o.browseType).removeClass("hidden"),c()(".bc-country"+o.browseType).removeClass("hidden"),c()(".bc-state"+o.browseType).removeClass("hidden"),c()(".bc-county"+o.browseType).removeClass("hidden"),c()(".bc-city"+o.browseType).removeClass("hidden")),"cemetery"===t&&(c()(".bc-continent"+o.browseType).removeClass("hidden"),c()(".bc-country"+o.browseType).removeClass("hidden"),c()(".bc-state"+o.browseType).removeClass("hidden"),c()(".bc-county"+o.browseType).removeClass("hidden"),c()(".bc-city"+o.browseType).removeClass("hidden"),c()(".bc-cemetery"+o.browseType).removeClass("hidden")),c()(".bc-"+t+o.browseType).find(".count").html(e.total-r.state-r.county-r.city)}getSubType(e){switch(e){case"top":return"continent";case"continent":return"country";case"country":return"state";case"state":return"county";case"county":return"city";case"city":return"cemetery";default:return""}}displayValues(e){var t,o;const n=this;c()(".bc-container").find(".browse-link-create").remove();const r=(null===(t=c()(n.idElement).val())||void 0===t?void 0:t.trim())||n.getLocation();if(n.startLocation!==r)return n.startLocation=r,n.browseInput.clear(),n.browse.clear(),n.initialize(n);function i(e){c()(e).find(".count").html(""),c()(e).find(".bc-container div").remove()}c()(`#cemetery-browse${n.browseType}`).off("click",".close-browse").on("click",".close-browse",function(){c()("#cemetery-browse"+n.browseType).modal("hide")}),n.loaded&&(c()(document).on("click","#useLocation"+n.browseType,function(){const e=n.bindElement.split("-"),t=Number(e[e.length-1]);if(!u.openIdx||u.openIdx===t){const e=c()("#location-placeholder"+n.browseType).text(),t=c()("#locationId-placeholder"+n.browseType).val(),o=c()("#locationId-placeholder"+n.browseType).data("location");e&&e.length&&t&&t.length?(c()(".preciseLocation, .cemetery-only").addClass("hidden"),n.limitToCoordinates&&!n.coordinates?c()(".preciseLocation").removeClass("hidden"):n.limitToCemetery&&"cemetery"!==n.currentType?c()(".cemetery-only").removeClass("hidden"):(c()("#cemetery-browse"+n.browseType).modal("hide"),c()(n.bindElement).val(e).parents(".btn-group, .input-group").find(".clear-search").removeClass("hidden"),c()(n.idElement).val(t),c()(n.bindElement).trigger("browse:set",[{id:t,coordinates:n.coordinates,location:o}]),c()(n.idElement).trigger("change"))):(c()(n.bindElement).val("").parents(".btn-group, .input-group").find(".clear-search").addClass("hidden"),c()("#location-placeholder"+n.browseType).html(""),c()("#useLocation"+n.browseType).attr("disabled","disabled"),c()(n.idElement).val(""),c()(n.idElement).trigger("change"))}}),c()(document).on("click",".browse-link"+n.browseType,function(e){return y(this,void 0,void 0,function*(){e.preventDefault();const t=c()(this),o=t.attr("data-id"),r=o.split("_")[0];n.currentType=r,n.coordinates=t.data("gps"),n.browseInput.set(r,o),n.startLocation=o;const s=t.children("input").attr("name");!function(e){switch(e){case"continent":["bc-country","bc-state","bc-county","bc-city","bc-cemetery"].map(e=>`.${e}${n.browseType}`).forEach(e=>i(e)),["country","state","county","city","cemetery"].forEach(e=>n.browseInput.delete(e));break;case"country":["bc-state","bc-county","bc-city","bc-cemetery"].map(e=>`.${e}${n.browseType}`).forEach(e=>i(e)),["state","county","city","cemetery"].forEach(e=>n.browseInput.delete(e));break;case"state":["bc-county","bc-city","bc-cemetery"].map(e=>`.${e}${n.browseType}`).forEach(e=>i(e)),["county","city","cemetery"].forEach(e=>n.browseInput.delete(e));break;case"county":["bc-city","bc-cemetery"].map(e=>`.${e}${n.browseType}`).forEach(e=>i(e)),["city","cemetery"].forEach(e=>n.browseInput.delete(e));break;case"city":i(`.bc-cemetery${n.browseType}`),n.browseInput.delete("cemetery")}}(s),n.limitToCoordinates&&n.coordinates&&c()(".preciseLocation").addClass("hidden");let y=t.attr("data-link");if(n.locationsWithoutCemeteries&&(y+="?withoutCemeteries=true"),c()(".bc-"+s+n.browseType).find(".active, .list-group-item-previous").removeClass("active bg-primary text-white").removeClass("list-group-item-previous"),c()("#cemetery-browse"+n.browseType).find(".active").addClass("list-group-item-previous").removeClass("active bg-primary text-white"),t.find("label").addClass("active bg-primary text-white"),"continent"!==s?(c()("#location-placeholder"+n.browseType).html(n.getFullName(t)),c()("#locationId-placeholder"+n.browseType).val(o).data("location",t.data("location"))):(c()("#location-placeholder"+n.browseType).html(""),c()("#locationId-placeholder"+n.browseType).val("").data("location",!1)),r!==n.lowestLevel){const e=yield n.loadBrowse([o]),t=n.getSubType(r);n.buildBrowseContainer(e.browse[0],t,n);let i=c()("#cemetery-browse"+n.browseType).find("label.active").offset().left-c()("#cemetery-browse"+n.browseType).find(".browse-container").offset().left+c()("#cemetery-browse"+n.browseType).find(".browse-container").scrollLeft();c()("#cemetery-browse"+n.browseType).find(".browse-container").animate({scrollLeft:i})}})}),c()("#clear-browse"+n.browseType).on("click",function(){c()(".bc-continent"+n.browseType).find("label.active, label.list-group-item-previous").removeClass("active bg-primary text-white").removeClass("list-group-item-previous"),c()(".bc-country"+n.browseType).find(".count").html(""),["bc-country","bc-state","bc-county","bc-city"].map(e=>`.${e}${n.browseType}`).forEach(e=>i(e)),c()(n.idElement).val(""),c()(n.bindElement).val("").parents(".btn-group, .input-group").find(".clear-search").addClass("hidden"),c()("#location-placeholder"+n.browseType).html(""),c()("#useLocation"+n.browseType).attr("disabled","disabled"),c()(n.idElement).trigger("change")}),null===(o=[...n.browse.values()])||void 0===o||o.map((e,t)=>{const o=n.getSubType(e.id.replace(/_.*/,""));if(n.buildBrowseContainer(e,o,n),tt.innerText.trim()).get();return t.push(e.find("label").text().trim()),t.reverse().join(", ")}highlightAndScroll(){var e,t;const o=this.startLocation.split("_")[0];c()(".bc-"+o+this.browseType).find("[data-id="+this.startLocation+"] label").addClass("active bg-primary text-white"),c()("#location-placeholder"+this.browseType).html(this.getFullName(c()(".bc-"+o+this.browseType).find("[data-id="+this.startLocation+"]"))),c()("#locationId-placeholder"+this.browseType).val(c()(".bc-"+o+this.browseType).find("[data-id="+this.startLocation+"]").attr("data-id")),["continent","country","state","county","city"].forEach(e=>{const t=c()(`.bc-${e}${this.browseType}`);if(t.find("label.list-group-item-previous, label.active").offset()){const e=t.find("label.list-group-item-previous, label.active").offset().top-t.find(".bc-container").offset().top+t.find(".bc-container").scrollTop();t.find(".bc-container").parent().animate({scrollTop:e})}});const n=(null===(e=c()("#cemetery-browse"+this.browseType).find("label.active").offset())||void 0===e?void 0:e.left)-(null===(t=c()("#cemetery-browse"+this.browseType).find(".browse-container").offset())||void 0===t?void 0:t.left)+c()("#cemetery-browse"+this.browseType).find(".browse-container").scrollLeft();c()("#cemetery-browse"+this.browseType).find(".browse-container").animate({scrollLeft:n})}loadBrowse(e){return y(this,void 0,void 0,function*(){const{data:t}=yield this.apolloClient.query({query:n.J1` query browse($parents: [ID!], $ignoreCemeteries: Boolean, $hasCemeteries: Boolean) { browse(parents: $parents, ignoreCemeteries: $ignoreCemeteries, hasCemeteries: $hasCemeteries) { id locations { id names { name } locations { cemetery city county state country continent } coordinates { lat lon } } } } `,variables:{parents:e,ignoreCemeteries:this.ignoreCemeteries,hasCemeteries:this.hasCemeteries}});return t.browse.forEach(e=>{const t=this.getSubType(e.id.replace(/_.*/,""));this.browse.set(t,e)}),this.loaded=!0,c()(`#browse-loading${this.browseType}`).addClass("hidden"),t})}getLocation(){const e=(0,i.Ri)("ipLoc");return d[e]||"country_4"}}u.eventsInitialized=!1;const l=u,d={af:"country_103",al:"country_105",dz:"country_13",as:"country_109",ad:"country_107",ao:"country_108",ai:"country_111",aq:"country_112",ag:"country_101",ar:"country_16",am:"country_106",aw:"country_100",au:"country_15",at:"country_17",az:"country_104",bs:"country_18",bh:"country_113",bd:"country_115",bb:"country_86",by:"country_90",be:"country_19",bz:"country_116",bj:"country_120",bm:"country_98",bt:"country_124",bo:"country_118",ba:"country_117",bw:"country_114",bv:"country_125",br:"country_20",io:"country_178",bn:"country_126",bg:"country_84",bf:"country_268",bi:"country_127",kh:"country_128",cm:"country_135",ca:"country_10",ky:"country_133",cf:"country_139",td:"country_129",cl:"country_132",cn:"country_22",cx:"country_191",cc:"country_134",co:"country_23",km:"country_136",cd:"country_131",cg:"country_130",ck:"country_24",cr:"country_81",ci:"country_181",hr:"country_76",cu:"country_26",cw:"country_177",cy:"country_142",cz:"country_36",dk:"country_27",dj:"country_143",dm:"country_144",do:"country_28",ec:"country_146",eg:"country_147",sv:"country_150",gq:"country_148",er:"country_149",ee:"country_93",sz:"country_280",et:"country_151",fk:"country_155",fo:"country_157",fj:"country_154",fi:"country_29",fr:"country_7",gf:"country_153",pf:"country_30",tf:"country_159",ga:"country_31",gm:"country_160",ge:"country_74",de:"country_8",gh:"country_161",gi:"country_162",gr:"country_11",gl:"country_165",gd:"country_163",gp:"country_167",gu:"country_168",gt:"country_88",gg:"country_164",gn:"country_169",gw:"country_232",gy:"country_170",ht:"country_172",va:"country_274",hn:"country_175",hk:"country_173",hu:"country_21",is:"country_33",in:"country_34",id:"country_83",ir:"country_180",iq:"country_182",ie:"country_35",im:"country_302",il:"country_54",it:"country_9",jm:"country_46",jp:"country_42",je:"country_183",jo:"country_62",kz:"country_193",ke:"country_41",ki:"country_190",kp:"country_188",kr:"country_78",kw:"country_192",kg:"country_187",la:"country_194",lv:"country_94",lb:"country_40",ls:"country_198",lr:"country_195",ly:"country_199",li:"country_197",lt:"country_58",lu:"country_39",mo:"country_201",mk:"country_205",mg:"country_200",mw:"country_204",my:"country_213",mv:"country_211",ml:"country_206",mt:"country_75",mh:"country_236",mq:"country_91",mr:"country_209",mu:"country_207",yt:"country_202",mx:"country_45",fm:"country_156",md:"country_70",mc:"country_37",mn:"country_77",me:"country_212",ms:"country_203",ma:"country_61",mz:"country_95",mm:"country_119",na:"country_275",nr:"country_221",np:"country_65",nl:"country_69",nc:"country_214",nz:"country_85",ni:"country_89",ne:"country_217",ng:"country_219",nu:"country_215",nf:"country_216",mp:"country_137",no:"country_52",om:"country_210",pk:"country_229",pw:"country_231",pa:"country_72",pg:"country_230",py:"country_225",pe:"country_55",ph:"country_80",pn:"country_226",pl:"country_48",pt:"country_12",qa:"country_233",re:"country_234",ro:"country_6",ru:"country_38",rw:"country_237",bl:"country_141",sh:"country_243",kn:"country_240",lc:"country_247",mf:"country_224",pm:"country_239",vc:"country_270",ws:"country_56",sm:"country_245",st:"country_259",sa:"country_238",sn:"country_242",rs:"country_44",sc:"country_241",sl:"country_244",sg:"country_79",sx:"country_266",sk:"country_57",si:"country_87",sb:"country_121",so:"country_246",za:"country_64",gs:"country_250",ss:"country_223",es:"country_43",lk:"country_97",sd:"country_248",sr:"country_222",sj:"country_249",se:"country_66",ch:"country_14",sy:"country_73",tw:"country_263",tj:"country_254",tz:"country_265",th:"country_253",tl:"country_261",tg:"country_258",tk:"country_256",to:"country_257",tt:"country_251",tn:"country_260",tr:"country_51",tm:"country_264",tc:"country_255",tv:"country_262",ug:"country_267",ua:"country_63",ae:"country_102",gb:"country_5",um:"country_305",us:"country_4",uy:"country_269",uz:"country_60",vu:"country_218",ve:"country_271",vn:"country_68",vg:"country_272",vi:"country_273",wf:"country_277",eh:"country_278",ye:"country_281",zm:"country_282",zw:"country_49",hm:"country_174",cv:"country_140"};o.d(t,["A",0,l])},51009(e,t,o){function n(e,t){return e&&t&&(e=e.includes("?")?`${e}&size=${t}`:`${e}?size=${t}`),e}function r(){return location.hostname.includes("localhost")||location.hostname.includes("gravelocal.com")?"https://images.gravedev.com":`https://images${location.hostname.substring(location.hostname.indexOf("."))}`}o.d(t,{N5:()=>r,nB:()=>n})}}]); //# sourceMappingURL=219.e46bf67afdb7ed521e0e.js.map