"use strict";(self.webpackChunkfindagrave_frontend=self.webpackChunkfindagrave_frontend||[]).push([[3627],{93627(e,t,o){var n=o(71757),i=o.n(n),a=(o(28575),o(54802)),r=o(37639),d=o(8747),s=function(e,t,o,n){return new(o||(o=Promise))(function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function d(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(r,d)}s((n=n.apply(e,t||[])).next())})};const l=history&&history.replaceState;class c{constructor(){this.supportsHistory=history&&history.replaceState,this.initialized=!1,this.handlerSet=!1}initializeClickHandler(){const e=this;this.handlerSet||(this.handlerSet=!0,i()(document).on("click",".board-item---img, .collage-item, #main-photo, #view-all-photos",function(){return s(this,void 0,void 0,function*(){const t=parseInt(i()(this).attr("data-photo-id"));!e.initialized&&(yield e.initializeMain(t)),e.setHash(`#view-photo=${t}`);const o=i()(".viewer-item").index(i()(".viewCurrentImg-"+t));e.carousel.to(o)})}))}initializeMain(e){return s(this,void 0,void 0,function*(){const t=this;if(this.initialized=!0,i()("#photoViewer").on("hidden.bs.modal",function(){location.hash.includes("view-photo=")&&t.setHash("")}),i()("#photo-carousel .viewer-item").each(function(){t.userIsOwner(i()(this),this.getAttribute("data-myphoto"),this.getAttribute("data-photo-id"))}),this.carousel=new d.FN("#photo-carousel",{wrap:!1}),i()("#photo-carousel").on("slide.bs.carousel",function(e){const o=i()(".viewer-item").eq(e.to);t.populateFooter(e.to),i()(".currentItemCount").html(e.to+1),t.setHash(`#view-photo=${o.attr("data-photo-id")}`),t.displayArrows(e.to)}),e){const t=i()(`.viewer-item[data-photo-id="${e}"]`);t.addClass("active"),i()("#photo-carousel .photo-indicator").removeAttr("aria-current").eq(t.index()).addClass("active").attr("aria-current","true"),i()(".currentItemCount").html(t.index()+1),this.populateFooter(t.index()),this.setHash(`#view-photo=${e}`),this.displayArrows(t.index()),e=null}})}populateFooter(e){i()("#photoViewer .modal-footer").empty().append(i()(".viewer-item .carousel-footer").eq(e).clone().removeClass("hidden")).find("[name|='photoType'][data-checked='checked']").prop("checked",!0).end().find("[data-eid]").each(function(){this.id=this.getAttribute("data-eid")})}setHash(e){if(l){const t=location.href.includes("#view-photo")?location.href.replace(/#view-photo=\d+/,e):location.href+e;history.replaceState(null,null,t)}else location.hash=e}displayArrows(e){i()("#photo-carousel button").show(),0===e&&i()("#photo-carousel .carousel-control-prev").hide(),e===i()("#photo-carousel .carousel-indicators button").length-1&&i()("#photo-carousel .carousel-control-next").hide()}destroy(){this.carousel.dispose(),i()("#photo-carousel .viewer-item").removeClass("active"),i()("#photo-carousel .photo-indicator").removeAttr("aria-current").removeClass("active"),this.initialized=!1}deleteItem(){const e=i()("#photo-carousel .viewer-item.active"),t=i()("#photo-carousel .photo-indicator.active");let o,n=e.index(),a=i()("#photo-carousel .viewer-item").length-1;n0?(this.populateFooter(o),i()(".currentItemCount").html(o+1),this.setHash(`#view-photo=${i()(".viewer-item").eq(o).attr("data-photo-id")}`),this.displayArrows(o),i()("#photo-carousel .photo-indicator").eq(o).addClass("active").attr("aria-current","true")):this.setHash("")}userIsOwner(e,t,o){findagrave.contributorId&&(e.find(".showrotatel").attr("data-id",o).removeClass("hidden"),e.find(".showrotater").attr("data-id",o).removeClass("hidden"))}}var u=o(94904),p=o(71757),f=function(e,t,o,n){return new(o||(o=Promise))(function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function d(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(r,d)}s((n=n.apply(e,t||[])).next())})};var m=o(95372),h=o(30303),y=(o(86879),o(74446),o(60842)),v=o(9336),g=o(44240),b=o(37968),w=o(77512),C=o(96083),k=o(75542),I=o(16126),S=o(56978),P=o(81160),x=o(41900),O=o(28452),E=o(38975),T=o(6276),$=o(59099),F=o(11239);function B(e){let t;try{t=window[e];let o="__storage_test__";return t.setItem(o,o),t.removeItem(o),!0}catch(e){return e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name)&&t&&0!==t.length}}var A=o(69917),_=o(51009),M=o(81846),L=o(40263),N=o.n(L),j=o(80278),J=o(17480),D=o(67927);const z="snap_polygon",H="snap-indicator-source",V="snap-indicator-layer";let R=null,U=()=>[];function q(e,t){const o=e.getSource(H);o&&o.setData({type:"FeatureCollection",features:t?[{type:"Feature",geometry:{type:"Point",coordinates:t},properties:{}}]:[]})}function W(e,t,o,n){var i;if(0===n.length)return null;const a=function(e,t){const o=e.getZoom(),n=e.getCenter().lat*Math.PI/180;return 2*Math.PI*6378137*Math.cos(n)/(256*Math.pow(2,o))*t}(o,10),r=j.point([e,t]);let d=1/0,s=null;for(const e of n){const t=e.geometry;if(!t)continue;const o=[];"Polygon"===t.type?o.push(...t.coordinates):"MultiPolygon"===t.type&&t.coordinates.forEach(e=>o.push(...e));for(const e of o){if(e.length<2)continue;let t=!1;for(const o of e){const e=J.I(r,j.point(o),{units:"meters"});e0?(e.polygon.removeCoordinate("0."+(e.currentVertexPosition-1)),e.currentVertexPosition--,0===e.currentVertexPosition&&(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(z))):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(z))},Y.onStop=function(e){R&&q(R,null),Q.onStop.call(this,e)};const G=Y;var X=o(71757),Z=function(e,t,o,n){return new(o||(o=Promise))(function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function d(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(r,d)}s((n=n.apply(e,t||[])).next())})};const{gql:K}=o(21659);let ee,te,oe,ne,ie=null,ae=[],re=[],de=[],se=null,le=new Set;const ce=new Set;let ue=[],pe=new Set,fe=[],me=null,he=[],ye=null,ve=null,ge=new Map,be=!1;function we(){return ee}function Ce(){return te}function ke(){return oe}function Ie(){return ie}function Se(e){ie=e}function Pe(){return ne}function xe(){return ae}function Oe(){return re}function Ee(e){re=e}function Te(){return de}function $e(e){de=e}function Fe(){return se}function Be(e){se=e}function Ae(){return le}function _e(){return ce}function Me(){return ue}function Le(e){ue=e}function Ne(){return pe}function je(){return fe}function Je(e){fe=e}function De(){return me}function ze(e){me=e}function He(){return he}function Ve(e){he=e}function Re(){return ye}function Ue(e){ye=e}function qe(){return ve}function We(e){ve=e}function Qe(){return ge}function Ye(e){be=e}function Ge(e){let t=0,o=0;const n=e.length;return e.forEach(e=>{t+=e[0],o+=e[1]}),[t/n,o/n]}function Xe(){var e;const t=(0,A.Ri)("overrideLanguage");if(t)return t;const o=(0,A.Ri)("preferredLanguage");if(o)return o;if(findagrave.preferredLanguage)return findagrave.preferredLanguage;const n=null===(e=navigator.language)||void 0===e?void 0:e.split("-")[0];return n||"en"}function Ze(e,t){var o,n,i;const a=null===(n=null===(o=e.geoJSON[0])||void 0===o?void 0:o.properties)||void 0===n?void 0:n.names;if(!a||0===a.length)return t?e.keyId:"";const r=Xe(),d=a.find(e=>e.language===r);if(d)return d.name;const s=a.find(e=>"en"===e.language);return s?s.name:(null===(i=a[0])||void 0===i?void 0:i.name)||e.keyId}function Ke(e){const t=X(`#language-list option[data-code="${e}"]`);return t.length>0?t.val():e}function et(e){const t=new Set,o=[...e].map(e=>re.find(t=>t.keyId===e)).filter(Boolean);for(;o.length>0;){const e=o.pop();re.filter(t=>t.sectionId===e.id).forEach(e=>{t.has(e.keyId)||(t.add(e.keyId),o.push(e))})}return t}function tt(e){const t=X(`#${e}`).text();X("#boundary-alert-message").text(t),X("#modal-boundary-alert").modal("show")}function ot(e){const t="section"===e?"#success-msg-boundary":"#success-msg-section";X("section"===e?"#success-msg-section":"#success-msg-boundary").removeClass("hidden"),X(t).addClass("hidden"),X("#modal-boundary-success").modal("show"),setTimeout(()=>X("#modal-boundary-success").modal("hide"),3e3)}function nt(e,t){t.setLayoutProperty("mapbox-satellite","visibility",e),"visible"===e?(t.setPaintProperty("place_label_city","text-color","rgba(0,0,0,1)"),t.setPaintProperty("place_label_city","text-halo-width",2),t.setFilter("road_major",["all",["==",["geometry-type"],"LineString"],["all",["match",["get","class"],["motorway","primary","trunk"],!0,!1],["match",["get","structure"],["ford","none"],!0,!1]]])):(t.setPaintProperty("place_label_city","text-color","#666666"),t.setPaintProperty("place_label_city","text-halo-width",1),t.setFilter("road_major",["all",["==",["geometry-type"],"LineString"],["all",["match",["get","class"],["motorway","primary","secondary","tertiary","trunk"],!0,!1],["match",["get","structure"],["ford","none"],!0,!1]]]))}const it=K` mutation CreateCemeteryBoundaryEdit($cemeteryBoundaryInput: [CemeteryBoundaryInput!]!, $note: String) { createCemeteryBoundaryEdit(cemeteryBoundaryInput: $cemeteryBoundaryInput, note: $note) { id dateCreated suggestedValue } } `,at=K` mutation cancelEdits($ids: [ID!]!) { cancelEdits(ids: $ids, isCemetery: true) { result } } `;function rt(e,t,o){var n,i,a,r,d;let s;if("string"==typeof o){const e=te.get(o);if(!e||"Polygon"!==e.geometry.type)return;s=e.geometry.coordinates[0]}else if(s=null===(i=null===(n=null==o?void 0:o.geometry)||void 0===n?void 0:n.coordinates)||void 0===i?void 0:i[0],!s)return;const l=`drawn-section-label-${e}`;if(!ee||ee.getSource(l))return;const c=Xe(),u=(null===(a=t.find(e=>e.language===c))||void 0===a?void 0:a.name)||(null===(r=t.find(e=>"en"===e.language))||void 0===r?void 0:r.name)||(null===(d=t[0])||void 0===d?void 0:d.name)||e,p=Ge(s);ee.addSource(l,{type:"geojson",data:{type:"Feature",geometry:{type:"Point",coordinates:p},properties:{text:u}}}),ee.addLayer({id:`drawn-section-label-layer-${e}`,type:"symbol",source:l,layout:{"text-field":["get","text"],"text-size":14,"text-anchor":"center"},paint:{"text-color":"#9b59b6","text-halo-color":"#ffffff","text-halo-width":2}})}function dt(e){const t=`drawn-section-label-layer-${e}`,o=`drawn-section-label-${e}`;(null==ee?void 0:ee.getLayer(t))&&ee.removeLayer(t),(null==ee?void 0:ee.getSource(o))&&ee.removeSource(o)}let st={},lt={};function ct(e,t,o,n,i){st=i||{},e.accessToken=findagrave.mapboxAccessToken||"pk.eyJ1IjoiYW5jZXN0cnltYXBib3giLCJhIjoiY2l5dWp3dzB5MDB1YTJxcjVzd2JrMDd4dyJ9.B9y6l3i3hEx3hy3DAMU3aQ";let a=window.map=new e.Map({container:"map_canvas_lg",style:n,minZoom:o,center:[findagrave.cemlongitude,findagrave.cemlatitude],zoom:t});return a.addControl(new e.NavigationControl,"bottom-right"),a.addControl(new e.FullscreenControl),a.addControl(new(N())({defaultLanguage:"en"})),a.addControl(new e.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!0,showUserHeading:!0})),te=new M.A({displayControlsDefault:!1,controls:{trash:!0},styles:[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"],["==","user_featureType","boundary"]],paint:{"fill-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"],["==","user_featureType","boundary"]],paint:{"fill-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"],["==","user_featureType","boundary"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"],["==","user_featureType","boundary"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-width":2}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"],["==","user_featureType","boundary"],["!=","user_pendingEdit","true"]],paint:{"fill-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"],["==","user_featureType","boundary"],["!=","user_pendingEdit","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-boundary-fill-pending",type:"fill",filter:["all",["==","$type","Polygon"],["==","user_featureType","boundary"],["==","user_pendingEdit","true"]],paint:{"fill-color":"#27ae60","fill-opacity":.1}},{id:"gl-draw-boundary-stroke-pending",type:"line",filter:["all",["==","$type","Polygon"],["==","user_featureType","boundary"],["==","user_pendingEdit","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#27ae60","line-width":2.5}},{id:"gl-draw-polygon-fill-inactive-default",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"],["!has","user_featureType"]],paint:{"fill-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active-default",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"],["!has","user_featureType"]],paint:{"fill-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-inactive-default",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"],["!has","user_featureType"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active-default",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"],["!has","user_featureType"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-width":2}},{id:"gl-draw-section-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"],["==","user_featureType","section"]],paint:{"fill-color":"#9b59b6","fill-opacity":.15}},{id:"gl-draw-section-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"],["==","user_featureType","section"]],paint:{"fill-color":"#e74c3c","fill-opacity":.15}},{id:"gl-draw-section-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"],["==","user_featureType","section"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#9b59b6","line-width":2}},{id:"gl-draw-section-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"],["==","user_featureType","section"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#e74c3c","line-width":2}},{id:"gl-draw-section-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"],["==","user_featureType","section"],["!=","user_pendingEdit","true"]],paint:{"fill-color":"#9b59b6","fill-opacity":.1}},{id:"gl-draw-section-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"],["==","user_featureType","section"],["!=","user_pendingEdit","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#9b59b6","line-width":2}},{id:"gl-draw-section-fill-highlighted",type:"fill",filter:["all",["==","$type","Polygon"],["==","user_featureType","section"],["==","user_highlighted","true"],["!=","user_pendingEdit","true"]],paint:{"fill-color":"#fbb03b","fill-opacity":.4}},{id:"gl-draw-section-stroke-highlighted",type:"line",filter:["all",["==","$type","Polygon"],["==","user_featureType","section"],["==","user_highlighted","true"],["!=","user_pendingEdit","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-width":3}},{id:"gl-draw-section-fill-pending",type:"fill",filter:["all",["==","$type","Polygon"],["==","user_featureType","section"],["==","user_pendingEdit","true"]],paint:{"fill-color":"#27ae60","fill-opacity":.2}},{id:"gl-draw-section-stroke-pending",type:"line",filter:["all",["==","$type","Polygon"],["==","user_featureType","section"],["==","user_pendingEdit","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#27ae60","line-width":2.5}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}],userProperties:!0,modes:Object.assign(Object.assign({},M.A.modes),{simple_select:Object.assign(Object.assign({},M.A.modes.simple_select),{dragMove(){}}),direct_select:Object.assign(Object.assign({},M.A.modes.direct_select),{dragFeature(){},onFeature(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()}}),draw_polygon:Object.assign(Object.assign({},M.A.modes.draw_polygon),{onTrash(e){e.currentVertexPosition>0?(e.polygon.removeCoordinate("0."+(e.currentVertexPosition-1)),e.currentVertexPosition--,0===e.currentVertexPosition&&(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode("draw_polygon"))):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode("draw_polygon"))}}),[z]:G})}),a.addControl(te),function(e,t){R=e,U=t}(a,()=>te.getAll().features.filter(e=>{var t,o,n,i;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)||"section"===(null===(o=e.properties)||void 0===o?void 0:o.featureType)||!(null===(n=e.properties)||void 0===n?void 0:n.featureType)&&"static"===(null===(i=e.properties)||void 0===i?void 0:i.mode)})),a.on("draw.selectionchange",()=>{te.getSelected().features.forEach(e=>{var t;"static"===(null===(t=e.properties)||void 0===t?void 0:t.mode)&&te.changeMode("simple_select")})}),a.on("draw.selectionchange",()=>{const e=te.getMode();if("simple_select"===e||"direct_select"===e){const e=te.getSelected().features.length>0;X("#deleteFeature").toggleClass("hidden",!e)}else X("#deleteFeature").addClass("hidden")}),a.on("draw.modechange",e=>{var t,o,n;if(e.mode===z?(!function(e){e.getSource(H)||(e.addSource(H,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),e.addLayer({id:V,type:"circle",source:H,paint:{"circle-radius":8,"circle-color":"#ffffff","circle-stroke-color":"#e74c3c","circle-stroke-width":2,"circle-opacity":.9}}))}(ee),null===(t=st.addOutOfBoundsIndicator)||void 0===t||t.call(st,ee),X("#deleteFeature").addClass("hidden")):function(e){e.getLayer(V)&&e.removeLayer(V),e.getSource(H)&&e.removeSource(H)}(ee),"direct_select"===e.mode&&"section"===ie&&!se){const e=te.getSelected().features.find(e=>{var t,o;return"section"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)&&"static"!==(null===(o=e.properties)||void 0===o?void 0:o.mode)});if(e){const t=null===(o=e.properties)||void 0===o?void 0:o.keyId,i=re.find(e=>e.keyId===t),a=i?null:fe.find(e=>e.keyId===t);if((i||a)&&t){const e=te.getAll().features.filter(e=>{var o,n;return"section"===(null===(o=e.properties)||void 0===o?void 0:o.featureType)&&(null===(n=e.properties)||void 0===n?void 0:n.keyId)===t}).map(e=>e.id);se={keyId:t,names:(null==i?void 0:i.names)||(null==a?void 0:a.names)||[],featureIds:e},X("#finishSection").removeClass("hidden"),null===(n=st.updatePendingHighlights)||void 0===n||n.call(st)}}}}),a.on("draw.create",e=>Z(this,void 0,void 0,function*(){var t;if("boundary"===ie){for(const t of e.features)te.setFeatureProperty(t.id,"featureType","boundary");return be=!0,void setTimeout(()=>te.changeMode("draw_polygon"),0)}if("section"===ie&&se){const o=e.features[0];if(!(!st.validateSectionWithinBoundary||(yield st.validateSectionWithinBoundary(o))))return te.setFeatureProperty(o.id,"featureType","section"),te.setFeatureProperty(o.id,"keyId",se.keyId),te.setFeatureProperty(o.id,"names",se.names),se.featureIds.push(o.id),ce.add(o.id),null===(t=st.updateOutOfBoundsIndicator)||void 0===t||t.call(st),void te.changeMode("direct_select",{featureId:o.id});te.setFeatureProperty(o.id,"featureType","section"),te.setFeatureProperty(o.id,"keyId",se.keyId),te.setFeatureProperty(o.id,"names",se.names),se.featureIds.push(o.id),X("#finishSection").removeClass("hidden"),X("#cancelSectionEdit").removeClass("hidden"),te.changeMode(z)}})),a.on("draw.update",e=>Z(this,void 0,void 0,function*(){var t,o,n;"boundary"===ie&&(be=!0);for(const n of e.features)if(null==se?void 0:se.featureIds.includes(n.id))pe.add(se.keyId);else if("section"===ie&&!se&&"section"===(null===(t=n.properties)||void 0===t?void 0:t.featureType)){const e=null===(o=n.properties)||void 0===o?void 0:o.keyId;e&&pe.add(e)}if("section"===ie&&pe.size>0&&(X("#finishSection").removeClass("hidden"),X("#cancelSectionEdit").removeClass("hidden")),"section"!==ie||!se)return;let i=!1;for(const t of e.features){const e=t.id;if(!se.featureIds.includes(e))continue;!st.validateSectionWithinBoundary||(yield st.validateSectionWithinBoundary(t))?ce.delete(e)&&(i=!0):ce.has(e)||(ce.add(e),i=!0)}i&&(null===(n=st.updateOutOfBoundsIndicator)||void 0===n||n.call(st))})),ee=a,oe=a.getCanvasContainer(),a}function ut(e){var t,o,n,i,a,r;if(e&&(lt=e),null===(t=window.findagrave)||void 0===t?void 0:t.hasPendingBoundary){((null===(o=window.findagrave)||void 0===o?void 0:o.edits)||[]).forEach(e=>{var t,o;const n=null===(t=e.suggestedValue)||void 0===t?void 0:t.value;if(!n||"/boundaries"!==(null===(o=e.suggestedValue)||void 0===o?void 0:o.path))return;(Array.isArray(n)?n:[n]).forEach(e=>{if("section"===e.type)return;(Array.isArray(e.geoJSON)?e.geoJSON:e.geoJSON?[e.geoJSON]:[]).forEach(e=>{if(!e)return;const t=Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),{mode:"static",featureType:"boundary",pendingEdit:"true"})});te.add(t).forEach(e=>{te.setFeatureProperty(e,"mode","static"),te.setFeatureProperty(e,"featureType","boundary"),te.setFeatureProperty(e,"pendingEdit","true")})})})})}const d=(null===(n=window.findagrave)||void 0===n?void 0:n.boundaries)||[],s=d.filter(e=>!e.type||"cemetery"===e.type),l=d.filter(e=>"section"===e.type);ae=s,re=l,s.forEach((e,t)=>{if(e.geoJSON){(Array.isArray(e.geoJSON)?e.geoJSON:[e.geoJSON]).forEach(e=>{const t=Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),{mode:"static",featureType:"boundary"})});te.add(t).forEach(e=>{te.setFeatureProperty(e,"mode","static"),te.setFeatureProperty(e,"featureType","boundary")})})}}),l.forEach((e,t)=>{if(e.geoJSON){const o=Array.isArray(e.geoJSON)?e.geoJSON:[e.geoJSON];o.forEach(t=>{const o=Object.assign(Object.assign({},t),{properties:Object.assign(Object.assign({},t.properties),{mode:"static",featureType:"section",keyId:e.keyId,names:e.names||[]})});te.add(o).forEach(e=>{te.setFeatureProperty(e,"mode","static"),te.setFeatureProperty(e,"featureType","section")})}),function(e,t,o){const n=Ze(t,!0),i=Ge(e.geometry.coordinates[0]),a=`section-label-${o}`;ee.getSource(a)||(ee.addSource(a,{type:"geojson",data:{type:"Feature",geometry:{type:"Point",coordinates:i},properties:{text:n}}}),ee.addLayer({id:`section-label-layer-${o}`,type:"symbol",source:a,layout:{"text-field":["get","text"],"text-size":14,"text-anchor":"center"},paint:{"text-color":"#9b59b6","text-halo-color":"#ffffff","text-halo-width":2}}))}(o[0],e,t)}}),re.length>0&&(null===(i=lt.renderSectionTiles)||void 0===i||i.call(lt)),fe=[];if(((null===(a=window.findagrave)||void 0===a?void 0:a.edits)||[]).forEach(e=>{var t,o;const n=null===(t=e.suggestedValue)||void 0===t?void 0:t.value;if(!n||"/boundaries"!==(null===(o=e.suggestedValue)||void 0===o?void 0:o.path))return;(Array.isArray(n)?n:[n]).forEach(t=>{var o,n;if("section"!==t.type||!t.keyId)return;const i=t.keyId,a=Array.isArray(t.geoJSON)?t.geoJSON:t.geoJSON?[t.geoJSON]:[],r=(null===(n=null===(o=a[0])||void 0===o?void 0:o.properties)||void 0===n?void 0:n.names)||t.names||[],d=[];a.forEach(e=>{if(!e)return;const t=Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),{mode:"static",featureType:"section",keyId:i,names:r,pendingEdit:"true"})}),o=te.add(t);o.forEach(e=>{te.setFeatureProperty(e,"mode","static"),te.setFeatureProperty(e,"featureType","section"),te.setFeatureProperty(e,"pendingEdit","true"),te.setFeatureProperty(e,"keyId",i)}),d.push(...o)}),d.length>0&&(fe.push({id:e.id,keyId:i,names:r,featureIds:d}),rt(i,r,a[0]))})}),fe.length>0){X("#sectionFilterToggle").hasClass("hidden")&&X("#nameFilterRow").length>0&&X("#sectionFilterToggle").removeClass("hidden"),X("#editSection").removeClass("hidden");(X("#filterModeSections").is(":checked")||X("#sectionFilterToggle").hasClass("hidden"))&&(X("#sectionList").removeClass("hidden"),X("#sectionFilterForm").removeClass("hidden")),null===(r=lt.renderSectionTiles)||void 0===r||r.call(lt)}}var pt=o(71757),ft=function(e,t,o,n){return new(o||(o=Promise))(function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function d(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(r,d)}s((n=n.apply(e,t||[])).next())})};const{gql:mt}=o(21659),ht=o(64095),yt=o(9627),vt=o(42429),gt=o(53490),bt="mapbox://styles/ancestrymapbox/cl5sijl36000414nzzh1gr6q1";let wt=[],Ct=[];const kt=new Set;let It,St,Pt,xt,Ot,Et;const Tt=new Map;let $t,Ft=0,Bt="idle",At=null,_t=null,Mt=null,Lt=null;const Nt={satView:!0,filter:"",mapBounds:null,geoHashes:null};function jt(e){pt.fn.isMapInViewport=function(){return pt(this).offset().top>pt(window).scrollTop()},Promise.resolve().then(o.t.bind(o,60842,23)).then(({default:t})=>{var o;pt("#TabMap").addClass("in").addClass("active"),function(e,t){!function(){const e=decodeURIComponent(location.hash).replace(/^#/,"").trim();if(""!==e){const[t,o,n,i]=e.split("|");Nt.satView="M"!==t,Nt.mapBounds=o&&JSON.parse(o),Nt.geoHashes=!!i&&i.split(","),Nt.filter=n&&JSON.parse(n)}}();const o={validateSectionWithinBoundary:t.validateSectionWithinBoundary,addOutOfBoundsIndicator:t.addOutOfBoundsIndicator,updateOutOfBoundsIndicator:t.updateOutOfBoundsIndicator,updatePendingHighlights:t.updatePendingHighlights,toggleBoundaryVisibility:t.toggleBoundaryVisibility};ct(e,15,7,bt,o);const n=we();n.on("load",function(){return ft(this,void 0,void 0,function*(){var e,o,i;Vt(""),function(){const e=we();let t={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:[findagrave.cemlongitude,findagrave.cemlatitude]}}]};e.addSource("cemPin",{type:"geojson",data:t}),e.addLayer({id:"cemPin",type:"symbol",source:"cemPin",layout:{"icon-image":findagrave.cemeteryIcon,"icon-size":.33,"icon-allow-overlap":!0},paint:{"icon-opacity":.95}})}(),ut({renderSectionTiles:t.renderSectionTiles});const a=Ce().getAll().features.some(e=>{var t,o;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)&&"true"===(null===(o=e.properties)||void 0===o?void 0:o.pendingEdit)});0!==xe().length||a||!(null===(e=window.findagrave)||void 0===e?void 0:e.canSuggestBoundaries)||(null===(o=window.findagrave)||void 0===o?void 0:o.hasPendingBoundary)||n.once("idle",()=>ft(this,void 0,void 0,function*(){const e=yield t.detectBoundaryFromMapbox();if(e&&e.length>0){pt("#boundaryDetectionAlert").addClass("hidden");const e=document.getElementById("toast-boundary-auto-detected");if(e){const t=new d.y8(e);t.show(),["saveAutoDetectedBoundary","editAutoDetectedBoundary","dismissAutoDetectedBoundary"].forEach(e=>{var o;null===(o=document.getElementById(e))||void 0===o||o.addEventListener("click",()=>t.hide(),{once:!0})})}}else pt("#toast-boundary-auto-detected").addClass("hidden")})),function(){const e=we();Nt.satView?nt("visible",e):(nt("none",e),pt("#satView").prop("checked",!1),pt("#mapView").prop("checked",!0));try{Nt.mapBounds&&e.fitBounds(Nt.mapBounds),Nt.geoHashes&&Nt.geoHashes.length>0&&(Nt.geoHashes.forEach(e=>{Wt(e)}),Rt(Nt.geoHashes.map(e=>({properties:{geoHash:e}})))),Nt.filter&&e.on("sourcedata",Yt)}catch(e){console.log(e)}}(),(null===(i=findagrave.boundaries)||void 0===i?void 0:i.length)>0&&n.setLayoutProperty("cemPin","visibility","none")})});const i=ke();n.boxZoom.disable(),i.addEventListener("mousedown",so,!0),i.addEventListener("touchstart",eo,{passive:!1}),i.addEventListener("touchend",no),pt("#resetNameFilter").on("click",()=>{fo(Ct.filter(e=>"summary"!==e),null,"")}),pt("#dismissPlotError").on("click",()=>pt("#plotError").addClass("hidden"));const a=document.getElementById("nameFilter");a&&(0,v.R)(a,"keyup").pipe((0,I.p)(e=>"Enter"!==e.code),(0,S.B)(200),(0,P.T)(e=>e.target.value.trim()),(0,x.F)()).subscribe(e=>{fo(Ct.filter(e=>"summary"!==e),null,e)});(0,g.h)((0,v.R)(n,"zoomend"),(0,v.R)(n,"moveend")).pipe((0,S.B)(200),(0,P.T)(()=>n.getBounds().toArray()),(0,x.F)()).subscribe(()=>{Qt(),"string"==typeof Nt.filter&&Nt.filter.trim().length>0&&fo(Ct.filter(e=>"summary"!==e),null,Nt.filter)}),pt("#filterResults").on("click",".filter-row",function(e){return ft(this,void 0,void 0,function*(){pt(".filter-row").removeClass("bg-secondary"),pt(this).addClass("bg-secondary");const t=pt(e.currentTarget);let[o,n,i,a,r,d,s,l]=["id","first","last","coordinates","birth","death","source","sourceid"].map(e=>t.data(e));a=a.split(","),zt(s,l);let c=null;Tt.has(o)?c=Tt.get(o):(c=yield Dt(o),Tt.set(o,c||null)),Ut(ht.render({id:o,name:{first:n,last:i},date:{death:d,birth:r},photos:c}),a)})}),n.on("mousemove",function(e){let t=n.queryRenderedFeatures(e.point,{layers:[...Ct.filter(e=>"summary"!==e),...wt.filter(e=>"markersSum"!==e).map(e=>e+"-highlighted")]});n.getCanvas().style.cursor=t.length?"pointer":""}),n.on("click",function(e){return ft(this,void 0,void 0,function*(){if(Date.now()-Ft<300)return;const t=[...Ct,"cemPin"];let o=n.queryRenderedFeatures(e.point,{layers:t});if(o&&o.length>0){const e=o[0],t=e.geometry.coordinates;if((e.properties.id||e.properties.cluster_id)&&zt(e.source,e.id),e.properties.geoHash)return Wt(e.properties.geoHash),Vt(e.properties.geoHash),void Qt();if(e.properties.cluster_id){const o=yield mo(e,11);o.forEach(e=>qt(e));const n=e.properties.point_count>10?e.properties.point_count-10:void 0;Ut(yt.render({memorials:o,moreCount:null==n?void 0:n.toLocaleString()}),t)}else if(e.properties.id){if(!Tt.has(e.properties.id)){const t=yield Dt(e.properties.id);Tt.set(e.properties.id,t||null)}e.properties.photos=Tt.get(e.properties.id),qt(e),Ut(ht.render(e.properties),t)}else{const[e,o]=t;Ut(gt.render({name:findagrave.name,lat:o.toFixed(5),lon:e.toFixed(5),directionsUrl:Jt(e,o),needLocation:"cemetery-nonprecise"===findagrave.cemeteryIcon}),t)}}})}),pt("#satView").on("click",()=>{Nt.satView=!0,nt("visible",we())}),pt("#mapView").on("click",()=>{Nt.satView=!1,nt("none",we())}),pt("#showPlot").on("change",e=>{const t=e.target.checked,o=we();[...Ct,...Ct.filter(e=>"summary"!==e).map(e=>e+"-highlighted"),...Ct.filter(e=>e.includes("cluster")||"summary"===e).map(e=>e+"-count")].forEach(e=>o.setLayoutProperty(e,"visibility",t?"visible":"none")),pt("#shiftDragTip").toggleClass("hidden",t),pt("#help").text(`${pt("#help").data(t?"tips":"moretips")}`)}),pt("#showCem").on("change",e=>{const t=e.target.checked;we().setLayoutProperty("cemPin","visibility",t?"visible":"none")});const r=pt("#showBoundary");r.length&&r.on("change",e=>{const o=e.target.checked;t.toggleBoundaryVisibility(o)});pt("#help").data("moretips",pt("#help").text()),n.on("error",e=>{Et=e,pt("#plotError").removeClass("hidden"),Ht()})}(t,e),null===(o=we())||void 0===o||o.resize()})}function Jt(e,t){return/iPhone|iPad|iPod|Macintosh/.test(navigator.userAgent)?`https://maps.apple.com/?daddr=${t},${e}`:`https://maps.google.com/maps/dir/?api=1&destination=${t},${e}`}function Dt(e){return ft(this,void 0,void 0,function*(){var t,o,n,i,a,r,d;const s=yield Pe().query({query:mt` query getDefaultPhoto($ids: [ID!]!) { memorialsById(ids:$ids) { photos(type: grave) { photos { path } } } } `,variables:{ids:[e]}});return(0,_.nB)(!s.errors&&(null===(d=null===(r=null===(a=null===(i=null===(n=null===(o=null===(t=s.data)||void 0===t?void 0:t.memorialsById)||void 0===o?void 0:o[0])||void 0===n?void 0:n.photos)||void 0===i?void 0:i.photos)||void 0===a?void 0:a[0])||void 0===r?void 0:r.path)||void 0===d?void 0:d.replace("photos250","")),"photoThumbnails")})}function zt(e,t){const o=we();if(Ot){const[e,t]=Ot.split(":");o.removeFeatureState({source:e,id:t},"selected")}Ot=`${e}:${t}`,o.setFeatureState({source:e,id:t},{selected:!0})}function Ht(){(Et||we().loaded())&&(pt("#loader").addClass("hidden"),we().off("render",Ht))}function Vt(e){return ft(this,void 0,void 0,function*(){const t=we(),o=""===e&&findagrave.gpsCount>9500;if(ho()&&(pt("#resetPlot").removeClass("hidden").one("click",ao),o))return function(){return ft(this,void 0,void 0,function*(){const e=yield fetch(`/memorialPlot/${findagrave.cemeteryId}?summary=true`);if(e.ok){Rt((yield e.json()).features)}})}();if(void 0!==t.getSource(`${e}markers${o?"Sum":""}`))return;wt.push(`${e}markers${o?"Sum":""}`),t.addSource(`${e}markers${o?"Sum":""}`,{type:"geojson",data:`/memorialPlot/${findagrave.cemeteryId}?summary=${o}&geoHash=${e}&mr=${findagrave.mostRecentMemorial}`,cluster:!0,clusterRadius:0,clusterMaxZoom:21,clusterMinPoints:2,generateId:!0});if(o)ho()||(pt("#plotAll").one("click",io),pt("#alwaysPlot").one("click",ro),pt("#plotAllGroup").removeClass("hidden")),Ct.push("summary"),t.addLayer({id:"summary",type:"circle",source:"markersSum",paint:{"circle-color":"#E01080","circle-radius":18}}),t.addLayer({id:"summary-count",type:"symbol",source:"markersSum",layout:{"text-field":"{count_k}","text-font":["DIN Offc Pro Medium","Arial Unicode MS Bold"],"text-size":16},paint:{"text-color":"#ffffff"}});else{Ct.push(`${e}markers`,`${e}icon-markers`,`${e}cluster`),pt("#nameFilterRow").removeClass("hidden");const o="ontouchstart"in window?10:6;pt("#loader").removeClass("hidden"),t.on("render",Ht),t.addLayer({id:`${e}markers`,type:"circle",source:`${e}markers`,minzoom:13,maxzoom:20,paint:{"circle-color":["case",["has","noPhoto"],"#FDB32B","#DD1B80"],"circle-radius":["interpolate",["linear"],["zoom"],18,["case",["boolean",["feature-state","selected"],!1],o+4,o],20,["case",["boolean",["feature-state","selected"],!1],13,17]],"circle-stroke-color":"#ffffff","circle-stroke-width":["interpolate",["linear"],["zoom"],18,["case",["boolean",["feature-state","selected"],!1],3,1],21,["case",["boolean",["feature-state","selected"],!1],7,4]]}}),t.addLayer({id:`${e}markers-highlighted`,type:"circle",source:`${e}markers`,minzoom:13,maxzoom:20,paint:{"circle-color":["case",["has","noPhoto"],"#29D6FF","#2487FB"],"circle-radius":["interpolate",["linear"],["zoom"],18,["case",["boolean",["feature-state","selected"],!1],o+4,o],20,["case",["boolean",["feature-state","selected"],!1],13,17]],"circle-stroke-color":"#ffffff","circle-stroke-width":["interpolate",["linear"],["zoom"],18,["case",["boolean",["feature-state","selected"],!1],3,1],21,["case",["boolean",["feature-state","selected"],!1],7,4]]},filter:["in","id",""]}),t.addLayer({id:`${e}icon-markers`,type:"symbol",source:`${e}markers`,minzoom:19,layout:{"icon-allow-overlap":!0,"icon-image":["case",["has","noPhoto"],"memorialPlotNoPhoto","memorialPlot"],"icon-size":["interpolate",["linear"],["zoom"],19,.33,21,.75]},paint:{"icon-opacity":["interpolate",["linear"],["zoom"],19,0,21,1]},filter:["!has","point_count"]}),t.addLayer({id:`${e}icon-markers-highlighted`,type:"symbol",source:`${e}markers`,minzoom:19,layout:{"icon-allow-overlap":!0,"icon-image":["case",["has","noPhoto"],"memorialPlotNoPhotoSelected","memorialPlotSelected"],"icon-size":["interpolate",["linear"],["zoom"],19,.33,21,.75]},paint:{"icon-opacity":["interpolate",["linear"],["zoom"],19,0,21,1]},filter:["all",["in","id",""],["!has","point_count"]]}),t.addLayer({id:`${e}cluster`,type:"circle",source:`${e}markers`,minzoom:13,paint:{"circle-color":"#E01080","circle-radius":["step",["get","point_count"],12,10,15]},filter:[">=","point_count",2]}),t.addLayer({id:`${e}cluster-highlighted`,type:"circle",source:`${e}markers`,minzoom:13,paint:{"circle-color":"#2487FD","circle-radius":["step",["get","point_count"],12,10,15]},filter:["all",[">=","point_count",2],["in","id",""]]}),t.addLayer({id:`${e}cluster-count`,type:"symbol",source:`${e}markers`,minzoom:13,layout:{"text-field":"{point_count_abbreviated}","text-font":["DIN Offc Pro Medium","Arial Unicode MS Bold"],"text-size":16},paint:{"text-color":"#ffffff"},filter:[">=","point_count",2]})}})}function Rt(e){const t=we();return new Promise((o,n)=>{(0,b.H)(e).pipe((0,O.Z)(e=>ft(this,void 0,void 0,function*(){let o=(0,w.s)((0,C.Y)(100).pipe((0,I.p)(()=>t.isSourceLoaded(`${e.properties.geoHash}markers`)),(0,E.s)(1)));return Vt(e.properties.geoHash),yield o,e.properties.geoHash}),3)).subscribe({complete:()=>{o("done")},error:e=>n(e)})})}function Ut(e,t){null==$t||$t.remove(),$t=(new y.Popup).setLngLat(t).setHTML(e).addTo(we())}function qt(e,t=["date","name"]){t.forEach(t=>{"string"==typeof e.properties[t]&&(e.properties[t]=JSON.parse(e.properties[t]))})}function Wt(e){const t=we();if(t.getLayer("summary")){kt.add(e);const o=["!in","geoHash"];kt.forEach(e=>""!==e.trim()&&o.push(e)),t.setFilter("summary",o),t.setFilter("summary-count",o)}}function Qt(){const e=we(),t=Nt.satView?"S":"M";let o="";ho()||(o=wt.filter(e=>!["markersSum","summary","markers"].includes(e)).map(e=>e.replace("markers","")).join(","));const n=[t,JSON.stringify(e.getBounds().toArray()),Nt.filter?JSON.stringify(Nt.filter):"",o].map(e=>e||"").join("|");history.replaceState(null,"",`${location.origin}${location.pathname}${location.search}#${encodeURIComponent(n)}`)}function Yt(){const e=we();if(!wt.find(t=>!e.isSourceLoaded(t)))if(e.loaded())if(e.off("sourcedata",Yt),"string"!=typeof Nt.filter)try{let[e,t]=Nt.filter;po([new y.Point(e.x,e.y),new y.Point(t.x,t.y)])}catch(e){}else pt("#nameFilter").val(Nt.filter).trigger("focus").trigger("blur"),fo(Ct.filter(e=>"summary"!==e),null,Nt.filter);else!xt&&(xt=setTimeout(()=>{Yt(),xt=null},100))}function Gt(e){const t=ke();var o=t.getBoundingClientRect();return new y.Point(e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop)}function Xt(e){const t=ke(),o=t.getBoundingClientRect();return new y.Point(e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop)}function Zt(e,t){const o=ke();Pt||(Pt=document.createElement("div"),Pt.classList.add("boxdraw"),o.appendChild(Pt));const n=Math.min(e.x,t.x),i=Math.max(e.x,t.x),a=Math.min(e.y,t.y),r=Math.max(e.y,t.y),d=`translate(${n}px,${a}px)`;Pt.style.transform=d,Pt.style.WebkitTransform=d,Pt.style.width=i-n+"px",Pt.style.height=r-a+"px"}function Kt(){var e;null!==At&&(clearTimeout(At),At=null),Pt&&(null===(e=Pt.parentNode)||void 0===e||e.removeChild(Pt),Pt=null),Bt="idle",_t=null,Mt=null,Lt=null,we().dragPan.enable(),document.removeEventListener("touchmove",to),document.removeEventListener("touchend",oo)}function eo(e){if(e.touches.length>1)return Lt=null,void Kt();Lt={x:e.touches[0].clientX,y:e.touches[0].clientY,time:Date.now()},_t=Xt(e.touches[0]),Mt={x:e.touches[0].clientX,y:e.touches[0].clientY},Bt="waiting_for_longpress",At=setTimeout(()=>{var e;Bt="area_selecting",Lt=null,null===(e=navigator.vibrate)||void 0===e||e.call(navigator,50),we().dragPan.disable()},500),document.addEventListener("touchmove",to,{passive:!1}),document.addEventListener("touchend",oo)}function to(e){if(e.touches.length>1)Kt();else if("waiting_for_longpress"===Bt){const t=e.touches[0].clientX-Mt.x,o=e.touches[0].clientY-Mt.y;Math.sqrt(t*t+o*o)>10&&(null!==At&&(clearTimeout(At),At=null),Bt="idle",_t=null,Mt=null,Lt=null,document.removeEventListener("touchmove",to),document.removeEventListener("touchend",oo))}else if("area_selecting"===Bt){e.preventDefault();const t=Xt(e.touches[0]);Zt(_t,t)}}function oo(e){if("waiting_for_longpress"===Bt)null!==At&&(clearTimeout(At),At=null),Bt="idle",_t=null,Mt=null;else if("area_selecting"===Bt){const t=Xt(e.changedTouches[0]);po([_t,t]),Bt="idle",_t=null,Mt=null}document.removeEventListener("touchmove",to),document.removeEventListener("touchend",oo)}function no(e){return ft(this,void 0,void 0,function*(){if(1!==e.changedTouches.length||"area_selecting"===Bt)return;if(!Lt)return;const t=e.changedTouches[0],o=t.clientX-Lt.x,n=t.clientY-Lt.y,i=Math.sqrt(o*o+n*n),a=Date.now()-Lt.time;if(i>15||a>400)return void(Lt=null);Lt=null;const r=we(),d=Xt(t),s=[new y.Point(d.x-12,d.y-12),new y.Point(d.x+12,d.y+12)],l=[...Ct,"cemPin"];let c=r.queryRenderedFeatures(s,{layers:l});if(c&&c.length>0){Ft=Date.now();const e=c[0],t=e.geometry.coordinates;if((e.properties.id||e.properties.cluster_id)&&zt(e.source,e.id),e.properties.geoHash)return Wt(e.properties.geoHash),Vt(e.properties.geoHash),void Qt();if(e.properties.cluster_id){const o=yield mo(e,11);o.forEach(e=>qt(e));const n=e.properties.point_count>10?e.properties.point_count-10:void 0;Ut(yt.render({memorials:o,moreCount:null==n?void 0:n.toLocaleString()}),t)}else if(e.properties.id){if(!Tt.has(e.properties.id)){const t=yield Dt(e.properties.id);Tt.set(e.properties.id,t||null)}e.properties.photos=Tt.get(e.properties.id),qt(e),Ut(ht.render(e.properties),t)}else{const[e,o]=t;Ut(gt.render({name:findagrave.name,lat:o.toFixed(5),lon:e.toFixed(5),directionsUrl:Jt(e,o),needLocation:"cemetery-nonprecise"===findagrave.cemeteryIcon}),t)}}})}function io(){return ft(this,void 0,void 0,function*(){const e=we();if(pt("#plotAll").prop("disabled",!0),e.getLayer("summary")){const t=e.querySourceFeatures("markersSum");e.removeLayer("summary").removeLayer("summary-count").removeSource("markersSum"),Ct=Ct.filter(e=>!e.includes("summary")),wt=wt.filter(e=>"markersSum"!==e),yield Rt(t)}Qt()})}function ao(){B("localStorage")?delete localStorage.plotAll:(0,A.zs)("plotAll"),pt("#resetPlot").addClass("hidden"),pt("#plotAllGroup").removeClass("hidden"),pt("#plotAll").one("click",io),pt("#alwaysPlot").one("click",ro)}function ro(){pt("#resetPlot").removeClass("hidden").one("click",ao),pt("#plotAllGroup").addClass("hidden");const e=(0,A.kQ)();return B("localStorage")?localStorage.plotAll=!0:e.pref&&(0,A.TV)("plotAll","true"),io(),!1}function so(e){e.shiftKey&&0===e.button&&(we().dragPan.disable(),document.addEventListener("mousemove",lo),document.addEventListener("mouseup",co),document.addEventListener("keydown",uo),It=Gt(e))}function lo(e){St=Gt(e),Zt(It,St)}function co(e){po([It,Gt(e)])}function uo(e){27===e.keyCode&&po()}function po(e){pt("#nameFilter").val(""),document.removeEventListener("mousemove",lo),document.removeEventListener("keydown",uo),document.removeEventListener("mouseup",co),Pt&&(Pt.parentNode.removeChild(Pt),Pt=null),fo(Ct,e),we().dragPan.enable()}function fo(e,t,o){return ft(this,void 0,void 0,function*(){const n=we();pt("#tooMany").addClass("hidden"),Nt.filter=t||o,Qt();try{if(void 0!==t){const[i,a]=(0,k.j)((0,b.H)(n.queryRenderedFeatures(t,{layers:e})),e=>e.properties.cluster),[r,d]=(0,k.j)(a,e=>e.properties.geoHash),s=i.pipe((0,O.Z)(e=>mo(e,200)),(0,O.Z)(e=>e));let l=yield(0,w.s)((0,g.h)(s,d).pipe((0,I.p)(function(e){return o&&""!==o.trim()?!!e.properties.name&&(qt(e,["name"]),`${e.properties.name.first} ${e.properties.name.last}`.toLowerCase().includes(o.toLowerCase())):!!t}),(0,T.d)(e=>e.properties.id),(0,E.s)(200),(0,$.M)(qt),(0,F.$)(),(0,P.T)(e=>e.sort((e,t)=>e.properties.name.last.localeCompare(t.properties.name.last)||e.properties.name.first.localeCompare(t.properties.name.first)))));l.length>=200&&pt("#tooMany").removeClass("hidden"),r.pipe((0,$.M)(e=>{Wt(e.properties.geoHash),Qt()}),(0,F.$)()).subscribe(Rt);let c=l.reduce(function(e,t){return t.properties.cluster_id?e.cluster_id.push(t.properties.cluster_id):e.id.push(t.properties.id),e},{id:[],cluster_id:[]});e.filter(e=>/markers$/.test(e)).map(e=>e+"-highlighted").forEach(e=>n.setFilter(e,["in","id",...c.id])),e.filter(e=>/cluster$/.test(e)).map(e=>e+"-highlighted").forEach(e=>n.setFilter(e,["all",[">=","point_count",2],["in","cluster_id",...c.cluster_id]])),pt("#filterResults").html(function(e){return vt.render({features:e.map(e=>Object.assign(Object.assign({},e.properties),{coordinates:e.geometry.coordinates,source:e.source,sourceId:e.id}))})}(l)).removeClass("hidden")}}catch(e){console.log(e)}})}function mo(e,t){const o=we();return new Promise((n,i)=>{o.getSource(e.source).getClusterLeaves(e.properties.cluster_id,Math.min(t,e.properties.point_count),0,(t,o)=>{t?i(t):n(o.map(t=>(t.properties.cluster_id=e.properties.cluster_id,t.id=t.id||e.id,t.source=t.source||e.source,t)))})})}function ho(){return B("localStorage")?!!localStorage.plotAll:!!(0,A.Ri)("plotAll")}var yo=o(71757),vo=function(e,t,o,n){return new(o||(o=Promise))(function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function d(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(r,d)}s((n=n.apply(e,t||[])).next())})};let go={};let bo=!1;function wo(e){const t=we();t.getSource("detected-boundary")||(t.addSource("detected-boundary",{type:"geojson",data:{type:"FeatureCollection",features:e}}),t.addLayer({id:"detected-boundary-fill",type:"fill",source:"detected-boundary",paint:{"fill-color":"#fbb03b","fill-opacity":.3}}),t.addLayer({id:"detected-boundary-outline",type:"line",source:"detected-boundary",paint:{"line-color":"#fbb03b","line-width":3,"line-dasharray":[2,2]}}))}function Co(){const e=we();e.getLayer("detected-boundary-fill")&&e.removeLayer("detected-boundary-fill"),e.getLayer("detected-boundary-outline")&&e.removeLayer("detected-boundary-outline"),e.getSource("detected-boundary")&&e.removeSource("detected-boundary")}function ko(){var e;const t=xe(),o=Oe(),n=je(),i=t.length>0||(null===(e=window.findagrave)||void 0===e?void 0:e.hasPendingBoundary),a=o.length>0||n.length>0;i?(yo("#detectBoundary, #drawBoundary").addClass("hidden"),yo("#editBoundary, #addSection, #boundaryDivider").removeClass("hidden")):(yo("#detectBoundary, #drawBoundary").removeClass("hidden"),yo("#editBoundary, #addSection, #boundaryDivider").addClass("hidden")),a?yo("#editSection").removeClass("hidden"):yo("#editSection").addClass("hidden")}function Io(){return vo(this,void 0,void 0,function*(){if(xe().length>0)return yo("#modal-boundary-exists").modal("show"),null;const e=we().queryRenderedFeatures({layers:["landuse","landuse-overlay"]}).filter(e=>{var t,o,n,i;return"cemetery"===(null===(t=e.properties)||void 0===t?void 0:t.class)||"cemetery"===(null===(o=e.properties)||void 0===o?void 0:o.type)||"cemetery"===(null===(n=e.properties)||void 0===n?void 0:n.landuse)||"grave_yard"===(null===(i=e.properties)||void 0===i?void 0:i.amenity)});if(e.length>0){const t=yield o.e(3375).then(o.bind(o,43375));let n=t.featureCollection(e.map(e=>t.feature(e.geometry)));try{const o=t.union(n),i=o?[o]:e;Ve(i),wo(i)}catch(t){Ve(e),wo(e)}return yo("#boundaryDetectionAlert").removeClass("hidden"),yo("#boundariesDropdownContainer").addClass("hidden"),yo("#boundariesActiveBtnContainer").removeClass("hidden"),He()}return null})}function So(){const e=He(),t=Ce();e.length>0&&(e.forEach(e=>{if("MultiPolygon"===e.geometry.type)e.geometry.coordinates.forEach(e=>{const o={type:"Feature",geometry:{type:"Polygon",coordinates:e},properties:{featureType:"boundary"}},n=t.add(o);n&&n.length>0&&t.changeMode("direct_select",{featureId:n[0]})});else{const o={type:"Feature",geometry:e.geometry,properties:{featureType:"boundary"}},n=t.add(o);n&&n.length>0&&t.changeMode("direct_select",{featureId:n[0]})}}),Co(),yo("#boundaryDetectionAlert").addClass("hidden"),yo("#saveBoundary").removeClass("hidden"),yo("#cancelBoundary").removeClass("hidden"))}function Po(){Co(),Ve([]),yo("#boundaryDetectionAlert").addClass("hidden")}function xo(){if("section"===Ie())return void tt("i18n-alert-boundary-while-section");const e=Ce(),t=e.getAll().features;if(0===t.length)return;Se("boundary"),yo("#boundariesDropdownContainer").addClass("hidden"),yo("#boundariesActiveBtnContainer").removeClass("hidden");const o=t.filter(e=>{var t;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)}),n=[];o.forEach(t=>{var o;"MultiPolygon"===t.geometry.type?(e.delete(t.id),t.geometry.coordinates.forEach(t=>{const o={type:"Feature",geometry:{type:"Polygon",coordinates:t},properties:{featureType:"boundary"}},i=e.add(o);i&&i.length>0&&n.push(i[0])})):("static"===(null===(o=t.properties)||void 0===o?void 0:o.mode)&&e.setFeatureProperty(t.id,"mode",""),n.push(t.id))}),1===n.length?e.changeMode("direct_select",{featureId:n[0]}):e.changeMode("simple_select",{featureIds:n}),yo("#saveBoundary").removeClass("hidden"),yo("#cancelBoundary").removeClass("hidden"),yo("#addBoundaryPolygon").removeClass("hidden")}function Oo(){const e=null===findagrave||void 0===findagrave?void 0:findagrave.cemlatitude,t=null===findagrave||void 0===findagrave?void 0:findagrave.cemlongitude,o=Ce();if(e&&t&&o){const n=o.getAll().features.filter(e=>{var t;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)});if(n.length>0){const o=Ge(n[0].geometry.coordinates[0]);if(function(e,t,o,n){const i=(o-e)*Math.PI/180,a=(n-t)*Math.PI/180,r=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e*Math.PI/180)*Math.cos(o*Math.PI/180)*Math.sin(a/2)*Math.sin(a/2);return 7917.6*Math.atan2(Math.sqrt(r),Math.sqrt(1-r))}(e,t,o[1],o[0])>2){if(n.length>1){const e=yo("#i18n-multiple-polygons-confirm").text().replace("{count}",String(n.length));yo("#modal-boundary-far-body").append(`

${e}

`)}return void yo("#modal-boundary-far-warning").modal("show")}}if(n.length>1){const e=yo("#i18n-multiple-polygons-confirm").text().replace("{count}",String(n.length));return yo("#multiple-polygons-message").text(e),void yo("#modal-boundary-multiple-polygons").modal("show")}}yo("#boundary-explanation-textarea").val(""),yo("#modal-boundary-explanation").modal("show")}function Eo(){return vo(this,void 0,void 0,function*(){const e=yo("#boundary-explanation-textarea").val().trim();yo("#modal-boundary-explanation").modal("hide"),yield function(e){return vo(this,void 0,void 0,function*(){var t,o,n,i,a,r;const d=null===(t=window.findagrave)||void 0===t?void 0:t.cemeteryId,s=Ce(),l=s.getAll(),c=xe(),u=bo?[]:l.features.filter(e=>{var t;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)}),p=e||"Boundary suggestion from map",f=Pe();if(0===u.length){if(!(null===(o=c[0])||void 0===o?void 0:o.id))return;try{(null===(n=(yield f.mutate({mutation:it,variables:{cemeteryBoundaryInput:[{id:c[0].id,type:"cemetery",locationId:d,op:"delete",geoJSON:[]}],note:p}})).data)||void 0===n?void 0:n.createCemeteryBoundaryEdit)&&(ot("boundary"),Se(null),Ye(!1),bo=!1,s.changeMode("simple_select"),yo("#saveBoundary").addClass("hidden"),yo("#cancelBoundary").addClass("hidden"),yo("#addBoundaryPolygon").addClass("hidden"),yo("#boundariesActiveBtnContainer").addClass("hidden"),yo("#boundariesDropdownContainer").removeClass("hidden"),window.findagrave.hasPendingBoundary=!0,ko())}catch(e){console.error("Failed to delete boundary:",e),yo("#modal-boundary-error").modal("show")}return}const m=[];u.forEach(e=>{"MultiPolygon"===e.geometry.type?e.geometry.coordinates.forEach(e=>m.push(e)):"Polygon"===e.geometry.type&&m.push(e.geometry.coordinates)});const h={type:"Feature",geometry:{type:"MultiPolygon",coordinates:m},properties:{featureType:"boundary"}};try{(null===(r=(yield f.mutate({mutation:it,variables:{cemeteryBoundaryInput:[Object.assign(Object.assign({},(null===(i=c[0])||void 0===i?void 0:i.id)?{id:c[0].id}:{}),{type:"cemetery",locationId:d,op:(null===(a=c[0])||void 0===a?void 0:a.id)?"update":"add",geoJSON:[h]})],note:p}})).data)||void 0===r?void 0:r.createCemeteryBoundaryEdit)&&(ot("boundary"),Se(null),Ye(!1),bo=!1,s.changeMode("simple_select"),yo("#saveBoundary").addClass("hidden"),yo("#cancelBoundary").addClass("hidden"),yo("#addBoundaryPolygon").addClass("hidden"),yo("#boundariesActiveBtnContainer").addClass("hidden"),yo("#boundariesDropdownContainer").removeClass("hidden"),window.findagrave.hasPendingBoundary=!0,ko())}catch(e){console.error("Failed to save boundary:",e),yo("#modal-boundary-error").modal("show")}})}(e||void 0)})}function To(e){const t=we(),o=Ce();if(!t||!o)return;const n=e?"visible":"none";window.map.getStyle().layers.filter(e=>{var t;return null===(t=e.source)||void 0===t?void 0:t.includes("mapbox-gl-draw")}).forEach(e=>{t.setLayoutProperty(e.id,"visibility",n)});xe().forEach((e,o)=>{const i=`boundary-label-layer-${o}`;t.getLayer(i)&&t.setLayoutProperty(i,"visibility",n)});Oe().forEach((e,o)=>{const i=`section-label-layer-${o}`;t.getLayer(i)&&t.setLayoutProperty(i,"visibility",n)});const i=Te(),a=je();[...i.map(e=>e.keyId),...a.map(e=>e.keyId)].forEach(e=>{const o=`drawn-section-label-layer-${e}`;t.getLayer(o)&&t.setLayoutProperty(o,"visibility",n)})}o(81920),o(25938),o(71757);function $o(e){let t=0;return e.children("[data-idx]").each((e,o)=>{const n=Number(o.getAttribute("data-idx"))||0;n>t&&(t=n)}),t+1}var Fo=o(71757),Bo=function(e,t,o,n){return new(o||(o=Promise))(function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function d(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(r,d)}s((n=n.apply(e,t||[])).next())})};const Ao=o(53406);let _o={};let Mo=null;function Lo(){if("edit-names"===Re()&&Mo){const e=(Fo("#section-keyId").val()||"").trim();if(0===e.length)return void Fo("#submitSectionDetails").prop("disabled",!0);if(e!==Mo.keyId)return void Fo("#submitSectionDetails").prop("disabled",!1);if((Fo("#section-parent-select").val()||"")!==(Mo.parentId||""))return void Fo("#submitSectionDetails").prop("disabled",!1);const t=[];Fo("#section-name-list").find(".row[data-idx]").each(function(){const e=Fo(this).data("idx"),o=Fo(`#sectionName-${e}`).val()||"",n=Fo(`#sectionNameLang-${e}`).val()||"";""!==o.trim()&&t.push({name:o.trim(),language:n})});const o=Mo.names,n=t.length!==o.length||t.some((e,t)=>{var n,i;return e.name!==(null===(n=o[t])||void 0===n?void 0:n.name)||e.language!==(null===(i=o[t])||void 0===i?void 0:i.language)});Fo("#submitSectionDetails").prop("disabled",!n)}else{const e=(Fo("#section-keyId").val()||"").trim();Fo("#submitSectionDetails").prop("disabled",0===e.length)}}const No="out-of-bounds-indicator-source",jo="__pending_boundary__";function Jo(e){if(!e||e===jo)return"cemetery";return xe().some(t=>t.id===e)?"cemetery":"section"}function Do(e){var t,o;const n=xe(),i=Oe(),a=Fo("#i18n-section-parent-boundary").text(),r=null===(t=window.findagrave)||void 0===t?void 0:t.hasPendingBoundary,d=(null===(o=n[0])||void 0===o?void 0:o.id)||(r?jo:""),s=Fo("#section-parent-select");s.empty(),s.append(``);const l=new Set;e&&(l.add(e),et(new Set([e])).forEach(e=>l.add(e)));[...i].filter(e=>e.id&&!l.has(e.keyId)).sort((e,t)=>Ze(e,!0).localeCompare(Ze(t,!0),void 0,{numeric:!0,sensitivity:"base"})).forEach(e=>{s.append(``)})}function zo(e){return Bo(this,void 0,void 0,function*(){const t=yield o.e(3375).then(o.bind(o,43375)),n=Ce().getAll().features.filter(e=>{var t,o,n;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)||!(null===(o=e.properties)||void 0===o?void 0:o.featureType)&&"static"===(null===(n=e.properties)||void 0===n?void 0:n.mode)});if(0===n.length)return!1;for(const o of n)try{const n=t.buffer(o,.5,{units:"meters"});if(n&&t.booleanWithin(e,n))return!0}catch(e){console.error("Containment validation error:",e)}return!1})}function Ho(e){e.getSource(No)||(e.addSource(No,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),e.addLayer({id:"out-of-bounds-indicator-fill",type:"fill",source:No,paint:{"fill-color":"#e74c3c","fill-opacity":.3}}),e.addLayer({id:"out-of-bounds-indicator-stroke",type:"line",source:No,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#e74c3c","line-width":2}}))}function Vo(){const e=we(),t=Ce(),o=_e(),n=null==e?void 0:e.getSource(No);if(!n)return;const i=t.getAll().features;n.setData({type:"FeatureCollection",features:i.filter(e=>o.has(e.id)).map(e=>({type:"Feature",id:e.id,geometry:e.geometry,properties:{}}))})}function Ro(){return Bo(this,void 0,void 0,function*(){var e,t,o,n,i,a,r,d,s,l,c,u;const p=xe(),f=Oe(),m=je(),h=(Me(),[]);let y=!1;if(Fo("#section-name-list").find(".row[data-idx]").each(function(){const e=Fo(this).data("idx"),t=Fo(`#sectionName-${e}`).val(),o=Fo(`#sectionNameLang-${e}`).val();if(t&&""!==t.trim()){if(!o||""===o.trim())return Fo("#section-name-language-alert").removeClass("hidden"),y=!0,!1;const e=function(e){const t=X(`#language-list option[value="${e}"]`);return t.length>0?t.data("code"):null}(o);e&&h.push({name:t.trim(),language:e})}}),y)return;if("edit-names"===Re()&&qe()){const d=qe(),s=(Fo("#section-keyId").val()||"").trim();if(!s)return void Fo("#section-keyId-alert").removeClass("hidden");if(s!==d){if([...f.map(e=>e.keyId),...je().map(e=>e.keyId)].includes(s))return void Fo("#section-keyId-duplicate-alert").removeClass("hidden")}const l=null===(e=window.findagrave)||void 0===e?void 0:e.hasPendingBoundary,c=Fo("#section-parent-select").val()||(null===(t=p[0])||void 0===t?void 0:t.id)||(l?jo:void 0),u=(Fo("#section-explanation").val()||"").trim()||void 0,m=null===(o=window.findagrave)||void 0===o?void 0:o.cemeteryId,y=Pe(),v=Ce(),g=f.find(e=>e.keyId===d),b=v.getAll().features.filter(e=>{var t,o;return"section"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)&&(null===(o=e.properties)||void 0===o?void 0:o.keyId)===d}),w=b.map(e=>({type:"Feature",geometry:e.geometry,properties:{keyId:s,names:h}})),C=[Object.assign(Object.assign({},(null==g?void 0:g.id)?{id:g.id}:{}),{type:"section",locationId:m,sectionId:c===jo?void 0:c,sectionIdType:Jo(c),op:"update",keyId:s,geoJSON:w})];try{const{data:e}=yield y.mutate({mutation:it,variables:{cemeteryBoundaryInput:C,note:u}}),t=(null===(n=null==e?void 0:e.createCemeteryBoundaryEdit)||void 0===n?void 0:n.id)||"";g&&(g.keyId=s,g.names=h,(null===(a=null===(i=g.geoJSON)||void 0===i?void 0:i[0])||void 0===a?void 0:a.properties)&&(g.geoJSON[0].properties.names=h,g.geoJSON[0].properties.keyId=s),c&&c!==jo&&(g.sectionId=c));const o=[];b.forEach(e=>{v.setFeatureProperty(e.id,"keyId",s),v.setFeatureProperty(e.id,"names",h),v.setFeatureProperty(e.id,"pendingEdit","true"),o.push(e.id)});const r=je();if(!r.some(e=>e.keyId===s)){const e=(null==g?void 0:g.geoJSON)?JSON.parse(JSON.stringify(g.geoJSON)):void 0;r.push({id:t,keyId:s,names:h,featureIds:o,originalGeoJSON:e}),Je(r)}dt(d);const l=we();if(l){const e=Oe().indexOf(g);if(e>=0){const t=`section-label-layer-${e}`,o=`section-label-${e}`;l.getLayer(t)&&l.removeLayer(t),l.getSource(o)&&l.removeSource(o)}}o.length>0&&rt(s,h,o[0]),ot("section")}catch(e){console.error("Failed to save section names:",e),Fo("#modal-boundary-error").modal("show")}Ue(null),We(null),Se(null);return v.getAll().features.forEach(e=>{var t,o;"section"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)&&"static"!==(null===(o=e.properties)||void 0===o?void 0:o.mode)&&v.setFeatureProperty(e.id,"mode","static")}),Fo("#section-keyId-field").removeClass("hidden"),Fo("#mt_modal-section-add-title").text(Fo("#mt_modal-section-add-title").data("original-title")),Fo("#modal-section-add").modal("hide"),Fo("#cancelSectionEdit").addClass("hidden"),Fo(".section-tile-actions").addClass("hidden"),void(null===(r=_o.renderSectionTiles)||void 0===r||r.call(_o))}const v=Fe(),g=v?je().find(e=>e.keyId===v.keyId):null,b=v&&""!==v.keyId&&(f.some(e=>e.keyId===v.keyId)||!!g),w=b?v.keyId:Fo("#section-keyId").val().trim();if(!w)return void Fo("#section-keyId-alert").removeClass("hidden");if(!b){if([...f.map(e=>e.keyId),...m.map(e=>e.keyId)].includes(w))return void Fo("#section-keyId-duplicate-alert").removeClass("hidden")}const C=null===(d=window.findagrave)||void 0===d?void 0:d.hasPendingBoundary,k=Fo("#section-parent-select").val()||(null===(s=p[0])||void 0===s?void 0:s.id)||(C?jo:void 0);if(k){if(v&&v.featureIds.length>0){const e=Ce(),t=null===(l=window.findagrave)||void 0===l?void 0:l.cemeteryId,o=Pe(),n=(Fo("#section-explanation").val()||"").trim()||void 0,i=v.featureIds,a=e.getAll().features.filter(e=>i.includes(e.id)).map(e=>({type:"Feature",geometry:e.geometry,properties:{keyId:w,names:h}})),r=b?f.find(e=>e.keyId===w):null,d=[Object.assign(Object.assign({},(null==r?void 0:r.id)?{id:r.id}:{}),{type:"section",locationId:t,sectionId:k===jo?void 0:k,sectionIdType:Jo(k),op:b&&r&&!g?"update":"add",keyId:w,geoJSON:a})];if(g)try{yield o.mutate({mutation:at,variables:{ids:[g.id]}});const e=je();Je(e.filter(e=>e.id!==g.id))}catch(e){console.error("Failed to cancel old pending edit:",e)}try{const{data:t}=yield o.mutate({mutation:it,variables:{cemeteryBoundaryInput:d,note:n}}),r=(null===(c=null==t?void 0:t.createCemeteryBoundaryEdit)||void 0===c?void 0:c.id)||"";if(Fo("#modal-section-add").modal("hide"),ot("section"),i.forEach(t=>{e.setFeatureProperty(t,"mode","static"),e.setFeatureProperty(t,"featureType","section"),e.setFeatureProperty(t,"keyId",w),e.setFeatureProperty(t,"names",h),e.setFeatureProperty(t,"pendingEdit","true")}),!b&&i.length>0&&rt(w,h,i[0]),b&&!g){const e=Oe(),t=e.findIndex(e=>e.keyId===w),o=t>=0?JSON.parse(JSON.stringify(e[t].geoJSON)):void 0;t>=0&&(e[t].geoJSON=a,h.length>0&&(e[t].geoJSON[0].properties.names=h));const n=je();n.some(e=>e.keyId===w)||(n.push({id:r,keyId:w,names:h,featureIds:i,originalGeoJSON:o}),Je(n))}else{const e=je();e.push({id:r,keyId:w,names:h,featureIds:i}),Je(e)}Be(null),Se(null);const s=_e();i.forEach(e=>s.delete(e)),Vo();const l=e.getAll().features.filter(e=>{var t,o;return"section"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)&&"static"!==(null===(o=e.properties)||void 0===o?void 0:o.mode)});l.forEach(t=>{e.setFeatureProperty(t.id,"mode","static")}),e.changeMode("simple_select");(Fo("#filterModeSections").is(":checked")||Fo("#sectionFilterToggle").hasClass("hidden"))&&(Fo("#sectionList").removeClass("hidden"),Fo("#sectionFilterForm").removeClass("hidden")),Fo("#sectionFilterToggle").hasClass("hidden")&&Fo("#nameFilterRow").length>0&&Fo("#sectionFilterToggle").removeClass("hidden"),Fo("#editSection").removeClass("hidden"),null===(u=_o.renderSectionTiles)||void 0===u||u.call(_o),Fo("#finishSection").addClass("hidden"),Fo("#cancelSectionEdit").addClass("hidden"),Fo("#deleteFeature").addClass("hidden")}catch(e){console.error("Failed to save section:",e),Fo("#modal-boundary-error").modal("show")}return}Be({keyId:w,names:h,featureIds:[],parentId:k}),Fo("#modal-section-add").modal("hide"),function(){var e;const t=xe();if(0===t.length&&!(null===(e=window.findagrave)||void 0===e?void 0:e.hasPendingBoundary))return void tt("i18n-alert-boundary-required");if("boundary"===Ie())return void tt("i18n-alert-section-while-boundary");const o=Ce();Se("section"),o.changeMode(z),Fo("#cancelSectionEdit").removeClass("hidden"),Fo("#saveBoundary").addClass("hidden"),Fo("#cancelBoundary").addClass("hidden")}()}else tt("i18n-alert-invalid-parent")})}function Uo(){var e;if(0===xe().length&&!(null===(e=window.findagrave)||void 0===e?void 0:e.hasPendingBoundary))return void tt("i18n-alert-boundary-required");if("boundary"===Ie())return void tt("i18n-alert-section-while-boundary");Fo("#alert-draw-instructions").removeClass("hidden");const t=Ce();Se("section"),Fo("#boundariesDropdownContainer").addClass("hidden"),Fo("#boundariesActiveBtnContainer").removeClass("hidden"),Be({keyId:"",names:[],featureIds:[],parentId:void 0}),t.changeMode(z),Fo("#finishSection").removeClass("hidden"),Fo("#cancelSectionEdit").removeClass("hidden"),Fo("#saveBoundary").addClass("hidden"),Fo("#cancelBoundary").addClass("hidden")}function qo(e){var t,o;const n=Ce(),i=Fe();let a=Te();const r=Ne(),d=Me();if((null==i?void 0:i.keyId)===e)return i.featureIds.forEach(e=>n.setFeatureProperty(e,"mode","static")),Be(null),r.delete(e),dt(e),0===a.length&&(Se(null),Fo("#finishSection").addClass("hidden"),Fo("#cancelSectionEdit").addClass("hidden")),n.changeMode("simple_select"),void(null===(t=_o.updatePendingHighlights)||void 0===t||t.call(_o));const s=a.find(t=>t.keyId===e);s&&(s.featureIds.forEach(e=>n.setFeatureProperty(e,"mode","static")),dt(e),a=a.filter(t=>t.keyId!==e),$e(a),Le(d.filter(t=>!("edit"===t.type&&t.keyId===e))),r.delete(e),0!==a.length||Fe()||(Se(null),Fo("#cancelSectionEdit").addClass("hidden")),n.changeMode("simple_select"),null===(o=_o.updatePendingHighlights)||void 0===o||o.call(_o))}function Wo(){var e;const t=Ce(),o=Oe();let n=Te();const i=Fe(),a=_e(),r=Ne(),d=Qe(),s=t.getAll().features.filter(e=>{var t,o;return"section"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)&&"static"!==(null===(o=e.properties)||void 0===o?void 0:o.mode)}),l=new Map;if(s.forEach(e=>{var t;const o=null===(t=e.properties)||void 0===t?void 0:t.keyId;l.has(o)||l.set(o,[]),l.get(o).push(e.id)}),i){const e=i.keyId;l.has(e)||l.set(e,[]),i.featureIds.forEach(t=>{l.get(e).includes(t)||l.get(e).push(t)})}n.forEach(e=>{if(!l.has(e.keyId)){const o=t.getAll().features.filter(t=>{var o,n;return"section"===(null===(o=t.properties)||void 0===o?void 0:o.featureType)&&(null===(n=t.properties)||void 0===n?void 0:n.keyId)===e.keyId}).map(e=>e.id);o.length>0?l.set(e.keyId,o):e.featureIds.length>0&&l.set(e.keyId,[...e.featureIds])}}),l.forEach((e,n)=>{const i=o.some(e=>e.keyId===n);if(i&&d.has(n)){e.forEach(e=>t.delete(e));d.get(n).forEach(e=>{const o=JSON.parse(JSON.stringify(e));o.properties=o.properties||{},o.properties.mode="static",o.properties.featureType="section",t.add(o)})}else i?e.forEach(e=>t.setFeatureProperty(e,"mode","static")):e.forEach(e=>t.delete(e))}),ge.clear(),n.forEach(e=>dt(e.keyId)),Se(null),$e([]),Le([]),Be(null),r.clear(),a.clear(),Vo(),t.changeMode("simple_select"),Fo("#finishSection").addClass("hidden"),Fo("#cancelSectionEdit").addClass("hidden"),Fo("#deleteFeature").addClass("hidden"),Fo(".section-tile-actions").addClass("hidden"),null===(e=_o.updatePendingHighlights)||void 0===e||e.call(_o)}var Qo=o(71757),Yo=function(e,t,o,n){return new(o||(o=Promise))(function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function d(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(r,d)}s((n=n.apply(e,t||[])).next())})};const Go=o(18653);function Xo(){const e=Te(),t=Me();return new Set([...e.map(e=>e.keyId),...t.map(e=>e.keyId)])}function Zo(){const e=Ce(),t=je(),o=Ae(),n=Xo();t.forEach(e=>n.add(e.keyId)),e.getAll().features.filter(e=>{var t;return"section"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)}).forEach(t=>{var o;const i=null===(o=t.properties)||void 0===o?void 0:o.keyId,a=n.has(i)?"true":"false";e.setFeatureProperty(t.id,"pendingEdit",a)}),Qo(".section-tile").each(function(){const e=Qo(this).data("keyid"),t=n.has(e),i=o.has(e);Qo(this).toggleClass("bg-success bg-opacity-10",t).toggleClass("bg-warning bg-opacity-25",i&&!t)})}function Ko(e=""){var t,o,n,i;const a=Xo(),r=Oe(),d=Me(),s=je(),l=Ae(),c=Qo("#sectionList"),u=e.toLowerCase(),p=new Set(d.filter(e=>"delete"===e.type).map(e=>e.keyId)),f=r.filter(e=>!p.has(e.keyId)).filter(e=>!s.some(t=>t.keyId===e.keyId)).sort((e,t)=>e.keyId.localeCompare(t.keyId,void 0,{numeric:!0,sensitivity:"base"})),m=[],h=(null===(t=window.findagrave)||void 0===t?void 0:t.contributorId)||0,y=new Map(f.map(e=>[e.id,e])),v=new Set(f.filter(e=>"section"===e.sectionIdType&&y.has(e.sectionId)).map(e=>e.id));function g(e){const t=Ze(e,!1),o=!u||e.keyId.toLowerCase().includes(u)||t.toLowerCase().includes(u);u&&o&&m.push(e.keyId);const n=l.has(e.keyId),i=u&&o||!u&&n,r=a.has(e.keyId)?" bg-success bg-opacity-10":i?" bg-warning bg-opacity-25":"";return{keyId:e.keyId,name:t,bgClass:r,ariaSelected:n?"true":"false",isMatch:o}}const b=f.filter(e=>!v.has(e.id)).map(e=>{const t=g(e),o=f.filter(t=>t.sectionId===e.id&&"section"===t.sectionIdType).map(g),n=!!u&&o.some(e=>e.isMatch);return Object.assign(Object.assign({},t),{children:o,hasMatchingChild:n})}).filter(e=>!u||e.isMatch||e.hasMatchingChild),w=s.filter(e=>!u||e.keyId.toLowerCase().includes(u)||e.names.some(e=>e.name.toLowerCase().includes(u))).map(e=>{var t,o,n;const i=Xe(),a=(null===(t=e.names.find(e=>e.language===i))||void 0===t?void 0:t.name)||(null===(o=e.names.find(e=>"en"===e.language))||void 0===o?void 0:o.name)||(null===(n=e.names[0])||void 0===n?void 0:n.name)||e.keyId;return{keyId:e.keyId,id:e.id,name:a}}),C=!!(null===(o=window.findagrave)||void 0===o?void 0:o.canSuggestBoundaries),k="section"===Ie();c.html(Go.render({sections:b,pendingEdits:w,contributorId:h,canSuggestBoundaries:C,editMode:k})),en(u?m:[...l]),Zo(),l.size>0&&(null===(n=window.findagrave)||void 0===n?void 0:n.canSuggestBoundaries)&&(null===(i=window.findagrave)||void 0===i?void 0:i.isCemeteryManager)?Qo("#setParentRow").removeClass("hidden"):Qo("#setParentRow").addClass("hidden")}function en(e){const t=Ce(),o=new Set(e),n=t.getAll();n.features.filter(e=>{var t;return"section"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)}).forEach(e=>{var t;e.properties.highlighted=o.has(null===(t=e.properties)||void 0===t?void 0:t.keyId)?"true":"false"}),t.set(n)}var tn=o(71757);var on=o(39708),nn=o(44162);class an{constructor(e){this.data=e,this.subscribers=[]}subscribe(e){this.subscribers.push(e)}set(e,t){this.data.set(e,t),this.subscribers.forEach(e=>e(this.data))}delete(e){this.data.delete(e),this.subscribers.forEach(e=>e(this.data))}get(e){return this.data.get(e)}getAll(){return this.data}setAll(e){this.data=e,this.subscribers.forEach(e=>e(this.data))}}var rn=function(e,t,o,n){return new(o||(o=Promise))(function(i,a){function r(e){try{s(n.next(e))}catch(e){a(e)}}function d(e){try{s(n.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(r,d)}s((n=n.apply(e,t||[])).next())})};const dn=o(53406),sn=(0,nn.H)({name:"findagrave-cemetery-overview",uri:findagrave.orchestrator});ne=sn,go={cancelSectionEdit:Wo,updateOutOfBoundsIndicator:Vo},function(e){_o=e}({renderSectionTiles:Ko,updatePendingHighlights:Zo,highlightSectionsOnMap:en});let ln,cn=new c;function un(){const e=/view-photo=(\d+)/;if(-1!==location.hash.indexOf("view-photo")){let t=0;e.test(location.hash)&&(t=parseInt(e.exec(location.hash)[1])),cn.initializeClickHandler(),cn.initializeMain(t),i()("#photoViewer").modal("show")}else cn.initializeClickHandler()}function pn(e,t){return rn(this,void 0,void 0,function*(){return sn.mutate({mutation:on.J1` mutation updateOrCreatePhotos($photos: [PhotoCreateUpdate!]!) { updateOrCreatePhotos(photos: $photos) { id path } } `,variables:{photos:[{id:e,caption:t,type:"Cemetery",container:{id:findagrave.cemeteryId,type:"Cemetery"}}]}}).then(e=>!!e.error)})}function fn(){if(""!==findagrave.tabId)if("overview"===findagrave.tabId)!function(){f(this,arguments,void 0,function*(e={768:{min:200,offset:300,lines:2},1024:{min:800,offset:400,lines:7},1650:{min:800,offset:700,lines:10},default:{min:1e3,offset:1100,lines:12}}){if(!/(gle|ing)bot/.test(navigator.userAgent)){const{default:t}=yield o.e(303).then(o.bind(o,30303)),n=p(window).width(),i=Object.keys(e).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,t)=>e-t).find(e=>nrn(this,void 0,void 0,function*(){const[{default:t},{default:n},{default:a},{default:r}]=yield Promise.all([o.e(90).then(o.t.bind(o,45156,23)),o.e(977).then(o.t.bind(o,66645,23)),o.e(7306).then(o.t.bind(o,24737,23)),o.e(90).then(o.t.bind(o,18644,23))]),d=[...e.values()];mn(d.filter(e=>{var t;return e.contributor.id===(null===(t=findagrave.contributorId)||void 0===t?void 0:t.toString())}).length);const s=Math.min(findagrave.maxPerEntity-findagrave.approvedAndPendingCount,findagrave.maxPerUser-findagrave.myPhotoCount)>0,l=t.render({photo:null==d?void 0:d[0],addImageSizeQueryParam:_.nB,contributorId:findagrave.contributorId,isAddPhotoAllowed:s}),c=n.render({photos:{photos:d},addImageSizeQueryParam:_.nB,contributorId:findagrave.contributorId}),u=a.render({additionalPhotos:null==d?void 0:d.slice(1),addImageSizeQueryParam:_.nB,contributorId:findagrave.contributorId});if(i()("#profile-section .profile-photo").replaceWith(l),i()("#sidebar-photos").replaceWith(u),i()("#photoViewer").replaceWith(c),(null==d?void 0:d.length)>0){const e=r.render({coverPhoto:null==d?void 0:d[0],isAddPhotoAllowed:s,contributorId:findagrave.contributorId});i()("#cem-photo-button").replaceWith(e)}}));else if("photo"===findagrave.tabId){function e(e){return rn(this,void 0,void 0,function*(){const[{default:t},{default:n}]=yield Promise.all([o.e(977).then(o.t.bind(o,66645,23)),o.e(6438).then(o.t.bind(o,81549,23))]);n.env.addFilter("truncateHtml",function(e,t){return(0,h.default)(e,t,{html:!0})});const a=Math.min(findagrave.maxPerEntity-findagrave.approvedAndPendingCount,findagrave.maxPerUser-findagrave.myPhotoCount)>0,r=t.render({photos:{photos:[...e.values()]},addImageSizeQueryParam:_.nB,contributorId:findagrave.contributorId}),d=document.getElementById("myPhotos").checked?"myPhotos":"allPhotos",s=n.render({photos:{photos:[...e.values()]},addImageSizeQueryParam:_.nB,contributorId:findagrave.contributorId,isAddPhotoAllowed:a,selected:d});i()("#photoViewer").replaceWith(r),i()("#TabPhotos").children().remove().end().append(s),cn=new c,un(),mn(e.size)})}i()("#TabPhotos").addClass("in").addClass("active"),i()("a[tabid=TabPhotos]").addClass("active"),i()("a[tabid=TabPhotos]").attr("aria-current","true"),findagrave.selectedTab="photos",ln.subscribe(e),i()(document).on("click","#allPhotos,#myPhotos",t=>{if("myPhotos"===t.target.id&&t.target.checked){const t=[...ln.getAll().entries()].filter(([e,t])=>{var o;return t.contributor.id===(null===(o=findagrave.contributorId)||void 0===o?void 0:o.toString())});e(new Map(t))}else e(ln.getAll());return!0})}else"map"===findagrave.tabId&&(i()("a[tabid=TabMap]").addClass("active"),i()("a[tabid=TabMap]").attr("aria-current","true"),requestAnimationFrame(()=>{function e(){i()("#boundariesActiveBtnContainer").addClass("hidden"),i()("#boundariesDropdownContainer").removeClass("hidden")}let t;jt({validateSectionWithinBoundary:zo,addOutOfBoundsIndicator:Ho,updateOutOfBoundsIndicator:Vo,updatePendingHighlights:Zo,renderSectionTiles:Ko,toggleBoundaryVisibility:To,detectBoundaryFromMapbox:Io}),i()("#detectBoundary").on("click",()=>{Io()}),i()("#drawBoundary").on("click",()=>{!function(){if("section"===Ie())return void tt("i18n-alert-boundary-while-section");Se("boundary"),yo("#boundariesDropdownContainer").addClass("hidden"),yo("#boundariesActiveBtnContainer").removeClass("hidden"),Ce().changeMode("draw_polygon"),yo("#saveBoundary").removeClass("hidden"),yo("#cancelBoundary").removeClass("hidden"),yo("#addBoundaryPolygon").removeClass("hidden"),yo("#alert-draw-instructions").removeClass("hidden")}()}),i()("#editBoundary").on("click",()=>{xo()}),i()("#addBoundaryPolygon").on("click",()=>{Ce().changeMode("draw_polygon"),yo("#alert-draw-instructions").removeClass("hidden")}),i()("#saveBoundary").on("click",()=>{e(),Oo()}),i()("#cancelBoundary").on("click",()=>{e(),function(){var e,t;const o=Ce(),n=xe(),i=o.getAll().features.filter(e=>{var t;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)}).map(e=>e.id);i.forEach(e=>o.delete(e)),n.forEach(e=>{e.geoJSON&&(Array.isArray(e.geoJSON)?e.geoJSON:[e.geoJSON]).forEach(e=>{const t=Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),{mode:"static",featureType:"boundary"})});o.add(t).forEach(e=>{o.setFeatureProperty(e,"mode","static"),o.setFeatureProperty(e,"featureType","boundary")})})}),(null===(e=window.findagrave)||void 0===e?void 0:e.hasPendingBoundary)&&((null===(t=window.findagrave)||void 0===t?void 0:t.edits)||[]).forEach(e=>{var t,n;const i=null===(t=e.suggestedValue)||void 0===t?void 0:t.value;i&&"/boundaries"===(null===(n=e.suggestedValue)||void 0===n?void 0:n.path)&&(Array.isArray(i)?i:[i]).forEach(e=>{"section"!==e.type&&(Array.isArray(e.geoJSON)?e.geoJSON:e.geoJSON?[e.geoJSON]:[]).forEach(e=>{if(!e)return;const t=Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),{mode:"static",featureType:"boundary",pendingEdit:"true"})});o.add(t).forEach(e=>{o.setFeatureProperty(e,"mode","static"),o.setFeatureProperty(e,"featureType","boundary"),o.setFeatureProperty(e,"pendingEdit","true")})})})});Se(null),Ye(!1),bo=!1,o.changeMode("simple_select"),yo("#saveBoundary").addClass("hidden"),yo("#cancelBoundary").addClass("hidden"),yo("#deleteFeature").addClass("hidden"),yo("#addBoundaryPolygon").addClass("hidden")}()}),i()("#useBoundary").on("click",()=>{So()}),i()("#dismissBoundary").on("click",()=>{e(),Po()}),i()("#showBoundary").on("change",e=>{To(e.target.checked)}),i()("#deleteFeature").on("click",()=>{!function(){const e=Ce().getSelectedIds();e.length>0&&(ze(e[0]),yo("#modal-boundary-delete").modal("show"))}()}),i()("#confirmBoundaryDelete").on("click",()=>{!function(){var e,t,o,n,i;const a=De();if(a){const r=Ce(),d=r.get(a),s="boundary"===(null===(e=null==d?void 0:d.properties)||void 0===e?void 0:e.featureType),l=s?r.getAll().features.filter(e=>{var t;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)}).length:0;if(r.delete(a),s){const e=r.getAll().features.filter(e=>{var t;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)}).length;if(e>=l){const e=r.getAll().features.filter(e=>{var t;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)&&e.id!==a});e.length>0&&r.delete(e[0].id)}const t=r.getAll().features.filter(e=>{var t;return"boundary"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)});0===t.length&&(bo=!0)}r.changeMode("simple_select");const c=Fe();if(c){c.featureIds=c.featureIds.filter(e=>e!==a),_e().delete(a),null===(t=go.updateOutOfBoundsIndicator)||void 0===t||t.call(go);const e=Oe();if(0===c.featureIds.length&&!e.some(e=>e.keyId===c.keyId)){Be(null);const e=Te(),t=Me();0===e.length&&0===t.length?null===(o=go.cancelSectionEdit)||void 0===o||o.call(go):(yo("#finishSection").addClass("hidden"),yo("#deleteFeature").addClass("hidden"))}}else if("section"===Ie()&&"section"===(null===(n=null==d?void 0:d.properties)||void 0===n?void 0:n.featureType)){const e=null===(i=d.properties)||void 0===i?void 0:i.keyId;if(e){const t=Oe().find(t=>t.keyId===e),o=t?null:je().find(t=>t.keyId===e),n=r.getAll().features.filter(t=>{var o,n;return"section"===(null===(o=t.properties)||void 0===o?void 0:o.featureType)&&(null===(n=t.properties)||void 0===n?void 0:n.keyId)===e}).map(e=>e.id);n.length>0&&(Be({keyId:e,names:(null==t?void 0:t.names)||(null==o?void 0:o.names)||[],featureIds:n}),Ne().add(e),yo("#finishSection").removeClass("hidden"),yo("#cancelSectionEdit").removeClass("hidden"))}}ze(null)}yo("#modal-boundary-delete").modal("hide")}()}),i()("#cancelBoundaryDelete").on("click",()=>{ze(null),yo("#modal-boundary-delete").modal("hide")}),i()("#submitBoundaryExplanation").on("click",()=>{Eo()}),i()("#proceedBoundaryExplanation").on("click",()=>{i()("#modal-boundary-far-warning").modal("hide"),i()("#boundary-explanation-textarea").val(""),i()("#modal-boundary-explanation").modal("show")}),i()("#saveAutoDetectedBoundary").on("click",()=>{So(),Oo()}),i()("#confirmMultiplePolygonsSave").on("click",()=>{yo("#modal-boundary-multiple-polygons").modal("hide"),yo("#boundary-explanation-textarea").val(""),yo("#modal-boundary-explanation").modal("show")}),i()("#editAutoDetectedBoundary").on("click",()=>{So(),xo()}),i()("#dismissAutoDetectedBoundary").on("click",()=>{e(),Po()}),i()("#addSection").on("click",()=>{Uo()}),i()("#editSection").on("click",()=>{!function(){var e,t;if("boundary"===Ie())return void tt("i18n-alert-section-while-edit-boundary");const o=Ce(),n=o.getAll().features.filter(e=>{var t,o;return"section"===(null===(t=e.properties)||void 0===t?void 0:t.featureType)&&"static"===(null===(o=e.properties)||void 0===o?void 0:o.mode)});if(0===n.length)return void tt("i18n-alert-no-sections-to-edit");Se("section"),Fo("#boundariesDropdownContainer").addClass("hidden"),Fo("#boundariesActiveBtnContainer").removeClass("hidden");const i=Qe();n.forEach(e=>{var t;const o=null===(t=e.properties)||void 0===t?void 0:t.keyId;o&&!i.has(o)&&i.set(o,[])}),n.forEach(e=>{var t;const n=null===(t=e.properties)||void 0===t?void 0:t.keyId;if(n&&i.has(n)){const t=JSON.parse(JSON.stringify(o.get(e.id)));i.get(n).push(t)}}),n.forEach(e=>{o.setFeatureProperty(e.id,"mode","")}),o.changeMode("simple_select"),Fo("#cancelSectionEdit").removeClass("hidden"),null===(e=_o.updatePendingHighlights)||void 0===e||e.call(_o),null===(t=_o.renderSectionTiles)||void 0===t||t.call(_o)}(),i()("#filterModeSections").trigger("click")}),i()("#submitSectionDetails").on("click",()=>{Ro()}),i()("#modal-section-add").on("hidden.bs.modal",()=>{e()}),i()("#finishSection").on("click",()=>{e(),function(){var e,t,o;const n=Fe(),i=_e(),a=Oe();if(!n||0===n.featureIds.length)return void tt("i18n-alert-draw-polygon");if(n.featureIds.some(e=>i.has(e)))return void Fo("#modal-section-out-of-bounds").modal("show");const r=je().find(e=>e.keyId===n.keyId),d=""!==n.keyId&&(a.some(e=>e.keyId===n.keyId)||!!r),s=Fo("#mt_modal-section-add-title");if(s.data("original-title")||s.data("original-title",s.text()),d){const i=Fo("#sectionList").data("i18n-edit-names-title")||"Edit Section";s.text(i),Fo("#section-keyId-field").removeClass("hidden"),Fo("#section-keyId").val(n.keyId);const d=Fo("#section-name-list");d.empty();const l=d.data("meta"),c=a.find(e=>e.keyId===n.keyId);((null===(o=null===(t=null===(e=null==c?void 0:c.geoJSON)||void 0===e?void 0:e[0])||void 0===t?void 0:t.properties)||void 0===o?void 0:o.names)||(null==c?void 0:c.names)||(null==r?void 0:r.names)||n.names||[]).forEach(e=>{const t=$o(d),o=Ao.render(Object.assign(Object.assign({},l),{index:t,value:e.name,newItem:!1}));d.append(o),Fo(`#sectionNameLang-${t}`).val(Ke(e.language))}),d.find(".delete-locale").removeAttr("data-bs-toggle").removeAttr("data-bs-target"),Do(n.keyId),(null==c?void 0:c.sectionId)&&Fo("#section-parent-select").val(c.sectionId),Fo("#submitSectionDetails").prop("disabled",!1)}else s.text(s.data("original-title")),Fo("#section-keyId").val("").prop("readonly",!1),Fo("#section-keyId-field").removeClass("hidden"),Fo("#section-name-list").empty(),Do(),Mo=null,Fo("#submitSectionDetails").prop("disabled",!0);Fo("#section-keyId-alert").addClass("hidden"),Fo("#section-keyId-duplicate-alert").addClass("hidden"),Fo("#section-name-language-alert").addClass("hidden"),Fo("#section-draw").addClass("hidden"),Fo("#section-explanation").val(""),Fo("#section-explanation-field").removeClass("hidden"),Fo("#modal-section-add").modal("show")}()}),i()("#cancelSectionEdit").on("click",()=>{e(),Wo()}),i()("#modal-section-add").on("click",".add-item",function(){const e=i()(this).siblings(".item-list"),t=$o(e),o=e.data("meta"),n=i()(dn.render(Object.assign(Object.assign({},o),{index:t,newItem:!0})));n.find(".delete-locale").removeAttr("data-bs-toggle").removeAttr("data-bs-target"),e.append(n),i()(`#${o.languageId}-${t}`).val(Ke(Xe())),hn(e),Lo()}),i()("#modal-section-add").on("input change","input, select, textarea",function(){Lo()}),i()("#modal-section-add").on("click",".delete-locale",function(e){e.preventDefault(),e.stopImmediatePropagation();const t=i()(this).closest(".item-list");i()(this).closest(".row[data-idx]").remove(),hn(t),Lo()}),i()("#modal-section-add").on("show.bs.modal",function(){hn(i()("#section-name-list"))}),i()("#modal-section-add").on("hidden.bs.modal",function(){const e=i()("#mt_modal-section-add-title"),t=e.data("original-title");t&&(e.text(t),e.removeData("original-title")),i()("#section-keyId").prop("readonly",!1)}),i()("#filterModeNames").on("change",()=>{i()("#nameFilterRow").removeClass("hidden"),i()("#filterResults").children().length>0&&i()("#filterResults").removeClass("hidden"),i()("#nameFilterTips").removeClass("hidden"),i()("#sectionFilterForm").addClass("hidden"),i()("#sectionList").addClass("hidden")}),i()("#filterModeSections").on("change",()=>{i()("#nameFilterRow").addClass("hidden"),i()("#filterResults").addClass("hidden"),i()("#nameFilterTips").addClass("hidden"),i()("#sectionFilterForm").removeClass("hidden"),i()("#sectionList").removeClass("hidden")}),i()("#sectionFilter").on("input",function(){clearTimeout(t);const e=i()(this).val().toString().trim();t=setTimeout(()=>Ko(e),200)}),i()("#resetSectionFilter").on("click",()=>{i()("#sectionFilter").val(""),Ko("")}),i()("#sectionList").on("click keydown",".section-tile",function(e){"keydown"===e.type&&"Enter"!==e.key&&" "!==e.key||("keydown"===e.type&&e.preventDefault(),i()(e.target).closest("button").length||function(e){var t,o;const n=Ae();n.has(e)?n.delete(e):n.add(e);const i=n.has(e),a=Xo().has(e);Qo(`.section-tile[data-keyid="${e}"]`).attr("aria-pressed",i?"true":"false").toggleClass("bg-warning bg-opacity-25",i&&!a),en([...n]),n.size>0&&(null===(t=window.findagrave)||void 0===t?void 0:t.canSuggestBoundaries)&&(null===(o=window.findagrave)||void 0===o?void 0:o.isCemeteryManager)?Qo("#setParentRow").removeClass("hidden"):Qo("#setParentRow").addClass("hidden")}(i()(this).data("keyid").toString()))}),i()("#sectionList").on("click",".section-tile-edit",function(){!function(e){var t;if("boundary"===Ie())return void tt("i18n-alert-section-while-edit-boundary");const o=Oe(),n=Te(),i=Fe(),a=Ne(),r=Ce(),d=o.find(t=>t.keyId===e),s=d?null:je().find(t=>t.keyId===e);if(!d&&!s)return;if((null==i?void 0:i.keyId)===e)return void(a.has(e)?(Fo("#modal-section-unsaved-changes").data("pending-keyid",e),Fo("#modal-section-unsaved-changes").modal("show")):qo(e));if(n.find(t=>t.keyId===e))return Fo("#modal-section-unsaved-changes").data("pending-keyid",e),void Fo("#modal-section-unsaved-changes").modal("show");if(i)return void tt("i18n-alert-save-or-cancel-section");const l=r.getAll().features.filter(t=>{var o,n;return"section"===(null===(o=t.properties)||void 0===o?void 0:o.featureType)&&(null===(n=t.properties)||void 0===n?void 0:n.keyId)===e});if(0===l.length)return void tt("i18n-alert-section-features-not-found");Se("section");const c=Qe();if(!c.has(e)){const t=l.map(e=>JSON.parse(JSON.stringify(r.get(e.id))));c.set(e,t)}const u=[];l.forEach(e=>{r.setFeatureProperty(e.id,"mode",""),u.push(e.id)}),Be({keyId:e,names:(null==d?void 0:d.names)||(null==s?void 0:s.names)||[],featureIds:u}),Fo("#finishSection").removeClass("hidden"),Fo("#cancelSectionEdit").removeClass("hidden"),null===(t=_o.updatePendingHighlights)||void 0===t||t.call(_o),u.length>0?r.changeMode("direct_select",{featureId:u[0]}):r.changeMode("simple_select")}(i()(this).data("keyid").toString())}),i()("#sectionList").on("click",".section-tile-names",function(){!function(e){var t,o,n;const i=Oe().find(t=>t.keyId===e);if(!i)return;Ue("edit-names"),We(e);const a=Fo("#mt_modal-section-add-title");a.data("original-title")||a.data("original-title",a.text());const r=Fo("#sectionList").data("i18n-edit-names-title")||"Edit Section Names";a.text(r),Fo("#section-draw").addClass("hidden"),Fo("#section-explanation-field").removeClass("hidden"),Fo("#section-explanation").val(""),Fo("#section-keyId-field").removeClass("hidden"),Fo("#section-keyId").val(e),Fo("#section-keyId-alert").addClass("hidden"),Fo("#section-keyId-duplicate-alert").addClass("hidden"),Fo("#section-name-language-alert").addClass("hidden");const d=Fo("#section-name-list");d.empty();const s=d.data("meta");if(((null===(n=null===(o=null===(t=i.geoJSON)||void 0===t?void 0:t[0])||void 0===o?void 0:o.properties)||void 0===n?void 0:n.names)||i.names||[]).forEach(e=>{const t=$o(d),o=Ao.render(Object.assign(Object.assign({},s),{index:t,value:e.name,newItem:!1}));d.append(o),Fo(`#sectionNameLang-${t}`).val(Ke(e.language))}),0===d.children(".row[data-idx]").length){const e=$o(d);d.append(Ao.render(Object.assign(Object.assign({},s),{index:e,newItem:!0}))),Fo(`#sectionNameLang-${e}`).val(Ke(Xe()))}d.find(".delete-locale").removeAttr("data-bs-toggle").removeAttr("data-bs-target"),Do(e),i.sectionId&&Fo("#section-parent-select").val(i.sectionId);const l=[];Fo("#section-name-list").find(".row[data-idx]").each(function(){const e=Fo(this).data("idx"),t=Fo(`#sectionName-${e}`).val()||"",o=Fo(`#sectionNameLang-${e}`).val()||"";""!==t.trim()&&l.push({name:t.trim(),language:o})}),Mo={names:l,parentId:Fo("#section-parent-select").val()||"",keyId:e},Fo("#submitSectionDetails").prop("disabled",!0),Fo("#modal-section-add").modal("show")}(i()(this).data("keyid").toString())}),i()("#sectionList").on("click",".section-tile-delete",function(){const e=i()(this).data("keyid").toString();i()("#delete-section-keyid-display").text(e),i()("#modal-section-delete").data("pending-keyid",e),i()("#modal-section-delete").modal("show")}),i()("#sectionList").on("click",".section-tile-cancel-edit",function(){!function(e){Bo(this,void 0,void 0,function*(){var t;const o=Pe(),n=Ce(),i=Oe();let a=je();try{yield o.mutate({mutation:at,variables:{ids:[e]}});const r=a.find(t=>t.id===e);if(r){r.featureIds.forEach(e=>n.delete(e)),dt(r.keyId);const t=i.find(e=>e.keyId===r.keyId);if(t){const e=r.originalGeoJSON||t.geoJSON;e&&(t.geoJSON=r.originalGeoJSON||t.geoJSON,(Array.isArray(e)?e:[e]).forEach(e=>{if(!e)return;const o=Object.assign(Object.assign({},e),{properties:Object.assign(Object.assign({},e.properties),{mode:"static",featureType:"section",keyId:r.keyId,names:t.names||[]})});n.add(o).forEach(e=>{n.setFeatureProperty(e,"mode","static"),n.setFeatureProperty(e,"featureType","section"),n.setFeatureProperty(e,"keyId",r.keyId)})}))}a=a.filter(t=>t.id!==e),Je(a)}null===(t=_o.renderSectionTiles)||void 0===t||t.call(_o),0===Oe().length&&0===je().length&&Fo("#editSection").addClass("hidden")}catch(e){console.error("Failed to cancel edit:",e),Fo("#modal-boundary-error").modal("show")}})}(i()(this).data("edit-id").toString())}),i()("#confirmSectionDelete").on("click",()=>{const e=i()("#modal-section-delete").data("pending-keyid").toString();i()("#modal-section-delete").modal("hide"),function(e){Bo(this,void 0,void 0,function*(){var t,o;const n=null===(t=window.findagrave)||void 0===t?void 0:t.cemeteryId,i=xe();let a=Oe();const r=Ae(),d=Pe();if(0===i.length)return void tt("i18n-alert-no-boundary-found");const s=i[0].id,l=a.find(t=>t.keyId===e);try{yield d.mutate({mutation:it,variables:{cemeteryBoundaryInput:[Object.assign(Object.assign({},(null==l?void 0:l.id)?{id:l.id}:{}),{type:"section",locationId:n,sectionId:s,op:"delete",keyId:e,geoJSON:[]})],note:"Section deletion suggested from map"}}),a=a.filter(t=>t.keyId!==e),Ee(a),r.delete(e),null===(o=_o.renderSectionTiles)||void 0===o||o.call(_o),ot("section")}catch(e){console.error("Failed to suggest section deletion:",e),Fo("#modal-boundary-error").modal("show")}})}(e)}),i()("#discardSectionChanges").on("click",()=>{const e=i()("#modal-section-unsaved-changes").data("pending-keyid").toString();i()("#modal-section-unsaved-changes").modal("hide"),qo(e)}),i()("#setParentBtn").on("click",()=>{!function(){var e;const t=Ae(),o=Oe(),n=xe();if(0===t.size)return;const i=Qo("#i18n-section-parent-boundary").text()||"Boundary",a=new Map(o.map(e=>[e.id,e])),r=Qo("#bulk-parent-section-list");r.empty(),t.forEach(e=>{const t=o.find(t=>t.keyId===e);if(!t)return;const n=a.get(t.sectionId),d=n?n.keyId:i;r.append(`
  • ${e}${d}
  • `)});const d=Qo("#bulk-parent-select");d.empty();const s=(null===(e=n[0])||void 0===e?void 0:e.id)||"";d.append(``);const l=et(t),c=new Set([...t,...l]);o.filter(e=>e.id&&!c.has(e.keyId)).sort((e,t)=>Ze(e,!0).localeCompare(Ze(t,!0),void 0,{numeric:!0,sensitivity:"base"})).forEach(e=>{d.append(``)}),Qo("#modal-bulk-parent").modal("show")}()}),i()("#confirmBulkParent").on("click",()=>{!function(){Yo(this,void 0,void 0,function*(){var e,t,o,n,i;const a=Ae(),r=Oe(),d=xe(),s=Qo("#bulk-parent-select").val(),l=null===(e=window.findagrave)||void 0===e?void 0:e.cemeteryId,c=Pe(),u=Ce();Qo("#modal-bulk-parent").modal("hide");const p=[...a].map(e=>r.find(t=>t.keyId===e)).filter(Boolean);try{for(const e of p){const a=u.getAll().features.filter(t=>{var o,n;return"section"===(null===(o=t.properties)||void 0===o?void 0:o.featureType)&&(null===(n=t.properties)||void 0===n?void 0:n.keyId)===e.keyId}),r=a.map(t=>{var o,n,i;return{type:"Feature",geometry:t.geometry,properties:{keyId:e.keyId,names:(null===(i=null===(n=null===(o=e.geoJSON)||void 0===o?void 0:o[0])||void 0===n?void 0:n.properties)||void 0===i?void 0:i.names)||e.names||[]}}}),p=[Object.assign(Object.assign({},e.id?{id:e.id}:{}),{type:"section",locationId:l,sectionId:s,sectionIdType:d.some(e=>e.id===s)?"cemetery":"section",op:"update",keyId:e.keyId,geoJSON:r})],{data:f}=yield c.mutate({mutation:it,variables:{cemeteryBoundaryInput:p,note:"Parent section updated from map"}}),m=(null===(t=null==f?void 0:f.createCemeteryBoundaryEdit)||void 0===t?void 0:t.id)||"";e.sectionId=s,a.forEach(e=>{u.setFeatureProperty(e.id,"pendingEdit","true")});const h=je(),y=(null===(i=null===(n=null===(o=e.geoJSON)||void 0===o?void 0:o[0])||void 0===n?void 0:n.properties)||void 0===i?void 0:i.names)||e.names||[],v=a.map(e=>e.id),g=e.geoJSON?JSON.parse(JSON.stringify(e.geoJSON)):void 0;h.some(t=>t.keyId===e.keyId)||(h.push({id:m,keyId:e.keyId,names:y,featureIds:v,originalGeoJSON:g}),Je(h))}Qo("#modal-boundary-success").find("#success-msg-boundary").addClass("hidden"),Qo("#modal-boundary-success").find("#success-msg-section").removeClass("hidden"),Qo("#modal-boundary-success").modal("show"),Se(null),a.clear(),Qo("#cancelSectionEdit").addClass("hidden"),Qo(".section-tile-actions").addClass("hidden"),Ko()}catch(e){console.error("Failed to save parent assignment:",e),Qo("#modal-boundary-error").modal("show"),Ko()}})}()})}),findagrave.selectedTab="map")}function mn(e){i()(".photosCount").text(e),findagrave.myPhotoCount=e,findagrave.approvedAndPendingCount=e}function hn(e){const t=e.find(".row[data-idx]");t.find(".delete-locale").removeClass("invisible"),t.first().find(".delete-locale").addClass("invisible")}i()(function(){var e,t,n;let d=new a.A;ln=new an(new Map(null===(t=null===(e=findagrave.photos)||void 0===e?void 0:e.photos)||void 0===t?void 0:t.map(e=>[e.id,e]))),new m.A,new r.A(d.recaptcha),(0,u.A)(),fn(),un(),function(e){if(e.length>0){var t=tn(e),o=tn(window),n=o.scrollTop(),i=n+o.height(),a=t.offset().top;return a+t.height()<=i&&a>=n}return!1}(i()("#lastname"))&&i()("#lastname").trigger("focus"),i()(document).on("shown.bs.modal","#photoViewer",function(){var e;(e=i()("#photoViewer")).on("keydown",function(t){var o=e.find('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),n=o.first(),i=o.last();"Tab"!==t.key||t.shiftKey?"Tab"===t.key&&t.shiftKey&&document.activeElement===n[0]&&(t.preventDefault(),i.focus()):document.activeElement===i[0]&&(t.preventDefault(),n.focus())})}),i()("#edit-cemetery").on("click",function(){i()(this).addClass("added")}),i()(document).on("hidden.bs.modal","#photoViewer",function(){i()("#photoViewer").off("keydown")});const s=i()("#main-photo img");function l(e){e.naturalHeight>e.naturalWidth&&e.classList.add("portrait")}var c,p;(null===(n=s[0])||void 0===n?void 0:n.complete)?l(s[0]):s.on("load",e=>l(e.target)),i()("#gps-directions").attr("href",(c=findagrave.cemlongitude,p=findagrave.cemlatitude,/iPhone|iPad|iPod|Macintosh/.test(navigator.userAgent)?`https://maps.apple.com/?daddr=${p},${c}`:`https://maps.google.com/maps/dir/?api=1&destination=${p},${c}`)),i()("#main-photo-link").on("click",e=>{e.stopPropagation()}),i()("#volunteer-btn").on("mouseenter",function(){if(i()(this).hasClass("btn-hover")){let e=i()("#volunteer-btn").attr("data-unvolunteer");i()("#volunteer-btn-text").text(e),i()("#volunteer-btn").find(".icon-heart").removeClass("icon-heart").addClass("icon-remove")}}),i()("#volunteer-btn").on("mouseleave",function(){if(i()(this).hasClass("btn-hover")){let e=i()("#volunteer-btn").attr("data-volunteering");i()("#volunteer-btn-text").text(e),i()("#volunteer-btn").find(".icon-remove").removeClass("icon-remove").addClass("icon-heart")}}),i()(document).on("click",".volunteer-for-cemetery",()=>rn(this,void 0,void 0,function*(){i()(".volunteer-error").addClass("hidden"),i()("#volunteerSuccessful").addClass("hidden"),i()("#unvolunteerSuccessful").addClass("hidden");try{yield sn.mutate({mutation:on.J1` mutation volunteerForCemetery($cemeteryIds: [ID!]!) { volunteerForCemetery(cemeteryIds: $cemeteryIds) { id } } `,variables:{cemeteryIds:[findagrave.cemeteryId]}});let e=i()("#volunteer-btn").attr("data-volunteering");i()("#volunteer-btn-text").text(e),i()("#volunteer-btn").attr("data-bs-toggle","modal").attr("data-bs-target","#unVolunteerForCemetery").removeClass("volunteer-for-cemetery").addClass("btn-hover").find(".icon-heart").removeClass("stroke-icon"),i()("#volunteerForCemetery").modal("hide"),i()("#volunteerSuccessful").removeClass("hidden")}catch(e){i()(".volunteer-error").removeClass("hidden"),console.error(e)}})),i()(document).on("click",".unvolunteer-for-cemetery",()=>rn(this,void 0,void 0,function*(){i()("#unvolunteer-error").addClass("hidden"),i()("#volunteerSuccessful").addClass("hidden"),i()("#unvolunteerSuccessful").addClass("hidden");try{yield sn.mutate({mutation:on.J1` mutation unvolunteerForCemetery($cemeteryIds: [ID!]!) { unvolunteerForCemetery(cemeteryIds: $cemeteryIds) { id } } `,variables:{cemeteryIds:[findagrave.cemeteryId]}});let e=i()("#volunteer-btn").attr("data-volunteer");i()("#volunteer-btn-text").text(e),i()("#volunteer-btn").removeAttr("data-bs-toggle").removeAttr("data-bs-target").addClass("volunteer-for-cemetery").removeClass("btn-hover").find(".icon-heart").addClass("stroke-icon"),i()("#unVolunteerForCemetery").modal("hide"),i()("#unvolunteerSuccessful").removeClass("hidden")}catch(e){i()("#unvolunteer-error").removeClass("hidden"),console.error(e)}})),i()("#volunteerSuccessful-close").on("click",()=>{i()("#volunteerSuccessful").addClass("hidden")}),i()("#unvolunteerSuccessful-close").on("click",()=>{i()("#unvolunteerSuccessful").addClass("hidden")}),i()("#sendVolunteerEmails").on("change",()=>rn(this,void 0,void 0,function*(){let e=i()("#sendVolunteerEmails").is(":checked");try{yield sn.mutate({mutation:on.J1` mutation updateContributor($contributors: [ContributorInput!]!) { updateContributor(contributors: $contributors) { id } } `,variables:{contributors:[{id:findagrave.contributorId,photoRequestEmails:e}]}})}catch(e){console.error(e)}})),i()("#adv-search").on("hidden.bs.collapse",()=>{i()("#moreOptions").removeClass("d-none"),i()("#cemSearch").removeClass("bg-white85 shadow"),i()(".show-all-photos").removeClass("position-absolute bottom-0"),i()("#fewerOptions").addClass("d-none")}).on("shown.bs.collapse",()=>{i()("#moreOptions").addClass("d-none"),i()("#cemSearch").addClass("bg-white85 shadow"),i()(".show-all-photos").addClass("position-absolute bottom-0"),i()("#fewerOptions").removeClass("d-none")}),i()('[data-bs-toggle="popover"]').popover({html:!0}).on("show.bs.popover",function(){i()(this).attr("aria-expanded","true")}).on("hide.bs.popover",function(){i()(this).attr("aria-expanded","false")}),i()('[data-bs-toggle="tooltip"]').tooltip(),i()("#showMarkerMap").length>0&&Promise.all([o.e(7869),o.e(9236)]).then(o.bind(o,27869)).then(({default:e})=>{const{parentLocation:{latitude:t,longitude:o}}=findagrave;new e("co",t,o,(n,a)=>{if(!e.valid(Number(n),Number(a),{lat:t,lon:o,km:160}))return i()("#too-distant").removeClass("hidden"),!1})}),i()("#photo-circle").circleProgress({startAngle:-Math.PI/4*2,size:100,thickness:9,lineCap:"round",fill:{color:"#C60"}}),i()("#gps-circle").circleProgress({startAngle:-Math.PI/4*2,size:78,thickness:9,lineCap:"round",fill:{color:"#6ba410"}}),i()("#cemeteryPhoto").on("click",function(){findagrave.selectedTab="photos"}),i()(".js--photoGrid").on("click",".view-cemetery-photos",function(){findagrave.selectedTab="photos",i()("#cemeteryPhoto").addClass("active"),i()("#cemeteryMap").removeClass("active"),i()("#cemeteryView").removeClass("active"),i()(window).scrollTop(0)}),i()("#cemeteryMap").on("click",function(){findagrave.selectedTab="map"}),i()("#cemeteryView").on("click",function(){findagrave.selectedTab="cemetery"}),i()(document).on("keyup",".captionText",function(){i()(this).parent().find(".caption-save").removeClass("disabled").prop("disabled",!1)}),i()("#content").on("click",".caption-save",function(e){e.stopPropagation(),e.stopImmediatePropagation();const t=i()(this).data("id");!function(e,t,o){rn(this,void 0,void 0,function*(){const n=o.text();o.text(o.data("loading-text")).prop("disabled",!0);const a=yield pn(e,t);if(a)i()("#confirmPhotoFailed-"+e).removeClass("hidden"),i()("#confirmPhotoFailed-"+e).attr("role","alert");else{i()("#confirmPhotoUpdated-"+e).removeClass("hidden"),i()("#confirmPhotoUpdated-"+e).attr("role","alert"),i()(`textarea[name="publicNote-${e}"]`).val(t);const o=i()('

    '),n=o.find('span[itemprop="name"]');n.text(t),n.html(n.html().replace(/\n/g,"
    ")),i()(`div.p-${e}.card .card-body`).html(o)}setTimeout(function(){o.prop("disabled",!1).text(n),!a&&o.addClass("disabled"),i()("#confirmPhotoUpdated-"+e).addClass("hidden"),i()("#confirmPhotoFailed-"+e).addClass("hidden")},3e3)})}(t,i()(this).parent().siblings("textarea[name='publicNote-"+t+"']").val(),i()(this))}),i()("#add-photos").on("hidden.bs.modal",function(e){i()("#FinishedUpload").addClass("hidden")});let f,h=i()("#add-photos"),y=0,v=0,g=i()("#FinishedUpload");o.e(2628).then(o.t.bind(o,62628,23)).then(({default:e})=>{e.options.dragImg=!1,h.on("show.bs.modal",function(){let e=i()(".dragdrop-wrapper"),t=i()("#number-of-images");g.addClass("hidden"),e.removeClass("hidden"),e.fadeIn(),f&&f.removeAllFiles(),t.text(""),y=0,v=0}),i()("#dragImg").dropzone({paramName:"file",acceptedFiles:"image/png,image/jpeg,image/gif,image/webp,image/png,.heic,.heif,image/heif,image/heic",previewsContainer:"#drag-preview-list",previewTemplate:document.querySelector("#preview-template").innerHTML,createImageThumbnails:!1,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,uploadMultiple:!1,maxFiles:Math.min(findagrave.maxPerEntity-findagrave.approvedAndPendingCount,findagrave.maxPerUser-findagrave.myPhotoCount),dictMaxFilesExceeded:i()("#i18n-tooManyPhotos").text(),parallelUploads:1,timeout:48e4,url:e=>e[0].uploadUrl,params:e=>{let t={key:e[0].key,"Content-Type":e[0].type.trim()||"image/"+e[0].name.substring(e[0].name.lastIndexOf(".")+1).toLowerCase(),acl:"private"};for(let o in e[0].AWSFields)t[o]=e[0].AWSFields[o];return t},dictFileTooBig:i()("#i18n-sizeExceeded").text(),dictInvalidFileType:i()("#i18n-notAPhoto").text(),maxFilesize:20,uploadCount:0,accept:function(e,t){var o;const n=this;if(Math.min(findagrave.maxPerEntity-findagrave.approvedAndPendingCount,findagrave.maxPerUser-findagrave.myPhotoCount)>0&&n.options.uploadCount=0?0===y?"":1===y?i()("#i18n-uploadingPhoto").text().replace("1",""+y):i()("#i18n-uploadingPhotos").text().replace("2",""+y):0===y?"":1===y?i()("#i18n-photoUploaded").text().replace("1",""+y):i()("#i18n-photosUploaded").text().replace("2",""+y),n.text(e)}),t.on("click",function(){e.removeAllFiles(!0),g.addClass("hidden"),o.fadeIn(),y=0,n.text("")}),e.on("sending",function(e,t,o){const n=i()(e.previewTemplate);n.find(".uploaded-item--status").html(i()("#progressBar").html()),n.find("[data-dz-remove]").addClass("invisible")}),e.uploadError=function(t,o,a){y-=1,v-=1;const r=i()(t.previewTemplate),d=r.find(".uploaded-item--status");if(d.addClass("text-danger"),r.find("[data-dz-remove]").addClass("invisible"),o&&"Invalid File Type"===o.description)d.text(i()("#i18n-invalidType").text());else if(o&&!a)d.text(o);else{const e=i()("#i18n-failed-"+(o&&o.type));o&&e.length>0?d.text(e.text()):d.text(i()("#i18n-failed").text())}a&&-1!==a&&e.processQueue();let s="";s=0===y?"":1===y?i()("#i18n-uploadingPhoto").text().replace("1",""+y):i()("#i18n-uploadingPhotos").text().replace("2",""+y),n.text(s)},e.on("error",e.uploadError),e.on("success",function(t,o,n){return rn(this,void 0,void 0,function*(){const o=yield sn.mutate({mutation:on.J1` mutation updateOrCreatePhotos($photos: [PhotoCreateUpdate!]!) { updateOrCreatePhotos(photos: $photos) { id path } } `,variables:{photos:[{path:t.key,container:{id:findagrave.cemeteryId,type:"Cemetery"},type:"Cemetery"}]},errorPolicy:"all"});if(o.error)e.uploadError(t,o.error,n);else{const a=o.data.updateOrCreatePhotos[0].id;let[r,d]=(0,A.OR)(["contributorId","publicName"]).map(e=>e&&decodeURIComponent(e)),s=Object.assign({notLazy:!0,id:a,path:(0,_.nB)(o.data.updateOrCreatePhotos[0].path,"photos250"),dateCreated:(new Date).toLocaleDateString(navigator.language,{year:"numeric",month:"short",day:"numeric"}),caption:null,contributor:{id:findagrave.contributorId.toString(),publicName:d}},o.data.updateOrCreatePhotos[0]);ln.set(a,s),v-=1;i()(t.previewTemplate).find("[data-dz-remove]").removeClass("invisible");const l=i()(t.previewTemplate).find(".uploaded-item--status");e.emit("thumbnail",t,(0,_.nB)(s.path,"photoThumbnails"));const c=i()("#progressBar");c.find(".progress-bar").css("width","100%").attr("aria-valuenow",100).addClass("bg-success"),l.html(c.html()),l.find("textarea").val(""),l.find("textarea").removeClass("hidden"),c.find(".progress-bar").css("width","0%").attr("aria-valuenow",0).removeClass("bg-success");i()(t.previewTemplate).find("[data-dz-remove]").on("click",function(){i().ajax({method:"POST",url:"/cemetery/delete-photo",data:{ajax:!0,photoId:a,cemeteryId:findagrave.cemeteryId},success:function(){ln.delete(a)}})});const u=i()(t.previewTemplate).find("textarea");u.on("blur",()=>rn(this,void 0,void 0,function*(){if(!(yield pn(a,u.val()))){const e=i()('

    '),o=e.find('span[itemprop="name"]');o.text(u.val()),o.html(o.html().replace(/\n/g,"
    ")),i()(`div.p-${a}.card .card-body`).html(e),i()(t.previewTemplate).find("span.captionSaved").removeClass("hidden");setTimeout(function(){i()(t.previewTemplate).find("span.captionSaved").addClass("hidden")},2e4)}})),n&&e.processQueue()}f.queueDone&&g.prop("disabled",!1)})}),e.on("queuecomplete",function(){v=0,f.queueDone=!0,i()("#FinishedUpload").removeClass("hidden");let e="";e=0===y?"":1===y?i()("#i18n-photoUploaded").text().replace("1",y.toString()):i()("#i18n-photosUploaded").text().replace("2",y.toString()),n.text(e)}),e.on("uploadprogress",function(e,t,o){t-=10;const n=i()(e.previewTemplate).find(".uploaded-item--status"),a=i()("#progressBar");a.find(".progress-bar").css("width",t+"%").attr("aria-valuenow",t),n.html(a.html())}),g.on("click",function(){i()("#add-photos").modal("hide")})}}),i()(".js--openDropzone").on("click",function(){i()("#dragImg").trigger("click")})})})},69917(e,t,o){o.d(t,{OR:()=>r,Ri:()=>a,TV:()=>n,kQ:()=>d,zs:()=>i});o(71757);function n(e,t,o,n){let i="",a=`path= ${n&&n.length>0?n:"/"};`,r=`domain=.${location.hostname.split(".").slice(-2).join(".")};`;if(o){let e=new Date;e.setTime(e.getTime()+24*o*60*60*1e3),i=`expires=${e.toUTCString()};`}document.cookie=`${e}=${t};${i}${a}${r}SameSite=Lax;Secure;`}function i(e){let t=`expires=${new Date(0)};`,o=`domain=.${location.hostname.split(".").slice(-2).join(".")};`,n="path=/;",i=`path=${location.pathname};`;document.cookie=`${e}=;${t}${n}`,document.cookie=`${e}=;${t}${n}${o}`,document.cookie=`${e}=;${t}${i}${o}`}function a(e){let t=document.cookie.split("; ").find(t=>t.split("=")[0]===e);return t?t.split("=")[1]:""}function r(e){let t=new Map(e.map(e=>[e,void 0]));return document.cookie.split("; ").map(e=>e.split("=")).filter(([t])=>e.includes(t)).forEach(([e,o])=>t.set(e,o)),[...t.values()]}function d(){var e=a("consentSettings"),t={pref:!1,ga:!1,aa:!1};try{t=JSON.parse(e)}catch(e){}return t}},51009(e,t,o){function n(e,t){return e&&t&&(e=e.includes("?")?`${e}&size=${t}`:`${e}?size=${t}`),e}function i(){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:()=>i,nB:()=>n})}}]); //# sourceMappingURL=3627.cdcb9c56afb3c9f91bd8.js.map