"use strict";(self.webpackChunkfindagrave_frontend=self.webpackChunkfindagrave_frontend||[]).push([[1841],{21841(e,t,a){var n=a(54802),o=a(56533),i=a(56267),r=a(69917),s=a(94904);var l=a(44162),d=a(71757);window.setDeathYearFilter=function(e){"unknown"==e?(d("#deathyear").val(""),d("#deathyear").prop("disabled",!0)):d("#deathyear").prop("disabled",!1),d("#deathyearfilter").val(e)},window.setBirthYearFilter=function(e){"unknown"==e?(d("#birthyear").val(""),d("#birthyear").prop("disabled",!0)):d("#birthyear").prop("disabled",!1),d("#birthyearfilter").val(e)},d(function(){const e=(0,l.H)({name:"findagrave-cemetery-searchresults",uri:findagrave.orchestrator});new n.A,new i.A({bindElement:"#location",idElement:"#locationId",locationsWithoutCemeteries:!1,apolloClient:e});(0,o.Ay)().singleTypeahead({type:o.Ps,noContinents:!0,apolloClient:e,onEmpty(){d("#locationError").show(),d("#location").one("focus",()=>d("#locationError").fadeOut())},clearEmpty(){d("#locationError").fadeOut()}}),(0,s.A)(),d(document).on("shown.bs.modal","#modal-search-updates",function(){var e;(e=d("#modal-search-updates")).on("keydown",function(t){var a=e.find('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'),n=a.first(),o=a.last();"Tab"!==t.key||t.shiftKey?"Tab"===t.key&&t.shiftKey&&document.activeElement===n[0]&&(t.preventDefault(),o.focus()):document.activeElement===o[0]&&(t.preventDefault(),n.focus())})}),d(document).on("hidden.bs.modal","#modal-search-updates",function(){d("#modal-search-updates").off("keydown")}),d(document).on("click",".collapse-link",function(){if(d(".home-search").toggleClass("expanded"),d("#moreOptions").toggleClass("d-none"),d("#fewerOptions").toggleClass("d-none"),d(".section-homepage").toggleClass("search-opt"),d("#moreOptions").hasClass("d-none")){(0,r.kQ)().pref&&(0,r.TV)("fullSearch","true",73)}else(0,r.zs)("fullSearch")});(0,r.Ri)("fullSearch")&&(d(".collapse-link").trigger("click"),d("#adv-search").collapse("toggle"))})},69917(e,t,a){a.d(t,{Ri:()=>i,TV:()=>n,kQ:()=>r,zs:()=>o});a(71757);function n(e,t,a,n){let o="",i=`path= ${n&&n.length>0?n:"/"};`,r=`domain=.${location.hostname.split(".").slice(-2).join(".")};`;if(a){let e=new Date;e.setTime(e.getTime()+24*a*60*60*1e3),o=`expires=${e.toUTCString()};`}document.cookie=`${e}=${t};${o}${i}${r}SameSite=Lax;Secure;`}function o(e){let t=`expires=${new Date(0)};`,a=`domain=.${location.hostname.split(".").slice(-2).join(".")};`,n="path=/;",o=`path=${location.pathname};`;document.cookie=`${e}=;${t}${n}`,document.cookie=`${e}=;${t}${n}${a}`,document.cookie=`${e}=;${t}${o}${a}`}function i(e){let t=document.cookie.split("; ").find(t=>t.split("=")[0]===e);return t?t.split("=")[1]:""}function r(){var e=i("consentSettings"),t={pref:!1,ga:!1,aa:!1};try{t=JSON.parse(e)}catch(e){}return t}},56533(e,t,a){a.d(t,{Ay:()=>h});var n=a(71757),o=a.n(n),i=(a(62427),a(29462)),r=a.n(i),s=a(39708),l=function(e,t,a,n){return new(a||(a=Promise))(function(o,i){function r(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(r,s)}l((n=n.apply(e,t||[])).next())})};const d=a(18510),c=a(53547);function h(){return{singleTypeahead:function(e){this.settings=o().extend({},this.defaults,e),this.changed=!1;const t=this,a=new TextEncoder;let n=new(r())({datumTokenizer:function(e){return r().tokenizers.whitespace(e.text)},queryTokenizer:r().tokenizers.whitespace,remote:{url:"/graphql/q=%prefix",wildcard:"%prefix",prepare:(e,t)=>(t.skipLoad=!/^\d+$/.test(e.trim())&&a.encode(e).length<3,t.name=e,t.url=t.url.replace("%prefix",e),t),transform:function(e){var a;return(null===(a=e.locationsByTypeahead)||void 0===a?void 0:a.locations.map(function(a){(a=Object.assign({},a)).text=["cemetery","city","county","state","country"].map(e=>a.locations[0][e]).filter(e=>e).join(", ").replace(/&/g,"&"),t.settings.displayId&&(a.text+=` (${a.id})`);const n=e.query.trim().split(/[\p{P}\s]+/u).filter(e=>e).map(e=>e.toLocaleLowerCase()),o=a.text.toLocaleLowerCase();return!n.every(e=>o.includes(e))&&a.highlight&&(a.text+=` (${a.highlight})`),a}))||[]},transport:(e,t,a)=>l(this,void 0,void 0,function*(){if(e.skipLoad)t([]);else{const{errors:n,data:o}=yield this.settings.apolloClient.query({query:s.J1` query locationTypeahead($search: LocationSearchInput) { locationsByTypeahead(search: $search) { total locations { ... on Location { id locations(format: short){ city county state country continent } names { name } coordinates { lat lon } highlight } ... on Cemetery { id locations(format: short){ cemetery city county state country continent } names { name } coordinates { lat lon } highlight } } } } `,variables:{search:{name:e.name,autocomplete:this.settings.autocomplete,categories:this.settings.type,havingCoordinates:this.settings.havingCoordinates,returnHighlight:!0}},errorPolicy:"all"});n?a(n):t(Object.assign(Object.assign({},o),{query:e.name.toLocaleLowerCase()}))}})}});this.typeaheadEl=o()(this.settings.inputId),this.typeahead=this.typeaheadEl.typeahead(this.settings.displayOptions,{name:this.settings.inputId.replace(/[#.]/,""),source:n.ttAdapter(),displayKey:"text",limit:5,templates:{notFound:function({query:e}){return!/^\d+$/.test(e.trim())&&a.encode(e).length<3?c.render():d.render()}}});const i=``;return this.typeaheadEl.addClass("form-control").after(i).parent().addClass("form-floating"),this.clearLocation=this.typeaheadEl.parents(".btn-group, .input-group").find(".clear-search"),this.targetId=o()(this.settings.targetId),this.typeahead.on("typeahead:autocomplete typeahead:select",function(e,a){t.targetId.val(null==a?void 0:a.id).data("d",a),t.typeahead.trigger("typeahead:set",[a]),t.targetId.trigger("change"),t.topSuggestion=a,t.clearLocation.removeClass("hidden")}).on("typeahead:change",function(e){var n;t.settings.onChange.call(t,e),!t.targetId.val().trim()&&a.encode(t.typeahead.typeahead("val").trim()).length>=3&&(t.changed=!0,null===(n=t.settings.onEmpty)||void 0===n||n.call(t))}).on("typeahead:render",function(e,a){a&&a.length>0&&a[0]&&(t.topSuggestion=a[0])}),t.typeahead.typeahead("val")&&t.typeahead.typeahead("val").trim().length>0&&t.clearLocation.removeClass("hidden"),t.clearLocation.on("click",function(){t.typeahead.typeahead("val",""),t.typeahead.trigger("typeahead:clear"),t.typeahead.trigger("focus"),t.targetId.val("").removeData("d"),t.targetId.trigger("change"),t.topSuggestion=null,o()(this).addClass("hidden")}),t.typeaheadEl.on("keydown",function(e){var n;if(13==e.which||9==e.which){a.encode(t.typeahead.typeahead("val").trim()).length>=3?t.topSuggestion?(t.targetId.val(t.topSuggestion.id).data("d",t.topSuggestion),t.typeahead.typeahead("val",t.topSuggestion.text),t.typeahead.trigger("typeahead:set",[t.topSuggestion]),t.targetId.trigger("change"),t.clearLocation.removeClass("hidden")):e.preventDefault():t.typeahead.typeahead("val","")}else["arrowup","arrowdown","arrowleft","arrowright","end","home","pagedown","pageup","meta","control","alt"].includes(null===(n=e.key)||void 0===n?void 0:n.toLowerCase())||e.metaKey||e.ctrlKey||(t.topSuggestion=null);return o()(this).val().trim().length>0?t.clearLocation.removeClass("hidden"):t.clearLocation.addClass("hidden"),t.settings.enterSubmitsForm||13!=e.which}).on("click",function(e){t.topSuggestion&&t.typeahead.typeahead("val").trim().length>=3&&(t.targetId.val(t.topSuggestion.id).data("d",t.topSuggestion),t.typeahead.typeahead("val",t.topSuggestion.text),t.typeahead.trigger("typeahead:set",[t.topSuggestion]),t.targetId.trigger("change"),t.typeahead.typeahead("close"),t.clearLocation.removeClass("hidden"))}),t},defaults:{inputId:"#location",targetId:"#locationId",type:p,autocomplete:"location",enterSubmitsForm:!0,noContinents:!1,displayId:!1,displayOptions:{hint:!0,highlight:!0,minLength:1},onEmpty:!1,clearEmpty:!1,onChange:function(e){this.typeahead.typeahead("val").trim().length>=3?(this.topSuggestion?(this.targetId.val(this.topSuggestion.id).data("d",this.topSuggestion),this.typeahead.trigger("typeahead:set",[this.topSuggestion]),this.targetId.trigger("change"),this.typeahead.typeahead("val",this.topSuggestion.text),this.typeahead.typeahead("close")):this.targetId.val("").removeData("d"),this.clearLocation.removeClass("hidden")):(this.targetId.val("").removeData("d"),this.typeahead.trigger("typeahead:clear"),this.targetId.trigger("change"),this.clearLocation.addClass("hidden"))}}}}const p=["loc"];a.d(t,["Ps",0,["yes"]])}}]); //# sourceMappingURL=1841.9b33359e30677026e728.js.map