"use strict"; // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair /* eslint-disable unicorn/prefer-module */ Object.defineProperty(exports, "__esModule", { value: true }); (() => { var _a; const los = exports.los; const maps = exports.maps; const searchFilterElement = document.querySelector('#searchFilter--map'); const searchResultsContainerElement = document.querySelector('#container--searchResults'); function renderResults() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = los.getLoadingParagraphHTML(`Loading ${los.escapedAliases.Maps}...`); let searchResultCount = 0; const searchResultsTbodyElement = document.createElement('tbody'); const filterStringSplit = searchFilterElement.value .trim() .toLowerCase() .split(' '); for (const map of maps) { const mapSearchString = `${(_a = map.mapName) !== null && _a !== void 0 ? _a : ''} ${(_b = map.mapDescription) !== null && _b !== void 0 ? _b : ''} ${(_c = map.mapAddress1) !== null && _c !== void 0 ? _c : ''} ${(_d = map.mapAddress2) !== null && _d !== void 0 ? _d : ''}`.toLowerCase(); let showMap = true; for (const filterStringPiece of filterStringSplit) { if (!mapSearchString.includes(filterStringPiece)) { showMap = false; break; } } if (!showMap) { continue; } searchResultCount += 1; // eslint-disable-next-line no-unsanitized/method searchResultsTbodyElement.insertAdjacentHTML('beforeend', ` ${cityssm.escapeHTML(((_e = map.mapName) !== null && _e !== void 0 ? _e : '') === '' ? '(No Name)' : (_f = map.mapName) !== null && _f !== void 0 ? _f : '')}
${cityssm.escapeHTML((_g = map.mapDescription) !== null && _g !== void 0 ? _g : '')} ${((_h = map.mapAddress1) !== null && _h !== void 0 ? _h : '') === '' ? '' : `${cityssm.escapeHTML((_j = map.mapAddress1) !== null && _j !== void 0 ? _j : '')}
`} ${((_k = map.mapAddress2) !== null && _k !== void 0 ? _k : '') === '' ? '' : `${cityssm.escapeHTML((_l = map.mapAddress2) !== null && _l !== void 0 ? _l : '')}
`} ${map.mapCity || map.mapProvince ? `${cityssm.escapeHTML((_m = map.mapCity) !== null && _m !== void 0 ? _m : '')}, ${cityssm.escapeHTML((_o = map.mapProvince) !== null && _o !== void 0 ? _o : '')}
` : ''} ${((_p = map.mapPostalCode) !== null && _p !== void 0 ? _p : '') === '' ? '' : cityssm.escapeHTML((_q = map.mapPostalCode) !== null && _q !== void 0 ? _q : '')} ${cityssm.escapeHTML((_r = map.mapPhoneNumber) !== null && _r !== void 0 ? _r : '')} ${map.mapLatitude && map.mapLongitude ? ` ` : ''} ${((_s = map.mapSVG) !== null && _s !== void 0 ? _s : '') === '' ? '' : ''} ${map.lotCount} `); } searchResultsContainerElement.innerHTML = ''; if (searchResultCount === 0) { // eslint-disable-next-line no-unsanitized/property searchResultsContainerElement.innerHTML = `

There are no ${los.escapedAliases.maps} that meet the search criteria.

`; } else { const searchResultsTableElement = document.createElement('table'); searchResultsTableElement.className = 'table is-fullwidth is-striped is-hoverable has-sticky-header'; // eslint-disable-next-line no-unsanitized/property searchResultsTableElement.innerHTML = ` ${los.escapedAliases.Map} Address Phone Number Coordinates Image ${los.escapedAliases.Lot} Count `; searchResultsTableElement.append(searchResultsTbodyElement); searchResultsContainerElement.append(searchResultsTableElement); } } searchFilterElement.addEventListener('keyup', renderResults); (_a = document .querySelector('#form--searchFilters')) === null || _a === void 0 ? void 0 : _a.addEventListener('submit', (formEvent) => { formEvent.preventDefault(); renderResults(); }); renderResults(); })();