@toast-ui/calendar
Version:
TOAST UI Calendar
1,450 lines • 379 kB
JavaScript
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a2, b2) => {
for (var prop in b2 || (b2 = {}))
if (__hasOwnProp.call(b2, prop))
__defNormalProp(a2, prop, b2[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b2)) {
if (__propIsEnum.call(b2, prop))
__defNormalProp(a2, prop, b2[prop]);
}
return a2;
};
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
/*!
* TOAST UI Calendar 2nd Edition
* @version 2.1.3 | Tue Aug 16 2022
* @author NHN Cloud FE Development Lab <dl_javascript@nhn.com>
* @license MIT
*/
import DatePicker from "tui-date-picker";
var n$2, l$3, u$3, t$2, o$3, r$3, f$3 = {}, e$1 = [], c$3 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
function s$3(n2, l2) {
for (var u2 in l2)
n2[u2] = l2[u2];
return n2;
}
function a$3(n2) {
var l2 = n2.parentNode;
l2 && l2.removeChild(n2);
}
function h$3(l2, u2, i2) {
var t2, o2, r2, f2 = {};
for (r2 in u2)
r2 == "key" ? t2 = u2[r2] : r2 == "ref" ? o2 = u2[r2] : f2[r2] = u2[r2];
if (arguments.length > 2 && (f2.children = arguments.length > 3 ? n$2.call(arguments, 2) : i2), typeof l2 == "function" && l2.defaultProps != null)
for (r2 in l2.defaultProps)
f2[r2] === void 0 && (f2[r2] = l2.defaultProps[r2]);
return v$3(l2, f2, t2, o2, null);
}
function v$3(n2, i2, t2, o2, r2) {
var f2 = { type: n2, props: i2, key: t2, ref: o2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, __h: null, constructor: void 0, __v: r2 == null ? ++u$3 : r2 };
return r2 == null && l$3.vnode != null && l$3.vnode(f2), f2;
}
function p$3(n2) {
return n2.children;
}
function d$3(n2, l2) {
this.props = n2, this.context = l2;
}
function _$3(n2, l2) {
if (l2 == null)
return n2.__ ? _$3(n2.__, n2.__.__k.indexOf(n2) + 1) : null;
for (var u2; l2 < n2.__k.length; l2++)
if ((u2 = n2.__k[l2]) != null && u2.__e != null)
return u2.__e;
return typeof n2.type == "function" ? _$3(n2) : null;
}
function k$2(n2) {
var l2, u2;
if ((n2 = n2.__) != null && n2.__c != null) {
for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++)
if ((u2 = n2.__k[l2]) != null && u2.__e != null) {
n2.__e = n2.__c.base = u2.__e;
break;
}
return k$2(n2);
}
}
function b$2(n2) {
(!n2.__d && (n2.__d = true) && t$2.push(n2) && !g$4.__r++ || o$3 !== l$3.debounceRendering) && ((o$3 = l$3.debounceRendering) || setTimeout)(g$4);
}
function g$4() {
for (var n2; g$4.__r = t$2.length; )
n2 = t$2.sort(function(n3, l2) {
return n3.__v.__b - l2.__v.__b;
}), t$2 = [], n2.some(function(n3) {
var l2, u2, i2, t2, o2, r2;
n3.__d && (o2 = (t2 = (l2 = n3).__v).__e, (r2 = l2.__P) && (u2 = [], (i2 = s$3({}, t2)).__v = t2.__v + 1, j$3(r2, t2, i2, l2.__n, r2.ownerSVGElement !== void 0, t2.__h != null ? [o2] : null, u2, o2 == null ? _$3(t2) : o2, t2.__h), z$2(u2, t2), t2.__e != o2 && k$2(t2)));
});
}
function w$3(n2, l2, u2, i2, t2, o2, r2, c2, s2, a2) {
var h2, y2, d2, k2, b2, g2, w2, x2 = i2 && i2.__k || e$1, C2 = x2.length;
for (u2.__k = [], h2 = 0; h2 < l2.length; h2++)
if ((k2 = u2.__k[h2] = (k2 = l2[h2]) == null || typeof k2 == "boolean" ? null : typeof k2 == "string" || typeof k2 == "number" || typeof k2 == "bigint" ? v$3(null, k2, null, null, k2) : Array.isArray(k2) ? v$3(p$3, { children: k2 }, null, null, null) : k2.__b > 0 ? v$3(k2.type, k2.props, k2.key, null, k2.__v) : k2) != null) {
if (k2.__ = u2, k2.__b = u2.__b + 1, (d2 = x2[h2]) === null || d2 && k2.key == d2.key && k2.type === d2.type)
x2[h2] = void 0;
else
for (y2 = 0; y2 < C2; y2++) {
if ((d2 = x2[y2]) && k2.key == d2.key && k2.type === d2.type) {
x2[y2] = void 0;
break;
}
d2 = null;
}
j$3(n2, k2, d2 = d2 || f$3, t2, o2, r2, c2, s2, a2), b2 = k2.__e, (y2 = k2.ref) && d2.ref != y2 && (w2 || (w2 = []), d2.ref && w2.push(d2.ref, null, k2), w2.push(y2, k2.__c || b2, k2)), b2 != null ? (g2 == null && (g2 = b2), typeof k2.type == "function" && k2.__k === d2.__k ? k2.__d = s2 = m$2(k2, s2, n2) : s2 = A$2(n2, k2, d2, x2, b2, s2), typeof u2.type == "function" && (u2.__d = s2)) : s2 && d2.__e == s2 && s2.parentNode != n2 && (s2 = _$3(d2));
}
for (u2.__e = g2, h2 = C2; h2--; )
x2[h2] != null && (typeof u2.type == "function" && x2[h2].__e != null && x2[h2].__e == u2.__d && (u2.__d = _$3(i2, h2 + 1)), N(x2[h2], x2[h2]));
if (w2)
for (h2 = 0; h2 < w2.length; h2++)
M$2(w2[h2], w2[++h2], w2[++h2]);
}
function m$2(n2, l2, u2) {
for (var i2, t2 = n2.__k, o2 = 0; t2 && o2 < t2.length; o2++)
(i2 = t2[o2]) && (i2.__ = n2, l2 = typeof i2.type == "function" ? m$2(i2, l2, u2) : A$2(u2, i2, i2, t2, i2.__e, l2));
return l2;
}
function x$3(n2, l2) {
return l2 = l2 || [], n2 == null || typeof n2 == "boolean" || (Array.isArray(n2) ? n2.some(function(n3) {
x$3(n3, l2);
}) : l2.push(n2)), l2;
}
function A$2(n2, l2, u2, i2, t2, o2) {
var r2, f2, e2;
if (l2.__d !== void 0)
r2 = l2.__d, l2.__d = void 0;
else if (u2 == null || t2 != o2 || t2.parentNode == null)
n:
if (o2 == null || o2.parentNode !== n2)
n2.appendChild(t2), r2 = null;
else {
for (f2 = o2, e2 = 0; (f2 = f2.nextSibling) && e2 < i2.length; e2 += 2)
if (f2 == t2)
break n;
n2.insertBefore(t2, o2), r2 = o2;
}
return r2 !== void 0 ? r2 : t2.nextSibling;
}
function C$1(n2, l2, u2, i2, t2) {
var o2;
for (o2 in u2)
o2 === "children" || o2 === "key" || o2 in l2 || H$2(n2, o2, null, u2[o2], i2);
for (o2 in l2)
t2 && typeof l2[o2] != "function" || o2 === "children" || o2 === "key" || o2 === "value" || o2 === "checked" || u2[o2] === l2[o2] || H$2(n2, o2, l2[o2], u2[o2], i2);
}
function $$1(n2, l2, u2) {
l2[0] === "-" ? n2.setProperty(l2, u2) : n2[l2] = u2 == null ? "" : typeof u2 != "number" || c$3.test(l2) ? u2 : u2 + "px";
}
function H$2(n2, l2, u2, i2, t2) {
var o2;
n:
if (l2 === "style")
if (typeof u2 == "string")
n2.style.cssText = u2;
else {
if (typeof i2 == "string" && (n2.style.cssText = i2 = ""), i2)
for (l2 in i2)
u2 && l2 in u2 || $$1(n2.style, l2, "");
if (u2)
for (l2 in u2)
i2 && u2[l2] === i2[l2] || $$1(n2.style, l2, u2[l2]);
}
else if (l2[0] === "o" && l2[1] === "n")
o2 = l2 !== (l2 = l2.replace(/Capture$/, "")), l2 = l2.toLowerCase() in n2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + o2] = u2, u2 ? i2 || n2.addEventListener(l2, o2 ? T$2 : I$2, o2) : n2.removeEventListener(l2, o2 ? T$2 : I$2, o2);
else if (l2 !== "dangerouslySetInnerHTML") {
if (t2)
l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
else if (l2 !== "href" && l2 !== "list" && l2 !== "form" && l2 !== "tabIndex" && l2 !== "download" && l2 in n2)
try {
n2[l2] = u2 == null ? "" : u2;
break n;
} catch (n3) {
}
typeof u2 == "function" || (u2 != null && (u2 !== false || l2[0] === "a" && l2[1] === "r") ? n2.setAttribute(l2, u2) : n2.removeAttribute(l2));
}
}
function I$2(n2) {
this.l[n2.type + false](l$3.event ? l$3.event(n2) : n2);
}
function T$2(n2) {
this.l[n2.type + true](l$3.event ? l$3.event(n2) : n2);
}
function j$3(n2, u2, i2, t2, o2, r2, f2, e2, c2) {
var a2, h2, v2, y2, _2, k2, b2, g2, m2, x2, A2, C2, $2, H2 = u2.type;
if (u2.constructor !== void 0)
return null;
i2.__h != null && (c2 = i2.__h, e2 = u2.__e = i2.__e, u2.__h = null, r2 = [e2]), (a2 = l$3.__b) && a2(u2);
try {
n:
if (typeof H2 == "function") {
if (g2 = u2.props, m2 = (a2 = H2.contextType) && t2[a2.__c], x2 = a2 ? m2 ? m2.props.value : a2.__ : t2, i2.__c ? b2 = (h2 = u2.__c = i2.__c).__ = h2.__E : ("prototype" in H2 && H2.prototype.render ? u2.__c = h2 = new H2(g2, x2) : (u2.__c = h2 = new d$3(g2, x2), h2.constructor = H2, h2.render = O$2), m2 && m2.sub(h2), h2.props = g2, h2.state || (h2.state = {}), h2.context = x2, h2.__n = t2, v2 = h2.__d = true, h2.__h = []), h2.__s == null && (h2.__s = h2.state), H2.getDerivedStateFromProps != null && (h2.__s == h2.state && (h2.__s = s$3({}, h2.__s)), s$3(h2.__s, H2.getDerivedStateFromProps(g2, h2.__s))), y2 = h2.props, _2 = h2.state, v2)
H2.getDerivedStateFromProps == null && h2.componentWillMount != null && h2.componentWillMount(), h2.componentDidMount != null && h2.__h.push(h2.componentDidMount);
else {
if (H2.getDerivedStateFromProps == null && g2 !== y2 && h2.componentWillReceiveProps != null && h2.componentWillReceiveProps(g2, x2), !h2.__e && h2.shouldComponentUpdate != null && h2.shouldComponentUpdate(g2, h2.__s, x2) === false || u2.__v === i2.__v) {
h2.props = g2, h2.state = h2.__s, u2.__v !== i2.__v && (h2.__d = false), h2.__v = u2, u2.__e = i2.__e, u2.__k = i2.__k, u2.__k.forEach(function(n3) {
n3 && (n3.__ = u2);
}), h2.__h.length && f2.push(h2);
break n;
}
h2.componentWillUpdate != null && h2.componentWillUpdate(g2, h2.__s, x2), h2.componentDidUpdate != null && h2.__h.push(function() {
h2.componentDidUpdate(y2, _2, k2);
});
}
if (h2.context = x2, h2.props = g2, h2.__v = u2, h2.__P = n2, A2 = l$3.__r, C2 = 0, "prototype" in H2 && H2.prototype.render)
h2.state = h2.__s, h2.__d = false, A2 && A2(u2), a2 = h2.render(h2.props, h2.state, h2.context);
else
do {
h2.__d = false, A2 && A2(u2), a2 = h2.render(h2.props, h2.state, h2.context), h2.state = h2.__s;
} while (h2.__d && ++C2 < 25);
h2.state = h2.__s, h2.getChildContext != null && (t2 = s$3(s$3({}, t2), h2.getChildContext())), v2 || h2.getSnapshotBeforeUpdate == null || (k2 = h2.getSnapshotBeforeUpdate(y2, _2)), $2 = a2 != null && a2.type === p$3 && a2.key == null ? a2.props.children : a2, w$3(n2, Array.isArray($2) ? $2 : [$2], u2, i2, t2, o2, r2, f2, e2, c2), h2.base = u2.__e, u2.__h = null, h2.__h.length && f2.push(h2), b2 && (h2.__E = h2.__ = null), h2.__e = false;
} else
r2 == null && u2.__v === i2.__v ? (u2.__k = i2.__k, u2.__e = i2.__e) : u2.__e = L$2(i2.__e, u2, i2, t2, o2, r2, f2, c2);
(a2 = l$3.diffed) && a2(u2);
} catch (n3) {
u2.__v = null, (c2 || r2 != null) && (u2.__e = e2, u2.__h = !!c2, r2[r2.indexOf(e2)] = null), l$3.__e(n3, u2, i2);
}
}
function z$2(n2, u2) {
l$3.__c && l$3.__c(u2, n2), n2.some(function(u3) {
try {
n2 = u3.__h, u3.__h = [], n2.some(function(n3) {
n3.call(u3);
});
} catch (n3) {
l$3.__e(n3, u3.__v);
}
});
}
function L$2(l2, u2, i2, t2, o2, r2, e2, c2) {
var s2, h2, v2, y2 = i2.props, p2 = u2.props, d2 = u2.type, k2 = 0;
if (d2 === "svg" && (o2 = true), r2 != null) {
for (; k2 < r2.length; k2++)
if ((s2 = r2[k2]) && "setAttribute" in s2 == !!d2 && (d2 ? s2.localName === d2 : s2.nodeType === 3)) {
l2 = s2, r2[k2] = null;
break;
}
}
if (l2 == null) {
if (d2 === null)
return document.createTextNode(p2);
l2 = o2 ? document.createElementNS("http://www.w3.org/2000/svg", d2) : document.createElement(d2, p2.is && p2), r2 = null, c2 = false;
}
if (d2 === null)
y2 === p2 || c2 && l2.data === p2 || (l2.data = p2);
else {
if (r2 = r2 && n$2.call(l2.childNodes), h2 = (y2 = i2.props || f$3).dangerouslySetInnerHTML, v2 = p2.dangerouslySetInnerHTML, !c2) {
if (r2 != null)
for (y2 = {}, k2 = 0; k2 < l2.attributes.length; k2++)
y2[l2.attributes[k2].name] = l2.attributes[k2].value;
(v2 || h2) && (v2 && (h2 && v2.__html == h2.__html || v2.__html === l2.innerHTML) || (l2.innerHTML = v2 && v2.__html || ""));
}
if (C$1(l2, p2, y2, o2, c2), v2)
u2.__k = [];
else if (k2 = u2.props.children, w$3(l2, Array.isArray(k2) ? k2 : [k2], u2, i2, t2, o2 && d2 !== "foreignObject", r2, e2, r2 ? r2[0] : i2.__k && _$3(i2, 0), c2), r2 != null)
for (k2 = r2.length; k2--; )
r2[k2] != null && a$3(r2[k2]);
c2 || ("value" in p2 && (k2 = p2.value) !== void 0 && (k2 !== l2.value || d2 === "progress" && !k2 || d2 === "option" && k2 !== y2.value) && H$2(l2, "value", k2, y2.value, false), "checked" in p2 && (k2 = p2.checked) !== void 0 && k2 !== l2.checked && H$2(l2, "checked", k2, y2.checked, false));
}
return l2;
}
function M$2(n2, u2, i2) {
try {
typeof n2 == "function" ? n2(u2) : n2.current = u2;
} catch (n3) {
l$3.__e(n3, i2);
}
}
function N(n2, u2, i2) {
var t2, o2;
if (l$3.unmount && l$3.unmount(n2), (t2 = n2.ref) && (t2.current && t2.current !== n2.__e || M$2(t2, null, u2)), (t2 = n2.__c) != null) {
if (t2.componentWillUnmount)
try {
t2.componentWillUnmount();
} catch (n3) {
l$3.__e(n3, u2);
}
t2.base = t2.__P = null;
}
if (t2 = n2.__k)
for (o2 = 0; o2 < t2.length; o2++)
t2[o2] && N(t2[o2], u2, typeof n2.type != "function");
i2 || n2.__e == null || a$3(n2.__e), n2.__e = n2.__d = void 0;
}
function O$2(n2, l2, u2) {
return this.constructor(n2, u2);
}
function P$2(u2, i2, t2) {
var o2, r2, e2;
l$3.__ && l$3.__(u2, i2), r2 = (o2 = typeof t2 == "function") ? null : t2 && t2.__k || i2.__k, e2 = [], j$3(i2, u2 = (!o2 && t2 || i2).__k = h$3(p$3, null, [u2]), r2 || f$3, f$3, i2.ownerSVGElement !== void 0, !o2 && t2 ? [t2] : r2 ? null : i2.firstChild ? n$2.call(i2.childNodes) : null, e2, !o2 && t2 ? t2 : r2 ? r2.__e : i2.firstChild, o2), z$2(e2, u2);
}
function q$3(l2, u2, i2) {
var t2, o2, r2, f2 = s$3({}, l2.props);
for (r2 in u2)
r2 == "key" ? t2 = u2[r2] : r2 == "ref" ? o2 = u2[r2] : f2[r2] = u2[r2];
return arguments.length > 2 && (f2.children = arguments.length > 3 ? n$2.call(arguments, 2) : i2), v$3(l2.type, f2, t2 || l2.key, o2 || l2.ref, null);
}
function B$1(n2, l2) {
var u2 = { __c: l2 = "__cC" + r$3++, __: n2, Consumer: function(n3, l3) {
return n3.children(l3);
}, Provider: function(n3) {
var u3, i2;
return this.getChildContext || (u3 = [], (i2 = {})[l2] = this, this.getChildContext = function() {
return i2;
}, this.shouldComponentUpdate = function(n4) {
this.props.value !== n4.value && u3.some(b$2);
}, this.sub = function(n4) {
u3.push(n4);
var l3 = n4.componentWillUnmount;
n4.componentWillUnmount = function() {
u3.splice(u3.indexOf(n4), 1), l3 && l3.call(n4);
};
}), n3.children;
} };
return u2.Provider.__ = u2.Consumer.contextType = u2;
}
n$2 = e$1.slice, l$3 = { __e: function(n2, l2, u2, i2) {
for (var t2, o2, r2; l2 = l2.__; )
if ((t2 = l2.__c) && !t2.__)
try {
if ((o2 = t2.constructor) && o2.getDerivedStateFromError != null && (t2.setState(o2.getDerivedStateFromError(n2)), r2 = t2.__d), t2.componentDidCatch != null && (t2.componentDidCatch(n2, i2 || {}), r2 = t2.__d), r2)
return t2.__E = t2;
} catch (l3) {
n2 = l3;
}
throw n2;
} }, u$3 = 0, d$3.prototype.setState = function(n2, l2) {
var u2;
u2 = this.__s != null && this.__s !== this.state ? this.__s : this.__s = s$3({}, this.state), typeof n2 == "function" && (n2 = n2(s$3({}, u2), this.props)), n2 && s$3(u2, n2), n2 != null && this.__v && (l2 && this.__h.push(l2), b$2(this));
}, d$3.prototype.forceUpdate = function(n2) {
this.__v && (this.__e = true, n2 && this.__h.push(n2), b$2(this));
}, d$3.prototype.render = p$3, t$2 = [], g$4.__r = 0, r$3 = 0;
var t$1, u$2, r$2, o$2, i$2 = 0, c$2 = [], f$2 = [], e = l$3.__b, a$2 = l$3.__r, v$2 = l$3.diffed, l$2 = l$3.__c, m$1 = l$3.unmount;
function p$2(t2, r2) {
l$3.__h && l$3.__h(u$2, t2, i$2 || r2), i$2 = 0;
var o2 = u$2.__H || (u$2.__H = { __: [], __h: [] });
return t2 >= o2.__.length && o2.__.push({ __V: f$2 }), o2.__[t2];
}
function y$1(n2) {
return i$2 = 1, d$2(z$1, n2);
}
function d$2(n2, r2, o2) {
var i2 = p$2(t$1++, 2);
return i2.t = n2, i2.__c || (i2.__ = [o2 ? o2(r2) : z$1(void 0, r2), function(n3) {
var t2 = i2.t(i2.__[0], n3);
i2.__[0] !== t2 && (i2.__ = [t2, i2.__[1]], i2.__c.setState({}));
}], i2.__c = u$2), i2.__;
}
function _$2(r2, o2) {
var i2 = p$2(t$1++, 3);
!l$3.__s && w$2(i2.__H, o2) && (i2.__ = r2, i2.u = o2, u$2.__H.__h.push(i2));
}
function h$2(r2, o2) {
var i2 = p$2(t$1++, 4);
!l$3.__s && w$2(i2.__H, o2) && (i2.__ = r2, i2.u = o2, u$2.__h.push(i2));
}
function s$2(n2) {
return i$2 = 5, F$2(function() {
return { current: n2 };
}, []);
}
function F$2(n2, u2) {
var r2 = p$2(t$1++, 7);
return w$2(r2.__H, u2) ? (r2.__V = n2(), r2.u = u2, r2.__h = n2, r2.__V) : r2.__;
}
function T$1(n2, t2) {
return i$2 = 8, F$2(function() {
return n2;
}, t2);
}
function q$2(n2) {
var r2 = u$2.context[n2.__c], o2 = p$2(t$1++, 9);
return o2.c = n2, r2 ? (o2.__ == null && (o2.__ = true, r2.sub(u$2)), r2.props.value) : n2.__;
}
function b$1() {
for (var t2; t2 = c$2.shift(); )
if (t2.__P)
try {
t2.__H.__h.forEach(j$2), t2.__H.__h.forEach(k$1), t2.__H.__h = [];
} catch (u2) {
t2.__H.__h = [], l$3.__e(u2, t2.__v);
}
}
l$3.__b = function(n2) {
u$2 = null, e && e(n2);
}, l$3.__r = function(n2) {
a$2 && a$2(n2), t$1 = 0;
var o2 = (u$2 = n2.__c).__H;
o2 && (r$2 === u$2 ? (o2.__h = [], u$2.__h = [], o2.__.forEach(function(n3) {
n3.__V = f$2, n3.u = void 0;
})) : (o2.__h.forEach(j$2), o2.__h.forEach(k$1), o2.__h = [])), r$2 = u$2;
}, l$3.diffed = function(t2) {
v$2 && v$2(t2);
var i2 = t2.__c;
i2 && i2.__H && (i2.__H.__h.length && (c$2.push(i2) !== 1 && o$2 === l$3.requestAnimationFrame || ((o$2 = l$3.requestAnimationFrame) || function(n2) {
var t3, u2 = function() {
clearTimeout(r2), g$3 && cancelAnimationFrame(t3), setTimeout(n2);
}, r2 = setTimeout(u2, 100);
g$3 && (t3 = requestAnimationFrame(u2));
})(b$1)), i2.__H.__.forEach(function(n2) {
n2.u && (n2.__H = n2.u), n2.__V !== f$2 && (n2.__ = n2.__V), n2.u = void 0, n2.__V = f$2;
})), r$2 = u$2 = null;
}, l$3.__c = function(t2, u2) {
u2.some(function(t3) {
try {
t3.__h.forEach(j$2), t3.__h = t3.__h.filter(function(n2) {
return !n2.__ || k$1(n2);
});
} catch (r2) {
u2.some(function(n2) {
n2.__h && (n2.__h = []);
}), u2 = [], l$3.__e(r2, t3.__v);
}
}), l$2 && l$2(t2, u2);
}, l$3.unmount = function(t2) {
m$1 && m$1(t2);
var u2, r2 = t2.__c;
r2 && r2.__H && (r2.__H.__.forEach(function(n2) {
try {
j$2(n2);
} catch (n3) {
u2 = n3;
}
}), u2 && l$3.__e(u2, r2.__v));
};
var g$3 = typeof requestAnimationFrame == "function";
function j$2(n2) {
var t2 = u$2, r2 = n2.__c;
typeof r2 == "function" && (n2.__c = void 0, r2()), u$2 = t2;
}
function k$1(n2) {
var t2 = u$2;
n2.__c = n2.__(), u$2 = t2;
}
function w$2(n2, t2) {
return !n2 || n2.length !== t2.length || t2.some(function(t3, u2) {
return t3 !== n2[u2];
});
}
function z$1(n2, t2) {
return typeof t2 == "function" ? t2(n2) : t2;
}
function n$1(n2) {
for (var r2 = arguments.length, t2 = Array(r2 > 1 ? r2 - 1 : 0), e2 = 1; e2 < r2; e2++)
t2[e2 - 1] = arguments[e2];
throw Error("[Immer] minified error nr: " + n2 + (t2.length ? " " + t2.map(function(n3) {
return "'" + n3 + "'";
}).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf");
}
function r$1(n2) {
return !!n2 && !!n2[Q$1];
}
function t(n2) {
return !!n2 && (function(n3) {
if (!n3 || typeof n3 != "object")
return false;
var r2 = Object.getPrototypeOf(n3);
if (r2 === null)
return true;
var t2 = Object.hasOwnProperty.call(r2, "constructor") && r2.constructor;
return t2 === Object || typeof t2 == "function" && Function.toString.call(t2) === Z$1;
}(n2) || Array.isArray(n2) || !!n2[L$1] || !!n2.constructor[L$1] || s$1(n2) || v$1(n2));
}
function i$1(n2, r2, t2) {
t2 === void 0 && (t2 = false), o$1(n2) === 0 ? (t2 ? Object.keys : nn)(n2).forEach(function(e2) {
t2 && typeof e2 == "symbol" || r2(e2, n2[e2], n2);
}) : n2.forEach(function(t3, e2) {
return r2(e2, t3, n2);
});
}
function o$1(n2) {
var r2 = n2[Q$1];
return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s$1(n2) ? 2 : v$1(n2) ? 3 : 0;
}
function u$1(n2, r2) {
return o$1(n2) === 2 ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
}
function a$1(n2, r2) {
return o$1(n2) === 2 ? n2.get(r2) : n2[r2];
}
function f$1(n2, r2, t2) {
var e2 = o$1(n2);
e2 === 2 ? n2.set(r2, t2) : e2 === 3 ? (n2.delete(r2), n2.add(t2)) : n2[r2] = t2;
}
function c$1(n2, r2) {
return n2 === r2 ? n2 !== 0 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
}
function s$1(n2) {
return X && n2 instanceof Map;
}
function v$1(n2) {
return q$1 && n2 instanceof Set;
}
function p$1(n2) {
return n2.o || n2.t;
}
function l$1(n2) {
if (Array.isArray(n2))
return Array.prototype.slice.call(n2);
var r2 = rn(n2);
delete r2[Q$1];
for (var t2 = nn(r2), e2 = 0; e2 < t2.length; e2++) {
var i2 = t2[e2], o2 = r2[i2];
o2.writable === false && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
}
return Object.create(Object.getPrototypeOf(n2), r2);
}
function d$1(n2, e2) {
return e2 === void 0 && (e2 = false), y(n2) || r$1(n2) || !t(n2) ? n2 : (o$1(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h$1), Object.freeze(n2), e2 && i$1(n2, function(n3, r2) {
return d$1(r2, true);
}, true), n2);
}
function h$1() {
n$1(2);
}
function y(n2) {
return n2 == null || typeof n2 != "object" || Object.isFrozen(n2);
}
function b(r2) {
var t2 = tn[r2];
return t2 || n$1(18, r2), t2;
}
function _$1() {
return U;
}
function j$1(n2, r2) {
r2 && (b("Patches"), n2.u = [], n2.s = [], n2.v = r2);
}
function O$1(n2) {
g$2(n2), n2.p.forEach(S$1), n2.p = null;
}
function g$2(n2) {
n2 === U && (U = n2.l);
}
function w$1(n2) {
return U = { p: [], l: U, h: n2, m: true, _: 0 };
}
function S$1(n2) {
var r2 = n2[Q$1];
r2.i === 0 || r2.i === 1 ? r2.j() : r2.O = true;
}
function P$1(r2, e2) {
e2._ = e2.p.length;
var i2 = e2.p[0], o2 = r2 !== void 0 && r2 !== i2;
return e2.h.g || b("ES5").S(e2, r2, o2), o2 ? (i2[Q$1].P && (O$1(e2), n$1(4)), t(r2) && (r2 = M$1(e2, r2), e2.l || x$2(e2, r2)), e2.u && b("Patches").M(i2[Q$1].t, r2, e2.u, e2.s)) : r2 = M$1(e2, i2, []), O$1(e2), e2.u && e2.v(e2.u, e2.s), r2 !== H$1 ? r2 : void 0;
}
function M$1(n2, r2, t2) {
if (y(r2))
return r2;
var e2 = r2[Q$1];
if (!e2)
return i$1(r2, function(i2, o3) {
return A$1(n2, e2, r2, i2, o3, t2);
}, true), r2;
if (e2.A !== n2)
return r2;
if (!e2.P)
return x$2(n2, e2.t, true), e2.t;
if (!e2.I) {
e2.I = true, e2.A._--;
var o2 = e2.i === 4 || e2.i === 5 ? e2.o = l$1(e2.k) : e2.o;
i$1(e2.i === 3 ? new Set(o2) : o2, function(r3, i2) {
return A$1(n2, e2, o2, r3, i2, t2);
}), x$2(n2, o2, false), t2 && n2.u && b("Patches").R(e2, t2, n2.u, n2.s);
}
return e2.o;
}
function A$1(e2, i2, o2, a2, c2, s2) {
if (r$1(c2)) {
var v2 = M$1(e2, c2, s2 && i2 && i2.i !== 3 && !u$1(i2.D, a2) ? s2.concat(a2) : void 0);
if (f$1(o2, a2, v2), !r$1(v2))
return;
e2.m = false;
}
if (t(c2) && !y(c2)) {
if (!e2.h.F && e2._ < 1)
return;
M$1(e2, c2), i2 && i2.A.l || x$2(e2, c2);
}
}
function x$2(n2, r2, t2) {
t2 === void 0 && (t2 = false), n2.h.F && n2.m && d$1(r2, t2);
}
function z(n2, r2) {
var t2 = n2[Q$1];
return (t2 ? p$1(t2) : n2)[r2];
}
function I$1(n2, r2) {
if (r2 in n2)
for (var t2 = Object.getPrototypeOf(n2); t2; ) {
var e2 = Object.getOwnPropertyDescriptor(t2, r2);
if (e2)
return e2;
t2 = Object.getPrototypeOf(t2);
}
}
function k(n2) {
n2.P || (n2.P = true, n2.l && k(n2.l));
}
function E$1(n2) {
n2.o || (n2.o = l$1(n2.t));
}
function R$1(n2, r2, t2) {
var e2 = s$1(r2) ? b("MapSet").N(r2, t2) : v$1(r2) ? b("MapSet").T(r2, t2) : n2.g ? function(n3, r3) {
var t3 = Array.isArray(n3), e3 = { i: t3 ? 1 : 0, A: r3 ? r3.A : _$1(), P: false, I: false, D: {}, l: r3, t: n3, k: null, o: null, j: null, C: false }, i2 = e3, o2 = en;
t3 && (i2 = [e3], o2 = on);
var u2 = Proxy.revocable(i2, o2), a2 = u2.revoke, f2 = u2.proxy;
return e3.k = f2, e3.j = a2, f2;
}(r2, t2) : b("ES5").J(r2, t2);
return (t2 ? t2.A : _$1()).p.push(e2), e2;
}
function D$1(e2) {
return r$1(e2) || n$1(22, e2), function n2(r2) {
if (!t(r2))
return r2;
var e3, u2 = r2[Q$1], c2 = o$1(r2);
if (u2) {
if (!u2.P && (u2.i < 4 || !b("ES5").K(u2)))
return u2.t;
u2.I = true, e3 = F$1(r2, c2), u2.I = false;
} else
e3 = F$1(r2, c2);
return i$1(e3, function(r3, t2) {
u2 && a$1(u2.t, r3) === t2 || f$1(e3, r3, n2(t2));
}), c2 === 3 ? new Set(e3) : e3;
}(e2);
}
function F$1(n2, r2) {
switch (r2) {
case 2:
return new Map(n2);
case 3:
return Array.from(n2);
}
return l$1(n2);
}
var G, U, W$1 = typeof Symbol != "undefined" && typeof Symbol("x") == "symbol", X = typeof Map != "undefined", q$1 = typeof Set != "undefined", B = typeof Proxy != "undefined" && Proxy.revocable !== void 0 && typeof Reflect != "undefined", H$1 = W$1 ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = true, G), L$1 = W$1 ? Symbol.for("immer-draftable") : "__$immer_draftable", Q$1 = W$1 ? Symbol.for("immer-state") : "__$immer_state", Z$1 = "" + Object.prototype.constructor, nn = typeof Reflect != "undefined" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function(n2) {
return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
} : Object.getOwnPropertyNames, rn = Object.getOwnPropertyDescriptors || function(n2) {
var r2 = {};
return nn(n2).forEach(function(t2) {
r2[t2] = Object.getOwnPropertyDescriptor(n2, t2);
}), r2;
}, tn = {}, en = { get: function(n2, r2) {
if (r2 === Q$1)
return n2;
var e2 = p$1(n2);
if (!u$1(e2, r2))
return function(n3, r3, t2) {
var e3, i3 = I$1(r3, t2);
return i3 ? "value" in i3 ? i3.value : (e3 = i3.get) === null || e3 === void 0 ? void 0 : e3.call(n3.k) : void 0;
}(n2, e2, r2);
var i2 = e2[r2];
return n2.I || !t(i2) ? i2 : i2 === z(n2.t, r2) ? (E$1(n2), n2.o[r2] = R$1(n2.A.h, i2, n2)) : i2;
}, has: function(n2, r2) {
return r2 in p$1(n2);
}, ownKeys: function(n2) {
return Reflect.ownKeys(p$1(n2));
}, set: function(n2, r2, t2) {
var e2 = I$1(p$1(n2), r2);
if (e2 == null ? void 0 : e2.set)
return e2.set.call(n2.k, t2), true;
if (!n2.P) {
var i2 = z(p$1(n2), r2), o2 = i2 == null ? void 0 : i2[Q$1];
if (o2 && o2.t === t2)
return n2.o[r2] = t2, n2.D[r2] = false, true;
if (c$1(t2, i2) && (t2 !== void 0 || u$1(n2.t, r2)))
return true;
E$1(n2), k(n2);
}
return n2.o[r2] === t2 && typeof t2 != "number" && (t2 !== void 0 || r2 in n2.o) || (n2.o[r2] = t2, n2.D[r2] = true, true);
}, deleteProperty: function(n2, r2) {
return z(n2.t, r2) !== void 0 || r2 in n2.t ? (n2.D[r2] = false, E$1(n2), k(n2)) : delete n2.D[r2], n2.o && delete n2.o[r2], true;
}, getOwnPropertyDescriptor: function(n2, r2) {
var t2 = p$1(n2), e2 = Reflect.getOwnPropertyDescriptor(t2, r2);
return e2 ? { writable: true, configurable: n2.i !== 1 || r2 !== "length", enumerable: e2.enumerable, value: t2[r2] } : e2;
}, defineProperty: function() {
n$1(11);
}, getPrototypeOf: function(n2) {
return Object.getPrototypeOf(n2.t);
}, setPrototypeOf: function() {
n$1(12);
} }, on = {};
i$1(en, function(n2, r2) {
on[n2] = function() {
return arguments[0] = arguments[0][0], r2.apply(this, arguments);
};
}), on.deleteProperty = function(r2, t2) {
return on.set.call(this, r2, t2, void 0);
}, on.set = function(r2, t2, e2) {
return en.set.call(this, r2[0], t2, e2, r2[0]);
};
var un$1 = function() {
function e2(r2) {
var e3 = this;
this.g = B, this.F = true, this.produce = function(r3, i3, o2) {
if (typeof r3 == "function" && typeof i3 != "function") {
var u2 = i3;
i3 = r3;
var a2 = e3;
return function(n2) {
var r4 = this;
n2 === void 0 && (n2 = u2);
for (var t2 = arguments.length, e4 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
e4[o3 - 1] = arguments[o3];
return a2.produce(n2, function(n3) {
var t3;
return (t3 = i3).call.apply(t3, [r4, n3].concat(e4));
});
};
}
var f2;
if (typeof i3 != "function" && n$1(6), o2 !== void 0 && typeof o2 != "function" && n$1(7), t(r3)) {
var c2 = w$1(e3), s2 = R$1(e3, r3, void 0), v2 = true;
try {
f2 = i3(s2), v2 = false;
} finally {
v2 ? O$1(c2) : g$2(c2);
}
return typeof Promise != "undefined" && f2 instanceof Promise ? f2.then(function(n2) {
return j$1(c2, o2), P$1(n2, c2);
}, function(n2) {
throw O$1(c2), n2;
}) : (j$1(c2, o2), P$1(f2, c2));
}
if (!r3 || typeof r3 != "object") {
if ((f2 = i3(r3)) === void 0 && (f2 = r3), f2 === H$1 && (f2 = void 0), e3.F && d$1(f2, true), o2) {
var p2 = [], l2 = [];
b("Patches").M(r3, f2, p2, l2), o2(p2, l2);
}
return f2;
}
n$1(21, r3);
}, this.produceWithPatches = function(n2, r3) {
if (typeof n2 == "function")
return function(r4) {
for (var t3 = arguments.length, i4 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
i4[o3 - 1] = arguments[o3];
return e3.produceWithPatches(r4, function(r5) {
return n2.apply(void 0, [r5].concat(i4));
});
};
var t2, i3, o2 = e3.produce(n2, r3, function(n3, r4) {
t2 = n3, i3 = r4;
});
return typeof Promise != "undefined" && o2 instanceof Promise ? o2.then(function(n3) {
return [n3, t2, i3];
}) : [o2, t2, i3];
}, typeof (r2 == null ? void 0 : r2.useProxies) == "boolean" && this.setUseProxies(r2.useProxies), typeof (r2 == null ? void 0 : r2.autoFreeze) == "boolean" && this.setAutoFreeze(r2.autoFreeze);
}
var i2 = e2.prototype;
return i2.createDraft = function(e3) {
t(e3) || n$1(8), r$1(e3) && (e3 = D$1(e3));
var i3 = w$1(this), o2 = R$1(this, e3, void 0);
return o2[Q$1].C = true, g$2(i3), o2;
}, i2.finishDraft = function(r2, t2) {
var e3 = r2 && r2[Q$1];
var i3 = e3.A;
return j$1(i3, t2), P$1(void 0, i3);
}, i2.setAutoFreeze = function(n2) {
this.F = n2;
}, i2.setUseProxies = function(r2) {
r2 && !B && n$1(20), this.g = r2;
}, i2.applyPatches = function(n2, t2) {
var e3;
for (e3 = t2.length - 1; e3 >= 0; e3--) {
var i3 = t2[e3];
if (i3.path.length === 0 && i3.op === "replace") {
n2 = i3.value;
break;
}
}
e3 > -1 && (t2 = t2.slice(e3 + 1));
var o2 = b("Patches").$;
return r$1(n2) ? o2(n2, t2) : this.produce(n2, function(n3) {
return o2(n3, t2);
});
}, e2;
}(), an = new un$1(), fn = an.produce;
an.produceWithPatches.bind(an);
an.setAutoFreeze.bind(an);
an.setUseProxies.bind(an);
an.applyPatches.bind(an);
an.createDraft.bind(an);
an.finishDraft.bind(an);
var produce = fn;
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
function isUndefined$3(obj) {
return obj === void 0;
}
var isUndefined_1 = isUndefined$3;
var isUndefined$2 = isUndefined_1;
function range(start, stop, step) {
var arr = [];
var flag;
if (isUndefined$2(stop)) {
stop = start || 0;
start = 0;
}
step = step || 1;
flag = step < 0 ? -1 : 1;
stop *= flag;
for (; start * flag < stop; start += step) {
arr.push(start);
}
return arr;
}
var range_1 = range;
const DEFAULT_DAY_NAME_MARGIN_LEFT = "0";
const MONTH_EVENT_HEIGHT = 24;
const MONTH_EVENT_MARGIN_TOP = 2;
const MONTH_CELL_PADDING_TOP = 3;
const MONTH_CELL_BAR_HEIGHT = 27;
const MONTH_MORE_VIEW_PADDING = 5;
const MONTH_MORE_VIEW_MIN_WIDTH = 280;
const MONTH_MORE_VIEW_HEADER_HEIGHT = 44;
const MONTH_MORE_VIEW_HEADER_MARGIN_BOTTOM = 12;
const MONTH_MORE_VIEW_HEADER_PADDING_TOP = 12;
const MONTH_MORE_VIEW_HEADER_PADDING = "12px 17px 0";
const WEEK_DAY_NAME_HEIGHT = 42;
const WEEK_DAY_NAME_BORDER = 1;
const WEEK_EVENT_MARGIN_TOP = 2;
const DEFAULT_PANEL_HEIGHT = 72;
const DEFAULT_EVENT_COLORS = {
color: "#000",
backgroundColor: "#a1b56c",
dragBackgroundColor: "#a1b56c",
borderColor: "#000"
};
const TIME_EVENT_CONTAINER_MARGIN_LEFT = 2;
const COLLAPSED_DUPLICATE_EVENT_WIDTH_PX = 9;
function isBoolean(obj) {
return typeof obj === "boolean" || obj instanceof Boolean;
}
var isBoolean_1 = isBoolean;
function isNumber(obj) {
return typeof obj === "number" || obj instanceof Number;
}
var isNumber_1 = isNumber;
function isObject$1(obj) {
return obj === Object(obj);
}
var isObject_1 = isObject$1;
function isString$1(obj) {
return typeof obj === "string" || obj instanceof String;
}
var isString_1 = isString$1;
function isNil(value) {
return isUndefined_1(value) || value === null;
}
function isPresent(value) {
return !isNil(value);
}
function isFunction$2(value) {
return typeof value === "function";
}
const CSS_PREFIX = "toastui-calendar-";
function cls(...args) {
const result = [];
args.forEach((arg) => {
if (!arg) {
return;
}
if (isString_1(arg)) {
result.push(arg);
} else {
Object.keys(arg).forEach((className2) => {
if (arg[className2]) {
result.push(className2);
}
});
}
});
return result.map((str) => `${CSS_PREFIX}${str}`).join(" ");
}
function toPercent(value) {
return `${value}%`;
}
function toPx(value) {
return `${value}px`;
}
function extractPercentPx(value) {
const percentRegexp = /(\d+)%/;
const percentResult = value.match(percentRegexp);
const pxRegexp = /(-?)\s?(\d+)px/;
const pxResult = value.match(pxRegexp);
return {
percent: percentResult ? parseInt(percentResult[1], 10) : 0,
px: pxResult ? parseInt(`${pxResult[1]}${pxResult[2]}`, 10) : 0
};
}
function getEventColors(uiModel, calendarColor) {
const eventColors = uiModel.model.getColors();
return Object.keys(DEFAULT_EVENT_COLORS).reduce((colors, _key) => {
var _a, _b;
const key = _key;
colors[key] = (_b = (_a = eventColors[key]) != null ? _a : calendarColor[key]) != null ? _b : DEFAULT_EVENT_COLORS[key];
return colors;
}, {});
}
const rISO8601 = /^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\.)?([0-9]+)?([+-]\d\d(?::?\d\d)?|\s*Z)?$/;
function throwNotSupported() {
throw new Error("This operation is not supported.");
}
function getDateTime(dateString) {
const match = rISO8601.exec(dateString);
if (match) {
const [, y2, M2, d2, h2, m2, s2, , ms, zoneInfo] = match;
return {
y: Number(y2),
M: Number(M2) - 1,
d: Number(d2),
h: Number(h2),
m: Number(m2),
s: Number(s2),
ms: Number(ms) || 0,
zoneInfo
};
}
return null;
}
function createFromDateString(dateString) {
const info = getDateTime(dateString);
if (info && !info.zoneInfo) {
const { y: y2, M: M2, d: d2, h: h2, m: m2, s: s2, ms } = info;
return new Date(y2, M2, d2, h2, m2, s2, ms);
}
return null;
}
class LocalDate {
constructor(...args) {
const [firstArg] = args;
if (firstArg instanceof Date) {
this.d = new Date(firstArg.getTime());
} else if (isString_1(firstArg) && args.length === 1) {
this.d = createFromDateString(firstArg);
}
if (!this.d) {
this.d = new Date(...args);
}
}
setTimezoneOffset() {
throwNotSupported();
}
setTimezoneName() {
throwNotSupported();
}
clone() {
return new LocalDate(this.d);
}
toDate() {
return new Date(this.d.getTime());
}
toString() {
return this.d.toString();
}
}
const getterMethods = [
"getTime",
"getTimezoneOffset",
"getFullYear",
"getMonth",
"getDate",
"getHours",
"getMinutes",
"getSeconds",
"getMilliseconds",
"getDay"
];
const setterMethods = [
"setTime",
"setFullYear",
"setMonth",
"setDate",
"setHours",
"setMinutes",
"setSeconds",
"setMilliseconds"
];
getterMethods.forEach((methodName) => {
LocalDate.prototype[methodName] = function(...args) {
return this.d[methodName](...args);
};
});
setterMethods.forEach((methodName) => {
LocalDate.prototype[methodName] = function(...args) {
return this.d[methodName](...args);
};
});
class UTCDate extends LocalDate {
clone() {
return new UTCDate(this.d);
}
getTimezoneOffset() {
return 0;
}
}
const getterProperties = [
"FullYear",
"Month",
"Date",
"Hours",
"Minutes",
"Seconds",
"Milliseconds",
"Day"
];
const setterProperties = [
"FullYear",
"Month",
"Date",
"Hours",
"Minutes",
"Seconds",
"Milliseconds"
];
getterProperties.forEach((prop) => {
const methodName = `get${prop}`;
UTCDate.prototype[methodName] = function(...args) {
return this.d[`getUTC${prop}`](...args);
};
});
setterProperties.forEach((prop) => {
const methodName = `set${prop}`;
UTCDate.prototype[methodName] = function(...args) {
return this.d[`setUTC${prop}`](...args);
};
});
const INVALID_DATETIME_FORMAT = "Invalid DateTime Format";
const INVALID_TIMEZONE_NAME = "Invalid IANA Timezone Name";
const INVALID_VIEW_TYPE = "Invalid View Type";
const MESSAGE_PREFIX = "@toast-ui/calendar: ";
class InvalidTimezoneNameError extends Error {
constructor(timezoneName) {
super(`${MESSAGE_PREFIX}${INVALID_TIMEZONE_NAME} - ${timezoneName}`);
this.name = "InvalidTimezoneNameError";
}
}
class InvalidDateTimeFormatError extends Error {
constructor(dateTimeString) {
super(`${MESSAGE_PREFIX}${INVALID_DATETIME_FORMAT} - ${dateTimeString}`);
this.name = "InvalidDateTimeFormatError";
}
}
class InvalidViewTypeError extends Error {
constructor(viewType) {
super(`${MESSAGE_PREFIX}${INVALID_VIEW_TYPE} - ${viewType}`);
this.name = "InvalidViewTypeError";
}
}
const logger = {
error: (firstArg, ...restArgs) => {
console.error(`${MESSAGE_PREFIX}${firstArg}`, ...restArgs);
},
warn: (firstArg, ...restArgs) => {
console.warn(`${MESSAGE_PREFIX}${firstArg}`, ...restArgs);
}
};
let Constructor = LocalDate;
function date(...args) {
return new Constructor(...args);
}
function getLocalTimezoneOffset() {
return -new Date().getTimezoneOffset();
}
function calculateTimezoneOffset(timezoneName, targetDate = new TZDate()) {
if (!isIntlDateTimeFormatSupported()) {
logger.warn("Intl.DateTimeFormat is not fully supported. So It will return the local timezone offset only.\nYou can use a polyfill to fix this issue.");
return -targetDate.toDate().getTimezoneOffset();
}
validateIANATimezoneName(timezoneName);
const token = tokenizeTZDate(targetDate, timezoneName);
const utcDate = tokenToUtcDate(token);
return Math.round((utcDate.getTime() - targetDate.getTime()) / 60 / 1e3);
}
function isUsingDST(targetDate, timezoneName) {
if (timezoneName) {
validateIANATimezoneName(timezoneName);
}
const jan = new TZDate(targetDate.getFullYear(), 0, 1);
const jul = new TZDate(targetDate.getFullYear(), 6, 1);
if (timezoneName) {
return Math.max(-calculateTimezoneOffset(timezoneName, jan), -calculateTimezoneOffset(timezoneName, jul)) !== -calculateTimezoneOffset(timezoneName, targetDate);
}
return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()) !== targetDate.toDate().getTimezoneOffset();
}
const dtfCache = {};
const timezoneNameValidationCache = {};
function isIntlDateTimeFormatSupported() {
var _a, _b;
return isFunction$2((_b = (_a = Intl == null ? void 0 : Intl.DateTimeFormat) == null ? void 0 : _a.prototype) == null ? void 0 : _b.formatToParts);
}
function validateIANATimezoneName(timezoneName) {
if (timezoneNameValidationCache[timezoneName]) {
return true;
}
try {
Intl.DateTimeFormat("en-US", { timeZone: timezoneName });
timezoneNameValidationCache[timezoneName] = true;
return true;
} catch (e2) {
throw new InvalidTimezoneNameError(timezoneName);
}
}
function getDateTimeFormat(timezoneName) {
if (dtfCache[timezoneName]) {
return dtfCache[timezoneName];
}
const dtf = new Intl.DateTimeFormat("en-US", {
timeZone: timezoneName,
hourCycle: "h23",
hour12: false,
year: "numeric",
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric"
});
dtfCache[timezoneName] = dtf;
return dtf;
}
const typeToPos = {
year: 0,
month: 1,
day: 2,
hour: 3,
minute: 4,
second: 5
};
function tokenizeTZDate(tzDate, timezoneName) {
const dtf = getDateTimeFormat(timezoneName);
const formatted = dtf.formatToParts(tzDate.toDate());
return formatted.reduce((result, cur) => {
const pos = typeToPos[cur.type];
if (isPresent(pos)) {
result[pos] = parseInt(cur.value, 10);
}
return result;
}, []);
}
function tokenToUtcDate(token) {
const [year, monthPlusOne, day, hour, minute, second] = token;
const month = monthPlusOne - 1;
return new Date(Date.UTC(year, month, day, hour % 24, minute, second));
}
function getTZOffsetMSDifference(offset) {
return (getLocalTimezoneOffset() - offset) * MS_PER_MINUTES;
}
class TZDate {
constructor(...args) {
this.tzOffset = null;
if (args[0] instanceof TZDate) {
this.d = date(args[0].getTime());
} else {
this.d = date(...args);
}
}
toString() {
return this.d.toString();
}
addFullYear(y2) {
this.setFullYear(this.getFullYear() + y2);
return this;
}
addMonth(m2) {
this.setMonth(this.getMonth() + m2);
return this;
}
addDate(d2) {
this.setDate(this.getDate() + d2);
return this;
}
addHours(h2) {
this.setHours(this.getHours() + h2);
return this;
}
addMinutes(M2) {
this.setMinutes(this.getMinutes() + M2);
return this;
}
addSeconds(s2) {
this.setSeconds(this.getSeconds() + s2);
return this;
}
addMilliseconds(ms) {
this.setMilliseconds(this.getMilliseconds() + ms);
return this;
}
setWithRaw(y2, m2, d2, h2, M2, s2, ms) {
this.setFullYear(y2, m2, d2);
this.setHours(h2, M2, s2, ms);
return this;
}
toDate() {
return this.d.toDate();
}
valueOf() {
return this.getTime();
}
getTimezoneOffset() {
var _a;
return (_a = this.tzOffset) != null ? _a : this.d.getTimezoneOffset();
}
getTime() {
return this.d.getTime();
}
getFullYear() {
return this.d.getFullYear();
}
getMonth() {
return this.d.getMonth();
}
getDate() {
return this.d.getDate();
}
getHours() {
return this.d.getHours();
}
getMinutes() {
return this.d.getMinutes();
}
getSeconds() {
return this.d.getSeconds();
}
getMilliseconds() {
return this.d.getMilliseconds();
}
getDay() {
return this.d.getDay();
}
setTime(t2) {
return this.d.setTime(t2);
}
setFullYear(y2, m2 = this.getMonth(), d2 = this.getDate()) {
return this.d.setFullYear(y2, m2, d2);
}
setMonth(m2, d2 = this.getDate()) {
return this.d.setMonth(m2, d2);
}
setDate(d2) {
return this.d.setDate(d2);
}
setHours(h2, M2 = this.getMinutes(), s2 = this.getSeconds(), ms = this.getMilliseconds()) {
return this.d.setHours(h2, M2, s2, ms);
}
setMinutes(M2, s2 = this.getSeconds(), ms = this.getMilliseconds()) {
return this.d.setMinutes(M2, s2, ms);
}
setSeconds(s2, ms = this.getMilliseconds()) {
return this.d.setSeconds(s2, ms);
}
setMilliseconds(ms) {
return this.d.setMilliseconds(ms);
}
tz(tzValue) {
if (tzValue === "Local") {
return new TZDate(this.getTime());
}
const tzOffset = isString_1(tzValue) ? calculateTimezoneOffset(tzValue, this) : tzValue;
const newTZDate = new TZDate(this.getTime() - getTZOffsetMSDifference(tzOffset));
newTZDate.tzOffset = tzOffset;
return newTZDate;
}
local(tzValue) {
if (isPresent(tzValue)) {
const tzOffset = isString_1(tzValue) ? calculateTimezoneOffset(tzValue, this) : tzValue;
return new TZDate(this.getTime() + getTZOffsetMSDifference(tzOffset));
}
return new TZDate(this.getTime() + (isPresent(this.tzOffset) ? getTZOffsetMSDifference(this.tzOffset) : 0));
}
}
function pick(obj, ...propNames) {
return propNames.reduce((acc, key) => {
if (obj.hasOwnProperty(key)) {
acc[key] = obj[key];
}
return acc;
}, {});
}
function clone$1(source) {
return Object.assign(Object.create(Object.getPrototypeOf(source)), source);
}
function mergeObject(target, source = {}) {
if (!isObject_1(source)) {
return target;
}
Object.keys(source).forEach((k2) => {
const targetKey = k2;
const sourceKey = k2;
if (!Array.isArray(source[sourceKey]) && isObject_1(target[targetKey]) && isObject_1(source[sourceKey]) && !(source[sourceKey] instanceof TZDate)) {
target[targetKey] = mergeObject(target[targetKey], source[sourceKey]);
} else {
target[targetKey] = source[sourceKey];
}
});
return target;
}
const eventUIPropsKey = [
"top",
"left",
"width",
"height",
"exceedLeft",
"exceedRight",
"croppedStart",
"croppedEnd",
"goingDurationHeight",
"modelDurationHeight",
"comingDurationHeight",
"duplicateEvents",
"duplicateEventIndex",
"duplicateStarts",
"duplicateEnds",
"duplicateLeft",
"duplicateWidth",
"collapse",
"isMain"
];
class EventUIModel {
constructor(event) {
this.top = 0;
this.left = 0;
this.width = 0;
this.height = 0;
this.exceedLeft = false;
this.exceedRight = false;
this.croppedStart = false;
this.croppedEnd = false;
this.goingDurationHeight = 0;
this.modelDurationHeight = 100;
this.comingDurationHeight = 0;
this.duplicateEvents = [];
this.duplicateEventIndex = -1;
this.duplicateLeft = "";
this.duplicateWidth = "";
this.collapse = false;
this.isMain = false;
this.model = event;
}
getUIProps() {
return pick(this, ...eventUIPropsKey);
}
setUIProps(props) {
Object.assign(this, props);
}
getStarts() {
if (this.renderStarts) {
return this.renderStarts;
}
return this.model.getStarts();
}
getEnds() {
if (this.renderEnds) {
return this.renderEnds;
}
return this.model.getEnds();
}
cid() {
return this.model.cid();
}
valueOf() {
return this.model;
}
duration() {
return this.model.duration();
}
collidesWith(uiModel, usingTravelTime = true) {
const infos = [];
[this, uiModel].forEach((event) => {
const isDuplicateEvent = event instanceof EventUIModel && event.duplicateEvents.length > 0;
if (isDuplicateEvent) {
infos.push({
start: event.duplicateStarts,
end: event.duplicateEnds,
goingDuration: 0,
comingDuration: 0
});
} else {
infos.push({
start: event.getStarts(),
end: event.getEnds(),
goingDuration: event.valueOf().goingDuration,
comingDuration: event.valueOf().comingDuration
});
}
});
const [thisInfo, targetInfo] = infos;
return collidesWith({
start: thisInfo.start.getTime(),
end: thisInfo.end.getTime(),
targetStart: targetInfo.start.getTime(),
targetEnd: targetInfo.end.getTime(),
goingDuration: thisInfo.goingDuration,
comingDuration: thisInfo.comingDuration,
targetGoingDuration: targetInfo.goingDuration,
targetComingDuration: targetInfo.comingDuration,
usingTravelTime
});
}
clone() {
const eventUIModelProps = this.getUIProps();
const clonedEventUIModel = new EventUIModel(this.model);
clonedEventUIModel.setUIProps(eventUIModelProps);
if (this.renderStarts) {
clonedEventUIModel.renderStarts = new TZDate(this.renderStarts);
}
if (this.renderEnds) {
clonedEventUIModel.renderEnds = new TZDate(this.renderEnds);
}
return clonedEventUIModel;
}
}
function compareBooleansASC(a2, b2) {
if (a2 !== b2) {
return a2 ? -1 : 1;
}
return 0;
}
function compareNumbersASC(a2, b2) {
return Number(a2) - Number(b2);
}
function compareStringsASC(_a, _b) {
const a2 = String(_a);
const b2 = String(_b);
if (a2 === b2) {
return 0;
}
return a2 > b2 ? 1 : -1;
}
function compareEventsASC(a2, b2) {
const modelA = a2 instanceof EventUIModel ? a2.model : a2;
const modelB = b2 instanceof EventUIModel ? b2.model : b2;
const alldayCompare = compareBooleansASC(modelA.isAllday || modelA.hasMultiDates, modelB.isAllday || modelB.hasMultiDates);
if (alldayCompare) {
return alldayCompare;
}
const startsCompare = compare(a2.getStarts(), b2.getStarts());
if (startsCompare) {
return startsCompare;
}
const durationA = a2.duration();
const duratio