@adyen/adyen-platform-experience-web
Version:

54 lines (53 loc) • 1.89 kB
JavaScript
import { timezoneToSystem as p, systemToTimezone as g } from "../../../../../core/Localization/datetime/restamper/utils.js";
import { clamp as T, isBitSafeInteger as l } from "../../../../../utils/value/number.js";
import { enumerable as m, hasOwnProperty as c, getter as z } from "../../../../../utils/struct/property.js";
import { struct as u } from "../../../../../utils/struct/main.js";
import { isUndefined as d, isFunction as h, isNullish as w } from "../../../../../utils/value/is.js";
const O = (e) => Object.freeze({
systemToTimezone: m((t) => g(e, t)),
timezoneToSystem: m((t) => p(e, t)),
timezoneOffset: m((t) => e(t).offset)
}), V = (e, t, o = e) => {
const a = (n, i) => {
let s = n;
w(n) ? s = o : l(n) || (s = i ?? o);
const r = T(e, s, t);
return r === s ? r : i ?? o;
};
return (n) => {
const i = z(() => s);
let s = a(n);
return u({
value: i,
descriptor: m({
...i,
set(r) {
const f = s;
s = a(r, s), f !== s && (this.now = this.now);
}
})
});
};
}, x = (e, t) => (o) => h(o) ? o.call(e, t) : o, P = (e) => !c(e, "offsets"), S = (e) => c(e, "from"), j = ({ now: e }) => e, U = /* @__PURE__ */ (() => {
const e = /* @__PURE__ */ new Map();
return (t) => {
let o = e.get(t);
return d(o) && (o = Object.freeze([0, 0, t, 0, 0, 0, -1]), e.set(t, o)), o;
};
})(), W = (e) => {
try {
const t = e instanceof Date || +e === e ? e : void 0, o = new Date(t).getTime();
return isNaN(o) ? void 0 : o;
} catch {
}
};
export {
O as createRangeTimestampsConfigRestampingContext,
x as getRangeTimestampsConfigParameterUnwrapper,
V as getRangeTimestampsContextIntegerPropertyFactory,
S as isRangeTimestampsConfigWithFromOffsets,
P as isRangeTimestampsConfigWithoutOffsets,
j as nowTimestamp,
U as offsetsForNDays,
W as parseRangeTimestamp
};