@maizzle/framework
Version:
Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.
1,205 lines • 1.48 MB
JavaScript
import { $n as toRef, Bt as onUnmounted, E as withModifiers, Et as mergeDefaults, G as createBaseVNode, Gn as reactive, H as cloneVNode, Hn as onScopeDispose, Ht as openBlock, It as onMounted, J as createElementBlock, Jt as renderList, K as createBlock, L as Teleport, Mt as onBeforeUnmount, N as Fragment, Ot as mergeProps, Pn as getCurrentScope, Qn as toRaw, Qt as resolveDynamicComponent, Sn as withCtx, St as inject, T as withKeys, Tn as withMemo, Vn as markRaw, Vt as onUpdated, W as computed, Wt as provide, Xn as shallowRef, Yn as shallowReadonly, Yt as renderSlot, _n as watch, bn as watchSyncEffect, cn as useAttrs, cr as normalizeStyle, dt as getCurrentInstance, er as toRefs, et as createTextVNode, fn as useSlots, ir as camelize, jt as onBeforeMount, k as Comment, kt as nextTick, ln as useId$1, lr as toDisplayString, mt as h, n as vue_runtime_esm_bundler_exports, nr as triggerRef, on as toHandlers, pt as guardReactiveProps, q as createCommentVNode, qn as ref, rr as unref, rt as defineComponent, sr as normalizeProps, tr as toValue$1, tt as createVNode, ur as toHandlerKey, vn as watchEffect, w as vShow, wn as withDirectives, yn as watchPostEffect, zn as isRef } from "./vue.runtime.esm-bundler-Dz9O_TVp.js";
import { createEventHook, createGlobalState, createSharedComposable, isClient, isIOS, reactiveComputed, reactiveOmit, refAutoReset, syncRef, tryOnBeforeUnmount, tryOnScopeDispose, useDebounceFn, useTimeout, useTimeoutFn, watchOnce } from "./@vueuse_shared.js";
import { defaultWindow, onKeyStroke, unrefElement, useActiveElement, useEventListener, useFocusWithin, useMounted, useParentElement, useRafFn, useResizeObserver, useVModel } from "./@vueuse_core.js";
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/ohash/dist/shared/ohash.D__AXeF1.mjs
function serialize(o) {
return typeof o == "string" ? `'${o}'` : new c().serialize(o);
}
var c = /*@__PURE__*/ function() {
class o {
#t = /* @__PURE__ */ new Map();
compare(t, r) {
const e = typeof t, n = typeof r;
return e === "string" && n === "string" ? t.localeCompare(r) : e === "number" && n === "number" ? t - r : String.prototype.localeCompare.call(this.serialize(t, true), this.serialize(r, true));
}
serialize(t, r) {
if (t === null) return "null";
switch (typeof t) {
case "string": return r ? t : `'${t}'`;
case "bigint": return `${t}n`;
case "object": return this.$object(t);
case "function": return this.$function(t);
}
return String(t);
}
serializeObject(t) {
const r = Object.prototype.toString.call(t);
if (r !== "[object Object]") return this.serializeBuiltInType(r.length < 10 ? `unknown:${r}` : r.slice(8, -1), t);
const e = t.constructor, n = e === Object || e === void 0 ? "" : e.name;
if (n !== "" && globalThis[n] === e) return this.serializeBuiltInType(n, t);
if (typeof t.toJSON == "function") {
const i = t.toJSON();
return n + (i !== null && typeof i == "object" ? this.$object(i) : `(${this.serialize(i)})`);
}
return this.serializeObjectEntries(n, Object.entries(t));
}
serializeBuiltInType(t, r) {
const e = this["$" + t];
if (e) return e.call(this, r);
if (typeof r?.entries == "function") return this.serializeObjectEntries(t, r.entries());
throw new Error(`Cannot serialize ${t}`);
}
serializeObjectEntries(t, r) {
const e = Array.from(r).sort((i, a) => this.compare(i[0], a[0]));
let n = `${t}{`;
for (let i = 0; i < e.length; i++) {
const [a, l] = e[i];
n += `${this.serialize(a, true)}:${this.serialize(l)}`, i < e.length - 1 && (n += ",");
}
return n + "}";
}
$object(t) {
let r = this.#t.get(t);
return r === void 0 && (this.#t.set(t, `#${this.#t.size}`), r = this.serializeObject(t), this.#t.set(t, r)), r;
}
$function(t) {
const r = Function.prototype.toString.call(t);
return r.slice(-15) === "[native code] }" ? `${t.name || ""}()[native]` : `${t.name}(${t.length})${r.replace(/\s*\n\s*/g, "")}`;
}
$Array(t) {
let r = "[";
for (let e = 0; e < t.length; e++) r += this.serialize(t[e]), e < t.length - 1 && (r += ",");
return r + "]";
}
$Date(t) {
try {
return `Date(${t.toISOString()})`;
} catch {
return "Date(null)";
}
}
$ArrayBuffer(t) {
return `ArrayBuffer[${new Uint8Array(t).join(",")}]`;
}
$Set(t) {
return `Set${this.$Array(Array.from(t).sort((r, e) => this.compare(r, e)))}`;
}
$Map(t) {
return this.serializeObjectEntries("Map", t.entries());
}
}
for (const s of [
"Error",
"RegExp",
"URL"
]) o.prototype["$" + s] = function(t) {
return `${s}(${t})`;
};
for (const s of [
"Int8Array",
"Uint8Array",
"Uint8ClampedArray",
"Int16Array",
"Uint16Array",
"Int32Array",
"Uint32Array",
"Float32Array",
"Float64Array"
]) o.prototype["$" + s] = function(t) {
return `${s}[${t.join(",")}]`;
};
for (const s of ["BigInt64Array", "BigUint64Array"]) o.prototype["$" + s] = function(t) {
return `${s}[${t.join("n,")}${t.length > 0 ? "n" : ""}]`;
};
return o;
}();
function isEqual(object1, object2) {
if (object1 === object2) return true;
if (serialize(object1) === serialize(object2)) return true;
return false;
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/arrays.js
/**
* The function `areEqual` compares two arrays and returns true if they are equal in length and have
* the same elements at corresponding indexes.
* @param {any[]} arrayA - An array of any type of elements.
* @param {any[]} arrayB - It looks like you haven't provided the value for `arrayB`. Could you please
* provide the arrayB value so that I can assist you further?
* @returns The function `areEqual` is returning a boolean value, either `true` if the two input arrays
* `arrayA` and `arrayB` are equal, or `false` if they are not equal.
*/
function areEqual(arrayA, arrayB) {
if (arrayA.length !== arrayB.length) return false;
for (let index = 0; index < arrayA.length; index++) if (arrayA[index] !== arrayB[index]) return false;
return true;
}
/**
* The function `findValuesBetween` takes an array and two values, then returns a subarray containing
* elements between the first occurrence of the start value and the first occurrence of the end value
* in the array.
* @param {T[]} array - The `array` parameter is an array of values of type `T`.
* @param {T} start - The `start` parameter is the value that marks the beginning of the range you want
* to find in the array.
* @param {T} end - The `end` parameter in the `findValuesBetween` function represents the end value
* that you want to find in the array. This function will return a subarray of values that are between
* the `start` and `end` values in the original array.
* @returns The `findValuesBetween` function returns an array of values from the input array that are
* between the `start` and `end` values (inclusive). If either the `start` or `end` values are not
* found in the input array, an empty array is returned.
*/
function findValuesBetween(array, start, end) {
const startIndex = array.findIndex((i) => isEqual(i, start));
const endIndex = array.findIndex((i) => isEqual(i, end));
if (startIndex === -1 || endIndex === -1) return [];
const [minIndex, maxIndex] = [startIndex, endIndex].sort((a, b) => a - b);
return array.slice(minIndex, maxIndex + 1);
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/browser.js
var isBrowser = typeof document !== "undefined";
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/clamp.js
/**
* The `clamp` function restricts a number within a specified range by returning the value itself if it
* falls within the range, or the closest boundary value if it exceeds the range.
* @param {number} value - The `value` parameter represents the number that you want to clamp within
* the specified range defined by `min` and `max` values.
* @param {number} min - If the `value` parameter is less than the `min` value, the
* function will return the `min` value.
* @param {number} max - If the `value` parameter is greater than the `max` value,
* the function will return `max`.
* @returns The `clamp` function returns the value of `value` constrained within the range defined by
* `min` and `max`.
*/
function clamp$2(value, min = Number.NEGATIVE_INFINITY, max = Number.POSITIVE_INFINITY) {
return Math.min(max, Math.max(min, value));
}
/**
* The function `roundToStepPrecision` rounds a number to a specified precision step.
* @param {number} value - The `value` parameter is the number that you want to round to a specific
* precision based on the `step` parameter.
* @param {number} step - The `step` parameter in the `roundToStepPrecision` function represents the
* interval at which you want to round the `value`. For example, if `step` is 0.5, the `value` will be
* rounded to the nearest half.
* @returns the `roundedValue` after rounding it to the precision specified by the `step`.
*/
function roundToStepPrecision(value, step) {
let roundedValue = value;
const stepString = step.toString();
const pointIndex = stepString.indexOf(".");
const precision = pointIndex >= 0 ? stepString.length - pointIndex : 0;
if (precision > 0) {
const pow = 10 ** precision;
roundedValue = Math.round(roundedValue * pow) / pow;
}
return roundedValue;
}
/**
* The function `snapValueToStep` snaps a given value to the nearest step within a specified range.
* @param {number} value - The `value` parameter represents the number that you want to snap to the
* nearest step value.
* @param {number | undefined} min - The `min` parameter represents the minimum value that the `value`
* should be snapped to. If `value` is less than `min`, it will be snapped to `min`. If `min` is not
* provided (undefined), then the snapping will not consider a minimum value.
* @param {number | undefined} max - The `max` parameter represents the maximum value that the `value`
* should be snapped to. It ensures that the snapped value does not exceed this maximum value.
* @param {number} step - The `step` parameter in the `snapValueToStep` function represents the
* interval at which the `value` should be snapped to. It determines the granularity of the snapping
* operation. For example, if `step` is 5, the `value` will be snapped to the nearest multiple of
* @returns a number that has been snapped to the nearest step value within the specified range of minimum and maximum values.
*/
function snapValueToStep(value, min, max, step) {
min = Number(min);
max = Number(max);
const remainder = (value - (Number.isNaN(min) ? 0 : min)) % step;
let snappedValue = roundToStepPrecision(Math.abs(remainder) * 2 >= step ? value + Math.sign(remainder) * (step - Math.abs(remainder)) : value - remainder, step);
if (!Number.isNaN(min)) {
if (snappedValue < min) snappedValue = min;
else if (!Number.isNaN(max) && snappedValue > max) snappedValue = min + Math.floor(roundToStepPrecision((max - min) / step, step)) * step;
} else if (!Number.isNaN(max) && snappedValue > max) snappedValue = Math.floor(roundToStepPrecision(max / step, step)) * step;
snappedValue = roundToStepPrecision(snappedValue, step);
return snappedValue;
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/createContext.js
/**
* @param providerComponentName - The name(s) of the component(s) providing the context.
*
* There are situations where context can come from multiple components. In such cases, you might need to give an array of component names to provide your context, instead of just a single string.
*
* @param contextName The description for injection key symbol.
*/
function createContext(providerComponentName, contextName) {
const symbolDescription = typeof providerComponentName === "string" && !contextName ? `${providerComponentName}Context` : contextName;
const injectionKey = Symbol(symbolDescription);
/**
* @param fallback The context value to return if the injection fails.
*
* @throws When context injection failed and no fallback is specified.
* This happens when the component injecting the context is not a child of the root component providing the context.
*/
const injectContext = (fallback) => {
const context = inject(injectionKey, fallback);
if (context) return context;
if (context === null) return context;
throw new Error(`Injection \`${injectionKey.toString()}\` not found. Component must be used within ${Array.isArray(providerComponentName) ? `one of the following components: ${providerComponentName.join(", ")}` : `\`${providerComponentName}\``}`);
};
const provideContext = (contextValue) => {
provide(injectionKey, contextValue);
return contextValue;
};
return [injectContext, provideContext];
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/getActiveElement.js
function getActiveElement() {
let activeElement = document.activeElement;
if (activeElement == null) return null;
while (activeElement != null && activeElement.shadowRoot != null && activeElement.shadowRoot.activeElement != null) activeElement = activeElement.shadowRoot.activeElement;
return activeElement;
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/handleAndDispatchCustomEvent.js
function handleAndDispatchCustomEvent$1(name, handler, detail) {
const target = detail.originalEvent.target;
const event = new CustomEvent(name, {
bubbles: false,
cancelable: true,
detail
});
if (handler) target.addEventListener(name, handler, { once: true });
target.dispatchEvent(event);
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/nullish.js
function isNullish(value) {
return value === null || value === void 0;
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/isValueEqualOrExist.js
/**
* The function `isValueEqualOrExist` checks if a value is equal to or exists in another value or
* array.
* @param {T | T[] | undefined} base - It represents the base value that you want to compare with the `current` value.
* @param {T | T[] | undefined} current - The `current` parameter represents the current value that you want to compare with the `base` value or values.
* @returns The `isValueEqualOrExist` function returns a boolean value. It checks if the `base` value
* is equal to the `current` value or if the `current` value exists within the `base` value. The
* function handles cases where `base` can be a single value, an array of values, or undefined.
*/
function isValueEqualOrExist(base, current) {
if (isNullish(base)) return false;
if (Array.isArray(base)) return base.some((val) => isEqual(val, current));
else return isEqual(base, current);
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/renderSlotFragments.js
function renderSlotFragments(children) {
if (!children) return [];
return children.flatMap((child) => {
if (child.type === Fragment) return renderSlotFragments(child.children);
return [child];
});
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/useArrowNavigation.js
var ignoredElement = ["INPUT", "TEXTAREA"];
/**
* Allow arrow navigation for every html element with data-reka-collection-item tag
*
* @param e Keyboard event
* @param currentElement Event initiator element or any element that wants to handle the navigation
* @param parentElement Parent element where contains all the collection items, this will collect every item to be used when nav
* @param options further options
* @returns the navigated html element or null if none
*/
function useArrowNavigation(e, currentElement, parentElement, options = {}) {
if (!currentElement || options.enableIgnoredElement && ignoredElement.includes(currentElement.nodeName)) return null;
const { arrowKeyOptions = "both", attributeName = "[data-reka-collection-item]", itemsArray = [], loop = true, dir = "ltr", preventScroll = true, focus = false } = options;
const [right, left, up, down, home, end] = [
e.key === "ArrowRight",
e.key === "ArrowLeft",
e.key === "ArrowUp",
e.key === "ArrowDown",
e.key === "Home",
e.key === "End"
];
const goingVertical = up || down;
const goingHorizontal = right || left;
if (!home && !end && (!goingVertical && !goingHorizontal || arrowKeyOptions === "vertical" && goingHorizontal || arrowKeyOptions === "horizontal" && goingVertical)) return null;
const allCollectionItems = parentElement ? Array.from(parentElement.querySelectorAll(attributeName)) : itemsArray;
if (!allCollectionItems.length) return null;
if (preventScroll) e.preventDefault();
let item = null;
if (goingHorizontal || goingVertical) item = findNextFocusableElement(allCollectionItems, currentElement, {
goForward: goingVertical ? down : dir === "ltr" ? right : left,
loop
});
else if (home) item = allCollectionItems.at(0) || null;
else if (end) item = allCollectionItems.at(-1) || null;
if (focus) item?.focus();
return item;
}
/**
* Recursive function to find the next focusable element to avoid disabled elements
*
* @param elements Elements to navigate
* @param currentElement Current active element
* @param options
* @returns next focusable element
*/
function findNextFocusableElement(elements, currentElement, options, iterations = !elements.includes(currentElement) ? elements.length + 1 : elements.length) {
if (--iterations === 0) return null;
const index = elements.indexOf(currentElement);
let newIndex;
if (index === -1) newIndex = options.goForward ? 0 : elements.length - 1;
else newIndex = options.goForward ? index + 1 : index - 1;
if (!options.loop && (newIndex < 0 || newIndex >= elements.length)) return null;
const candidate = elements[(newIndex + elements.length) % elements.length];
if (!candidate) return null;
if (candidate.hasAttribute("disabled") && candidate.getAttribute("disabled") !== "false") return findNextFocusableElement(elements, candidate, options, iterations);
return candidate;
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/ConfigProvider/ConfigProvider.js
var [injectConfigProviderContext, provideConfigProviderContext] = /*#__PURE__*/ createContext("ConfigProvider");
var ConfigProvider_default = /* @__PURE__ */ defineComponent({
inheritAttrs: false,
__name: "ConfigProvider",
props: {
dir: {
type: String,
required: false,
default: "ltr"
},
locale: {
type: String,
required: false,
default: "en"
},
scrollBody: {
type: [Boolean, Object],
required: false,
default: true
},
nonce: {
type: String,
required: false,
default: void 0
},
teleportTo: {
type: null,
required: false,
default: void 0
},
useId: {
type: Function,
required: false,
default: void 0
}
},
setup(__props) {
const props = __props;
const { dir, locale, scrollBody, nonce, teleportTo } = toRefs(props);
provideConfigProviderContext({
dir,
locale,
scrollBody,
nonce,
teleportTo,
useId: props.useId
});
return (_ctx, _cache) => {
return renderSlot(_ctx.$slots, "default");
};
}
});
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/defu/dist/defu.mjs
function isPlainObject(value) {
if (value === null || typeof value !== "object") return false;
const prototype = Object.getPrototypeOf(value);
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
if (Symbol.iterator in value) return false;
if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
return true;
}
function _defu(baseObject, defaults, namespace = ".", merger) {
if (!isPlainObject(defaults)) return _defu(baseObject, {}, namespace, merger);
const object = { ...defaults };
for (const key of Object.keys(baseObject)) {
if (key === "__proto__" || key === "constructor") continue;
const value = baseObject[key];
if (value === null || value === void 0) continue;
if (merger && merger(object, key, value, namespace)) continue;
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
else if (isPlainObject(value) && isPlainObject(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
else object[key] = value;
}
return object;
}
function createDefu(merger) {
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
}
var defu = createDefu();
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/useBodyScrollLock.js
var useBodyLockStackCount = createSharedComposable(() => {
const map = ref(/* @__PURE__ */ new Map());
const initialOverflow = ref();
const locked = computed(() => {
for (const value of map.value.values()) if (value) return true;
return false;
});
const context = injectConfigProviderContext({ scrollBody: ref(true) });
let stopTouchMoveListener = null;
const resetBodyStyle = () => {
document.body.style.paddingRight = "";
document.body.style.marginRight = "";
document.body.style.pointerEvents = "";
document.documentElement.style.removeProperty("--scrollbar-width");
document.body.style.overflow = initialOverflow.value ?? "";
isIOS && stopTouchMoveListener?.();
initialOverflow.value = void 0;
};
watch(locked, (val, oldVal) => {
if (!isClient) return;
if (!val) {
if (oldVal) resetBodyStyle();
return;
}
if (initialOverflow.value === void 0) initialOverflow.value = document.body.style.overflow;
const verticalScrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
const defaultConfig = {
padding: verticalScrollbarWidth,
margin: 0
};
const config = context.scrollBody?.value ? typeof context.scrollBody.value === "object" ? defu({
padding: context.scrollBody.value.padding === true ? verticalScrollbarWidth : context.scrollBody.value.padding,
margin: context.scrollBody.value.margin === true ? verticalScrollbarWidth : context.scrollBody.value.margin
}, defaultConfig) : defaultConfig : {
padding: 0,
margin: 0
};
if (verticalScrollbarWidth > 0) {
document.body.style.paddingRight = typeof config.padding === "number" ? `${config.padding}px` : String(config.padding);
document.body.style.marginRight = typeof config.margin === "number" ? `${config.margin}px` : String(config.margin);
document.documentElement.style.setProperty("--scrollbar-width", `${verticalScrollbarWidth}px`);
document.body.style.overflow = "hidden";
}
if (isIOS) stopTouchMoveListener = useEventListener(document, "touchmove", (e) => preventDefault(e), { passive: false });
nextTick(() => {
if (!locked.value) return;
document.body.style.pointerEvents = "none";
document.body.style.overflow = "hidden";
});
}, {
immediate: true,
flush: "sync"
});
return map;
});
function useBodyScrollLock(initialState) {
const id = Math.random().toString(36).substring(2, 7);
const map = useBodyLockStackCount();
map.value.set(id, initialState ?? false);
const locked = computed({
get: () => map.value.get(id) ?? false,
set: (value) => map.value.set(id, value)
});
tryOnBeforeUnmount(() => {
map.value.delete(id);
});
return locked;
}
function checkOverflowScroll(ele) {
const style = window.getComputedStyle(ele);
if (style.overflowX === "scroll" || style.overflowY === "scroll" || style.overflowX === "auto" && ele.clientWidth < ele.scrollWidth || style.overflowY === "auto" && ele.clientHeight < ele.scrollHeight) return true;
else {
const parent = ele.parentNode;
if (!(parent instanceof Element) || parent.tagName === "BODY") return false;
return checkOverflowScroll(parent);
}
}
function preventDefault(rawEvent) {
const e = rawEvent || window.event;
const _target = e.target;
if (_target instanceof Element && checkOverflowScroll(_target)) return false;
if (e.touches.length > 1) return true;
if (e.preventDefault && e.cancelable) e.preventDefault();
return false;
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/reka-ui/dist/shared/useComposing.js
function useComposing(onEnd) {
const isComposing = ref(false);
function handleCompositionStart() {
isComposing.value = true;
}
function handleCompositionEnd(event) {
nextTick(() => {
isComposing.value = false;
onEnd?.(event);
});
}
return {
isComposing,
handleCompositionStart,
handleCompositionEnd
};
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@internationalized/date/dist/private/utils.mjs
function $09ec6a572d60460f$export$842a2cf37af977e1(amount, numerator) {
return amount - numerator * Math.floor(amount / numerator);
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.mjs
var $93635573935797de$var$EPOCH = 1721426;
function $93635573935797de$export$f297eb839006d339(era, year, month, day) {
year = $93635573935797de$export$c36e0ecb2d4fa69d(era, year);
let y1 = year - 1;
let monthOffset = -2;
if (month <= 2) monthOffset = 0;
else if ($93635573935797de$export$553d7fa8e3805fc0(year)) monthOffset = -1;
return $93635573935797de$var$EPOCH - 1 + 365 * y1 + Math.floor(y1 / 4) - Math.floor(y1 / 100) + Math.floor(y1 / 400) + Math.floor((367 * month - 362) / 12 + monthOffset + day);
}
function $93635573935797de$export$553d7fa8e3805fc0(year) {
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
}
function $93635573935797de$export$c36e0ecb2d4fa69d(era, year) {
return era === "BC" ? 1 - year : year;
}
function $93635573935797de$export$4475b7e617eb123c(year) {
let era = "AD";
if (year <= 0) {
era = "BC";
year = 1 - year;
}
return [era, year];
}
var $93635573935797de$var$daysInMonth = {
standard: [
31,
28,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
],
leapyear: [
31,
29,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31
]
};
var $93635573935797de$export$80ee6245ec4f29ec = class {
fromJulianDay(jd) {
let jd0 = jd;
let depoch = jd0 - $93635573935797de$var$EPOCH;
let quadricent = Math.floor(depoch / 146097);
let dqc = $09ec6a572d60460f$export$842a2cf37af977e1(depoch, 146097);
let cent = Math.floor(dqc / 36524);
let dcent = $09ec6a572d60460f$export$842a2cf37af977e1(dqc, 36524);
let quad = Math.floor(dcent / 1461);
let dquad = $09ec6a572d60460f$export$842a2cf37af977e1(dcent, 1461);
let yindex = Math.floor(dquad / 365);
let [era, year] = $93635573935797de$export$4475b7e617eb123c(quadricent * 400 + cent * 100 + quad * 4 + yindex + (cent !== 4 && yindex !== 4 ? 1 : 0));
let yearDay = jd0 - $93635573935797de$export$f297eb839006d339(era, year, 1, 1);
let leapAdj = 2;
if (jd0 < $93635573935797de$export$f297eb839006d339(era, year, 3, 1)) leapAdj = 0;
else if ($93635573935797de$export$553d7fa8e3805fc0(year)) leapAdj = 1;
let month = Math.floor(((yearDay + leapAdj) * 12 + 373) / 367);
return new $2aaf608024c21ca1$export$99faa760c7908e4f(era, year, month, jd0 - $93635573935797de$export$f297eb839006d339(era, year, month, 1) + 1);
}
toJulianDay(date) {
return $93635573935797de$export$f297eb839006d339(date.era, date.year, date.month, date.day);
}
getDaysInMonth(date) {
return $93635573935797de$var$daysInMonth[$93635573935797de$export$553d7fa8e3805fc0(date.year) ? "leapyear" : "standard"][date.month - 1];
}
getMonthsInYear(date) {
return 12;
}
getDaysInYear(date) {
return $93635573935797de$export$553d7fa8e3805fc0(date.year) ? 366 : 365;
}
getMaximumMonthsInYear() {
return 12;
}
getMaximumDaysInMonth() {
return 31;
}
getYearsInEra(date) {
return 9999;
}
getEras() {
return ["BC", "AD"];
}
isInverseEra(date) {
return date.era === "BC";
}
balanceDate(date) {
if (date.year <= 0) {
date.era = date.era === "BC" ? "AD" : "BC";
date.year = 1 - date.year;
}
}
constructor() {
this.identifier = "gregory";
}
};
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@internationalized/date/dist/private/weekStartData.mjs
var $d2ca8165c9aa885a$export$7a5acbd77d414bd9 = {
"001": 1,
AD: 1,
AE: 6,
AF: 6,
AI: 1,
AL: 1,
AM: 1,
AN: 1,
AR: 1,
AT: 1,
AU: 1,
AX: 1,
AZ: 1,
BA: 1,
BE: 1,
BG: 1,
BH: 6,
BM: 1,
BN: 1,
BY: 1,
CH: 1,
CL: 1,
CM: 1,
CN: 1,
CR: 1,
CY: 1,
CZ: 1,
DE: 1,
DJ: 6,
DK: 1,
DZ: 6,
EC: 1,
EE: 1,
EG: 6,
ES: 1,
FI: 1,
FJ: 1,
FO: 1,
FR: 1,
GB: 1,
GE: 1,
GF: 1,
GP: 1,
GR: 1,
HR: 1,
HU: 1,
IE: 1,
IQ: 6,
IR: 6,
IS: 1,
IT: 1,
JO: 6,
KG: 1,
KW: 6,
KZ: 1,
LB: 1,
LI: 1,
LK: 1,
LT: 1,
LU: 1,
LV: 1,
LY: 6,
MC: 1,
MD: 1,
ME: 1,
MK: 1,
MN: 1,
MQ: 1,
MV: 5,
MY: 1,
NL: 1,
NO: 1,
NZ: 1,
OM: 6,
PL: 1,
QA: 6,
RE: 1,
RO: 1,
RS: 1,
RU: 1,
SD: 6,
SE: 1,
SI: 1,
SK: 1,
SM: 1,
SY: 6,
TJ: 1,
TM: 1,
TR: 1,
UA: 1,
UY: 1,
UZ: 1,
VA: 1,
VN: 1,
XK: 1
};
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@internationalized/date/dist/private/queries.mjs
function $ad063034c8620db8$export$ea39ec197993aef0(a, b) {
b = $d07e34cce18680fd$export$b4a036af3fc0b032(b, a.calendar);
return a.era === b.era && a.year === b.year && a.month === b.month && a.day === b.day;
}
function $ad063034c8620db8$export$a18c89cbd24170ff(a, b) {
b = $d07e34cce18680fd$export$b4a036af3fc0b032(b, a.calendar);
a = $ad063034c8620db8$export$a5a3b454ada2268e(a);
b = $ad063034c8620db8$export$a5a3b454ada2268e(b);
return a.era === b.era && a.year === b.year && a.month === b.month;
}
function $ad063034c8620db8$export$91b62ebf2ba703ee(a, b) {
return $ad063034c8620db8$export$dbc69fd56b53d5e(a.calendar, b.calendar) && $ad063034c8620db8$export$ea39ec197993aef0(a, b);
}
function $ad063034c8620db8$export$5a8da0c44a3afdf2(a, b) {
return $ad063034c8620db8$export$dbc69fd56b53d5e(a.calendar, b.calendar) && $ad063034c8620db8$export$a18c89cbd24170ff(a, b);
}
function $ad063034c8620db8$export$dbc69fd56b53d5e(a, b) {
return a.isEqual?.(b) ?? b.isEqual?.(a) ?? a.identifier === b.identifier;
}
function $ad063034c8620db8$export$629b0a497aa65267(date, timeZone) {
return $ad063034c8620db8$export$ea39ec197993aef0(date, $ad063034c8620db8$export$d0bdf45af03a6ea3(timeZone));
}
var $ad063034c8620db8$var$DAY_MAP = {
sun: 0,
mon: 1,
tue: 2,
wed: 3,
thu: 4,
fri: 5,
sat: 6
};
function $ad063034c8620db8$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) {
let julian = date.calendar.toJulianDay(date);
let weekStart = firstDayOfWeek ? $ad063034c8620db8$var$DAY_MAP[firstDayOfWeek] : $ad063034c8620db8$var$getWeekStart(locale);
let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;
return dayOfWeek;
}
function $ad063034c8620db8$export$461939dd4422153(timeZone) {
return $d07e34cce18680fd$export$1b96692a1ba042ac(Date.now(), timeZone);
}
function $ad063034c8620db8$export$d0bdf45af03a6ea3(timeZone) {
return $d07e34cce18680fd$export$93522d1a439f3617($ad063034c8620db8$export$461939dd4422153(timeZone));
}
function $ad063034c8620db8$export$68781ddf31c0090f(a, b) {
return a.calendar.toJulianDay(a) - b.calendar.toJulianDay(b);
}
function $ad063034c8620db8$export$c19a80a9721b80f6(a, b) {
return $ad063034c8620db8$var$timeToMs(a) - $ad063034c8620db8$var$timeToMs(b);
}
function $ad063034c8620db8$var$timeToMs(a) {
return a.hour * 36e5 + a.minute * 6e4 + a.second * 1e3 + a.millisecond;
}
var $ad063034c8620db8$var$localTimeZone = null;
var $ad063034c8620db8$var$localTimeZoneOverride = false;
function $ad063034c8620db8$export$aa8b41735afcabd2() {
if ($ad063034c8620db8$var$localTimeZone == null) $ad063034c8620db8$var$localTimeZone = new Intl.DateTimeFormat().resolvedOptions().timeZone;
return $ad063034c8620db8$var$localTimeZone;
}
function $ad063034c8620db8$export$6ab69b273755230b() {
return $ad063034c8620db8$var$localTimeZoneOverride;
}
function $ad063034c8620db8$export$a5a3b454ada2268e(date) {
return date.subtract({ days: date.day - 1 });
}
function $ad063034c8620db8$export$a2258d9c4118825c(date) {
return date.add({ days: date.calendar.getDaysInMonth(date) - date.day });
}
function $ad063034c8620db8$export$f91e89d3d0406102(date) {
return $ad063034c8620db8$export$a5a3b454ada2268e(date.subtract({ months: date.month - 1 }));
}
function $ad063034c8620db8$export$8b7aa55c66d5569e(date) {
return $ad063034c8620db8$export$a2258d9c4118825c(date.add({ months: date.calendar.getMonthsInYear(date) - date.month }));
}
var $ad063034c8620db8$var$cachedRegions = /* @__PURE__ */ new Map();
var $ad063034c8620db8$var$cachedWeekInfo = /* @__PURE__ */ new Map();
function $ad063034c8620db8$var$getRegion(locale) {
if (Intl.Locale) {
let region = $ad063034c8620db8$var$cachedRegions.get(locale);
if (!region) {
region = new Intl.Locale(locale).maximize().region;
if (region) $ad063034c8620db8$var$cachedRegions.set(locale, region);
}
return region;
}
let part = locale.split("-")[1];
return part === "u" ? void 0 : part;
}
function $ad063034c8620db8$var$getWeekStart(locale) {
let weekInfo = $ad063034c8620db8$var$cachedWeekInfo.get(locale);
if (!weekInfo) {
if (Intl.Locale) {
let localeInst = new Intl.Locale(locale);
if ("getWeekInfo" in localeInst) {
weekInfo = localeInst.getWeekInfo();
if (weekInfo) {
$ad063034c8620db8$var$cachedWeekInfo.set(locale, weekInfo);
return weekInfo.firstDay;
}
}
}
let region = $ad063034c8620db8$var$getRegion(locale);
if (locale.includes("-fw-")) {
let day = locale.split("-fw-")[1].split("-")[0];
if (day === "mon") weekInfo = { firstDay: 1 };
else if (day === "tue") weekInfo = { firstDay: 2 };
else if (day === "wed") weekInfo = { firstDay: 3 };
else if (day === "thu") weekInfo = { firstDay: 4 };
else if (day === "fri") weekInfo = { firstDay: 5 };
else if (day === "sat") weekInfo = { firstDay: 6 };
else weekInfo = { firstDay: 0 };
} else if (locale.includes("-ca-iso8601")) weekInfo = { firstDay: 1 };
else weekInfo = { firstDay: region ? $d2ca8165c9aa885a$export$7a5acbd77d414bd9[region] || 0 : 0 };
$ad063034c8620db8$var$cachedWeekInfo.set(locale, weekInfo);
}
return weekInfo.firstDay;
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@internationalized/date/dist/private/conversion.mjs
function $d07e34cce18680fd$export$bd4fb2bc8bb06fb(date) {
date = $d07e34cce18680fd$export$b4a036af3fc0b032(date, new $93635573935797de$export$80ee6245ec4f29ec());
return $d07e34cce18680fd$var$epochFromParts($93635573935797de$export$c36e0ecb2d4fa69d(date.era, date.year), date.month, date.day, date.hour, date.minute, date.second, date.millisecond);
}
function $d07e34cce18680fd$var$epochFromParts(year, month, day, hour, minute, second, millisecond) {
let date = /* @__PURE__ */ new Date();
date.setUTCHours(hour, minute, second, millisecond);
date.setUTCFullYear(year, month - 1, day);
return date.getTime();
}
function $d07e34cce18680fd$export$59c99f3515d3493f(ms, timeZone) {
if (timeZone === "UTC") return 0;
if (ms > 0 && timeZone === $ad063034c8620db8$export$aa8b41735afcabd2() && !$ad063034c8620db8$export$6ab69b273755230b()) return new Date(ms).getTimezoneOffset() * -6e4;
let { year, month, day, hour, minute, second } = $d07e34cce18680fd$var$getTimeZoneParts(ms, timeZone);
return $d07e34cce18680fd$var$epochFromParts(year, month, day, hour, minute, second, 0) - Math.floor(ms / 1e3) * 1e3;
}
var $d07e34cce18680fd$var$formattersByTimeZone = /* @__PURE__ */ new Map();
function $d07e34cce18680fd$var$getTimeZoneParts(ms, timeZone) {
let formatter = $d07e34cce18680fd$var$formattersByTimeZone.get(timeZone);
if (!formatter) {
formatter = new Intl.DateTimeFormat("en-US", {
timeZone,
hour12: false,
era: "short",
year: "numeric",
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric"
});
$d07e34cce18680fd$var$formattersByTimeZone.set(timeZone, formatter);
}
let parts = formatter.formatToParts(new Date(ms));
let namedParts = {};
for (let part of parts) if (part.type !== "literal") namedParts[part.type] = part.value;
return {
year: namedParts.era === "BC" || namedParts.era === "B" ? -namedParts.year + 1 : +namedParts.year,
month: +namedParts.month,
day: +namedParts.day,
hour: namedParts.hour === "24" ? 0 : +namedParts.hour,
minute: +namedParts.minute,
second: +namedParts.second
};
}
var $d07e34cce18680fd$var$DAYMILLIS = 864e5;
function $d07e34cce18680fd$var$getValidWallTimes(date, timeZone, earlier, later) {
return (earlier === later ? [earlier] : [earlier, later]).filter((absolute) => $d07e34cce18680fd$var$isValidWallTime(date, timeZone, absolute));
}
function $d07e34cce18680fd$var$isValidWallTime(date, timeZone, absolute) {
let parts = $d07e34cce18680fd$var$getTimeZoneParts(absolute, timeZone);
return date.year === parts.year && date.month === parts.month && date.day === parts.day && date.hour === parts.hour && date.minute === parts.minute && date.second === parts.second;
}
function $d07e34cce18680fd$export$5107c82f94518f5c(date, timeZone, disambiguation = "compatible") {
let dateTime = $d07e34cce18680fd$export$b21e0b124e224484(date);
if (timeZone === "UTC") return $d07e34cce18680fd$export$bd4fb2bc8bb06fb(dateTime);
if (timeZone === $ad063034c8620db8$export$aa8b41735afcabd2() && disambiguation === "compatible" && !$ad063034c8620db8$export$6ab69b273755230b()) {
dateTime = $d07e34cce18680fd$export$b4a036af3fc0b032(dateTime, new $93635573935797de$export$80ee6245ec4f29ec());
let date = /* @__PURE__ */ new Date();
let year = $93635573935797de$export$c36e0ecb2d4fa69d(dateTime.era, dateTime.year);
date.setFullYear(year, dateTime.month - 1, dateTime.day);
date.setHours(dateTime.hour, dateTime.minute, dateTime.second, dateTime.millisecond);
return date.getTime();
}
let ms = $d07e34cce18680fd$export$bd4fb2bc8bb06fb(dateTime);
let offsetBefore = $d07e34cce18680fd$export$59c99f3515d3493f(ms - $d07e34cce18680fd$var$DAYMILLIS, timeZone);
let offsetAfter = $d07e34cce18680fd$export$59c99f3515d3493f(ms + $d07e34cce18680fd$var$DAYMILLIS, timeZone);
let valid = $d07e34cce18680fd$var$getValidWallTimes(dateTime, timeZone, ms - offsetBefore, ms - offsetAfter);
if (valid.length === 1) return valid[0];
if (valid.length > 1) switch (disambiguation) {
case "compatible":
case "earlier": return valid[0];
case "later": return valid[valid.length - 1];
case "reject": throw new RangeError("Multiple possible absolute times found");
}
switch (disambiguation) {
case "earlier": return Math.min(ms - offsetBefore, ms - offsetAfter);
case "compatible":
case "later": return Math.max(ms - offsetBefore, ms - offsetAfter);
case "reject": throw new RangeError("No such absolute time found");
}
}
function $d07e34cce18680fd$export$e67a095c620b86fe(dateTime, timeZone, disambiguation = "compatible") {
return new Date($d07e34cce18680fd$export$5107c82f94518f5c(dateTime, timeZone, disambiguation));
}
function $d07e34cce18680fd$export$1b96692a1ba042ac(ms, timeZone) {
let offset = $d07e34cce18680fd$export$59c99f3515d3493f(ms, timeZone);
let date = new Date(ms + offset);
let year = date.getUTCFullYear();
let month = date.getUTCMonth() + 1;
let day = date.getUTCDate();
let hour = date.getUTCHours();
let minute = date.getUTCMinutes();
let second = date.getUTCSeconds();
let millisecond = date.getUTCMilliseconds();
return new $2aaf608024c21ca1$export$d3b7288e7994edea(year < 1 ? "BC" : "AD", year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond);
}
function $d07e34cce18680fd$export$93522d1a439f3617(dateTime) {
return new $2aaf608024c21ca1$export$99faa760c7908e4f(dateTime.calendar, dateTime.era, dateTime.year, dateTime.month, dateTime.day);
}
function $d07e34cce18680fd$export$b21e0b124e224484(date, time) {
let hour = 0, minute = 0, second = 0, millisecond = 0;
if ("timeZone" in date) ({hour: hour, minute: minute, second: second, millisecond: millisecond} = date);
else if ("hour" in date && !time) return date;
if (time) ({hour: hour, minute: minute, second: second, millisecond: millisecond} = time);
return new $2aaf608024c21ca1$export$ca871e8dbb80966f(date.calendar, date.era, date.year, date.month, date.day, hour, minute, second, millisecond);
}
function $d07e34cce18680fd$export$b4a036af3fc0b032(date, calendar) {
if ($ad063034c8620db8$export$dbc69fd56b53d5e(date.calendar, calendar)) return date;
let calendarDate = calendar.fromJulianDay(date.calendar.toJulianDay(date));
let copy = date.copy();
copy.calendar = calendar;
copy.era = calendarDate.era;
copy.year = calendarDate.year;
copy.month = calendarDate.month;
copy.day = calendarDate.day;
$435a2ceaa8778ed8$export$c4e2ecac49351ef2(copy);
return copy;
}
function $d07e34cce18680fd$export$84c95a83c799e074(date, timeZone, disambiguation) {
if (date instanceof $2aaf608024c21ca1$export$d3b7288e7994edea) {
if (date.timeZone === timeZone) return date;
return $d07e34cce18680fd$export$538b00033cc11c75(date, timeZone);
}
return $d07e34cce18680fd$export$1b96692a1ba042ac($d07e34cce18680fd$export$5107c82f94518f5c(date, timeZone, disambiguation), timeZone);
}
function $d07e34cce18680fd$export$83aac07b4c37b25(date) {
let ms = $d07e34cce18680fd$export$bd4fb2bc8bb06fb(date) - date.offset;
return new Date(ms);
}
function $d07e34cce18680fd$export$538b00033cc11c75(date, timeZone) {
return $d07e34cce18680fd$export$b4a036af3fc0b032($d07e34cce18680fd$export$1b96692a1ba042ac($d07e34cce18680fd$export$bd4fb2bc8bb06fb(date) - date.offset, timeZone), date.calendar);
}
//#endregion
//#region ../../home/cosmin/Work/maizzle/framework/node_modules/@internationalized/date/dist/private/manipulation.mjs
var $435a2ceaa8778ed8$var$ONE_HOUR = 36e5;
function $435a2ceaa8778ed8$export$e16d8520af44a096(date, duration) {
let mutableDate = date.copy();
let days = "hour" in mutableDate ? $435a2ceaa8778ed8$var$addTimeFields(mutableDate, duration) : 0;
$435a2ceaa8778ed8$var$addYears(mutableDate, duration.years || 0);
if (mutableDate.calendar.balanceYearMonth) mutableDate.calendar.balanceYearMonth(mutableDate, date);
mutableDate.month += duration.months || 0;
$435a2ceaa8778ed8$var$balanceYearMonth(mutableDate);
$435a2ceaa8778ed8$var$constrainMonthDay(mutableDate);
mutableDate.day += (duration.weeks || 0) * 7;
mutableDate.day += duration.days || 0;
mutableDate.day += days;
$435a2ceaa8778ed8$var$balanceDay(mutableDate);
if (mutableDate.calendar.balanceDate) mutableDate.calendar.balanceDate(mutableDate);
if (mutableDate.year < 1) {
mutableDate.year = 1;
mutableDate.month = 1;
mutableDate.day = 1;
}
let maxYear = mutableDate.calendar.getYearsInEra(mutableDate);
if (mutableDate.year > maxYear) {
let isInverseEra = mutableDate.calendar.isInverseEra?.(mutableDate);
mutableDate.year = maxYear;
mutableDate.month = isInverseEra ? 1 : mutableDate.calendar.getMonthsInYear(mutableDate);
mutableDate.day = isInverseEra ? 1 : mutableDate.calendar.getDaysInMonth(mutableDate);
}
if (mutableDate.month < 1) {
mutableDate.month = 1;
mutableDate.day = 1;
}
let maxMonth = mutableDate.calendar.getMonthsInYear(mutableDate);
if (mutableDate.month > maxMonth) {
mutableDate.month = maxMonth;
mutableDate.day = mutableDate.calendar.getDaysInMonth(mutableDate);
}
mutableDate.day = Math.max(1, Math.min(mutableDate.calendar.getDaysInMonth(mutableDate), mutableDate.day));
return mutableDate;
}
function $435a2ceaa8778ed8$var$addYears(date, years) {
if (date.calendar.isInverseEra?.(date)) years = -years;
date.year += years;
}
function $435a2ceaa8778ed8$var$balanceYearMonth(date) {
while (date.month < 1) {
$435a2ceaa8778ed8$var$addYears(date, -1);
date.month += date.calendar.getMonthsInYear(date);
}
let monthsInYear = 0;
while (date.month > (monthsInYear = date.calendar.getMonthsInYear(date))) {
date.month -= monthsInYear;
$435a2ceaa8778ed8$var$addYears(date, 1);
}
}
function $435a2ceaa8778ed8$var$balanceDay(date) {
while (date.day < 1) {
date.month--;
$435a2ceaa8778ed8$var$balanceYearMonth(date);
date.day += date.calendar.getDaysInMonth(date);
}
while (date.day > date.calendar.getDaysInMonth(date)) {
date.day -= date.calendar.getDaysInMonth(date);
date.month++;
$435a2ceaa8778ed8$var$balanceYearMonth(date);
}
}
function $435a2ceaa8778ed8$var$constrainMonthDay(date) {
date.month = Math.max(1, Math.min(date.calendar.getMonthsInYear(date), date.month));
date.day = Math.max(1, Math.min(date.calendar.getDaysInMonth(date), date.day));
}
function $435a2ceaa8778ed8$export$c4e2ecac49351ef2(date) {
if (date.calendar.constrainDate) date.calendar.constrainDate(date);
date.year = Math.max(1, Math.min(date.calendar.getYearsInEra(date), date.year));
$435a2ceaa8778ed8$var$constrainMonthDay(date);
}
function $435a2ceaa8778ed8$export$3e2544e88a25bff8(duration) {
let inverseDuration = {};
for (let key in duration) if (typeof duration[key] === "number") inverseDuration[key] = -duration[key];
return inverseDuration;
}
function $435a2ceaa8778ed8$export$4e2d2ead65e5f7e3(date, duration) {
return $435a2ceaa8778ed8$export$e16d8520af44a096(date, $435a2ceaa8778ed8$export$3e2544e88a25bff8(duration));
}
function $435a2ceaa8778ed8$export$adaa4cf7ef1b65be(date, fields) {
let mutableDate = date.copy();
if (fields.era != null) mutableDate.era = fields.era;
if (fields.year != null) mutableDate.year = fields.year;
if (fields.month != null) mutableDate.month = fields.month;
if (fields.day != null) mutableDate.day = fields.day;
$435a2ceaa8778ed8$export$c4e2ecac49351ef2(mutableDate);
return mutableDate;
}
function $435a2ceaa8778ed8$export$e5d5e1c1822b6e56(value, fields) {
let mutableValue = value.copy();
if (fields.hour != null) mutableValue.hour = fields.hour;
if (fields.minute != null) mutableValue.minute = fields.minute;
if (fields.second != null) mutableValue.second = fields.second;
if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
$435a2ceaa8778ed8$export$7555de1e070510cb(mutableValue);
return mutableValue;
}
function $435a2ceaa8778ed8$var$balanceTime(time) {
time.second += Math.floor(time.millisecond / 1e3);
time.millisecond = $435a2ceaa8778ed8$var$nonNegativeMod(time.millisecond, 1e3);
time.minute += Math.floor(time.second / 60);
time.second = $435a2ceaa8778ed8$var$nonNegativeMod(time.second, 60);
time.hour += Math.floor(time.minute / 60);
time.minute = $435a2ceaa8778ed8$var$nonNegativeMod(time.minute, 60);
let days = Math.floor(time.hour / 24);
time.hour = $435a2ceaa8778ed8$var$nonNegativeMod(time.hour, 24);
return days;
}
function $435a2ceaa8778ed8$export$7555de1e070510cb(time) {
time.millisecond = Math.max(0, Math.min(time.millisecond, 1e3));
time.second = Math.max(0, Math.min(time.second, 59));
time.minute = Math.max(0, Math.min(time.minute, 59));
time.hour = Math.max(0, Math.min(time.hour, 23));
}
function $435a2ceaa8778ed8$var$nonNegativeMod(a, b) {
let result = a % b;
if (result < 0) result += b;
return result;
}
function $435a2ceaa8778ed8$var$addTimeFields(time, duration) {
time.hour += duration.hours || 0;
time.minute += duration.minutes || 0;
time.second += duration.seconds || 0;
time.millisecond += duration.milliseconds || 0;
return $435a2ceaa8778ed8$var$balanceTime(time);
}
function $435a2ceaa8778ed8$export$7ed87b6bc2506470(time, duration) {
let res = time.copy();
$435a2ceaa8778ed8$var$addTimeFields(res, duration);
return res;
}
function $435a2ceaa8778ed8$export$fe34d3a381cd7501(time, duration) {
return $435a2ceaa8778ed8$export$7ed87b6bc2506470(time, $435a2ceaa8778ed8$export$3e2544e88a25bff8(duration));
}
function $435a2ceaa8778ed8$export$d52ced6badfb9a4c(value, field, amount, options) {
let mutable = value.copy();
switch (field) {
case "era": {
let eras = value.calendar.getEras();
let eraIndex = eras.indexOf(value.era);
if (eraIndex < 0) throw new Error("Invalid era: " + value.era);
eraIndex = $435a2ceaa8778ed8$var$cycleValue(eraIndex, amount, 0, eras.length - 1, options?.round);
mutable.era = eras[eraIndex];
$435a2ceaa8778ed8$export$c4e2ecac49351ef2(mutable);
break;
}
case "year":
if (mutable.calendar.isInverseEra?.(mutable)) amount = -amount;
mutable.year = $435a2ceaa8778ed8$var$cycleValue(value.year, amount, -Infinity, 9999, options?.round);
if (mutable.year === -Infinity) mutable.year = 1;
if (mutable.calendar.balanceYearMonth) mutable.calendar.balanceYearMonth(mutable, value);
break;
case "month":
mutable.month = $435a2ceaa8778ed8$var$cycleValue(value.month, amount, 1, value.calendar.getMonthsInYear(value), options?.round);
break;
case "day":
mutable.day = $435a2ceaa8778ed8$var$cycleValue(value.day, amount, 1, value.calendar.getDaysInMonth(value), options?.round);
break;
default: throw new Error("Unsupported field " + field);
}
if (value.calendar.balanceDate) value.calendar.balanceDate(mutable);
$435a2ceaa8778ed8$export$c4e2ecac49351ef2(mutable);
return mutable;
}
function $435a2ceaa8778ed8$export$dd02b3e0007dfe28(value, field, amount, options) {
let mutable = value.copy();
switch (field) {
case "hour": {
let hours = value.hour;
let min = 0;
let max = 23;
if (options?.hourCycle === 12) {
let isPM = hours >= 12;
min = isPM ? 12 : 0;
max = isPM ? 23 : 11;
}
mutable.hour = $435a2ceaa8778ed8$var$cycleValue(hours, amount, min, max, options?.round);
break;
}
case "minute":
mutable.minute = $435a2ceaa8778ed8$var$cycleValue(value.minute, amount, 0, 59, options?.round);
break;
case "second":
mutable.second = $435a2ceaa8778ed8$var$cycleValue(value.second, amount, 0, 59, options?.round);
break;
case "millisecond":
mutable.millisecond = $435a2ceaa8778ed8$var$cycleValue(value.millisecond, amount, 0, 999, options?.round);
break;
default: throw new Error("Unsupported field " + field);
}
re