@wikicasa-dev/utilities 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +32 -2
  2. package/dist/ArrayUtils.cjs +1 -0
  3. package/dist/ArrayUtils.js +4 -0
  4. package/dist/ColorUtils.cjs +1 -0
  5. package/dist/ColorUtils.js +8 -0
  6. package/dist/Control.Geocoder-Dyvby5gX.cjs +1 -0
  7. package/dist/Control.Geocoder-l0sNRNKZ.js +1 -0
  8. package/dist/CookieUtils.cjs +1 -0
  9. package/dist/CookieUtils.js +32 -0
  10. package/dist/CurrencyUtils.cjs +1 -0
  11. package/dist/CurrencyUtils.js +14 -0
  12. package/dist/DOMUtils.cjs +1 -0
  13. package/dist/DOMUtils.js +18 -0
  14. package/dist/DateUtils.cjs +1 -0
  15. package/dist/DateUtils.js +7 -0
  16. package/dist/DeviceDetectionUtils.cjs +1 -0
  17. package/dist/DeviceDetectionUtils.js +8 -0
  18. package/dist/EmailUtils.cjs +1 -0
  19. package/dist/EmailUtils.js +27 -0
  20. package/dist/FavoriteUtils.cjs +1 -0
  21. package/dist/FavoriteUtils.js +13 -0
  22. package/dist/FunctionUtils.cjs +1 -0
  23. package/dist/FunctionUtils.js +21 -0
  24. package/dist/GAutocompleteUtils.cjs +1 -0
  25. package/dist/GAutocompleteUtils.js +23 -0
  26. package/dist/GenericUtils.cjs +1 -0
  27. package/dist/GenericUtils.js +25 -0
  28. package/dist/LazyLoadingBg.cjs +1 -0
  29. package/dist/LazyLoadingBg.js +13 -0
  30. package/dist/Leaflet-BKkoCsyw.js +6436 -0
  31. package/dist/Leaflet-CHOsN941.cjs +1 -0
  32. package/dist/MapUtils.cjs +1 -0
  33. package/dist/MapUtils.js +79 -0
  34. package/dist/NumberUtils.cjs +1 -0
  35. package/dist/NumberUtils.js +50 -0
  36. package/dist/ObjectUtils.cjs +1 -0
  37. package/dist/ObjectUtils.js +23 -0
  38. package/dist/ObserverUtils.cjs +1 -0
  39. package/dist/ObserverUtils.js +20 -0
  40. package/dist/PermissionUtils.cjs +1 -0
  41. package/dist/PermissionUtils.js +18 -0
  42. package/dist/RESB_UrlBuilder.cjs +1 -0
  43. package/dist/RESB_UrlBuilder.js +30 -0
  44. package/dist/RequestUtils.cjs +1 -0
  45. package/dist/RequestUtils.js +13 -0
  46. package/dist/StringUtils.cjs +1 -0
  47. package/dist/StringUtils.js +40 -0
  48. package/dist/URLBuilderUtils.cjs +1 -0
  49. package/dist/URLBuilderUtils.js +11 -0
  50. package/dist/URLPagesFactory.cjs +1 -0
  51. package/dist/URLPagesFactory.js +12 -0
  52. package/dist/agencyAPI.cjs +1 -0
  53. package/dist/agencyAPI.js +61 -0
  54. package/dist/constants.cjs +1 -0
  55. package/dist/constants.js +5 -0
  56. package/dist/geographyAPI.cjs +1 -0
  57. package/dist/geographyAPI.js +73 -0
  58. package/dist/icons.cjs +1 -0
  59. package/dist/icons.js +32 -0
  60. package/dist/index.cjs +1 -0
  61. package/dist/index.d.ts +33 -34
  62. package/dist/index.js +142 -0
  63. package/dist/insightsAPI.cjs +1 -0
  64. package/dist/insightsAPI.js +15 -0
  65. package/dist/leaflet-Dyvby5gX.cjs +1 -0
  66. package/dist/leaflet-freedraw.esm-D8SxeKC1.js +26934 -0
  67. package/dist/leaflet-freedraw.esm-DSDVLXDC.cjs +7 -0
  68. package/dist/leaflet-l0sNRNKZ.js +1 -0
  69. package/dist/leaflet.draw-Dyvby5gX.cjs +1 -0
  70. package/dist/leaflet.draw-l0sNRNKZ.js +1 -0
  71. package/dist/leaflet_map.cjs +1 -0
  72. package/dist/leaflet_map.js +454 -0
  73. package/dist/mailAPI.cjs +1 -0
  74. package/dist/mailAPI.js +51 -0
  75. package/dist/main.cjs +1 -0
  76. package/dist/main.d.ts +0 -0
  77. package/dist/main.js +1 -0
  78. package/dist/placesAPI.cjs +1 -0
  79. package/dist/placesAPI.js +47 -0
  80. package/dist/portfolioCustomerAPI.cjs +1 -0
  81. package/dist/portfolioCustomerAPI.js +14 -0
  82. package/dist/publicUserAPI.cjs +1 -0
  83. package/dist/publicUserAPI.js +142 -0
  84. package/dist/realEstateAPI.cjs +1 -0
  85. package/dist/realEstateAPI.js +67 -0
  86. package/dist/requestAPI.cjs +1 -0
  87. package/dist/requestAPI.js +17 -0
  88. package/dist/services/wikicasaPro.d.ts +1 -1
  89. package/dist/servicesUtils.cjs +3 -0
  90. package/dist/servicesUtils.js +12 -0
  91. package/dist/statisticsAPI.cjs +1 -0
  92. package/dist/statisticsAPI.js +58 -0
  93. package/dist/style.css +1 -0
  94. package/dist/types-BaBnqzzG.js +85 -0
  95. package/dist/types-CwWBrQCP.cjs +1 -0
  96. package/dist/utils/FunctionUtils.d.ts +2 -2
  97. package/dist/utils/StringUtils.d.ts +1 -0
  98. package/dist/valuationAPI.cjs +1 -0
  99. package/dist/valuationAPI.js +21 -0
  100. package/dist/vite-env.cjs +1 -0
  101. package/dist/vite-env.js +1 -0
  102. package/dist/wikicasaPro.cjs +1 -0
  103. package/dist/wikicasaPro.js +14 -0
  104. package/package.json +19 -14
  105. package/dist/utilities.cjs +0 -5
  106. package/dist/utilities.iife.js +0 -5
  107. package/dist/utilities.mjs +0 -2732
  108. package/dist/utils/AppRedirectUtils.d.ts +0 -1
  109. package/dist/utils/GAEvents.d.ts +0 -2
  110. package/src/custom/constants.ts +0 -3
  111. package/src/custom/icons.ts +0 -63
  112. package/src/custom/leaflet_map.ts +0 -946
  113. package/src/index.ts +0 -173
  114. package/src/services/agencyAPI.ts +0 -105
  115. package/src/services/geographyAPI.ts +0 -129
  116. package/src/services/insightsAPI.ts +0 -20
  117. package/src/services/mailAPI.ts +0 -89
  118. package/src/services/placesAPI.ts +0 -72
  119. package/src/services/portfolioCustomerAPI.ts +0 -16
  120. package/src/services/publicUserAPI.ts +0 -216
  121. package/src/services/realEstateAPI.ts +0 -133
  122. package/src/services/requestAPI.ts +0 -40
  123. package/src/services/servicesUtils.ts +0 -27
  124. package/src/services/statisticsAPI.ts +0 -84
  125. package/src/services/valuationAPI.ts +0 -45
  126. package/src/services/wikicasaPro.ts +0 -25
  127. package/src/utils/AppRedirectUtils.ts +0 -26
  128. package/src/utils/ArrayUtils.ts +0 -2
  129. package/src/utils/ColorUtils.ts +0 -11
  130. package/src/utils/CookieUtils.ts +0 -43
  131. package/src/utils/CurrencyUtils.ts +0 -18
  132. package/src/utils/DOMUtils.ts +0 -28
  133. package/src/utils/DateUtils.ts +0 -9
  134. package/src/utils/DeviceDetectionUtils.ts +0 -17
  135. package/src/utils/EmailUtils.ts +0 -45
  136. package/src/utils/FavoriteUtils.ts +0 -19
  137. package/src/utils/FunctionUtils.ts +0 -29
  138. package/src/utils/GAEvents.ts +0 -414
  139. package/src/utils/GAutocompleteUtils.ts +0 -70
  140. package/src/utils/GenericUtils.ts +0 -37
  141. package/src/utils/LazyLoadingBg.ts +0 -18
  142. package/src/utils/MapUtils.ts +0 -118
  143. package/src/utils/NumberUtils.ts +0 -90
  144. package/src/utils/ObjectUtils.ts +0 -34
  145. package/src/utils/ObserverUtils.ts +0 -32
  146. package/src/utils/PermissionUtils.ts +0 -41
  147. package/src/utils/RESB_UrlBuilder.ts +0 -99
  148. package/src/utils/RequestUtils.ts +0 -20
  149. package/src/utils/StringUtils.ts +0 -67
  150. package/src/utils/URLBuilderUtils.ts +0 -21
  151. package/src/utils/URLPagesFactory.ts +0 -20
  152. package/src/vite-env.d.ts +0 -1
  153. package/tsconfig.json +0 -38
  154. package/vite.config.ts +0 -42
