@wikicasa-dev/utilities 1.1.20 → 1.1.22-alpha.2
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.
- package/dist/index.cjs +1 -1
- package/dist/index.js +23 -23
- package/dist/{AdressUtils.cjs → utils/AdressUtils.cjs} +1 -1
- package/dist/utils/DOMUtils.d.ts +0 -1
- package/dist/utils/DateUtils.cjs +1 -0
- package/dist/utils/DateUtils.js +30 -0
- package/dist/utils/DeviceDetectionUtils.cjs +1 -0
- package/dist/utils/DeviceDetectionUtils.js +77 -0
- package/dist/utils/EmailUtils.d.ts +0 -1
- package/dist/utils/GAutocompleteUtils.d.ts +0 -1
- package/dist/utils/MapUtils.d.ts +0 -1
- package/dist/utils/ObjectUtils.d.ts +0 -1
- package/dist/utils/RESB_UrlBuilder.cjs +1 -0
- package/dist/utils/RESB_UrlBuilder.d.ts +0 -1
- package/dist/utils/RESB_UrlBuilder.js +78 -0
- package/package.json +7 -7
- package/dist/DateUtils.cjs +0 -1
- package/dist/DateUtils.js +0 -2675
- package/dist/DeviceDetectionUtils.cjs +0 -1
- package/dist/DeviceDetectionUtils.js +0 -19
- package/dist/RESB_UrlBuilder.cjs +0 -1
- package/dist/RESB_UrlBuilder.js +0 -17
- package/dist/types-B87NrRgz.cjs +0 -1
- package/dist/types-CBgxV9we.js +0 -3526
- /package/dist/{ObjectUtilsTypes.cjs → types/ObjectUtilsTypes.cjs} +0 -0
- /package/dist/{ObjectUtilsTypes.js → types/ObjectUtilsTypes.js} +0 -0
- /package/dist/{AdressUtils.js → utils/AdressUtils.js} +0 -0
- /package/dist/{ArrayUtils.cjs → utils/ArrayUtils.cjs} +0 -0
- /package/dist/{ArrayUtils.js → utils/ArrayUtils.js} +0 -0
- /package/dist/{ColorUtils.cjs → utils/ColorUtils.cjs} +0 -0
- /package/dist/{ColorUtils.js → utils/ColorUtils.js} +0 -0
- /package/dist/{CookieUtils.cjs → utils/CookieUtils.cjs} +0 -0
- /package/dist/{CookieUtils.js → utils/CookieUtils.js} +0 -0
- /package/dist/{CurrencyUtils.cjs → utils/CurrencyUtils.cjs} +0 -0
- /package/dist/{CurrencyUtils.js → utils/CurrencyUtils.js} +0 -0
- /package/dist/{DOMUtils.cjs → utils/DOMUtils.cjs} +0 -0
- /package/dist/{DOMUtils.js → utils/DOMUtils.js} +0 -0
- /package/dist/{DownloadUtils.cjs → utils/DownloadUtils.cjs} +0 -0
- /package/dist/{DownloadUtils.js → utils/DownloadUtils.js} +0 -0
- /package/dist/{EmailUtils.cjs → utils/EmailUtils.cjs} +0 -0
- /package/dist/{EmailUtils.js → utils/EmailUtils.js} +0 -0
- /package/dist/{FunctionUtils.cjs → utils/FunctionUtils.cjs} +0 -0
- /package/dist/{FunctionUtils.js → utils/FunctionUtils.js} +0 -0
- /package/dist/{GAutocompleteUtils.cjs → utils/GAutocompleteUtils.cjs} +0 -0
- /package/dist/{GAutocompleteUtils.js → utils/GAutocompleteUtils.js} +0 -0
- /package/dist/{GenericUtils.cjs → utils/GenericUtils.cjs} +0 -0
- /package/dist/{GenericUtils.js → utils/GenericUtils.js} +0 -0
- /package/dist/{GeolocationUtils.cjs → utils/GeolocationUtils.cjs} +0 -0
- /package/dist/{GeolocationUtils.js → utils/GeolocationUtils.js} +0 -0
- /package/dist/{LazyLoadingBg.cjs → utils/LazyLoadingBg.cjs} +0 -0
- /package/dist/{LazyLoadingBg.js → utils/LazyLoadingBg.js} +0 -0
- /package/dist/{MapUtils.cjs → utils/MapUtils.cjs} +0 -0
- /package/dist/{MapUtils.js → utils/MapUtils.js} +0 -0
- /package/dist/{NumberUtils.cjs → utils/NumberUtils.cjs} +0 -0
- /package/dist/{NumberUtils.js → utils/NumberUtils.js} +0 -0
- /package/dist/{ObjectUtils.cjs → utils/ObjectUtils.cjs} +0 -0
- /package/dist/{ObjectUtils.js → utils/ObjectUtils.js} +0 -0
- /package/dist/{ObserverUtils.cjs → utils/ObserverUtils.cjs} +0 -0
- /package/dist/{ObserverUtils.js → utils/ObserverUtils.js} +0 -0
- /package/dist/{PermissionUtils.cjs → utils/PermissionUtils.cjs} +0 -0
- /package/dist/{PermissionUtils.js → utils/PermissionUtils.js} +0 -0
- /package/dist/{RegexUtils.cjs → utils/RegexUtils.cjs} +0 -0
- /package/dist/{RegexUtils.js → utils/RegexUtils.js} +0 -0
- /package/dist/{StringUtils.cjs → utils/StringUtils.cjs} +0 -0
- /package/dist/{StringUtils.js → utils/StringUtils.js} +0 -0
- /package/dist/{URLBuilderUtils.cjs → utils/URLBuilderUtils.cjs} +0 -0
- /package/dist/{URLBuilderUtils.js → utils/URLBuilderUtils.js} +0 -0
- /package/dist/{vite-env.cjs → vite-env.d.cjs} +0 -0
- /package/dist/{vite-env.js → vite-env.d.js} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("./utils/ArrayUtils.cjs"),p=require("./utils/ColorUtils.cjs"),l=require("./utils/CookieUtils.cjs"),u=require("./utils/CurrencyUtils.cjs"),a=require("./utils/DateUtils.cjs"),s=require("./utils/DeviceDetectionUtils.cjs"),n=require("./utils/DOMUtils.cjs"),c=require("./utils/EmailUtils.cjs"),E=require("./utils/FunctionUtils.cjs"),m=require("./utils/GenericUtils.cjs"),t=require("./utils/NumberUtils.cjs"),r=require("./utils/ObjectUtils.cjs"),C=require("./utils/ObserverUtils.cjs"),d=require("./utils/PermissionUtils.cjs"),_=require("./utils/RESB_UrlBuilder.cjs"),o=require("./utils/StringUtils.cjs"),S=require("./utils/URLBuilderUtils.cjs"),e=require("./utils/RegexUtils.cjs"),g=require("./utils/GeolocationUtils.cjs"),b=require("./utils/AdressUtils.cjs"),y=require("./utils/GAutocompleteUtils.cjs"),f=require("./utils/DownloadUtils.cjs"),i=require("./utils/MapUtils.cjs");exports.isArrNullOrEmpty=O.isArrNullOrEmpty;exports.rgba=p.rgba;exports.decodeCookie=l.decodeCookie;exports.encodeCookie=l.encodeCookie;exports.getCookie=l.getCookie;exports.removeCookie=l.removeCookie;exports.formatCurrency=u.formatCurrency;exports.formatCurrencyShort=u.formatCurrencyShort;exports.formatDate=a.formatDate;exports.formatDateToddMMYYYY=a.formatDateToddMMYYYY;exports.getStartAndEndOfDayUTC=a.getStartAndEndOfDayUTC;exports.subtractDaysFromDate=a.subtractDaysFromDate;exports.getCurrentDeviceSize=s.getCurrentDeviceSize;exports.isMobile=s.isMobile;exports.isSafari=s.isSafari;exports.isWindows=s.isWindows;exports.isiOSDevice=s.isiOSDevice;exports.emptyElem=n.emptyElem;exports.getSingleElement=n.getSingleElement;exports.hideElem=n.hideElem;exports.showElem=n.showElem;exports.hash256=c.hash256;exports.hashEmail=c.hashEmail;exports.debounce=E.debounce;exports.isPromise=E.isPromise;exports.awaitableSetTimeout=m.awaitableSetTimeout;exports.createCustomEvent=m.createCustomEvent;exports.formatFloat=t.formatFloat;exports.formatInteger=t.formatInteger;exports.formatLocaleNumber=t.formatLocaleNumber;exports.formatLocaleNumberAuto=t.formatLocaleNumberAuto;exports.formatNumber=t.formatNumber;exports.formatterNumberObj=t.formatterNumberObj;exports.parseLocaleNumber=t.parseLocaleNumber;exports.parseLocaleNumberAuto=t.parseLocaleNumberAuto;exports.areObjectsEqual=r.areObjectsEqual;exports.deepCopy=r.deepCopy;exports.getOrDefault=r.getOrDefault;exports.getOrNull=r.getOrNull;exports.invertFlatObject=r.invertFlatObject;exports.invertKeyToValue=r.invertKeyToValue;exports.isEmptyObject=r.isEmptyObject;exports.shallowCopyObjectTo=r.shallowCopyObjectTo;exports.observeOnce=C.observeOnce;exports.addPermissionStateListener=d.addPermissionStateListener;exports.onNotificationsPermissionChange=d.onNotificationsPermissionChange;exports.buildParams=_.buildParams;exports.buildURL=_.buildURL;exports.capitalizeFirstLetter=o.capitalizeFirstLetter;exports.cleanASCII=o.cleanASCII;exports.decodeTextWithEntities=o.decodeTextWithEntities;exports.replaceAll=o.replaceAll;exports.replaceAllTokens=o.replaceAllTokens;exports.stringToHyphened=o.stringToHyphened;exports.strip=o.strip;exports.appendQueryString=S.appendQueryString;exports.COMPETITOR_REGEX=e.COMPETITOR_REGEX;exports.DATE_REGEX=e.DATE_REGEX;exports.EMAIL_REGEX=e.EMAIL_REGEX;exports.EMAIL_REGEX_INTO_TEXT=e.EMAIL_REGEX_INTO_TEXT;exports.EXCLUDED_REGEX=e.EXCLUDED_REGEX;exports.GLOBAL_PHONE_REGEX=e.GLOBAL_PHONE_REGEX;exports.PASSWORD_REGEX=e.PASSWORD_REGEX;exports.PHONE_REGEX=e.PHONE_REGEX;exports.ROOMS_REGEX=e.ROOMS_REGEX;exports.SQM_REGEX=e.SQM_REGEX;exports.browserSupportGeolocation=g.browserSupportGeolocation;exports.getUserPosition=g.getUserPosition;exports.formatAddress=b.formatAddress;exports.formattedAddress=b.formattedAddress;exports.googlePlaceConverter=y.googlePlaceConverter;exports.downloadFile=f.downloadFile;exports.calcPolygonCenter=i.calcPolygonCenter;exports.encodePolygon=i.encodePolygon;exports.getMinMaxLatLng=i.getMinMaxLatLng;exports.getPolygonString=i.getPolygonString;exports.parsePoints=i.parsePoints;exports.removeDuplicatePoints=i.removeDuplicatePoints;
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { isArrNullOrEmpty as r } from "./ArrayUtils.js";
|
|
2
|
-
import { rgba as a } from "./ColorUtils.js";
|
|
3
|
-
import { decodeCookie as i, encodeCookie as l, getCookie as n, removeCookie as p } from "./CookieUtils.js";
|
|
4
|
-
import { formatCurrency as E, formatCurrencyShort as f } from "./CurrencyUtils.js";
|
|
5
|
-
import { formatDate as d, formatDateToddMMYYYY as u, getStartAndEndOfDayUTC as x, subtractDaysFromDate as g } from "./DateUtils.js";
|
|
6
|
-
import { getCurrentDeviceSize as O, isMobile as C, isSafari as S, isWindows as y, isiOSDevice as P } from "./DeviceDetectionUtils.js";
|
|
7
|
-
import { emptyElem as L, getSingleElement as R, hideElem as T, showElem as D } from "./DOMUtils.js";
|
|
8
|
-
import { hash256 as G, hashEmail as N } from "./EmailUtils.js";
|
|
9
|
-
import { debounce as h, isPromise as M } from "./FunctionUtils.js";
|
|
10
|
-
import { awaitableSetTimeout as I, createCustomEvent as w } from "./GenericUtils.js";
|
|
11
|
-
import { formatFloat as k, formatInteger as F, formatLocaleNumber as U, formatLocaleNumberAuto as Y, formatNumber as H, formatterNumberObj as W, parseLocaleNumber as z, parseLocaleNumberAuto as Q } from "./NumberUtils.js";
|
|
12
|
-
import { areObjectsEqual as B, deepCopy as K, getOrDefault as V, getOrNull as J, invertFlatObject as Z, invertKeyToValue as $, isEmptyObject as ee, shallowCopyObjectTo as oe } from "./ObjectUtils.js";
|
|
13
|
-
import { observeOnce as te } from "./ObserverUtils.js";
|
|
14
|
-
import { addPermissionStateListener as me, onNotificationsPermissionChange as ie } from "./PermissionUtils.js";
|
|
15
|
-
import { buildParams as ne, buildURL as pe } from "./RESB_UrlBuilder.js";
|
|
16
|
-
import { capitalizeFirstLetter as Ee, cleanASCII as fe, decodeTextWithEntities as ce, replaceAll as de, replaceAllTokens as ue, stringToHyphened as xe, strip as ge } from "./StringUtils.js";
|
|
17
|
-
import { appendQueryString as Oe } from "./URLBuilderUtils.js";
|
|
18
|
-
import { COMPETITOR_REGEX as Se, DATE_REGEX as ye, EMAIL_REGEX as Pe, EMAIL_REGEX_INTO_TEXT as Ae, EXCLUDED_REGEX as Le, GLOBAL_PHONE_REGEX as Re, PASSWORD_REGEX as Te, PHONE_REGEX as De, ROOMS_REGEX as _e, SQM_REGEX as Ge } from "./RegexUtils.js";
|
|
19
|
-
import { browserSupportGeolocation as Xe, getUserPosition as he } from "./GeolocationUtils.js";
|
|
20
|
-
import { formatAddress as ve, formattedAddress as Ie } from "./AdressUtils.js";
|
|
21
|
-
import { googlePlaceConverter as je } from "./GAutocompleteUtils.js";
|
|
22
|
-
import { downloadFile as Fe } from "./DownloadUtils.js";
|
|
23
|
-
import { calcPolygonCenter as Ye, encodePolygon as He, getMinMaxLatLng as We, getPolygonString as ze, parsePoints as Qe, removeDuplicatePoints as qe } from "./MapUtils.js";
|
|
1
|
+
import { isArrNullOrEmpty as r } from "./utils/ArrayUtils.js";
|
|
2
|
+
import { rgba as a } from "./utils/ColorUtils.js";
|
|
3
|
+
import { decodeCookie as i, encodeCookie as l, getCookie as n, removeCookie as p } from "./utils/CookieUtils.js";
|
|
4
|
+
import { formatCurrency as E, formatCurrencyShort as f } from "./utils/CurrencyUtils.js";
|
|
5
|
+
import { formatDate as d, formatDateToddMMYYYY as u, getStartAndEndOfDayUTC as x, subtractDaysFromDate as g } from "./utils/DateUtils.js";
|
|
6
|
+
import { getCurrentDeviceSize as O, isMobile as C, isSafari as S, isWindows as y, isiOSDevice as P } from "./utils/DeviceDetectionUtils.js";
|
|
7
|
+
import { emptyElem as L, getSingleElement as R, hideElem as T, showElem as D } from "./utils/DOMUtils.js";
|
|
8
|
+
import { hash256 as G, hashEmail as N } from "./utils/EmailUtils.js";
|
|
9
|
+
import { debounce as h, isPromise as M } from "./utils/FunctionUtils.js";
|
|
10
|
+
import { awaitableSetTimeout as I, createCustomEvent as w } from "./utils/GenericUtils.js";
|
|
11
|
+
import { formatFloat as k, formatInteger as F, formatLocaleNumber as U, formatLocaleNumberAuto as Y, formatNumber as H, formatterNumberObj as W, parseLocaleNumber as z, parseLocaleNumberAuto as Q } from "./utils/NumberUtils.js";
|
|
12
|
+
import { areObjectsEqual as B, deepCopy as K, getOrDefault as V, getOrNull as J, invertFlatObject as Z, invertKeyToValue as $, isEmptyObject as ee, shallowCopyObjectTo as oe } from "./utils/ObjectUtils.js";
|
|
13
|
+
import { observeOnce as te } from "./utils/ObserverUtils.js";
|
|
14
|
+
import { addPermissionStateListener as me, onNotificationsPermissionChange as ie } from "./utils/PermissionUtils.js";
|
|
15
|
+
import { buildParams as ne, buildURL as pe } from "./utils/RESB_UrlBuilder.js";
|
|
16
|
+
import { capitalizeFirstLetter as Ee, cleanASCII as fe, decodeTextWithEntities as ce, replaceAll as de, replaceAllTokens as ue, stringToHyphened as xe, strip as ge } from "./utils/StringUtils.js";
|
|
17
|
+
import { appendQueryString as Oe } from "./utils/URLBuilderUtils.js";
|
|
18
|
+
import { COMPETITOR_REGEX as Se, DATE_REGEX as ye, EMAIL_REGEX as Pe, EMAIL_REGEX_INTO_TEXT as Ae, EXCLUDED_REGEX as Le, GLOBAL_PHONE_REGEX as Re, PASSWORD_REGEX as Te, PHONE_REGEX as De, ROOMS_REGEX as _e, SQM_REGEX as Ge } from "./utils/RegexUtils.js";
|
|
19
|
+
import { browserSupportGeolocation as Xe, getUserPosition as he } from "./utils/GeolocationUtils.js";
|
|
20
|
+
import { formatAddress as ve, formattedAddress as Ie } from "./utils/AdressUtils.js";
|
|
21
|
+
import { googlePlaceConverter as je } from "./utils/GAutocompleteUtils.js";
|
|
22
|
+
import { downloadFile as Fe } from "./utils/DownloadUtils.js";
|
|
23
|
+
import { calcPolygonCenter as Ye, encodePolygon as He, getMinMaxLatLng as We, getPolygonString as ze, parsePoints as Qe, removeDuplicatePoints as qe } from "./utils/MapUtils.js";
|
|
24
24
|
export {
|
|
25
25
|
Se as COMPETITOR_REGEX,
|
|
26
26
|
ye as DATE_REGEX,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./StringUtils.cjs");function t(d,s,o,n){const i=[];d&&d!=="ND"&&(s&&s!=="ND"&&s!=="0"?i.push(`${d} ${s}`):i.push(d)),o&&n?i.push(`${o} (${n})`):i.push(o);const f=i.filter(l=>!!l).join(", ");return r.capitalizeFirstLetter(f)}const u=(d,s,o,n)=>s?t(s,o||"",n):d;exports.formatAddress=t;exports.formattedAddress=u;
|
package/dist/utils/DOMUtils.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Nullable } from '@wikicasa-dev/types';
|
|
2
|
-
|
|
3
2
|
export declare const getSingleElement: (selector: string) => HTMLElement;
|
|
4
3
|
export declare const emptyElem: (selectorOrElem: string | Element) => void;
|
|
5
4
|
export declare const showElem: (elem: Nullable<HTMLElement>, displayValue?: "block" | "d-flex") => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("date-fns");function s(t,a=!1){const e=t.getDate(),n=t.getMonth()+1,o=t.getFullYear();return a?`${("0"+e).slice(-2)}-${("0"+n).slice(-2)}-${o}`:`${o}-${("0"+n).slice(-2)}-${("0"+e).slice(-2)}`}const y=t=>{if(typeof t=="string"){const a=new Date(t);return isNaN(a.valueOf())?"":r.format(a,"dd/MM/yyyy")}return r.format(t,"dd/MM/yyyy")},d=(t=new Date,a)=>(a<0&&(a=0),r.subDays(t,a));function i(t){const e=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy"].map(n=>r.parse(t,n,new Date)).find(n=>r.isValid(n));if(e){const n=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0),o=new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59);return{start:n.toISOString(),end:o.toISOString()}}return{start:null,end:null}}exports.formatDate=s;exports.formatDateToddMMYYYY=y;exports.getStartAndEndOfDayUTC=i;exports.subtractDaysFromDate=d;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { format as o, subDays as y, parse as s, isValid as i } from "date-fns";
|
|
2
|
+
function l(t, n = !1) {
|
|
3
|
+
const e = t.getDate(), r = t.getMonth() + 1, a = t.getFullYear();
|
|
4
|
+
return n ? `${("0" + e).slice(-2)}-${("0" + r).slice(-2)}-${a}` : `${a}-${("0" + r).slice(-2)}-${("0" + e).slice(-2)}`;
|
|
5
|
+
}
|
|
6
|
+
const c = (t) => {
|
|
7
|
+
if (typeof t == "string") {
|
|
8
|
+
const n = new Date(t);
|
|
9
|
+
return isNaN(n.valueOf()) ? "" : o(n, "dd/MM/yyyy");
|
|
10
|
+
}
|
|
11
|
+
return o(t, "dd/MM/yyyy");
|
|
12
|
+
}, u = (t = /* @__PURE__ */ new Date(), n) => (n < 0 && (n = 0), y(t, n));
|
|
13
|
+
function D(t) {
|
|
14
|
+
const e = ["yyyy-MM-dd", "yyyy/MM/dd", "dd/MM/yyyy", "dd-MM-yyyy"].map((r) => s(t, r, /* @__PURE__ */ new Date())).find((r) => i(r));
|
|
15
|
+
if (e) {
|
|
16
|
+
const r = new Date(e.getFullYear(), e.getMonth(), e.getDate(), 0, 0, 0), a = new Date(e.getFullYear(), e.getMonth(), e.getDate(), 23, 59, 59);
|
|
17
|
+
return {
|
|
18
|
+
start: r.toISOString(),
|
|
19
|
+
// Format in ISO 8601
|
|
20
|
+
end: a.toISOString()
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return { start: null, end: null };
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
l as formatDate,
|
|
27
|
+
c as formatDateToddMMYYYY,
|
|
28
|
+
D as getStartAndEndOfDayUTC,
|
|
29
|
+
u as subtractDaysFromDate
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=n=>{const r=()=>{const e=[];for(const i in n){const l=n[i];e.push(l.id)}return e},s=()=>{const e=[];for(const i in n){const l=n[i];e.push(l.label)}return e},a=()=>{const e=[];for(const i in n)e.push(i);return e},u=()=>n,d=e=>{if(e==null)return null;for(const i in n)if(n[i].id===e)return n[i];return null},c=e=>{if(e==null)return null;for(const i in n)if(n[i].label===e)return n[i];return null},t=n;for(const e in t)t[e]!==void 0&&(t[e].key=e);return Object.defineProperty(t,"lookupById",{value:d,enumerable:!1}),Object.defineProperty(t,"lookupByLabel",{value:c,enumerable:!1}),Object.defineProperty(t,"getIds",{value:r,enumerable:!1}),Object.defineProperty(t,"getLabels",{value:s,enumerable:!1}),Object.defineProperty(t,"getKeys",{value:a,enumerable:!1}),Object.defineProperty(t,"getValues",{value:u,enumerable:!1}),t},o=b({SMALL:{id:576,label:"Small"},MEDIUM:{id:768,label:"Medium"},LARGE:{id:992,label:"Large"},EXTRA_LARGE:{id:1200,label:"Extra large"}}),f=()=>/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window?.MSStream,g=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator?.userAgent),v=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent),m=()=>navigator?.userAgent.includes("Windows"),p=(n={sm:o.SMALL.id,md:o.MEDIUM.id,lg:o.LARGE.id,xl:o.EXTRA_LARGE.id})=>{const r=n;return window?.innerWidth<r.sm?"mobile":window?.innerWidth<r.lg?"tablet":"desktop"};exports.getCurrentDeviceSize=p;exports.isMobile=g;exports.isSafari=v;exports.isWindows=m;exports.isiOSDevice=f;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const b = (n) => {
|
|
2
|
+
const o = () => {
|
|
3
|
+
const e = [];
|
|
4
|
+
for (const t in n) {
|
|
5
|
+
const l = n[t];
|
|
6
|
+
e.push(l.id);
|
|
7
|
+
}
|
|
8
|
+
return e;
|
|
9
|
+
}, s = () => {
|
|
10
|
+
const e = [];
|
|
11
|
+
for (const t in n) {
|
|
12
|
+
const l = n[t];
|
|
13
|
+
e.push(l.label);
|
|
14
|
+
}
|
|
15
|
+
return e;
|
|
16
|
+
}, a = () => {
|
|
17
|
+
const e = [];
|
|
18
|
+
for (const t in n)
|
|
19
|
+
e.push(t);
|
|
20
|
+
return e;
|
|
21
|
+
}, u = () => n, d = (e) => {
|
|
22
|
+
if (e == null) return null;
|
|
23
|
+
for (const t in n)
|
|
24
|
+
if (n[t].id === e)
|
|
25
|
+
return n[t];
|
|
26
|
+
return null;
|
|
27
|
+
}, c = (e) => {
|
|
28
|
+
if (e == null) return null;
|
|
29
|
+
for (const t in n)
|
|
30
|
+
if (n[t].label === e)
|
|
31
|
+
return n[t];
|
|
32
|
+
return null;
|
|
33
|
+
}, i = n;
|
|
34
|
+
for (const e in i)
|
|
35
|
+
i[e] !== void 0 && (i[e].key = e);
|
|
36
|
+
return Object.defineProperty(i, "lookupById", {
|
|
37
|
+
value: d,
|
|
38
|
+
enumerable: !1
|
|
39
|
+
}), Object.defineProperty(i, "lookupByLabel", {
|
|
40
|
+
value: c,
|
|
41
|
+
enumerable: !1
|
|
42
|
+
}), Object.defineProperty(i, "getIds", {
|
|
43
|
+
value: o,
|
|
44
|
+
enumerable: !1
|
|
45
|
+
}), Object.defineProperty(i, "getLabels", {
|
|
46
|
+
value: s,
|
|
47
|
+
enumerable: !1
|
|
48
|
+
}), Object.defineProperty(i, "getKeys", {
|
|
49
|
+
value: a,
|
|
50
|
+
enumerable: !1
|
|
51
|
+
}), Object.defineProperty(i, "getValues", {
|
|
52
|
+
value: u,
|
|
53
|
+
enumerable: !1
|
|
54
|
+
}), i;
|
|
55
|
+
}, r = /* @__PURE__ */ b({
|
|
56
|
+
SMALL: { id: 576, label: "Small" },
|
|
57
|
+
MEDIUM: { id: 768, label: "Medium" },
|
|
58
|
+
LARGE: { id: 992, label: "Large" },
|
|
59
|
+
EXTRA_LARGE: { id: 1200, label: "Extra large" }
|
|
60
|
+
}), f = () => /iPad|iPhone|iPod/.test(navigator.userAgent) && !window?.MSStream, g = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
61
|
+
navigator?.userAgent
|
|
62
|
+
), p = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent), m = () => navigator?.userAgent.includes("Windows"), v = (n = {
|
|
63
|
+
sm: r.SMALL.id,
|
|
64
|
+
md: r.MEDIUM.id,
|
|
65
|
+
lg: r.LARGE.id,
|
|
66
|
+
xl: r.EXTRA_LARGE.id
|
|
67
|
+
}) => {
|
|
68
|
+
const o = n;
|
|
69
|
+
return window?.innerWidth < o.sm ? "mobile" : window?.innerWidth < o.lg ? "tablet" : "desktop";
|
|
70
|
+
};
|
|
71
|
+
export {
|
|
72
|
+
v as getCurrentDeviceSize,
|
|
73
|
+
g as isMobile,
|
|
74
|
+
p as isSafari,
|
|
75
|
+
m as isWindows,
|
|
76
|
+
f as isiOSDevice
|
|
77
|
+
};
|
package/dist/utils/MapUtils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Nullable, Optional } from '@wikicasa-dev/types';
|
|
2
2
|
import { FlatInvert, InvertKeyToValue } from '../types/ObjectUtilsTypes';
|
|
3
|
-
|
|
4
3
|
export declare function shallowCopyObjectTo(from: Record<string, any> | undefined, to: Record<string, any>): void;
|
|
5
4
|
/**
|
|
6
5
|
* Checks if the given object is empty.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={priceFrom:"PrezzoMinimo",priceTo:"PrezzoMassimo",sqMfrom:"SuperficieMinima",sqMto:"SuperficieMassima",roomsFrom:"NumeroMinimoLocali",roomsTo:"NumeroMassimoLocali",bathroomsFrom:"NumeroMinimoBagni",bathroomsTo:"NumeroMassimoBagni",conditionType:"StatoImmobile",energyClassFilter:"ClasseEnergetica",floor:"Piano",excludeAuctions:"EscludiAste",shortRentOnly:"SoloAffittiBrevi",excludeBareOwnership:"EscludiNudaProprieta",onlyPublicUser:"DaPrivato",balcony:"Balcone",terrace:"Terrazzo",balconyTerrace:"BalconeTerrazzo",boxCarSpot:"BoxPostoAuto",carSpot:"PostoAuto",box:"Box",lift:"Ascensore",privateGarden:"GiardinoPrivato",publicGarden:"GiardinoPubblico",cellar:"Cantina",airConditioning:"AriaCondizionata",furnished:"Arredato",publicTransport:"Trasporti",school:"Istruzione",market:"Supermercati",hospital:"Ospedali",pharmacy:"Farmacie",charging:"Ricarica",post:"UfficioPostale",bank:"Banche",swimmingPoolPrivate:"PiscinaPrivata",swimmingPoolPublic:"PiscinaCondominiale",luxury:"Lusso",discounted:"Sconto",auctionMinimumOfferFrom:"OffertaMinimaAstaDa",auctionMinimumOfferTo:"OffertaMinimaAstaA",auctionMinimumBid:"RialzoMinimoAsta",auctionCourtTypeID:"TribunaleAsta",auctionSaleModeID:"ModalitaVenditaAsta",auctionProcedureNumber:"NumeroProceduraAsta",auctionProcedureTypologyID:"TipologiaProceduraAsta",auctionReferenceYear:"AnnoRiferimentoAsta",auctionPublicationDateFrom:"DataPubblicazioneAstaDa",auctionPublicationDateTo:"DataPubblicazioneAstaA",auctionDateFrom:"DataAstaDa",auctionDateTo:"DataAstaA",filterOrderId:"Ordinamento"},u={sale:"Vendita",rent:"Affitto",auctionType:"Asta",bareOwnershipType:"NudaProprieta",typologyIdList:"Tipologia",filterOrderId:"Ordinamento"};function l(t,c,e,r,a,o,n){let i="/";return e&&(i+=e+"-"),i+=`${c}/`,o&&(i+=`${o}/`),t&&(i+=`${t.replace(/^-+|-+$/g,"")}/`),r&&(i+=`${r.replace(/^_+|_+$/g,"")}/`),!r&&n&&(i+=`${n.replace(/^_+|_+$/g,"")}/`),a&&(i+=`${a.replace(/^_+|_+$/g,"")}/`),i}function m(t,c=!1){const e=c?{...u}:{...s},r=Object.entries(t).filter(([a,o])=>e[a]&&o!==void 0&&o!==null&&o!==!1&&o!=="").flatMap(([a,o])=>Array.isArray(o)?o.map(n=>`${encodeURIComponent(e[a])}=${encodeURIComponent(n)}`):o!=null?`${encodeURIComponent(e[a])}=${o instanceof Date?encodeURIComponent(o.toISOString()):encodeURIComponent(o)}`:[]).join("&");return r?`?${r}`:""}exports.buildParams=m;exports.buildURL=l;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { RealEstateSearchBean } from '@wikicasa-dev/types';
|
|
2
|
-
|
|
3
2
|
export declare function buildURL(cityURL: string, listingTypology: string, contractType: string | undefined | null, zone?: string | null, seoFilter?: string | null, agencyAndPlace?: string, district?: string | null): string;
|
|
4
3
|
export declare function buildParams(searchBean: RealEstateSearchBean, isAgency?: boolean): string;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const s = {
|
|
2
|
+
priceFrom: "PrezzoMinimo",
|
|
3
|
+
priceTo: "PrezzoMassimo",
|
|
4
|
+
sqMfrom: "SuperficieMinima",
|
|
5
|
+
sqMto: "SuperficieMassima",
|
|
6
|
+
roomsFrom: "NumeroMinimoLocali",
|
|
7
|
+
roomsTo: "NumeroMassimoLocali",
|
|
8
|
+
bathroomsFrom: "NumeroMinimoBagni",
|
|
9
|
+
bathroomsTo: "NumeroMassimoBagni",
|
|
10
|
+
conditionType: "StatoImmobile",
|
|
11
|
+
energyClassFilter: "ClasseEnergetica",
|
|
12
|
+
floor: "Piano",
|
|
13
|
+
excludeAuctions: "EscludiAste",
|
|
14
|
+
shortRentOnly: "SoloAffittiBrevi",
|
|
15
|
+
excludeBareOwnership: "EscludiNudaProprieta",
|
|
16
|
+
onlyPublicUser: "DaPrivato",
|
|
17
|
+
balcony: "Balcone",
|
|
18
|
+
terrace: "Terrazzo",
|
|
19
|
+
balconyTerrace: "BalconeTerrazzo",
|
|
20
|
+
boxCarSpot: "BoxPostoAuto",
|
|
21
|
+
carSpot: "PostoAuto",
|
|
22
|
+
box: "Box",
|
|
23
|
+
lift: "Ascensore",
|
|
24
|
+
privateGarden: "GiardinoPrivato",
|
|
25
|
+
publicGarden: "GiardinoPubblico",
|
|
26
|
+
cellar: "Cantina",
|
|
27
|
+
airConditioning: "AriaCondizionata",
|
|
28
|
+
furnished: "Arredato",
|
|
29
|
+
publicTransport: "Trasporti",
|
|
30
|
+
school: "Istruzione",
|
|
31
|
+
market: "Supermercati",
|
|
32
|
+
hospital: "Ospedali",
|
|
33
|
+
pharmacy: "Farmacie",
|
|
34
|
+
charging: "Ricarica",
|
|
35
|
+
post: "UfficioPostale",
|
|
36
|
+
bank: "Banche",
|
|
37
|
+
swimmingPoolPrivate: "PiscinaPrivata",
|
|
38
|
+
swimmingPoolPublic: "PiscinaCondominiale",
|
|
39
|
+
luxury: "Lusso",
|
|
40
|
+
discounted: "Sconto",
|
|
41
|
+
auctionMinimumOfferFrom: "OffertaMinimaAstaDa",
|
|
42
|
+
auctionMinimumOfferTo: "OffertaMinimaAstaA",
|
|
43
|
+
auctionMinimumBid: "RialzoMinimoAsta",
|
|
44
|
+
auctionCourtTypeID: "TribunaleAsta",
|
|
45
|
+
auctionSaleModeID: "ModalitaVenditaAsta",
|
|
46
|
+
auctionProcedureNumber: "NumeroProceduraAsta",
|
|
47
|
+
auctionProcedureTypologyID: "TipologiaProceduraAsta",
|
|
48
|
+
auctionReferenceYear: "AnnoRiferimentoAsta",
|
|
49
|
+
auctionPublicationDateFrom: "DataPubblicazioneAstaDa",
|
|
50
|
+
auctionPublicationDateTo: "DataPubblicazioneAstaA",
|
|
51
|
+
auctionDateFrom: "DataAstaDa",
|
|
52
|
+
auctionDateTo: "DataAstaA",
|
|
53
|
+
/* Don't consider this prop in the filters counter */
|
|
54
|
+
filterOrderId: "Ordinamento"
|
|
55
|
+
}, u = {
|
|
56
|
+
sale: "Vendita",
|
|
57
|
+
rent: "Affitto",
|
|
58
|
+
auctionType: "Asta",
|
|
59
|
+
bareOwnershipType: "NudaProprieta",
|
|
60
|
+
typologyIdList: "Tipologia",
|
|
61
|
+
filterOrderId: "Ordinamento"
|
|
62
|
+
};
|
|
63
|
+
function m(t, c, e, r, a, o, n) {
|
|
64
|
+
let i = "/";
|
|
65
|
+
return e && (i += e + "-"), i += `${c}/`, o && (i += `${o}/`), t && (i += `${t.replace(/^-+|-+$/g, "")}/`), r && (i += `${r.replace(/^_+|_+$/g, "")}/`), !r && n && (i += `${n.replace(/^_+|_+$/g, "")}/`), a && (i += `${a.replace(/^_+|_+$/g, "")}/`), i;
|
|
66
|
+
}
|
|
67
|
+
function l(t, c = !1) {
|
|
68
|
+
const e = c ? { ...u } : { ...s }, r = Object.entries(t).filter(
|
|
69
|
+
([a, o]) => e[a] && o !== void 0 && o !== null && o !== !1 && o !== ""
|
|
70
|
+
).flatMap(([a, o]) => Array.isArray(o) ? o.map(
|
|
71
|
+
(n) => `${encodeURIComponent(e[a])}=${encodeURIComponent(n)}`
|
|
72
|
+
) : o != null ? `${encodeURIComponent(e[a])}=${o instanceof Date ? encodeURIComponent(o.toISOString()) : encodeURIComponent(o)}` : []).join("&");
|
|
73
|
+
return r ? `?${r}` : "";
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
l as buildParams,
|
|
77
|
+
m as buildURL
|
|
78
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wikicasa-dev/utilities",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22-alpha.2",
|
|
4
4
|
"description": "Wikicasa frontend utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./functions/*": {
|
|
14
|
+
"import": "./dist/utils/*.js",
|
|
15
|
+
"types": "./dist/utils/*.d.ts"
|
|
12
16
|
}
|
|
13
17
|
},
|
|
14
18
|
"files": [
|
|
@@ -31,13 +35,9 @@
|
|
|
31
35
|
"@types/js-cookie": "^3.0.6",
|
|
32
36
|
"@types/leaflet": "^1.9.3",
|
|
33
37
|
"@types/node": "^20.5.0",
|
|
34
|
-
"@wikicasa-dev/types": "
|
|
35
|
-
"glob": "^10.3.10",
|
|
38
|
+
"@wikicasa-dev/types": "2.1.8-alpha.2",
|
|
36
39
|
"jest-environment-jsdom": "^29.7.0",
|
|
37
|
-
"ts-jest": "^29.2.1"
|
|
38
|
-
"typescript": "^5.4.3",
|
|
39
|
-
"vite": "^5.2.3",
|
|
40
|
-
"vite-plugin-dts": "^3.7.3"
|
|
40
|
+
"ts-jest": "^29.2.1"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"date-fns": "^3.6.0",
|
package/dist/DateUtils.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(r){const e=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&e==="[object Date]"?new r.constructor(+r):typeof r=="number"||e==="[object Number]"||typeof r=="string"||e==="[object String]"?new Date(r):new Date(NaN)}function m(r,e){return r instanceof Date?new r.constructor(e):new Date(e)}function X(r,e){const t=p(r);return isNaN(e)?m(r,NaN):(e&&t.setDate(t.getDate()+e),t)}const te=6048e5,me=864e5,we=6e4,ye=36e5,ge=1e3;let be={};function _(){return be}function O(r,e){const t=_(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,a=p(r),s=a.getDay(),o=(s<n?7:0)+s-n;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function W(r){return O(r,{weekStartsOn:1})}function ne(r){const e=p(r),t=e.getFullYear(),n=m(r,0);n.setFullYear(t+1,0,4),n.setHours(0,0,0,0);const a=W(n),s=m(r,0);s.setFullYear(t,0,4),s.setHours(0,0,0,0);const o=W(s);return e.getTime()>=a.getTime()?t+1:e.getTime()>=o.getTime()?t:t-1}function J(r){const e=p(r);return e.setHours(0,0,0,0),e}function F(r){const e=p(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function pe(r,e){const t=J(r),n=J(e),a=+t-F(t),s=+n-F(n);return Math.round((a-s)/me)}function xe(r){const e=ne(r),t=m(r,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),W(t)}function Me(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function re(r){if(!Me(r)&&typeof r!="number")return!1;const e=p(r);return!isNaN(Number(e))}function Pe(r){const e=p(r),t=m(r,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}const De={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Te=(r,e,t)=>{let n;const a=De[r];return typeof a=="string"?n=a:e===1?n=a.one:n=a.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function I(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const ke={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Oe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ye={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ve={date:I({formats:ke,defaultWidth:"full"}),time:I({formats:Oe,defaultWidth:"full"}),dateTime:I({formats:Ye,defaultWidth:"full"})},Ee={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},We=(r,e,t,n)=>Ee[r];function q(r){return(e,t)=>{const n=t?.context?String(t.context):"standalone";let a;if(n==="formatting"&&r.formattingValues){const o=r.defaultFormattingWidth||r.defaultWidth,d=t?.width?String(t.width):o;a=r.formattingValues[d]||r.formattingValues[o]}else{const o=r.defaultWidth,d=t?.width?String(t.width):r.defaultWidth;a=r.values[d]||r.values[o]}const s=r.argumentCallback?r.argumentCallback(e):e;return a[s]}}const _e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ne={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},qe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},He={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Fe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Le={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ce=(r,e)=>{const t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Ie={ordinalNumber:Ce,era:q({values:_e,defaultWidth:"wide"}),quarter:q({values:Ne,defaultWidth:"wide",argumentCallback:r=>r-1}),month:q({values:qe,defaultWidth:"wide"}),day:q({values:He,defaultWidth:"wide"}),dayPeriod:q({values:Fe,defaultWidth:"wide",formattingValues:Le,defaultFormattingWidth:"wide"})};function H(r){return(e,t={})=>{const n=t.width,a=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],s=e.match(a);if(!s)return null;const o=s[0],d=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],M=Array.isArray(d)?Re(d,f=>f.test(o)):Qe(d,f=>f.test(o));let x;x=r.valueCallback?r.valueCallback(M):M,x=t.valueCallback?t.valueCallback(x):x;const b=e.slice(o.length);return{value:x,rest:b}}}function Qe(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function Re(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function Xe(r){return(e,t={})=>{const n=e.match(r.matchPattern);if(!n)return null;const a=n[0],s=e.match(r.parsePattern);if(!s)return null;let o=r.valueCallback?r.valueCallback(s[0]):s[0];o=t.valueCallback?t.valueCallback(o):o;const d=e.slice(a.length);return{value:o,rest:d}}}const Ge=/^(\d+)(th|st|nd|rd)?/i,Be=/\d+/i,Ae={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$e={any:[/^b/i,/^(a|c)/i]},je={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ve={any:[/1/i,/2/i,/3/i,/4/i]},ze={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Je={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ze={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ke={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ue={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Se={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},et={ordinalNumber:Xe({matchPattern:Ge,parsePattern:Be,valueCallback:r=>parseInt(r,10)}),era:H({matchPatterns:Ae,defaultMatchWidth:"wide",parsePatterns:$e,defaultParseWidth:"any"}),quarter:H({matchPatterns:je,defaultMatchWidth:"wide",parsePatterns:Ve,defaultParseWidth:"any",valueCallback:r=>r+1}),month:H({matchPatterns:ze,defaultMatchWidth:"wide",parsePatterns:Je,defaultParseWidth:"any"}),day:H({matchPatterns:Ze,defaultMatchWidth:"wide",parsePatterns:Ke,defaultParseWidth:"any"}),dayPeriod:H({matchPatterns:Ue,defaultMatchWidth:"any",parsePatterns:Se,defaultParseWidth:"any"})},ae={code:"en-US",formatDistance:Te,formatLong:ve,formatRelative:We,localize:Ie,match:et,options:{weekStartsOn:0,firstWeekContainsDate:1}};function tt(r){const e=p(r);return pe(e,Pe(e))+1}function se(r){const e=p(r),t=+W(e)-+xe(e);return Math.round(t/te)+1}function G(r,e){const t=p(r),n=t.getFullYear(),a=_(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=m(r,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const d=O(o,e),M=m(r,0);M.setFullYear(n,0,s),M.setHours(0,0,0,0);const x=O(M,e);return t.getTime()>=d.getTime()?n+1:t.getTime()>=x.getTime()?n:n-1}function nt(r,e){const t=_(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,a=G(r,e),s=m(r,0);return s.setFullYear(a,0,n),s.setHours(0,0,0,0),O(s,e)}function oe(r,e){const t=p(r),n=+O(t,e)-+nt(t,e);return Math.round(n/te)+1}function c(r,e){const t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}const k={y(r,e){const t=r.getFullYear(),n=t>0?t:1-t;return c(e==="yy"?n%100:n,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):c(t+1,2)},d(r,e){return c(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return c(r.getHours()%12||12,e.length)},H(r,e){return c(r.getHours(),e.length)},m(r,e){return c(r.getMinutes(),e.length)},s(r,e){return c(r.getSeconds(),e.length)},S(r,e){const t=e.length,n=r.getMilliseconds(),a=Math.trunc(n*Math.pow(10,t-3));return c(a,e.length)}},E={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Z={G:function(r,e,t){const n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const n=r.getFullYear(),a=n>0?n:1-n;return t.ordinalNumber(a,{unit:"year"})}return k.y(r,e)},Y:function(r,e,t,n){const a=G(r,n),s=a>0?a:1-a;if(e==="YY"){const o=s%100;return c(o,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):c(s,e.length)},R:function(r,e){const t=ne(r);return c(t,e.length)},u:function(r,e){const t=r.getFullYear();return c(t,e.length)},Q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return c(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return c(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){const n=r.getMonth();switch(e){case"M":case"MM":return k.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){const n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return c(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){const a=oe(r,n);return e==="wo"?t.ordinalNumber(a,{unit:"week"}):c(a,e.length)},I:function(r,e,t){const n=se(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):c(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):k.d(r,e)},D:function(r,e,t){const n=tt(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):c(n,e.length)},E:function(r,e,t){const n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return c(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(a,{width:"short",context:"formatting"});case"eeee":default:return t.day(a,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return c(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(a,{width:"narrow",context:"standalone"});case"cccccc":return t.day(a,{width:"short",context:"standalone"});case"cccc":default:return t.day(a,{width:"wide",context:"standalone"})}},i:function(r,e,t){const n=r.getDay(),a=n===0?7:n;switch(e){case"i":return String(a);case"ii":return c(a,e.length);case"io":return t.ordinalNumber(a,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){const a=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(r,e,t){const n=r.getHours();let a;switch(n===12?a=E.noon:n===0?a=E.midnight:a=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(r,e,t){const n=r.getHours();let a;switch(n>=17?a=E.evening:n>=12?a=E.afternoon:n>=4?a=E.morning:a=E.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return k.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):k.H(r,e)},K:function(r,e,t){const n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):k.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):k.s(r,e)},S:function(r,e){return k.S(r,e)},X:function(r,e,t){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return U(n);case"XXXX":case"XX":return Y(n);case"XXXXX":case"XXX":default:return Y(n,":")}},x:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"x":return U(n);case"xxxx":case"xx":return Y(n);case"xxxxx":case"xxx":default:return Y(n,":")}},O:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+K(n,":");case"OOOO":default:return"GMT"+Y(n,":")}},z:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+K(n,":");case"zzzz":default:return"GMT"+Y(n,":")}},t:function(r,e,t){const n=Math.trunc(r.getTime()/1e3);return c(n,e.length)},T:function(r,e,t){const n=r.getTime();return c(n,e.length)}};function K(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Math.trunc(n/60),s=n%60;return s===0?t+String(a):t+String(a)+e+c(s,2)}function U(r,e){return r%60===0?(r>0?"-":"+")+c(Math.abs(r)/60,2):Y(r,e)}function Y(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=c(Math.trunc(n/60),2),s=c(n%60,2);return t+a+e+s}const S=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},ie=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},rt=(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return S(r,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",S(n,e)).replace("{{time}}",ie(a,e))},Q={p:ie,P:rt},at=/^D+$/,st=/^Y+$/,ot=["D","DD","YY","YYYY"];function ue(r){return at.test(r)}function ce(r){return st.test(r)}function R(r,e,t){const n=it(r,e,t);if(console.warn(n),ot.includes(r))throw new RangeError(n)}function it(r,e,t){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ut=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ct=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,dt=/^'([^]*?)'?$/,lt=/''/g,ft=/[a-zA-Z]/;function ee(r,e,t){const n=_(),a=n.locale??ae,s=n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=n.weekStartsOn??n.locale?.options?.weekStartsOn??0,d=p(r);if(!re(d))throw new RangeError("Invalid time value");let M=e.match(ct).map(b=>{const f=b[0];if(f==="p"||f==="P"){const N=Q[f];return N(b,a.formatLong)}return b}).join("").match(ut).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const f=b[0];if(f==="'")return{isToken:!1,value:ht(b)};if(Z[f])return{isToken:!0,value:b};if(f.match(ft))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:b}});a.localize.preprocessor&&(M=a.localize.preprocessor(d,M));const x={firstWeekContainsDate:s,weekStartsOn:o,locale:a};return M.map(b=>{if(!b.isToken)return b.value;const f=b.value;(ce(f)||ue(f))&&R(f,e,String(r));const N=Z[f[0]];return N(d,f,a.localize,x)}).join("")}function ht(r){const e=r.match(dt);return e?e[1].replace(lt,"'"):r}function mt(){return Object.assign({},_())}function wt(r){let t=p(r).getDay();return t===0&&(t=7),t}function yt(r,e){const t=e instanceof Date?m(e,0):new e(0);return t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),t.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),t}const gt=10;class de{subPriority=0;validate(e,t){return!0}}class bt extends de{constructor(e,t,n,a,s){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=a,s&&(this.subPriority=s)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}}class pt extends de{priority=gt;subPriority=-1;set(e,t){return t.timestampIsSet?e:m(e,yt(e,Date))}}class u{run(e,t,n,a){const s=this.parse(e,t,n,a);return s?{setter:new bt(s.value,this.validate,this.set,this.priority,this.subPriority),rest:s.rest}:null}validate(e,t,n){return!0}}class xt extends u{priority=140;parse(e,t,n){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});case"GGGG":default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]}const y={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},D={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function g(r,e){return r&&{value:e(r.value),rest:r.rest}}function l(r,e){const t=e.match(r);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}function T(r,e){const t=e.match(r);if(!t)return null;if(t[0]==="Z")return{value:0,rest:e.slice(1)};const n=t[1]==="+"?1:-1,a=t[2]?parseInt(t[2],10):0,s=t[3]?parseInt(t[3],10):0,o=t[5]?parseInt(t[5],10):0;return{value:n*(a*ye+s*we+o*ge),rest:e.slice(t[0].length)}}function le(r){return l(y.anyDigitsSigned,r)}function w(r,e){switch(r){case 1:return l(y.singleDigit,e);case 2:return l(y.twoDigits,e);case 3:return l(y.threeDigits,e);case 4:return l(y.fourDigits,e);default:return l(new RegExp("^\\d{1,"+r+"}"),e)}}function L(r,e){switch(r){case 1:return l(y.singleDigitSigned,e);case 2:return l(y.twoDigitsSigned,e);case 3:return l(y.threeDigitsSigned,e);case 4:return l(y.fourDigitsSigned,e);default:return l(new RegExp("^-?\\d{1,"+r+"}"),e)}}function B(r){switch(r){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function fe(r,e){const t=e>0,n=t?e:1-e;let a;if(n<=50)a=r||100;else{const s=n+50,o=Math.trunc(s/100)*100,d=r>=s%100;a=r+o-(d?100:0)}return t?a:1-a}function he(r){return r%400===0||r%4===0&&r%100!==0}class Mt extends u{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="yy"});switch(t){case"y":return g(w(4,e),a);case"yo":return g(n.ordinalNumber(e,{unit:"year"}),a);default:return g(w(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){const a=e.getFullYear();if(n.isTwoDigitYear){const o=fe(n.year,a);return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}const s=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}class Pt extends u{priority=130;parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="YY"});switch(t){case"Y":return g(w(4,e),a);case"Yo":return g(n.ordinalNumber(e,{unit:"year"}),a);default:return g(w(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,a){const s=G(e,a);if(n.isTwoDigitYear){const d=fe(n.year,s);return e.setFullYear(d,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),O(e,a)}const o=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(o,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),O(e,a)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class Dt extends u{priority=130;parse(e,t){return L(t==="R"?4:t.length,e)}set(e,t,n){const a=m(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),W(a)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class Tt extends u{priority=130;parse(e,t){return L(t==="u"?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class kt extends u{priority=120;parse(e,t,n){switch(t){case"Q":case"QQ":return w(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class Ot extends u{priority=120;parse(e,t,n){switch(t){case"q":case"qq":return w(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class Yt extends u{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"M":return g(l(y.month,e),a);case"MM":return g(w(2,e),a);case"Mo":return g(n.ordinalNumber(e,{unit:"month"}),a);case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}}class vt extends u{priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"L":return g(l(y.month,e),a);case"LL":return g(w(2,e),a);case"Lo":return g(n.ordinalNumber(e,{unit:"month"}),a);case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function Et(r,e,t){const n=p(r),a=oe(n,t)-e;return n.setDate(n.getDate()-a*7),n}class Wt extends u{priority=100;parse(e,t,n){switch(t){case"w":return l(y.week,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,a){return O(Et(e,n,a),a)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function _t(r,e){const t=p(r),n=se(t)-e;return t.setDate(t.getDate()-n*7),t}class Nt extends u{priority=100;parse(e,t,n){switch(t){case"I":return l(y.week,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return W(_t(e,n))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const qt=[31,28,31,30,31,30,31,31,30,31,30,31],Ht=[31,29,31,30,31,30,31,31,30,31,30,31];class Ft extends u{priority=90;subPriority=1;parse(e,t,n){switch(t){case"d":return l(y.date,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return w(t.length,e)}}validate(e,t){const n=e.getFullYear(),a=he(n),s=e.getMonth();return a?t>=1&&t<=Ht[s]:t>=1&&t<=qt[s]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class Lt extends u{priority=90;subpriority=1;parse(e,t,n){switch(t){case"D":case"DD":return l(y.dayOfYear,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return w(t.length,e)}}validate(e,t){const n=e.getFullYear();return he(n)?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function A(r,e,t){const n=_(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=p(r),o=s.getDay(),M=(e%7+7)%7,x=7-a,b=e<0||e>6?e-(o+x)%7:(M+x)%7-(o+x)%7;return X(s,b)}class Ct extends u{priority=90;parse(e,t,n){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=A(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]}class It extends u{priority=90;parse(e,t,n,a){const s=o=>{const d=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+d};switch(t){case"e":case"ee":return g(w(t.length,e),s);case"eo":return g(n.ordinalNumber(e,{unit:"day"}),s);case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=A(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class Qt extends u{priority=90;parse(e,t,n,a){const s=o=>{const d=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+d};switch(t){case"c":case"cc":return g(w(t.length,e),s);case"co":return g(n.ordinalNumber(e,{unit:"day"}),s);case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=A(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function Rt(r,e){const t=p(r),n=wt(t),a=e-n;return X(t,a)}class Xt extends u{priority=90;parse(e,t,n){const a=s=>s===0?7:s;switch(t){case"i":case"ii":return w(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return g(n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiii":return g(n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiiii":return g(n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiii":default:return g(n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=Rt(e,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class Gt extends u{priority=80;parse(e,t,n){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(B(n),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]}class Bt extends u{priority=80;parse(e,t,n){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(B(n),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]}class At extends u{priority=80;parse(e,t,n){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(B(n),0,0,0),e}incompatibleTokens=["a","b","t","T"]}class $t extends u{priority=70;parse(e,t,n){switch(t){case"h":return l(y.hour12h,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){const a=e.getHours()>=12;return a&&n<12?e.setHours(n+12,0,0,0):!a&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]}class jt extends u{priority=70;parse(e,t,n){switch(t){case"H":return l(y.hour23h,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]}class Vt extends u{priority=70;parse(e,t,n){switch(t){case"K":return l(y.hour11h,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]}class zt extends u{priority=70;parse(e,t,n){switch(t){case"k":return l(y.hour24h,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){const a=n<=24?n%24:n;return e.setHours(a,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]}class Jt extends u{priority=60;parse(e,t,n){switch(t){case"m":return l(y.minute,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=["t","T"]}class Zt extends u{priority=50;parse(e,t,n){switch(t){case"s":return l(y.second,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=["t","T"]}class Kt extends u{priority=30;parse(e,t){const n=a=>Math.trunc(a*Math.pow(10,-t.length+3));return g(w(t.length,e),n)}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=["t","T"]}class Ut extends u{priority=10;parse(e,t){switch(t){case"X":return T(D.basicOptionalMinutes,e);case"XX":return T(D.basic,e);case"XXXX":return T(D.basicOptionalSeconds,e);case"XXXXX":return T(D.extendedOptionalSeconds,e);case"XXX":default:return T(D.extended,e)}}set(e,t,n){return t.timestampIsSet?e:m(e,e.getTime()-F(e)-n)}incompatibleTokens=["t","T","x"]}class St extends u{priority=10;parse(e,t){switch(t){case"x":return T(D.basicOptionalMinutes,e);case"xx":return T(D.basic,e);case"xxxx":return T(D.basicOptionalSeconds,e);case"xxxxx":return T(D.extendedOptionalSeconds,e);case"xxx":default:return T(D.extended,e)}}set(e,t,n){return t.timestampIsSet?e:m(e,e.getTime()-F(e)-n)}incompatibleTokens=["t","T","X"]}class en extends u{priority=40;parse(e){return le(e)}set(e,t,n){return[m(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class tn extends u{priority=20;parse(e){return le(e)}set(e,t,n){return[m(e,n),{timestampIsSet:!0}]}incompatibleTokens="*"}const nn={G:new xt,y:new Mt,Y:new Pt,R:new Dt,u:new Tt,Q:new kt,q:new Ot,M:new Yt,L:new vt,w:new Wt,I:new Nt,d:new Ft,D:new Lt,E:new Ct,e:new It,c:new Qt,i:new Xt,a:new Gt,b:new Bt,B:new At,h:new $t,H:new jt,K:new Vt,k:new zt,m:new Jt,s:new Zt,S:new Kt,X:new Ut,x:new St,t:new en,T:new tn},rn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,an=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sn=/^'([^]*?)'?$/,on=/''/g,un=/\S/,cn=/[a-zA-Z]/;function dn(r,e,t,n){const a=mt(),s=a.locale??ae,o=a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,d=a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(e==="")return r===""?p(t):m(t,NaN);const M={firstWeekContainsDate:o,weekStartsOn:d,locale:s},x=[new pt],b=e.match(an).map(i=>{const h=i[0];if(h in Q){const P=Q[h];return P(i,s.formatLong)}return i}).join("").match(rn),f=[];for(let i of b){ce(i)&&R(i,e,r),ue(i)&&R(i,e,r);const h=i[0],P=nn[h];if(P){const{incompatibleTokens:j}=P;if(Array.isArray(j)){const V=f.find(z=>j.includes(z.token)||z.token===h);if(V)throw new RangeError(`The format string mustn't contain \`${V.fullToken}\` and \`${i}\` at the same time`)}else if(P.incompatibleTokens==="*"&&f.length>0)throw new RangeError(`The format string mustn't contain \`${i}\` and any other token at the same time`);f.push({token:h,fullToken:i});const C=P.run(r,i,s.match,M);if(!C)return m(t,NaN);x.push(C.setter),r=C.rest}else{if(h.match(cn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");if(i==="''"?i="'":h==="'"&&(i=ln(i)),r.indexOf(i)===0)r=r.slice(i.length);else return m(t,NaN)}}if(r.length>0&&un.test(r))return m(t,NaN);const N=x.map(i=>i.priority).sort((i,h)=>h-i).filter((i,h,P)=>P.indexOf(i)===h).map(i=>x.filter(h=>h.priority===i).sort((h,P)=>P.subPriority-h.subPriority)).map(i=>i[0]);let v=p(t);if(isNaN(v.getTime()))return m(t,NaN);const $={};for(const i of N){if(!i.validate(v,M))return m(t,NaN);const h=i.set(v,$,M);Array.isArray(h)?(v=h[0],Object.assign($,h[1])):v=h}return m(t,v)}function ln(r){return r.match(sn)[1].replace(on,"'")}function fn(r,e){return X(r,-e)}function hn(r,e=!1){const t=r.getDate(),n=r.getMonth()+1,a=r.getFullYear();return e?`${("0"+t).slice(-2)}-${("0"+n).slice(-2)}-${a}`:`${a}-${("0"+n).slice(-2)}-${("0"+t).slice(-2)}`}const mn=r=>{if(typeof r=="string"){const e=new Date(r);return isNaN(e.valueOf())?"":ee(e,"dd/MM/yyyy")}return ee(r,"dd/MM/yyyy")},wn=(r=new Date,e)=>(e<0&&(e=0),fn(r,e));function yn(r){const t=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy"].map(n=>dn(r,n,new Date)).find(n=>re(n));if(t){const n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0),a=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59);return{start:n.toISOString(),end:a.toISOString()}}return{start:null,end:null}}exports.formatDate=hn;exports.formatDateToddMMYYYY=mn;exports.getStartAndEndOfDayUTC=yn;exports.subtractDaysFromDate=wn;
|