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A,IAEA,AAAI,GAAM,YACD,CAAC,EAAE,EAAI,IAAI,EAAE,GAAM,aAAa,GAAG,CAAC,EAAE,GAAM,aAAa,GAAG,CAAC,EAAE,GAAM,aAAa,GAAG,CAAC,EAAE,GAAM,aAAa,GAAG,OAAO,EAAE,GAAM,MAAM,QAAQ,EAAE,GAAM,OAAO,YAAY,CAAC,CACrK,EACF,CAAC,EAAE,EAAI,KAAK,EAAE,EAAW,IAAI,CAAC,CAAC,EAAE,GAAY,IAAI,OAAO,EAAE,GAAM,MAAM,QAAQ,EAAE,GAAM,OAAO,YAAY,CAAC,CAE1G,CAAC,EAAE,EAAI,OAAO,EAAE,EAAc,QAAQ,EAAE,EAAe,YAAY,CAAC,CASlE,EAA2B,CACtC,EACA,EACA,KAEA,IAAM,EAAkB,KAAK,GAAG,GAAK,EAErC,eAAe,OAAO,CAAC,EAAK,KAAK,SAAS,CAD7B,CAAE,MAAA,EAAO,gBAAA,CAAgB,GAExC,EAGa,EAA2B,AAAC,IACvC,IAAM,EAAO,eAAe,OAAO,CAAC,GACpC,GAAI,CAAC,EAAM,OAAO,KAElB,GAAM,CAAA,MAAE,CAAK,CAAA,gBAAE,CAAe,CAAE,CAAG,KAAK,KAAK,CAAC,UAG9C,AAAI,KAAK,GAAG,GAAK,GACf,eAAe,UAAU,CAAC,GACnB,MAGF,CACT,C,E","sources":["","js/React/helpers.ts"],"sourcesContent":["(function () {\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n var parcelRequire = $parcel$global[\"parcelRequire7bbe\"];\nvar parcelRegister = parcelRequire.register;\nparcelRegister(\"l8eky\", function(module, exports) {\n\n$parcel$export(module.exports, \"useDebounce\", function () { return $9a74061b8d9cdb1b$export$21805fee57372823; });\n$parcel$export(module.exports, \"useOnClickOutside\", function () { return $9a74061b8d9cdb1b$export$9afc64c180e82dc4; });\n$parcel$export(module.exports, \"useKeyPress\", function () { return $9a74061b8d9cdb1b$export$b65485ca34c366f3; });\n$parcel$export(module.exports, \"changeCheckboxAriaAttr\", function () { return $9a74061b8d9cdb1b$export$fcee17a44533bf4f; });\n$parcel$export(module.exports, \"gtmPageBuilder\", function () { return $9a74061b8d9cdb1b$export$ba7c21bf8d04b182; });\n$parcel$export(module.exports, \"getLargeObjectTypeIconPath\", function () { return $9a74061b8d9cdb1b$export$b4c0e43afc46e381; });\n$parcel$export(module.exports, \"formatLargeNumbers\", function () { return $9a74061b8d9cdb1b$export$dcaf1dbf3e0c13ab; });\n$parcel$export(module.exports, \"makeCamelCase\", function () { return $9a74061b8d9cdb1b$export$44e7716ae1289d49; });\n$parcel$export(module.exports, \"handleUpAndDown\", function () { return $9a74061b8d9cdb1b$export$69242b0ce39e8dd6; });\n$parcel$export(module.exports, \"focusOnInput\", function () { return $9a74061b8d9cdb1b$export$638ec343b26d72db; });\n$parcel$export(module.exports, \"getDates\", function () { return $9a74061b8d9cdb1b$export$dd09f40777b29234; });\n$parcel$export(module.exports, \"restrictToOnlyLetters\", function () { return $9a74061b8d9cdb1b$export$bd0df835003197b0; });\n$parcel$export(module.exports, \"translateEstateType\", function () { return $9a74061b8d9cdb1b$export$8e931dc4399d58f1; });\n$parcel$export(module.exports, \"GetStatusText\", function () { return $9a74061b8d9cdb1b$export$e4c1b429cc7a7158; });\n$parcel$export(module.exports, \"municipalityCheck\", function () { return $9a74061b8d9cdb1b$export$cefe5d5eda7bee66; });\n$parcel$export(module.exports, \"GetCurrentEstate\", function () { return $9a74061b8d9cdb1b$export$47a56b1fff388487; });\n$parcel$export(module.exports, \"letterTransform\", function () { return $9a74061b8d9cdb1b$export$62e765922eb7ba09; });\n$parcel$export(module.exports, \"getSessionId\", function () { return $9a74061b8d9cdb1b$export$b3739caaf2580dd; });\n$parcel$export(module.exports, \"removeSessionId\", function () { return $9a74061b8d9cdb1b$export$587d07e363d643fa; });\n$parcel$export(module.exports, \"removeLoginType\", function () { return $9a74061b8d9cdb1b$export$1a9e7ff3d494e529; });\n$parcel$export(module.exports, \"officeBrokerGrayScale\", function () { return $9a74061b8d9cdb1b$export$50f60048ef8acba; });\n$parcel$export(module.exports, \"arealTerms\", function () { return $9a74061b8d9cdb1b$export$f974294898073a2e; });\n$parcel$export(module.exports, \"scrollToElementById\", function () { return $9a74061b8d9cdb1b$export$9defdf5fd4260665; });\n$parcel$export(module.exports, \"postalCodeFormatter\", function () { return $9a74061b8d9cdb1b$export$408255c143692c3; });\n$parcel$export(module.exports, \"capitalizeFirstLetter\", function () { return $9a74061b8d9cdb1b$export$d07f57595c356899; });\n$parcel$export(module.exports, \"buildUmbracoImageUrl\", function () { return $9a74061b8d9cdb1b$export$8eca4915c8e83d68; });\n$parcel$export(module.exports, \"setSessionFlagWithExpiry\", function () { return $9a74061b8d9cdb1b$export$336f96d7a7ef3a88; });\n$parcel$export(module.exports, \"getSessionFlagWithExpiry\", function () { return $9a74061b8d9cdb1b$export$b7b8e3e7a2da2caa; });\n\nvar $dTCkE = parcelRequire(\"dTCkE\");\n\nvar $cUbQm = parcelRequire(\"cUbQm\");\n\nvar $1A7pc = parcelRequire(\"1A7pc\");\nfunction $9a74061b8d9cdb1b$export$21805fee57372823(value, delay) {\n // State and setters for debounced value\n const [debouncedValue, setDebouncedValue] = (0, $dTCkE.useState)(value);\n (0, $dTCkE.useEffect)(()=>{\n // Update debounced value after delay\n const handler = setTimeout(()=>{\n setDebouncedValue(value);\n }, delay);\n // Cancel the timeout if value changes (also on delay change or unmount)\n // This is how we prevent debounced value from updating if value is changed ...\n // .. within the delay period. Timeout gets cleared and restarted.\n return ()=>{\n clearTimeout(handler);\n };\n }, [\n value,\n delay\n ] // Only re-call effect if value or delay changes\n );\n return debouncedValue;\n}\nfunction $9a74061b8d9cdb1b$export$eacf0f51ec6fbe2c(item, list) {\n return list.includes(item) ? list.filter((i)=>i !== item) : [\n ...list,\n item\n ];\n}\nfunction $9a74061b8d9cdb1b$export$9afc64c180e82dc4(ref, handler) {\n (0, $dTCkE.useEffect)(()=>{\n const listener = (event)=>{\n // Do nothing if clicking ref's element or descendent elements\n if (!ref.current || ref.current.contains(event.target)) return;\n handler();\n };\n document.addEventListener(\"mousedown\", listener);\n document.addEventListener(\"touchstart\", listener);\n return ()=>{\n document.removeEventListener(\"mousedown\", listener);\n document.removeEventListener(\"touchstart\", listener);\n };\n }, // Add ref and handler to effect dependencies\n // It's worth noting that because passed in handler is a new ...\n // ... function on every render that will cause this effect ...\n // ... callback/cleanup to run every render. It's not a big deal ...\n // ... but to optimize you can wrap handler in useCallback before ...\n // ... passing it into this hook.\n [\n ref,\n handler\n ]);\n}\nfunction $9a74061b8d9cdb1b$export$b65485ca34c366f3(targetKey) {\n // State for keeping track of whether key is pressed\n const [keyPressed, setKeyPressed] = (0, $dTCkE.useState)(false);\n // If pressed key is our target key then set to true\n // Add event listeners\n (0, $dTCkE.useEffect)(()=>{\n function downHandler({ key: key }) {\n if (key === targetKey) setKeyPressed(true);\n }\n // If released key is our target key then set to false\n const upHandler = ({ key: key })=>{\n if (key === targetKey) setKeyPressed(false);\n };\n window.addEventListener(\"keydown\", downHandler);\n window.addEventListener(\"keyup\", upHandler);\n // Remove event listeners on cleanup\n return ()=>{\n window.removeEventListener(\"keydown\", downHandler);\n window.removeEventListener(\"keyup\", upHandler);\n };\n }, [\n targetKey\n ]); // Empty array ensures that effect is only run on mount and unmount\n return keyPressed;\n}\nfunction $9a74061b8d9cdb1b$export$fcee17a44533bf4f(e) {\n const item = e.currentTarget;\n switch(item?.getAttribute(\"aria-checked\")){\n case \"true\":\n item.setAttribute(\"aria-checked\", \"false\");\n break;\n case \"false\":\n item.setAttribute(\"aria-checked\", \"true\");\n break;\n }\n}\nfunction $9a74061b8d9cdb1b$export$ba7c21bf8d04b182(officeName) {\n let pageLink = \"\";\n if (officeName !== undefined) {\n officeName = officeName.toLowerCase().trim();\n const a = \"\\xe0\\xe1\\xe2\\xe4\\xe6\\xe3\\xe5\\u0101\\u0103\\u0105\\xe7\\u0107\\u010D\\u0111\\u010F\\xe8\\xe9\\xea\\xeb\\u0113\\u0117\\u0119\\u011B\\u011F\\u01F5\\u1E27\\xee\\xef\\xed\\u012B\\u012F\\xec\\u0131\\u0130\\u0142\\u1E3F\\xf1\\u0144\\u01F9\\u0148\\xf4\\xf6\\xf2\\xf3\\u0153\\xf8\\u014D\\xf5\\u0151\\u1E55\\u0155\\u0159\\xdf\\u015B\\u0161\\u015F\\u0219\\u0165\\u021B\\xfb\\xfc\\xf9\\xfa\\u016B\\u01D8\\u016F\\u0171\\u0173\\u1E83\\u1E8D\\xff\\xfd\\u017E\\u017A\\u017C\\xb7/_,:;\";\n const b = \"aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------\";\n const p = new RegExp(a.split(\"\").join(\"|\"), \"g\");\n officeName = officeName.toString().toLowerCase().replace(/\\s+/g, \"-\") // Replace spaces with -\n .replace(p, (c)=>b.charAt(a.indexOf(c))) // Replace special characters\n .replace(/&/g, \"-and-\") // Replace & with 'and'\n .replace(/[^\\w\\-]+/g, \"\") // Remove all non-word characters\n .replace(/\\-\\-+/g, \"-\") // Replace multiple - with single -\n .replace(/^-+/, \"\") // Trim - from start of text\n .replace(/-+$/, \"\"); // Trim - from end of text\n pageLink = window.location.href + \"tack/\" + officeName;\n }\n return pageLink;\n}\nfunction $9a74061b8d9cdb1b$export$8c3d67c5d320a22(estateType) {\n let estateIcon = \"\";\n if (estateType === (0, $cUbQm.EstateType).House) estateIcon = \"liten_villa.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Plot) estateIcon = \"liten_tomt.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Commercial) estateIcon = \"liten_kommersiell.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Cottage) estateIcon = \"liten_fritidshus.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Cooperative) estateIcon = \"liten_bostadsratt.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Agriculture) estateIcon = \"liten_gard.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Project) estateIcon = \"liten_nyproduktion.svg\";\n else if (estateType === (0, $cUbQm.EstateType).OwnedApartment) estateIcon = \"liten_bostadsratt.svg\";\n return estateIcon;\n}\nfunction $9a74061b8d9cdb1b$export$b4c0e43afc46e381(estateType, color) {\n let estateIcon = \"\";\n if (estateType === (0, $cUbQm.EstateType).House) estateIcon = color === \"white\" ? `stor_villa-white.svg` : \"stor_villa.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Plot) estateIcon = color === \"white\" ? `stor_tomt-white.svg` : \"stor_tomt.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Commercial) estateIcon = color === \"white\" ? `stor_kommersiell-white.svg` : \"stor_kommersiell.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Cottage) estateIcon = color === \"white\" ? `stor_fritidshus-white.svg` : \"stor_fritidshus_blue.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Cooperative) estateIcon = color === \"white\" ? `stor_bostadsratt-white.svg` : \"stor_bostadsratt.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Agriculture) estateIcon = color === \"white\" ? `stor_gard-white.svg` : \"stor_gard.svg\";\n else if (estateType === (0, $cUbQm.EstateType).Project) estateIcon = color === \"white\" ? `stor_nyproduktion-white.svg` : \"stor_nyproduktion.svg\";\n else if (estateType === (0, $cUbQm.EstateType).OwnedApartment) estateIcon = color === \"white\" ? `stor_bostadsratt-white.svg` : \"stor_bostadsratt.svg\";\n else if (estateType === (0, $cUbQm.EstateType).RowHouse) estateIcon = color === \"white\" ? `stor_parhus-white.svg` : \"stor_parhus.svg\";\n return estateIcon;\n}\nfunction $9a74061b8d9cdb1b$export$dcaf1dbf3e0c13ab(n) {\n if (n === 0) return \"0\";\n const formattedPrice = [];\n for(; n >= 1000; n = Math.floor(n / 1000))formattedPrice.unshift(String(n % 1000).padStart(3, \"0\"));\n formattedPrice.unshift(n);\n const finalOutput = formattedPrice.join(\" \");\n return finalOutput;\n}\nfunction $9a74061b8d9cdb1b$export$44e7716ae1289d49(input) {\n return input?.replace(/(?:^\\w|[a-zåäö]|\\b\\w)/g, function(word, index) {\n return index === 0 ? word.toUpperCase() : word.toLowerCase();\n });\n}\nfunction $9a74061b8d9cdb1b$export$69242b0ce39e8dd6(event) {\n if (event.key === \"ArrowUp\") {\n const parent = document.getElementById(\"ac-result-list\");\n if (parent) {\n const theList = $9a74061b8d9cdb1b$var$getAllFocusableElements(parent);\n const arrayOfFocusableElements = Array.from(theList);\n if (document.activeElement) {\n const indexOfActiveElement = arrayOfFocusableElements.indexOf(document.activeElement);\n if (arrayOfFocusableElements[indexOfActiveElement - 1] !== undefined) arrayOfFocusableElements[indexOfActiveElement - 1].focus();\n return;\n }\n }\n }\n if (event.key === \"ArrowDown\") {\n const parent = document.getElementById(\"ac-result-list\");\n if (parent) {\n const theList = $9a74061b8d9cdb1b$var$getAllFocusableElements(parent);\n const arrayOfFocusableElements = Array.from(theList);\n if (document.activeElement) {\n const indexOfActiveElement = arrayOfFocusableElements.indexOf(document.activeElement);\n if (arrayOfFocusableElements[indexOfActiveElement + 1] !== undefined) arrayOfFocusableElements[indexOfActiveElement + 1].focus();\n return;\n }\n }\n }\n}\nconst $9a74061b8d9cdb1b$var$getAllFocusableElements = (parent)=>{\n if (!parent) {\n console.warn(\"You need to pass a parent HTMLElement\");\n return []; // Return array so length queries will work\n }\n return parent.querySelectorAll('[href], [tabindex]:not([tabindex=\"-1\"]):not([disabled])');\n};\nfunction $9a74061b8d9cdb1b$export$638ec343b26d72db() {\n const searchInputField = document.getElementById(\"searchfield-input\");\n searchInputField?.focus();\n}\nconst $9a74061b8d9cdb1b$export$8619e4a655a41ad9 = (fn)=>{\n const cb = (0, $dTCkE.useRef)(fn); // init with fn, so that type checkers won't assume that current might be undefined\n (0, $dTCkE.useEffect)(()=>{\n cb.current = fn;\n }, [\n fn\n ]);\n (0, $dTCkE.useEffect)(()=>{\n const onUnload = (...args)=>cb.current?.(...args);\n window.addEventListener(\"beforeunload\", onUnload);\n return ()=>window.removeEventListener(\"beforeunload\", onUnload);\n }, []);\n};\nvar $9a74061b8d9cdb1b$export$2e2bcd8739ae039 = $9a74061b8d9cdb1b$export$8619e4a655a41ad9;\nfunction $9a74061b8d9cdb1b$export$dd09f40777b29234(todayDate) {\n let returnDate = \"\";\n const date = new Date();\n if (todayDate === true) {\n const today = date.toJSON().slice(0, 10);\n returnDate = today;\n } else {\n date.setFullYear(date.getFullYear() + 10);\n const futureTime = date.toJSON().slice(0, 10);\n returnDate = futureTime;\n }\n return returnDate;\n}\nfunction $9a74061b8d9cdb1b$export$bd0df835003197b0(e, lettersOnly) {\n if (lettersOnly && (isFinite(Number(e.key)) || e.key === \".\" || e.key === \",\" || e.key === \"!\" || e.key === \"#\" || e.key === \"\\u20AC\" || e.key === \"%\" || e.key === \"&\" || e.key === \"/\" || e.key === \"(\" || e.key === \")\" || e.key === \"=\" || e.key === \"?\" || e.key === \"\\xa1\" || e.key === \"\\u201D\" || e.key === \"\\xa5\" || e.key === \"\\xa2\" || e.key === \"\\u2030\" || e.key === \"\\xb6\" || e.key === \"{\" || e.key === \"}\" || e.key === \"\\u2260\" || e.key === \"_\" || e.key === \":\" || e.key === \";\" || e.key === \"*\" || e.key === \"\\xa8\" || e.key === \"<\" || e.key === \">\" || e.key === \"\\u2264\" || e.key === \"\\u2265\" || e.key === \"\\xbf\" || e.key === \"`\") && e.key !== \"Backspace\" && e.key !== \"Tab\" && e.key !== \"ArrowRight\" && e.key !== \"ArrowLeft\") e.preventDefault();\n}\nconst $9a74061b8d9cdb1b$export$8e931dc4399d58f1 = (value)=>{\n switch(value){\n case \"Villa\":\n return \"liten_villa.svg\";\n case \"Tomt\":\n return \"liten_tomt.svg\";\n case \"Kommersiellt\":\n return \"liten_kommersiell.svg\";\n case \"Fritidshus\":\n return \"liten_fritidshus.svg\";\n case (0, $cUbQm.EstateType).Cooperative:\n return \"liten_bostadsratt.svg\";\n case \"G\\xe5rd\":\n return \"liten_gard.svg\";\n case \"\\xc4garl\\xe4genhet\":\n return \"liten_bostadsratt.svg\";\n default:\n return \"liten_villa.svg\";\n }\n};\nfunction $9a74061b8d9cdb1b$export$e4c1b429cc7a7158(id, isSeller, accepted, showOnMyPages) {\n if ((0, $cUbQm.StatusId).ForSale == id || (0, $cUbQm.StatusId).HeadStartHomes == id) return !isSeller ? \"Till salu\" : \"F\\xf6rs\\xe4ljning p\\xe5g\\xe5r\";\n else if ((0, $cUbQm.StatusId).Intake == id) return !isSeller ? \"Ej under publik f\\xf6rs\\xe4ljning\" : accepted ? \"Godk\\xe4nd, v\\xe4ntar p\\xe5 m\\xe4klare\" : showOnMyPages ? \"V\\xe4ntar p\\xe5 godk\\xe4nnande\" : \"M\\xe4klaren f\\xf6rbereder annonsen\";\n else if ((0, $cUbQm.StatusId).Sold == id) return !isSeller ? \"S\\xe5ld\" : \"S\\xe5lt\";\n else if ((0, $cUbQm.StatusId).DuringIntake == id) return \"Kontakt med m\\xe4klare p\\xe5b\\xf6rjad\";\n else if ((0, $cUbQm.StatusId).Coming == id) return \"Kommande f\\xf6rs\\xe4ljning\";\n return \"\";\n}\nfunction $9a74061b8d9cdb1b$export$cefe5d5eda7bee66(value) {\n switch(value){\n case \"Gotland\":\n return \"p\\xe5\";\n case \"Liding\\xf6\":\n return \"p\\xe5\";\n case \"\\xd6land\":\n return \"p\\xe5\";\n case \"Eker\\xf6\":\n return \"p\\xe5\";\n case \"\\xd6cker\\xf6\":\n return \"p\\xe5\";\n case \"Orust\":\n return \"p\\xe5\";\n case \"M\\xf6rbyl\\xe5nga\":\n return \"p\\xe5\";\n case \"Tj\\xf6rn\":\n return \"p\\xe5\";\n case \"V\\xe4rmd\\xf6\":\n return \"p\\xe5\";\n case \"Hammar\\xf6\":\n return \"p\\xe5\";\n default:\n return \"i\";\n }\n}\nfunction $9a74061b8d9cdb1b$export$47a56b1fff388487(user, estateId) {\n if (estateId) return user?.objectsImBuying.find((obj)=>obj.id === estateId) ?? user?.objectsImSelling.find((obj)=>obj.id === estateId);\n return user?.objectsImSelling.sort((a, b)=>a.sortIndex - b.sortIndex)[0] ?? user?.objectsImBuying[0];\n}\nconst $9a74061b8d9cdb1b$export$62e765922eb7ba09 = (name)=>{\n return name?.replace(/[åäö]/gi, (match)=>{\n switch(match){\n case \"\\xe5\":\n return \"a\";\n case \"\\xe4\":\n return \"a\";\n case \"\\xf6\":\n return \"o\";\n }\n });\n};\nconst $9a74061b8d9cdb1b$export$b3739caaf2580dd = ()=>{\n return (0, (/*@__PURE__*/$parcel$interopDefault($1A7pc))).get(\"sessionId\");\n};\nconst $9a74061b8d9cdb1b$export$587d07e363d643fa = ()=>{\n (0, (/*@__PURE__*/$parcel$interopDefault($1A7pc))).remove(\"sessionId\");\n};\nconst $9a74061b8d9cdb1b$export$1a9e7ff3d494e529 = ()=>{\n (0, (/*@__PURE__*/$parcel$interopDefault($1A7pc))).remove(\"loginType\");\n};\nfunction $9a74061b8d9cdb1b$export$c6e2787f63ca055d(str) {\n return str === null || str.match(/^ *$/) !== null;\n}\nconst $9a74061b8d9cdb1b$export$50f60048ef8acba = (office)=>{\n switch(office){\n case \"Sollentuna\":\n return true;\n case \"Sundbyberg\":\n return true;\n case \"Solna\":\n return true;\n case \"Bromma\":\n return true;\n case \"\\xd6ster\\xe5ker\":\n return true;\n default:\n return false;\n }\n};\nconst $9a74061b8d9cdb1b$export$f974294898073a2e = (value)=>{\n switch(value){\n case \"forest\":\n return \"Skog\";\n case \"wasteLand\":\n return \"Impediment\";\n case \"arabel\":\n return \"\\xc5ker\";\n case \"infield\":\n return \"In\\xe4gomark\";\n case \"pasture\":\n return \"Bete\";\n case \"water\":\n return \"Vatten\";\n case \"other\":\n return \"\\xd6vrigt\";\n case \"totalArea\":\n return \"Totalt\";\n case \"Skogsbruksplan\":\n return \"Areal enligt skogsbruksplan\";\n default:\n return value;\n }\n};\nconst $9a74061b8d9cdb1b$export$1567cc001e3d0c1d = (endValue, duration)=>{\n const [currentValue, setCurrentValue] = (0, $dTCkE.useState)(0);\n (0, $dTCkE.useEffect)(()=>{\n let startTime = null;\n let animationFrame;\n const startAnimation = (timestamp)=>{\n if (!startTime) startTime = timestamp;\n const elapsedTime = timestamp - startTime;\n const progress = Math.min(1, elapsedTime / duration);\n const newValue = Math.floor(progress * endValue);\n setCurrentValue(newValue);\n if (progress < 1) animationFrame = requestAnimationFrame(startAnimation);\n };\n animationFrame = requestAnimationFrame(startAnimation);\n return ()=>cancelAnimationFrame(animationFrame);\n }, [\n endValue,\n duration\n ]);\n};\nconst $9a74061b8d9cdb1b$export$9defdf5fd4260665 = (e)=>{\n const element = document.getElementById(e);\n element.scrollIntoView({\n behavior: \"smooth\",\n block: \"start\"\n });\n};\nconst $9a74061b8d9cdb1b$export$408255c143692c3 = (str)=>{\n if (str.length < 3) return str;\n const part1 = str.slice(0, 3);\n const part2 = str.slice(3);\n return `${part1} ${part2}`;\n};\nfunction $9a74061b8d9cdb1b$export$90a76a0e4122dd3a(elementId, behavior = \"smooth\", position = \"center\") {\n const element = document.getElementById(elementId)?.firstChild;\n element?.scrollIntoView({\n behavior: behavior,\n block: position\n });\n}\nconst $9a74061b8d9cdb1b$export$d07f57595c356899 = (str)=>{\n if (!str) return \"\";\n return str.toLowerCase().split(\" \").map((word)=>word.charAt(0).toUpperCase() + word.slice(1)).join(\" \");\n};\nconst $9a74061b8d9cdb1b$export$8eca4915c8e83d68 = (url, crop, focalPoint, fallbackWidth, fallBackHeight)=>{\n if (crop?.coordinates) return `${url}?cc=${crop?.coordinates?.x1},${crop?.coordinates?.y1},${crop?.coordinates?.x2},${crop?.coordinates?.y2}&width=${crop?.width}&height=${crop?.height}&format=webp`;\n else if (focalPoint) return `${url}?rxy=${focalPoint.left},${focalPoint?.top}&width=${crop?.width}&height=${crop?.height}&format=webp`;\n else return `${url}?width=${fallbackWidth}&height=${fallBackHeight}&format=webp`;\n};\nconst $9a74061b8d9cdb1b$export$e0c08d15c4f9dab5 = (resp)=>{\n return typeof resp === \"string\" ? JSON.parse(resp) : resp;\n};\nconst $9a74061b8d9cdb1b$export$336f96d7a7ef3a88 = (key, value, expiryTimeMs)=>{\n const expiryTimestamp = Date.now() + expiryTimeMs;\n const data = {\n value: value,\n expiryTimestamp: expiryTimestamp\n };\n sessionStorage.setItem(key, JSON.stringify(data));\n};\nconst $9a74061b8d9cdb1b$export$b7b8e3e7a2da2caa = (key)=>{\n const data = sessionStorage.getItem(key);\n if (!data) return null;\n const { value: value, expiryTimestamp: expiryTimestamp } = JSON.parse(data);\n // Check if the current time is past the expiration time\n if (Date.now() > expiryTimestamp) {\n sessionStorage.removeItem(key); // Invalidate the expired key\n return null;\n }\n return value;\n};\n\n});\n\n})();\n//# sourceMappingURL=ObjectPage.03ab0fd2.js.map\n","import { RefObject, useEffect, useRef, useState } from 'react';\r\nimport { EstateType, StatusId } from './Enums';\r\nimport { MyPagesEstateDto, User } from './services/generatedApi';\r\nimport Cookies from 'js-cookie';\r\nimport { FocalCoordinates, Crop } from './types/UmbracoOfficeInterface';\r\n\r\nexport function useDebounce(value: T, delay: number): T {\r\n // State and setters for debounced value\r\n const [debouncedValue, setDebouncedValue] = useState(value);\r\n useEffect(\r\n () => {\r\n // Update debounced value after delay\r\n const handler = setTimeout(() => {\r\n setDebouncedValue(value);\r\n }, delay);\r\n // Cancel the timeout if value changes (also on delay change or unmount)\r\n // This is how we prevent debounced value from updating if value is changed ...\r\n // .. within the delay period. Timeout gets cleared and restarted.\r\n return () => {\r\n clearTimeout(handler);\r\n };\r\n },\r\n [value, delay] // Only re-call effect if value or delay changes\r\n );\r\n return debouncedValue;\r\n}\r\n\r\nexport function toggleInList(item: T, list: T[]): T[] {\r\n return list.includes(item) ? list.filter((i) => i !== item) : [...list, item];\r\n}\r\n\r\nexport function useOnClickOutside(\r\n ref: RefObject,\r\n handler: () => void\r\n): void {\r\n useEffect(\r\n () => {\r\n const listener = (event: Event) => {\r\n // Do nothing if clicking ref's element or descendent elements\r\n if (!ref.current || ref.current.contains(event.target as Node)) {\r\n return;\r\n }\r\n handler();\r\n };\r\n document.addEventListener('mousedown', listener);\r\n document.addEventListener('touchstart', listener);\r\n return () => {\r\n document.removeEventListener('mousedown', listener);\r\n document.removeEventListener('touchstart', listener);\r\n };\r\n },\r\n // Add ref and handler to effect dependencies\r\n // It's worth noting that because passed in handler is a new ...\r\n // ... function on every render that will cause this effect ...\r\n // ... callback/cleanup to run every render. It's not a big deal ...\r\n // ... but to optimize you can wrap handler in useCallback before ...\r\n // ... passing it into this hook.\r\n [ref, handler]\r\n );\r\n}\r\n\r\nexport function useKeyPress(targetKey: string): boolean {\r\n // State for keeping track of whether key is pressed\r\n const [keyPressed, setKeyPressed] = useState(false);\r\n // If pressed key is our target key then set to true\r\n\r\n // Add event listeners\r\n useEffect(() => {\r\n function downHandler({ key }: { key: string }) {\r\n if (key === targetKey) {\r\n setKeyPressed(true);\r\n }\r\n }\r\n // If released key is our target key then set to false\r\n const upHandler = ({ key }: { key: string }) => {\r\n if (key === targetKey) {\r\n setKeyPressed(false);\r\n }\r\n };\r\n\r\n window.addEventListener('keydown', downHandler);\r\n window.addEventListener('keyup', upHandler);\r\n // Remove event listeners on cleanup\r\n return () => {\r\n window.removeEventListener('keydown', downHandler);\r\n window.removeEventListener('keyup', upHandler);\r\n };\r\n }, [targetKey]); // Empty array ensures that effect is only run on mount and unmount\r\n return keyPressed;\r\n}\r\n\r\n//Sets ariaattributes\r\nexport function changeCheckboxAriaAttr(\r\n e: React.ChangeEvent\r\n): void {\r\n const item = e.currentTarget;\r\n\r\n switch (item?.getAttribute('aria-checked')) {\r\n case 'true':\r\n item.setAttribute('aria-checked', 'false');\r\n break;\r\n case 'false':\r\n item.setAttribute('aria-checked', 'true');\r\n break;\r\n }\r\n}\r\n\r\nexport function gtmPageBuilder(officeName: string | undefined): string {\r\n let pageLink = '';\r\n if (officeName !== undefined) {\r\n officeName = officeName.toLowerCase().trim();\r\n\r\n const a =\r\n 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;';\r\n const b =\r\n 'aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------';\r\n const p = new RegExp(a.split('').join('|'), 'g');\r\n\r\n officeName = officeName\r\n .toString()\r\n .toLowerCase()\r\n .replace(/\\s+/g, '-') // Replace spaces with -\r\n .replace(p, (c) => b.charAt(a.indexOf(c))) // Replace special characters\r\n .replace(/&/g, '-and-') // Replace & with 'and'\r\n .replace(/[^\\w\\-]+/g, '') // Remove all non-word characters\r\n .replace(/\\-\\-+/g, '-') // Replace multiple - with single -\r\n .replace(/^-+/, '') // Trim - from start of text\r\n .replace(/-+$/, ''); // Trim - from end of text\r\n\r\n pageLink = window.location.href + 'tack/' + officeName;\r\n }\r\n return pageLink;\r\n}\r\n\r\nexport function getSmallObjectTypeIconPath(estateType: EstateType): string {\r\n let estateIcon = '';\r\n if (estateType === EstateType.House) {\r\n estateIcon = 'liten_villa.svg';\r\n } else if (estateType === EstateType.Plot) {\r\n estateIcon = 'liten_tomt.svg';\r\n } else if (estateType === EstateType.Commercial) {\r\n estateIcon = 'liten_kommersiell.svg';\r\n } else if (estateType === EstateType.Cottage) {\r\n estateIcon = 'liten_fritidshus.svg';\r\n } else if (estateType === EstateType.Cooperative) {\r\n estateIcon = 'liten_bostadsratt.svg';\r\n } else if (estateType === EstateType.Agriculture) {\r\n estateIcon = 'liten_gard.svg';\r\n } else if (estateType === EstateType.Project) {\r\n estateIcon = 'liten_nyproduktion.svg';\r\n } else if (estateType === EstateType.OwnedApartment) {\r\n estateIcon = 'liten_bostadsratt.svg';\r\n }\r\n return estateIcon;\r\n}\r\n\r\nexport function getLargeObjectTypeIconPath(\r\n estateType: EstateType,\r\n color?: 'white' | 'blue'\r\n): string {\r\n let estateIcon = '';\r\n if (estateType === EstateType.House) {\r\n estateIcon = color === 'white' ? `stor_villa-white.svg` : 'stor_villa.svg';\r\n } else if (estateType === EstateType.Plot) {\r\n estateIcon = color === 'white' ? `stor_tomt-white.svg` : 'stor_tomt.svg';\r\n } else if (estateType === EstateType.Commercial) {\r\n estateIcon =\r\n color === 'white' ? `stor_kommersiell-white.svg` : 'stor_kommersiell.svg';\r\n } else if (estateType === EstateType.Cottage) {\r\n estateIcon =\r\n color === 'white'\r\n ? `stor_fritidshus-white.svg`\r\n : 'stor_fritidshus_blue.svg';\r\n } else if (estateType === EstateType.Cooperative) {\r\n estateIcon =\r\n color === 'white' ? `stor_bostadsratt-white.svg` : 'stor_bostadsratt.svg';\r\n } else if (estateType === EstateType.Agriculture) {\r\n estateIcon = color === 'white' ? `stor_gard-white.svg` : 'stor_gard.svg';\r\n } else if (estateType === EstateType.Project) {\r\n estateIcon =\r\n color === 'white'\r\n ? `stor_nyproduktion-white.svg`\r\n : 'stor_nyproduktion.svg';\r\n } else if (estateType === EstateType.OwnedApartment) {\r\n estateIcon =\r\n color === 'white' ? `stor_bostadsratt-white.svg` : 'stor_bostadsratt.svg';\r\n } else if (estateType === EstateType.RowHouse) {\r\n estateIcon =\r\n color === 'white' ? `stor_parhus-white.svg` : 'stor_parhus.svg';\r\n }\r\n return estateIcon;\r\n}\r\n\r\n//Formatting for example 1000000 to 1 000 000\r\nexport function formatLargeNumbers(n: number): string {\r\n if (n === 0) {\r\n return '0';\r\n }\r\n const formattedPrice = [];\r\n for (; n >= 1000; n = Math.floor(n / 1000)) {\r\n formattedPrice.unshift(String(n % 1000).padStart(3, '0'));\r\n }\r\n formattedPrice.unshift(n);\r\n const finalOutput = formattedPrice.join(' ');\r\n return finalOutput;\r\n}\r\n\r\nexport function makeCamelCase(input: string): string {\r\n return input?.replace(\r\n /(?:^\\w|[a-zåäö]|\\b\\w)/g,\r\n function (word: string, index: number) {\r\n return index === 0 ? word.toUpperCase() : word.toLowerCase();\r\n }\r\n );\r\n}\r\n\r\n//Made for Autocomplete of search estates field.\r\nexport function handleUpAndDown(event: KeyboardEvent): void {\r\n if (event.key === 'ArrowUp') {\r\n const parent = document.getElementById('ac-result-list') as HTMLElement;\r\n if (parent) {\r\n const theList = getAllFocusableElements(parent);\r\n const arrayOfFocusableElements = Array.from(theList) as HTMLElement[];\r\n if (document.activeElement) {\r\n const indexOfActiveElement = arrayOfFocusableElements.indexOf(\r\n document.activeElement as HTMLElement\r\n );\r\n if (arrayOfFocusableElements[indexOfActiveElement - 1] !== undefined) {\r\n arrayOfFocusableElements[indexOfActiveElement - 1].focus();\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n if (event.key === 'ArrowDown') {\r\n const parent = document.getElementById('ac-result-list') as HTMLElement;\r\n if (parent) {\r\n const theList = getAllFocusableElements(parent);\r\n const arrayOfFocusableElements = Array.from(theList) as HTMLElement[];\r\n if (document.activeElement) {\r\n const indexOfActiveElement = arrayOfFocusableElements.indexOf(\r\n document.activeElement as HTMLElement\r\n );\r\n if (arrayOfFocusableElements[indexOfActiveElement + 1] !== undefined) {\r\n arrayOfFocusableElements[indexOfActiveElement + 1].focus();\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n}\r\nconst getAllFocusableElements = (parent: any) => {\r\n if (!parent) {\r\n console.warn('You need to pass a parent HTMLElement');\r\n return []; // Return array so length queries will work\r\n }\r\n\r\n return parent.querySelectorAll(\r\n '[href], [tabindex]:not([tabindex=\"-1\"]):not([disabled])'\r\n );\r\n};\r\n\r\nexport function focusOnInput(): void {\r\n const searchInputField = document.getElementById('searchfield-input');\r\n searchInputField?.focus();\r\n}\r\n\r\nexport const useUnload = (fn: any) => {\r\n const cb = useRef(fn); // init with fn, so that type checkers won't assume that current might be undefined\r\n\r\n useEffect(() => {\r\n cb.current = fn;\r\n }, [fn]);\r\n\r\n useEffect(() => {\r\n const onUnload = (...args: any) => cb.current?.(...args);\r\n\r\n window.addEventListener('beforeunload', onUnload);\r\n\r\n return () => window.removeEventListener('beforeunload', onUnload);\r\n }, []);\r\n};\r\n\r\nexport default useUnload;\r\nexport function getDates(todayDate: boolean): string {\r\n let returnDate = '';\r\n const date = new Date();\r\n\r\n if (todayDate === true) {\r\n const today = date.toJSON().slice(0, 10);\r\n returnDate = today;\r\n } else {\r\n date.setFullYear(date.getFullYear() + 10);\r\n const futureTime = date.toJSON().slice(0, 10);\r\n returnDate = futureTime;\r\n }\r\n return returnDate;\r\n}\r\n\r\n//Ugly way of distinguish only letters for immediate validation, strict mode.\r\nexport function restrictToOnlyLetters(\r\n e: React.KeyboardEvent,\r\n lettersOnly: boolean | undefined\r\n): void {\r\n if (\r\n lettersOnly &&\r\n (isFinite(Number(e.key)) ||\r\n e.key === '.' ||\r\n e.key === ',' ||\r\n e.key === '!' ||\r\n e.key === '#' ||\r\n e.key === '€' ||\r\n e.key === '%' ||\r\n e.key === '&' ||\r\n e.key === '/' ||\r\n e.key === '(' ||\r\n e.key === ')' ||\r\n e.key === '=' ||\r\n e.key === '?' ||\r\n e.key === '¡' ||\r\n e.key === '”' ||\r\n e.key === '¥' ||\r\n e.key === '¢' ||\r\n e.key === '‰' ||\r\n e.key === '¶' ||\r\n e.key === '{' ||\r\n e.key === '}' ||\r\n e.key === '≠' ||\r\n e.key === '_' ||\r\n e.key === ':' ||\r\n e.key === ';' ||\r\n e.key === '*' ||\r\n e.key === '¨' ||\r\n e.key === '<' ||\r\n e.key === '>' ||\r\n e.key === '≤' ||\r\n e.key === '≥' ||\r\n e.key === '¿' ||\r\n e.key === '`') &&\r\n e.key !== 'Backspace' &&\r\n e.key !== 'Tab' &&\r\n e.key !== 'ArrowRight' &&\r\n e.key !== 'ArrowLeft'\r\n ) {\r\n e.preventDefault();\r\n }\r\n}\r\n\r\nexport const translateEstateType = (value: string) => {\r\n switch (value) {\r\n case 'Villa':\r\n return 'liten_villa.svg';\r\n case 'Tomt':\r\n return 'liten_tomt.svg';\r\n case 'Kommersiellt':\r\n return 'liten_kommersiell.svg';\r\n case 'Fritidshus':\r\n return 'liten_fritidshus.svg';\r\n case EstateType.Cooperative:\r\n return 'liten_bostadsratt.svg';\r\n case 'Gård':\r\n return 'liten_gard.svg';\r\n case 'Ägarlägenhet':\r\n return 'liten_bostadsratt.svg';\r\n default:\r\n return 'liten_villa.svg';\r\n }\r\n};\r\n\r\nexport function GetStatusText(\r\n id: string,\r\n isSeller: boolean,\r\n accepted: boolean,\r\n showOnMyPages: boolean\r\n) {\r\n if (StatusId.ForSale == id || StatusId.HeadStartHomes == id) {\r\n return !isSeller ? 'Till salu' : 'Försäljning pågår';\r\n } else if (StatusId.Intake == id) {\r\n return !isSeller\r\n ? 'Ej under publik försäljning'\r\n : accepted\r\n ? 'Godkänd, väntar på mäklare'\r\n : showOnMyPages\r\n ? 'Väntar på godkännande'\r\n : 'Mäklaren förbereder annonsen';\r\n } else if (StatusId.Sold == id) {\r\n return !isSeller ? 'Såld' : 'Sålt';\r\n } else if (StatusId.DuringIntake == id) {\r\n return 'Kontakt med mäklare påbörjad';\r\n } else if (StatusId.Coming == id) {\r\n return 'Kommande försäljning';\r\n }\r\n return '';\r\n}\r\nexport function municipalityCheck(value: string | undefined | null) {\r\n switch (value) {\r\n case 'Gotland':\r\n return 'på';\r\n case 'Lidingö':\r\n return 'på';\r\n case 'Öland':\r\n return 'på';\r\n case 'Ekerö':\r\n return 'på';\r\n case 'Öckerö':\r\n return 'på';\r\n case 'Orust':\r\n return 'på';\r\n case 'Mörbylånga':\r\n return 'på';\r\n case 'Tjörn':\r\n return 'på';\r\n case 'Värmdö':\r\n return 'på';\r\n case 'Hammarö':\r\n return 'på';\r\n default:\r\n return 'i';\r\n }\r\n}\r\n\r\n/**\r\n * This function is the same as in UserItem.cs, matches the old get current estate on user.\r\n * @param user\r\n * @param estateId\r\n * @returns MyPagesEstateDto\r\n */\r\nexport function GetCurrentEstate(\r\n user: User,\r\n estateId?: string\r\n): MyPagesEstateDto {\r\n if (estateId) {\r\n return (\r\n user?.objectsImBuying.find((obj) => obj.id === estateId) ??\r\n user?.objectsImSelling.find((obj) => obj.id === estateId)\r\n );\r\n }\r\n return (\r\n user?.objectsImSelling.sort(\r\n (a: MyPagesEstateDto, b: MyPagesEstateDto) => a.sortIndex - b.sortIndex\r\n )[0] ?? user?.objectsImBuying[0]\r\n );\r\n}\r\n\r\nexport const letterTransform = (name: string) => {\r\n return name?.replace(/[åäö]/gi, (match) => {\r\n switch (match) {\r\n case 'å':\r\n return 'a';\r\n case 'ä':\r\n return 'a';\r\n case 'ö':\r\n return 'o';\r\n }\r\n });\r\n};\r\n\r\nexport const getSessionId = () => {\r\n return Cookies.get('sessionId');\r\n};\r\n\r\nexport const removeSessionId = () => {\r\n Cookies.remove('sessionId');\r\n};\r\nexport const removeLoginType = () => {\r\n Cookies.remove('loginType');\r\n};\r\n\r\nexport function isNullOrWhiteSpace(str: string) {\r\n return str === null || str.match(/^ *$/) !== null;\r\n}\r\n\r\nexport const officeBrokerGrayScale = (office: string | undefined | null) => {\r\n switch (office) {\r\n case 'Sollentuna':\r\n return true;\r\n case 'Sundbyberg':\r\n return true;\r\n case 'Solna':\r\n return true;\r\n case 'Bromma':\r\n return true;\r\n case 'Österåker':\r\n return true;\r\n default:\r\n return false;\r\n }\r\n};\r\n\r\nexport const arealTerms = (value: string) => {\r\n switch (value) {\r\n case 'forest':\r\n return 'Skog';\r\n case 'wasteLand':\r\n return 'Impediment';\r\n case 'arabel':\r\n return 'Åker';\r\n case 'infield':\r\n return 'Inägomark';\r\n case 'pasture':\r\n return 'Bete';\r\n case 'water':\r\n return 'Vatten';\r\n case 'other':\r\n return 'Övrigt';\r\n case 'totalArea':\r\n return 'Totalt';\r\n case 'Skogsbruksplan':\r\n return 'Areal enligt skogsbruksplan';\r\n default:\r\n return value;\r\n }\r\n};\r\n\r\nexport const CountUp = (endValue: number, duration: number) => {\r\n const [currentValue, setCurrentValue] = useState(0);\r\n\r\n useEffect(() => {\r\n let startTime: number | null = null;\r\n let animationFrame: number;\r\n\r\n const startAnimation = (timestamp: number) => {\r\n if (!startTime) startTime = timestamp;\r\n const elapsedTime = timestamp - startTime;\r\n const progress = Math.min(1, elapsedTime / duration);\r\n const newValue = Math.floor(progress * endValue);\r\n setCurrentValue(newValue);\r\n\r\n if (progress < 1) {\r\n animationFrame = requestAnimationFrame(startAnimation);\r\n }\r\n };\r\n\r\n animationFrame = requestAnimationFrame(startAnimation);\r\n\r\n return () => cancelAnimationFrame(animationFrame);\r\n }, [endValue, duration]);\r\n};\r\n\r\nexport const scrollToElementById = (e: string) => {\r\n const element = document.getElementById(e);\r\n element.scrollIntoView({\r\n behavior: 'smooth',\r\n block: 'start',\r\n });\r\n};\r\n\r\nexport const postalCodeFormatter = (str: string): string => {\r\n if (str.length < 3) {\r\n return str;\r\n }\r\n const part1 = str.slice(0, 3);\r\n const part2 = str.slice(3);\r\n return `${part1} ${part2}`;\r\n};\r\nexport function scrollToFunction(\r\n elementId: string,\r\n behavior: ScrollBehavior = 'smooth',\r\n position: ScrollLogicalPosition = 'center'\r\n) {\r\n const element = document.getElementById(elementId)?.firstChild as HTMLElement;\r\n element?.scrollIntoView({\r\n behavior: behavior,\r\n block: position,\r\n });\r\n}\r\nexport const capitalizeFirstLetter = (str: string) => {\r\n if (!str) {\r\n return '';\r\n }\r\n return str\r\n .toLowerCase()\r\n .split(' ')\r\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\r\n .join(' ');\r\n};\r\n\r\nexport const buildUmbracoImageUrl = (\r\n url: string,\r\n crop: Crop,\r\n focalPoint: FocalCoordinates,\r\n fallbackWidth: number,\r\n fallBackHeight: number\r\n) => {\r\n if (crop?.coordinates) {\r\n return `${url}?cc=${crop?.coordinates?.x1},${crop?.coordinates?.y1},${crop?.coordinates?.x2},${crop?.coordinates?.y2}&width=${crop?.width}&height=${crop?.height}&format=webp`;\r\n } else if (focalPoint) {\r\n return `${url}?rxy=${focalPoint.left},${focalPoint?.top}&width=${crop?.width}&height=${crop?.height}&format=webp`;\r\n } else {\r\n return `${url}?width=${fallbackWidth}&height=${fallBackHeight}&format=webp`;\r\n }\r\n};\r\n\r\nexport const parseJsonResponse = (resp: any): T => {\r\n return typeof resp === 'string' ? JSON.parse(resp) : resp;\r\n};\r\n\r\n// Utility function to set a flag with expiration in sessionStorage\r\nexport const setSessionFlagWithExpiry = (\r\n key: string,\r\n value: string,\r\n expiryTimeMs: number\r\n) => {\r\n const expiryTimestamp = Date.now() + expiryTimeMs;\r\n const data = { value, expiryTimestamp };\r\n sessionStorage.setItem(key, JSON.stringify(data));\r\n};\r\n\r\n// Utility function to get a flag and check its expiration\r\nexport const getSessionFlagWithExpiry = (key: string): string | null => {\r\n const data = sessionStorage.getItem(key);\r\n if (!data) return null;\r\n\r\n const { value, expiryTimestamp } = JSON.parse(data);\r\n\r\n // Check if the current time is past the expiration time\r\n if (Date.now() > expiryTimestamp) {\r\n sessionStorage.removeItem(key); // Invalidate the expired key\r\n return null;\r\n }\r\n\r\n return value;\r\n};\r\n"],"names":["$parcel$interopDefault","a","__esModule","default","$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","parcelRequire","$parcel$global","globalThis","self","window","global","parcelRegister","register","module","exports","$9a74061b8d9cdb1b$export$21805fee57372823","$9a74061b8d9cdb1b$export$9afc64c180e82dc4","$9a74061b8d9cdb1b$export$b65485ca34c366f3","$9a74061b8d9cdb1b$export$fcee17a44533bf4f","$9a74061b8d9cdb1b$export$ba7c21bf8d04b182","$9a74061b8d9cdb1b$export$b4c0e43afc46e381","$9a74061b8d9cdb1b$export$dcaf1dbf3e0c13ab","$9a74061b8d9cdb1b$export$44e7716ae1289d49","$9a74061b8d9cdb1b$export$69242b0ce39e8dd6","$9a74061b8d9cdb1b$export$638ec343b26d72db","$9a74061b8d9cdb1b$export$dd09f40777b29234","$9a74061b8d9cdb1b$export$bd0df835003197b0","$9a74061b8d9cdb1b$export$8e931dc4399d58f1","$9a74061b8d9cdb1b$export$e4c1b429cc7a7158","$9a74061b8d9cdb1b$export$cefe5d5eda7bee66","$9a74061b8d9cdb1b$export$47a56b1fff388487","$9a74061b8d9cdb1b$export$62e765922eb7ba09","$9a74061b8d9cdb1b$export$b3739caaf2580dd","$9a74061b8d9cdb1b$export$587d07e363d643fa","$9a74061b8d9cdb1b$export$1a9e7ff3d494e529","$9a74061b8d9cdb1b$export$50f60048ef8acba","$9a74061b8d9cdb1b$export$f974294898073a2e","$9a74061b8d9cdb1b$export$9defdf5fd4260665","$9a74061b8d9cdb1b$export$408255c143692c3","$9a74061b8d9cdb1b$export$d07f57595c356899","$9a74061b8d9cdb1b$export$8eca4915c8e83d68","$9a74061b8d9cdb1b$export$336f96d7a7ef3a88","$9a74061b8d9cdb1b$export$b7b8e3e7a2da2caa","$dTCkE","$cUbQm","$1A7pc","value","delay","debouncedValue","setDebouncedValue","useState","useEffect","handler","setTimeout","clearTimeout","ref","listener","event","current","contains","target","document","addEventListener","removeEventListener","targetKey","keyPressed","setKeyPressed","downHandler","key","upHandler","item","currentTarget","getAttribute","setAttribute","officeName","pageLink","undefined","toLowerCase","trim","p","RegExp","split","join","toString","replace","c","b","charAt","indexOf","location","href","estateType","color","estateIcon","EstateType","House","Plot","Commercial","Cottage","Cooperative","Agriculture","Project","OwnedApartment","RowHouse","formattedPrice","Math","floor","unshift","String","padStart","input","word","index","toUpperCase","parent","getElementById","arrayOfFocusableElements","Array","from","$9a74061b8d9cdb1b$var$getAllFocusableElements","activeElement","indexOfActiveElement","focus","querySelectorAll","console","warn","searchInputField","todayDate","date","Date","setFullYear","getFullYear","toJSON","slice","lettersOnly","isFinite","Number","preventDefault","id","isSeller","accepted","showOnMyPages","StatusId","ForSale","HeadStartHomes","Intake","Sold","DuringIntake","Coming","user","estateId","objectsImBuying","find","obj","objectsImSelling","sort","sortIndex","name","match","remove","office","element","scrollIntoView","behavior","block","str","length","part1","part2","map","url","crop","focalPoint","fallbackWidth","fallBackHeight","coordinates","x1","y1","x2","y2","width","height","left","top","expiryTimeMs","expiryTimestamp","now","sessionStorage","setItem","JSON","stringify","data","getItem","parse","removeItem"],"version":3,"file":"ObjectPage.03ab0fd2.js.map"}