package/README.md CHANGED
@@ -1,2 +1,32 @@
1
- # utilities
2
- ciao
1
+ # @wikicasa-dev/utilities
2
+
3
+ Libreria condivisa contenente funzioni utility scritte in TypeScript.
4
+ La chiave privata per la condivisione è già configurata su tutti i progetti Wikicasa, per l'installazione o l'aggiornamento della libreria basterà quindi eseguire
5
+
6
+ yarn add @wikicasa-dev/utilities
7
+
8
+ ## Sviluppo e rilascio
9
+
10
+ La libreria fa parte di un monorepo insieme a `@wikicasa-dev/types` e `@wikicasa-dev/components`.
11
+ Il monorepo è gestito da **[pnpm](https://pnpm.io/it/)**. Il bundler in uso per questa libreria è **[Vite](https://pnpm.io/it/)**.
12
+
13
+ I file *index.html* e *main.ts* possono essere usati come playground per provare il funzionamento delle componenti. Per avviare il server di sviluppo basterà eseguire
14
+
15
+ pnpm dev
16
+
17
+ e collegarsi all'indirizzo corrispondente. Il server di sviluppo è dotato di hot reload, basterà quidni salvare il file modificato. Il file *main.ts* è escluso dalla build quindi non bisogna preoccuparsi di sporcarlo.
18
+
19
+ ### Rilascio
20
+
21
+ Come prima cosa bisogna buildare i file con
22
+
23
+ pnpm build
24
+
25
+ Successivamente bisognerà incrementare la versione. pnpm ha un comando apposito per cui si sconsiglia di andare a modificare a mano la versione nel *package.json*. Il comando è
26
+
27
+ pnpm version <major|minor|patch>
28
+
29
+ Sta allo sviluppatore scegliere l'incremento di versione più opportuno.
30
+ Dopodiché occorrerà eseguire il commit e push delle modifiche (pnpm blocca il rilascio in caso di modifiche non committate) per poi procedere alla pubblicazione con
31
+
32
+ pnpm publish
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=r=>!r?.length;exports.isArrNullOrEmpty=t;
@@ -0,0 +1,4 @@
1
+ const t = (r) => !r?.length;
2
+ export {
3
+ t as isArrNullOrEmpty
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function b(r,t){r=r.replace("#","");const n=parseInt(r.substring(0,2),16),s=parseInt(r.substring(2,4),16),a=parseInt(r.substring(4,6),16);return`rgba(${n}, ${s}, ${a}, ${t})`}exports.rgba=b;
@@ -0,0 +1,8 @@
1
+ function b(r, n) {
2
+ r = r.replace("#", "");
3
+ const s = parseInt(r.substring(0, 2), 16), t = parseInt(r.substring(2, 4), 16), a = parseInt(r.substring(4, 6), 16);
4
+ return `rgba(${s}, ${t}, ${a}, ${n})`;
5
+ }
6
+ export {
7
+ b as rgba
8
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("js-cookie");function d(o,e,r=30,i=!0){const t=new Date;t.setTime(t.getTime()+24*60*60*1e3*r);const n=typeof e!="string"?JSON.stringify(e):e,u=i?btoa(encodeURIComponent(n)):n;document.cookie=o+"="+u+";path=/;expires="+t.toUTCString()}function l(o){try{const e=document.cookie.match("(^|;) ?"+o+"=([^;]*)(;|$)");return e?e[2]:null}catch(e){return console.error(e),null}}function k(o){try{const e=document.cookie.match("(^|;) ?"+o+"=([^;]*)(;|$)");return e?JSON.parse(decodeURIComponent(atob(e[2]))):null}catch(e){return console.error(e),c(o),null}}function c(o){s.remove(o)}exports.decodeCookie=k;exports.encodeCookie=d;exports.getCookie=l;exports.removeCookie=c;
@@ -0,0 +1,32 @@
1
+ import u from "js-cookie";
2
+ function l(e, o, c = 30, r = !0) {
3
+ const t = /* @__PURE__ */ new Date();
4
+ t.setTime(t.getTime() + 24 * 60 * 60 * 1e3 * c);
5
+ const n = typeof o != "string" ? JSON.stringify(o) : o, i = r ? btoa(encodeURIComponent(n)) : n;
6
+ document.cookie = e + "=" + i + ";path=/;expires=" + t.toUTCString();
7
+ }
8
+ function d(e) {
9
+ try {
10
+ const o = document.cookie.match("(^|;) ?" + e + "=([^;]*)(;|$)");
11
+ return o ? o[2] : null;
12
+ } catch (o) {
13
+ return console.error(o), null;
14
+ }
15
+ }
16
+ function a(e) {
17
+ try {
18
+ const o = document.cookie.match("(^|;) ?" + e + "=([^;]*)(;|$)");
19
+ return o ? JSON.parse(decodeURIComponent(atob(o[2]))) : null;
20
+ } catch (o) {
21
+ return console.error(o), s(e), null;
22
+ }
23
+ }
24
+ function s(e) {
25
+ u.remove(e);
26
+ }
27
+ export {
28
+ a as decodeCookie,
29
+ l as encodeCookie,
30
+ d as getCookie,
31
+ s as removeCookie
32
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./ObjectUtils.cjs"),n=(t,e,o="it-IT")=>{if(t===void 0)return"0";const r={style:"currency",currency:"EUR",maximumFractionDigits:0};return c.shallowCopyObjectTo(e,r),new Intl.NumberFormat(o,r).format(t)};exports.formatCurrency=n;
@@ -0,0 +1,14 @@
1
+ import { shallowCopyObjectTo as c } from "./ObjectUtils.js";
2
+ const i = (r, o, n = "it-IT") => {
3
+ if (r === void 0)
4
+ return "0";
5
+ const t = {
6
+ style: "currency",
7
+ currency: "EUR",
8
+ maximumFractionDigits: 0
9
+ };
10
+ return c(o, t), new Intl.NumberFormat(n, t).format(r);
11
+ };
12
+ export {
13
+ i as formatCurrency
14
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=e=>{const t=document.querySelector(e);if(!t)throw new Error(`No element found with the id: ${e}`);return t},o=e=>{typeof e=="string"?n(e).textContent="":e.textContent=""},i=(e,t="block")=>{e&&(e.style.display=t)},l=e=>{e&&(e.style.display="none")};exports.emptyElem=o;exports.getSingleElement=n;exports.hideElem=l;exports.showElem=i;
@@ -0,0 +1,18 @@
1
+ const n = (t) => {
2
+ const e = document.querySelector(t);
3
+ if (!e)
4
+ throw new Error(`No element found with the id: ${t}`);
5
+ return e;
6
+ }, o = (t) => {
7
+ typeof t == "string" ? n(t).textContent = "" : t.textContent = "";
8
+ }, i = (t, e = "block") => {
9
+ t && (t.style.display = e);
10
+ }, r = (t) => {
11
+ t && (t.style.display = "none");
12
+ };
13
+ export {
14
+ o as emptyElem,
15
+ n as getSingleElement,
16
+ r as hideElem,
17
+ i as showElem
18
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(e,l=!1){const t=e.getDate(),o=e.getMonth()+1,c=e.getFullYear();return l?`${("0"+t).slice(-2)}-${("0"+o).slice(-2)}-${c}`:`${c}-${("0"+o).slice(-2)}-${("0"+t).slice(-2)}`}exports.formatDate=n;
@@ -0,0 +1,7 @@
1
+ function s(e, o = !1) {
2
+ const t = e.getDate(), c = e.getMonth() + 1, n = e.getFullYear();
3
+ return o ? `${("0" + t).slice(-2)}-${("0" + c).slice(-2)}-${n}` : `${n}-${("0" + c).slice(-2)}-${("0" + t).slice(-2)}`;
4
+ }
5
+ export {
6
+ s as formatDate
7
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=()=>/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,e=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent);exports.isMobile=e;exports.isSafari=t;exports.isiOSDevice=i;
@@ -0,0 +1,8 @@
1
+ const i = () => /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, e = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
2
+ navigator.userAgent
3
+ ), r = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
4
+ export {
5
+ e as isMobile,
6
+ r as isSafari,
7
+ i as isiOSDevice
8
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>e.includes("@gmail");async function i(e){const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(n)).map(a=>a.toString(16).padStart(2,"0")).join("")}const h=e=>{const r=e.split("@");if(r.length<2)throw new Error("The email has nothing before the '@' symbol");const n=r[0];let s="";for(const t of n)if(t!=="."){if(t==="+")break;s+=t}return`${s}@${r[1]}`},c=e=>{if(!e||!e.trim())throw new Error("The email in null or empty");let r=e;return o(r)&&(r=h(e)),i(r)};exports.hashEmail=c;
@@ -0,0 +1,27 @@
1
+ const a = (r) => r.includes("@gmail");
2
+ async function h(r) {
3
+ const e = new TextEncoder().encode(r), t = await crypto.subtle.digest("SHA-256", e);
4
+ return Array.from(new Uint8Array(t)).map((o) => o.toString(16).padStart(2, "0")).join("");
5
+ }
6
+ const i = (r) => {
7
+ const e = r.split("@");
8
+ if (e.length < 2)
9
+ throw new Error("The email has nothing before the '@' symbol");
10
+ const t = e[0];
11
+ let s = "";
12
+ for (const n of t)
13
+ if (n !== ".") {
14
+ if (n === "+")
15
+ break;
16
+ s += n;
17
+ }
18
+ return `${s}@${e[1]}`;
19
+ }, c = (r) => {
20
+ if (!r || !r.trim())
21
+ throw new Error("The email in null or empty");
22
+ let e = r;
23
+ return a(e) && (e = i(r)), h(e);
24
+ };
25
+ export {
26
+ c as hashEmail
27
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=e=>{document.querySelectorAll(`a[class^=fav][data-id='${e}']`).forEach(s=>{s.classList.contains("fav-save")?s.style.display="none":s.classList.contains("fav-remove")&&(s.style.display="block")})},t=e=>{document.querySelectorAll(`a[class^=fav][data-id='${e}']`).forEach(s=>{s.classList.contains("fav-save")?s.style.display="block":s.classList.contains("fav-remove")&&(s.style.display="none")})};exports.showAddFavoritesIcon=t;exports.showRemoveFavoritesIcons=a;
@@ -0,0 +1,13 @@
1
+ const l = (a) => {
2
+ document.querySelectorAll(`a[class^=fav][data-id='${a}']`).forEach((s) => {
3
+ s.classList.contains("fav-save") ? s.style.display = "none" : s.classList.contains("fav-remove") && (s.style.display = "block");
4
+ });
5
+ }, o = (a) => {
6
+ document.querySelectorAll(`a[class^=fav][data-id='${a}']`).forEach((s) => {
7
+ s.classList.contains("fav-save") ? s.style.display = "block" : s.classList.contains("fav-remove") && (s.style.display = "none");
8
+ });
9
+ };
10
+ export {
11
+ o as showAddFavoritesIcon,
12
+ l as showRemoveFavoritesIcons
13
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function s(e){if(!e||typeof e.then!="function")throw new Error("The provide function is not a promise");return e}function d(e,i){return(...n)=>new Promise((o,t)=>{e.id&&clearTimeout(e.id),e.id=setTimeout(()=>{try{const r=i(...n);o(r)}catch(r){t(r)}},e.delay)})}exports.debounce=d;exports.isPromise=s;
@@ -0,0 +1,21 @@
1
+ function s(r) {
2
+ if (!r || typeof r.then != "function")
3
+ throw new Error("The provide function is not a promise");
4
+ return r;
5
+ }
6
+ function d(r, n) {
7
+ return (...i) => new Promise((o, t) => {
8
+ r.id && clearTimeout(r.id), r.id = setTimeout(() => {
9
+ try {
10
+ const e = n(...i);
11
+ o(e);
12
+ } catch (e) {
13
+ t(e);
14
+ }
15
+ }, r.delay);
16
+ });
17
+ }
18
+ export {
19
+ d as debounce,
20
+ s as isPromise
21
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./StringUtils.cjs"),a=require("./geographyAPI.cjs"),d=async(s,n)=>{const o={};for(let e=0;e<s.address_components.length;e++)s.address_components[e].types.indexOf("administrative_area_level_3")!==-1?o.city=s.address_components[e].long_name:s.address_components[e].types.indexOf("locality")!==-1?o.locality=s.address_components[e].long_name:s.address_components[e].types.indexOf("route")!==-1?o.streetName=s.address_components[e].long_name:s.address_components[e].types.indexOf("street_number")!==-1?o.streetNumber=s.address_components[e].long_name:s.address_components[e].types.indexOf("postal_code")!==-1&&(o.zip=s.address_components[e].long_name);o.latitude=s.geometry.location.lat,o.longitude=s.geometry.location.lng,o.address=r.cleanASCII(n),typeof o.streetNumber>"u"&&(o.streetNumber=null);let t=await a.guessPlace(o.latitude,o.longitude);if(delete t.city,delete t.locality,t={...t,...o},!t.streetNumber){const e=parseInt(t.address.split(",")[1]),i=parseInt(t.zip);e&&e!==i&&(t.streetNumber=e.toString())}return t},l=async(s,n)=>{const o=await a.getPlacesDetails(s),t=await d(o,n),e=t.streetName?r.formatAddress(t.streetName,t.streetNumber||"",t.cityName):t.address;return{place:t,address:e}};exports.getPlaceFromGAutocomplete=l;exports.googlePlaceConverter=d;
@@ -0,0 +1,23 @@
1
+ import { cleanASCII as d, formatAddress as a } from "./StringUtils.js";
2
+ import { guessPlace as i, getPlacesDetails as m } from "./geographyAPI.js";
3
+ const l = async (s, o) => {
4
+ const n = {};
5
+ for (let e = 0; e < s.address_components.length; e++)
6
+ s.address_components[e].types.indexOf(
7
+ "administrative_area_level_3"
8
+ ) !== -1 ? n.city = s.address_components[e].long_name : s.address_components[e].types.indexOf("locality") !== -1 ? n.locality = s.address_components[e].long_name : s.address_components[e].types.indexOf("route") !== -1 ? n.streetName = s.address_components[e].long_name : s.address_components[e].types.indexOf("street_number") !== -1 ? n.streetNumber = s.address_components[e].long_name : s.address_components[e].types.indexOf("postal_code") !== -1 && (n.zip = s.address_components[e].long_name);
9
+ n.latitude = s.geometry.location.lat, n.longitude = s.geometry.location.lng, n.address = d(o), typeof n.streetNumber > "u" && (n.streetNumber = null);
10
+ let t = await i(n.latitude, n.longitude);
11
+ if (delete t.city, delete t.locality, t = { ...t, ...n }, !t.streetNumber) {
12
+ const e = parseInt(t.address.split(",")[1]), r = parseInt(t.zip);
13
+ e && e !== r && (t.streetNumber = e.toString());
14
+ }
15
+ return t;
16
+ }, _ = async (s, o) => {
17
+ const n = await m(s), t = await l(n, o), e = t.streetName ? a(t.streetName, t.streetNumber || "", t.cityName) : t.address;
18
+ return { place: t, address: e };
19
+ };
20
+ export {
21
+ _ as getPlaceFromGAutocomplete,
22
+ l as googlePlaceConverter
23
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=(t,e)=>new Promise((o,n)=>{setTimeout(()=>{try{t&&t(),o()}catch{n()}},e)});function i(t,e){if(typeof window.CustomEvent=="function")return new CustomEvent(t,e);e=e||{bubbles:!1,cancelable:!1,detail:void 0};const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,!!e.bubbles,!!e.cancelable,e.detail),o}exports.awaitableSetTimeout=u;exports.createCustomEvent=i;
@@ -0,0 +1,25 @@
1
+ const c = (t, e) => new Promise((n, o) => {
2
+ setTimeout(() => {
3
+ try {
4
+ t && t(), n();
5
+ } catch {
6
+ o();
7
+ }
8
+ }, e);
9
+ });
10
+ function i(t, e) {
11
+ if (typeof window.CustomEvent == "function")
12
+ return new CustomEvent(t, e);
13
+ e = e || { bubbles: !1, cancelable: !1, detail: void 0 };
14
+ const n = document.createEvent("CustomEvent");
15
+ return n.initCustomEvent(
16
+ t,
17
+ !!e.bubbles,
18
+ !!e.cancelable,
19
+ e.detail
20
+ ), n;
21
+ }
22
+ export {
23
+ c as awaitableSetTimeout,
24
+ i as createCustomEvent
25
+ };
@@ -0,0 +1 @@
1
+ "use strict";document&&document.addEventListener("DOMContentLoaded",()=>{const t=document.getElementsByClassName("lazy");if(t.length!==0)for(const n of t){const e=n;e.onload=()=>{const{currentSrc:o}=e;e.style.cssText="display:none";const s=e.parentNode;s.style.backgroundImage='url("'+o+'")'}}});
@@ -0,0 +1,13 @@
1
+ document && document.addEventListener("DOMContentLoaded", () => {
2
+ const n = document.getElementsByClassName("lazy");
3
+ if (n.length !== 0)
4
+ for (const t of n) {
5
+ const e = t;
6
+ e.onload = () => {
7
+ const { currentSrc: o } = e;
8
+ e.style.cssText = "display:none";
9
+ const a = e.parentNode;
10
+ a.style.backgroundImage = 'url("' + o + '")';
11
+ };
12
+ }
13
+ });